Similarity criterion for image resizing
 Shungang Hua^{1}Email author,
 Xiaoxiao Li^{1} and
 Qing Zhong^{1}
https://doi.org/10.1186/16876180201127
© Hua et al; licensee Springer. 2011
Received: 5 January 2011
Accepted: 21 July 2011
Published: 21 July 2011
Abstract
Based on bidirectional similarity measure between patches of image, in this study, we investigate the similarity criterion of image for resizing image. First, our scheme implements image resizing by Seam Carving step by step. For each step, we remove five seams, and then calculate the dissimilarity between the original image and its resized one as well as the relative difference of dissimilarity between neighboring steps. According to the relative differences of dissimilarity of all steps, we can assess the degree of distortion of the resized image and conclude the similarity criterion. On the basis of the similarity criterion, we present an effective imageresizing algorithm by combining Seam Carving, Scaling, and Bidirectional Similarity iteration. Before the salient feature gets damaged markedly, we change the resizing method from Seam Carving to Scaling, and resize the image up to the preferred size. Then, we can update the resized image to eliminate artifacts by iterative computations of Bidirectional Similarity measure. Experiments show that, even though the amount of adjustment is large, our algorithm can preserve the important information, local structures, and global visual effect adequately.
Keywords
image resizing similarity criterion dissimilarity relative difference of dissimilarity1. Introduction
With the rapid development of the multimedia technology, various display devices have been emerging endlessly, such as computer screen, digital TV, mobile media, MP4, digital camera, and so on. In order that digital image and video should be transmitted and displayed in different display devices, digital image and video need to be changed to different size or aspect ratio for displaying; hence, a variety of algorithms have been proposed to realize such a purpose. A sophisticated algorithm should be able to maintain the salient and interesting regions intact and authentic as much as possible.
Traditional imageresizing methods, such as Scaling and Cropping, have clear drawbacks because of the lack of attentions paid to the content and the feature distribution of images. Scaling will cause obvious distortion if the aspect ratio of the image is drastically changed. Cropping only removes pixels from the image periphery, and hence, it is likely to discard too much important information scattering over the image. Recently, there are growing interests with regard to imageresizing and retargeting algorithms that can protect both the global visual effect and some local structures of the original image [1]; image resizing can be realized by considering important content, unimportant region, image construction, or texture and so on. These methods can be used to resize image fairily, but there are still some problems remaining to be solved. For example, if the amount of adjustment exceeds some bound, then the original image will be warped significantly, and the resulting image will be dissimilar to the original image; even though a certain algorithm gets better resized result by iterative or traverse calculation, it is remarkably timeconsuming.
In this article, we investigate the image resizing and the similarity value between the original image and the resized one, and summarize a similarity criterion for the image resizing through a number of experiments. Based on the similarity criterion, we propose an effective imageresizing algorithm which can be used to protect the salient and important information efficiently. First, our algorithm resizes the original image using Seam Carving step by step, and calculates the dissimilarity at each step, as well as the relative difference of dissimilarity between neighboring steps simultaneously. Second, we can estimate whether the deformation degree exceeds a threshold value calculated by a criterion formula; before reaching the critical value, our algorithm stops using Seam Carving and transfers the remnant task to Scaling and Bidirectional Similarity strategy. As a consequence, our algorithm can nicely preserve the authenticity and visibility of an image.
In summary, our main contributions in this article are as follows:

Building a similarity criterion between an image and its changed version;

Utilizing the similarity criterion to assess the degree of distortion of the resized images;

