## 4 Selective Image Encryption
### Quadtree-Based Image Coding  
Although there are more efficient compression algorithms, quadtree complexity is very low compared to robust algorithms, as, for example, JPEG, being well adaptable for wireless image sensor networks. Quadtree compression [52] is based on a rooted tree in which every node has zero or four children, as can be seen in Figure 3. Nodes with children are called internal nodes, and nodes without children are called leafnodes. Just like in all computational trees, nodes have a level that is the number of edges on the shortest path to the root. The height is defined as the maximum number of levels, and a node is in the lowest level when it is the closest to the root of the tree [20].  
Figure 3: Quadtree coding example.  
Figure 2: Cryptography paradigms: (**a**) traditional encryption; (**b**) selective encryption.  
Quadtree coding can be lossy or lossless. In lossless compression, the value of each leaf is represented by the same number of bits, while in lossy compression, the number of bits to represent the leaves is different.  
According to [20], in lossless compression, the tree starts with a node and performs a test to check if the entire image is homogeneous. Being homogeneous, the root node receives the information of the grayscale image. Thereafter, images are partitioned into four quadrants, and four corresponding children are added to the tree root. The algorithm recursively examines each quadrant using each of the four leaves as a root node to a new subtree. In lossy compression, the process is similar, but instead of a homogeneity test, a similarity test of pixels is performed. In a similarity test, a block of an image can be measured by the variance of pixel values and textures, while the homogeneity test values are real and not statistical.  
Quadtree decomposition can define objects in the original image, as shown in Figure 4b. This way, one potential selective encryption algorithm would encrypt only objects defined in the quadtree structure. Another relevant remark is that this compression method can be implemented in both a top-down approach, previously presented, and in a bottom-up approach. In this second approach, the tree starts full with size \(n\). The highest level is examined before execution, and four brother leaf nodes are added to build the parent node. The algorithm repeats until there are no more leaves or when it reaches the root node of the tree.  
Some recent works have employed quadtree coding in wireless image sensor networks. The work in [53] proposes an adaptive compression mechanism to adapt a transmission rate according to current network conditions. The transmission delay of image packets is used as a reference when selecting what parts of encoded images will be transmitted. Similarly, the work in [54] proposes the use of quadtree decomposition to support adaptive image compression and efficient congestion control. Raw images are decomposed using a quadtree algorithm, but the actual amount of information that will be transmitted depends on QoS parameters. Using quadtree, unnecessary information deduced from the created tree structure may be removed, but image quality is reduced. Actually, a higher decomposition factor results in higher compression, with fewer data to transmit over the network. In [54], the authors propose that higher compression should be adopted when less information should be transmitted through the network due to congestion, in a dynamic and adaptive way.  
For selective encryption, parts of quadtree-based-encoded images may be exploited when selecting the most relevant data to be encrypted. Doing so, the quadtree structure may be encrypted, leaving leaves  
Figure 4: Image decomposition with quadtree coding: (**a**) original image; (**b**) decomposed image.  
unprotected [55]. For wireless visual sensor networks, crucial processing, memory and energy resources could be saved when adopting such an approach.