Proposing a contentaware imageresizing algorithm which can preserve the salient information and the global visual effect, based on the similarity criterion.
The rest of this article is organized as follows: Section 2 introduces the background of image resizing and similarity measure. Section 3 shows the imageresizing and similarity measure algorithms used in this article. Section 4 describes similarity criterion between images. In Section 5, we present an effective imageresizing algorithm based on the similarity criterion. In Section 6, we compare the effects of our method with those of the other algorithms and present some discussion.
2. Related works
Until now, a number of algorithms have been proposed to resize image, such as the methods of preserving the visual consistency of the important regions [2–5], removing or duplicating unimportant content [6–11], bidirectional similarity of the patches [12, 13], and so on.
Suh et al. [14] proposed an automatic thumbnail creation based on either a saliency map or the output of a face detector. The large image is then cropped to capture the most salient region. However, if salient regions of the image are sparse, then the effect will not be very perfect. Other imageresizing algorithms [15, 16], based on saliency map, detected and transmitted the most important regions to the small display device, where users can browse the important regions through scrolling the pages, but the important regions could not be seen at the same time. Setlur et al. [17] proposed an automatic, nonphotorealistic algorithm for retargeting images to small resolution displays. The retargeting algorithm segments an image into regions, identifies important regions, removes them, resizes the remaining image, and reinserts the important regions. Based on the conformal energy, Zhang et al. [18] employed tools to describe original image and minimized quadratic distortion energies to obtain a resized image.
With dynamic programming, Avidan and Shamir [6] presented a simple imageresizing method called Seam Carving, and then Rubinstein et al. [19] improved it by using graph cuts for image and video retargeting. Seam Carving pays more attention to the unimportant regions, and can retain important content through removing or duplicating the unimportant regions. However, if resizing image is done severely (e.g., the low gradient pixels have been removed), or the interesting objects span the entire image, then the interesting objects and the important regions would suffer from distortion, and, therefore, the local structures and global layout might be destroyed. By utilizing a stream, a path of several pixels width, instead of a seam, Domingues et al. [20] presented an improved algorithm called Stream Carving to induce an increase in the quality of the resized image. Mansfield et al. [21] proposed a scenecarving method, by decomposing the imageretargeting procedure into removing image content with minimal distortion and rearrangement of known objects within the scene to maximize their visibility. Considering the distortion in both spatial and temporal dimensions, Grundmann et al. [22] presented a discontinuous Seam Carving for video retargeting to process the video frame sequentially and afford great flexibility.
Dong et al. [9] presented a resizing algorithm combining Seam Carving with Scaling. However, their algorithm needs to compute all the possible combinations of resizing amount by both Seam Carving and Scaling, and then chooses the best ratio for resizing image. Based on bidirectional similarity measure of the patches, Simakov et al. [13] proposed an image summary algorithm. Because bidirectional similarity algorithm takes into consideration the completeness and coherence between the resized image and the original image, it can get image summary effectively by iteration computation. Obviously, the above two algorithms are timeconsuming. Rubinstein et al. [23] compared a number of stateoftheart retargeting methods by creating a benchmark of images and conducting a user study.
In general, some artifacts and warping will be introduced to the resized image. If the magnitude of warping is within an acceptable range, then we think that the resized image is similar to the original image subjectively. If it exceeds certain bound, then one will feel that the original image is damaged and the resulting image is not similar to the original one any longer. In fact, a similarity (or dissimilarity) value can be taken into account for image resizing to judge the effect of the resulting image.
Similarity measure between images is an important part of image analysis, and it can be broadly used for image retrieval, visual tracking, and image quality assessment [24–26]. For image resizing and retargeting, Simakov et al. [13] proposed a similarity measure method which quantitatively captures the incompleteness and incoherence of the patches between the original image and the resized images. Rubinstein et al. [8] provided a similarity measure algorithm between images termed BiDirectional Warping. It measures the similarity between every row (column), and then takes the maximum alignment error as the distance. This algorithm takes the positional concept of pixels into account, and hence, it can capture the overallsimilarity between the images. Maalouf and Larabi [27] defined a multiscale bandeletbased perceptual similarity measure for image retargeting, by measuring the geometric and perceptual similarities between two images to obtain the resulting image that contains as many as of the geometric and perceptual features of the original image. Dong et al. [9] presented a welldefined image distance function, which is formulated as a combination of patchbased bidirectional image Euclidean distance, imagedominant color similarity, and seam energy variation. In this article, we explore and summarize a similarity criterion on the basis of similarity measure and apply it to image resizing.
3. Image resizing and similarity measure
 (1)
Compute the energy of every pixel in the image using the gradient energy function, then calculate the accumulative energy of all the eightconnected paths, and find a connected seam which has minimum cumulative energy (see [6]).
 (2)
Divide the image into 3 × 3 blocks, compute a uniformity measure of each block by working out the variances of R, G, and B intensity value in each block, then calculate the energy of all the eightconnected paths, and find one particular path having the minimum energy [28]. This way is a modified version of above method and can be implemented quickly.
Such a state as the above motivates us to investigate the similarity between the original and resized image and conclude a similarity criterion for image resizing. Various similarity algorithms have been presented for image analysis and processing [8, 9, 12, 13, 24–26, 29]. In this article, considering the character of image resizing, we choose the Bidirectional Similarity measure to calculate dissimilarity (similarity) value between images.
The Bidirectional Similarity measure method is proposed by Simakov for summarizing image or video [13]. Its essential idea is that a good visual summary should satisfy two properties, namely, it should contain as much information as possible from the original image, and introduce as few artifacts as possible, which were not in the original. Hence, in Bidirectional Similarity measure, two aspects, completeness and coherence, are considered and described in the following.
where the term d_{complete}(S,T) measures the deviation of T from "completeness" w.r.t.S, the term d_{cohere}(S,T) measures the deviation of T from "coherence" w.r.t. S. For details, please refer to the literature [13].
4. Similarity criterion
Experiments show that with the increase in the number of the removed seams, Seam Carving would cause the distortion of image contents. We adopt Equation 1 to compute the dissimilarity value between the original image and the resulting image accompanying each step, and further calculate the relative difference of dissimilarity between adjacent steps.
 (1)
If the amount of adjustment in horizontal dimension is the same as that in vertical dimension, then at each step, we remove the seams of Δn _{row} rows and Δn _{column} columns with minimal energy in both horizontal and vertical dimensions, respectively, and then calculate the dissimilarity value d_{ i } and the relative difference of dissimilarity. Δd_{ i } . We repeat such process up to the preferred size.
 (2)
If the amount of adjustment in vertical dimension is greater (less) than that in horizontal dimension, then we first perform the image resizing as mentioned above until completing the horizontal (vertical) adjustment, then resize the remaining adjustment in vertical (horizontal) dimension only. At each step, we remove the seams of Δn _{row} rows and/or Δn _{column} columns with minimum energy and compute d_{ i } and Δd_{ i } .
where d_{ i } denotes the dissimilarity value between the original image and its resized image at the i^{ th } step, d_{ i1 } denotes the dissimilarity value between the original image and its resized image at the (i1) ^{ th } step.
In our proposed algorithm, we empirically set Δn_{row} (Δn_{column}) equal to five, namely carving out 5 seams in horizontal or vertical direction at each step for facilitating the estimation of the distortion degree. If Δn_{row} (Δn_{column}) is smaller than 5, then the increment of distortion is not obvious in every step, and it is difficult to find the crucial step; conversely, if Δn_{row} (Δn_{column}) is much greater than 5, then it maybe omits some scenarios with sharp increment of relative difference.
where ΔE is the total dissimilarity between the original image and the resized image of ultimate size by Seam Carving, L indicates the total number of removed seams, α is the number of removed seams of every step, and β is a coefficient.
For different images, there exist different contents and distribution, and the magnitude of the relative difference of dissimilarity corresponding to the step with increment sharply is different. Hence, Equation 3 contains the average value of dissimilarity (ΔE/L) and an adjustive coefficient β In this article, we set β = 1.2.
On the basis of the Equation 3 and analysis above, we construct the similarity criterion for image resizing by comparing the relative difference of dissimilarity Δd_{ i } with the threshold θ. If Δd_{ i } is less than θ, we continue resizing image by Seam Carving; otherwise we should stop Seam Carving and switch to other resizing algorithms for remaining adjustment.
5. Our algorithm
Seam Carving resizes an image by carving out or duplicating unimportant regions gracefully, and hence, it has good performance for preserving important information of the original image as much as possible. While the unimportant pixels are almost removed, the global visual effect and some local structures of image will be damaged severely if we continue resizing the image this way.
 (1)
Resize the original image to a preferred size directly by Seam Carving and calculate the dissimilarity value between the resized image and the original image. Based on the dissimilarity value and the total number of seams removed, the threshold θ is computed.
 (2)
Resize the original image by Seam Carving step by step.
 (3)
Calculate dissimilarity value d_{ i } between the original image and its resized one as well as relative difference of dissimilarity Δd_{ i } associated with step i(i = 1,2,3,...), then judge whether Δd_{ i } exceeds the threshold θ.
 (4)
If Δd_{ i } is less than θ, then go to step 2 and continue resizing; otherwise, go to step 5.
 (5)
If Δd_{ i } exceeds the threshold θ at the i^{ th } step, then we will adopt following approach to complete the remnant tasks from the (i1) ^{ th } step:
We scale the (i1) ^{ th } step image to ultimate size directly, denoting the (i1) ^{ th } step image with S_{1} and the final image with T_{1}, and then use the Bidirectional Similarity iteration to update the image T_{1}. We will obtain the target image until we get minimal dissimilarity value.
Iterative refinement is performed as follows:
Considering the coherence, traverse each pixel in image T_{1.} For a pixel q in T_{1}, let Q_{1},Q_{2},...,Q_{ m } denote all the patches containing the pixel q. Let P_{1},P_{2},...,P_{ m } denote the most similar patches in S_{1} corresponding to Q_{1},Q_{2},...,Q_{ m } , and p_{1},p_{2},...,p_{ m } be the corresponding pixels in P_{1},P_{2},...,P_{ m } to the pixel q within Q_{1},Q_{2},...,Q_{ m } in geometric position. In this article, the size of patch is 7 × 7, and so m is 49.
Considering the completeness, traverse all patches in the image S_{1}. For each patch, search the most similar patch in T_{1}, and record all the corresponding pixels between the two pitches. Hence, for a pixel q in T_{1}, it can get the votes by corresponding pixels within the patches in S_{1}. The subscript symbol n is decided by the number of similar patches.
where and denote the number of patches in S_{1} and T_{1}, m and n denote the number of pixels p_{ i } and in S_{1} corresponding to the pixel q in T_{1}.
6. Experiment and discussion
We resize the image from 201 × 134 to 126 × 134 as shown in Figure 4. The balloons are the important objects. Figure 4b is the resizing result only by Seam Carving. The balloons in the rectangles are damaged, and there are some aliases around the borders of the balloons. In Figure 4c, the image contents are shrunken uniformly. Using our method, the contents within image are preserved better and the verge of balloon is smooth (see Figure 4d). For dissimilarity value, relative to the original image, the dissimilarity value is 2,248 for Figure 4b; 3,188 for Figure 4c; and 1,292 for Figure 4d. Our result is the most similar to the original image.
Another example as shown in Figure 5 resizes the original image from 181 × 119 to 101 × 119 with several methods. We can observe that there are some artifacts appearing on the verge of petal within the image Figure 5b. Resizing the entire image in the same ratio using Scaling would change the shape of the flower, and the global visual effect is damaged (see Figure 5c). However, our method (see Figure 5d) can preserve the contents of image from distortion; yet, the edge of petal is smooth. While assessing the similarity, our result is the most similar to the original image due to the use of the iterative update, and the dissimilarity value is the smallest.
Analogously, we resize the image (see Figure 6) in vertical direction, from 136 × 134 to 136 × 84. The resulting image by Seam Carving is shown in Figure 6b, and the roof of the house is damaged. However, the result by our method, owing to adopting iterative computation, could mend a few interesting contents to some extent (see Figure 6d).
In Figure 7, we show an example of resizing image from 169 × 128 to 109 × 80. In this case, the size of image will be changed in both width and height. We can see that the fur of rabbits is damaged (see Figure 7b), and the entire image is shrunk uniformly (see Figure 7c). In our approach, the important information can be preserved and good visual effect obtained.
Because Bidirectional Similarity involves iterative computation which is timeconsuming, our algorithm is slower than Seam Carving. However, pixels' updating computation is needed only in remnant summarizing task, and so it is faster than using Bidirectional Similarity alone. In order to improve the speed, multiple CPUs/GPU parallel calculation can be introduced for significant speedup.
In this article, we focused on the image reduction and image summary. For image enlarging, Seam Carving is a sophisticated method and can be implemented gracefully.
7. Conclusions
In this article, we investigate the image resizing and sum up the similarity criterion, which could be employed to judge the degree of deformation for the resized images relative to the original image. Based on the similarity criterion, we proposed an effective image resizing algorithm combining the Seam Carving with Bidirectional Similarity measure. Even though the amount of adjustment is large, the algorithm can still avoid the disorder and distortion of image contents and preserve both the important regions and the global visual effect of the original image.
For the future study, we will further research an adaptive resizing algorithm, to choose automatically the best resizing algorithm from several candidate methods in every step to obtain better results of resizing.
Declarations
Authors’ Affiliations
References
 Vaquero D, Turk M, Pulli K, Tico M, Gelfand N: A survey of image retargeting techniques. Proceedings of SPIEThe International Society for Optical Engineering, Applications of Digital Image Processing XXXIII 2010., 7798:Google Scholar
 Setlur V, Lechner T, Nienhaus M, Gooch B: Retargeting images and video for preserving information saliency. IEEE Comput Graph Appl 2007,27(5):8088.View ArticleGoogle Scholar
 Wang YS, Tai CL, Sorkine O, Lee TY: Optimized scaleandstretch for image resizing. ACM Trans Graph 2008,27(5):Article number 118.View ArticleGoogle Scholar
 Ren TW, Liu Y, Wu GS: Image retargeting using multimap constrained region warping. Proceedings of the Seventeen ACM International Conference on Multimedia 2009, 853856.View ArticleGoogle Scholar
 Pritch Y, KavVenaki E, Peleg S: Shiftmap image editing. Proceedings of the Twelfth IEEE International Conference on Computer Vision 2009.Google Scholar
 Avidan S, Shamir A: Seam carving for contentaware image resizing. ACM Trans Graph 2007,26(3):1018. 10.1145/1276377.1276390View ArticleGoogle Scholar
 Han JW, Choi KS, Wang TS, Cheon SH, Ko SJ: Improved seam carving using a modified energy function based on wavelet decomposition. The 13th IEEE International Symposium on Consumer Electronics 2009, 3841.Google Scholar
 Rubinstein M, Shamir A, Avidan S: Multioperator media retargeting. ACM Trans Graph 2009,28(3):Article number 23.View ArticleGoogle Scholar
 Dong WM, Zhou N, Paul JC, Zhang XP: Optimized image resizing using seam carving and scaling. ACM Trans Graph 2009,28(5):Article number 125.View ArticleGoogle Scholar
 Roberto G, Ardizzone E, Pirrone R: Realtime contentaware image resizing using reduced linear model. Proceedings of 2010 IEEE 17th International Conference on Image Processing 2010, 28132816.View ArticleGoogle Scholar
 Mansfeld A, Gehler P, Van Gool L , Rother C: Visibility maps for improving seam carving. European Conference on Computer Vision (ECCV) 2010.Google Scholar
 Cho TS, Butman M, Avidan S, Freeman WT: The patch transform and its applications to image editing. IEEE Conference on Computer Vision and Pattern Recognition (CVPR) 2008.Google Scholar
 Simakov D, Caspi Y, Shechtman E, Irani M: Summarizing visual data using bidirectional similarity. IEEE Conference on Computer Vision and Pattern Recognition 2008, 18.Google Scholar
 Suh B, Ling H, Bederson BB, Jacobs DW: Automatic thumbnail and its effectiveness. Proceedings of the 16th Annual ACM Symposium on User Interface Software and Technology 2003, 95104.View ArticleGoogle Scholar
 Chen L, Xie X, Fan X, Ma WY, Zhang HJ, Zhou HQ: A visual attention model for adapting images on small display. Multimedia Syst 2003,9(4):353364. 10.1007/s0053000301054View ArticleGoogle Scholar
 Liu H, Xie X, Ma WY, Zhang HJ: Automatic browsing of large picture on mobile devices. Proceedings of the Eleventh ACM International Conference on Multimedia 2003, 148155.View ArticleGoogle Scholar
 Setlur V, Takagi S, Raskar R, Gleicher M, Gooch B: Automatic image retargeting. Proceedings of the 4th International Conference on Mobile and Ubiquitous Multimedia 2005, 154: 5968.View ArticleGoogle Scholar
 Zhang GX, Cheng MM, Hu SM, Martin RR: A shapepreserving approach to image resizing. Comput Graph Forum 2009,28(7):18971906. 10.1111/j.14678659.2009.01568.xView ArticleGoogle Scholar
 Rubinstein M, Shamir A, Avidan S: Improved seam carving for video retargeting. ACM Trans Graph 2008,27(3):Article number 16.View ArticleGoogle Scholar
 Domingues D, Alahi A, Vandergheynst P: Stream carving: an adaptive seam carving algorithm. Proceedings of 2010 IEEE 17th International Conference on Image Processing 2010, 901904.View ArticleGoogle Scholar
 Mansfield A, Gehler P, Van Gool L, Rother C: Scene carving: scene consistent image retargeting. 2010, 143156.Google Scholar
 Grundmann M, Kwatra V, Han M, Essa I: Discontinuous seamcarving for video retargeting. Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition 2010, 569576.Google Scholar
 Rubinstein M, Gutierrez D, Sorkine O, Shamir A: A comparative study of image retargeting. ACM Trans Graph 2010,29(6):Article number 160.View ArticleGoogle Scholar
 Augustine KV, Huang DJ: Image similarity for rotation invariants image retrieval system. International Conference on Mesoscale Convective Systems 2009, 133137.Google Scholar
 ArevalilloHerráez M, Domingo J, Ferri FJ: Combining similarity measures in contentbased image retrieval. Pattern Recognition Lett 2008,29(16):21742181. 10.1016/j.patrec.2008.08.003View ArticleGoogle Scholar
 Wang L, Yang LJ, Tian XM: Query aware visual similarity propagation for image search reranking. Proceeding of the Seventeen ACM International Conference on Multimedia 2009, 725728.View ArticleGoogle Scholar
 Maalouf A, Larabi MC: Image retargeting using a bandeletbased similarity measure. IEEE International Conference on Acoustics, Speech and Signal ProcessingProceedings 2010, 942945.Google Scholar
 Srivastava A, Biswas KK: Fast content aware image retargeting. Sixth Indian Conference on Computer Vision, Graphics and Image Processing 2008, 505511.View ArticleGoogle Scholar
 Wei LY, Han JW, Zhou K, Bao HJ, Guo BN, Shum HY: Inverse texture synthesis. ACM Trans Graph 2008,27(3):19.Google Scholar
Copyright
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.