- Open Access
Similarity criterion for image resizing
© Hua et al; licensee Springer. 2011
- Received: 5 January 2011
- Accepted: 21 July 2011
- Published: 21 July 2011
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 image-resizing 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.
- image resizing
- similarity criterion
- relative difference of dissimilarity
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 image-resizing 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 image-resizing and retargeting algorithms that can protect both the global visual effect and some local structures of the original image ; 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 time-consuming.
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 image-resizing 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 content-aware image-resizing 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 image-resizing and similarity measure algorithms used in this article. Section 4 describes similarity criterion between images. In Section 5, we present an effective image-resizing 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.
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.  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 image-resizing 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.  proposed an automatic, non-photorealistic 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.  employed tools to describe original image and minimized quadratic distortion energies to obtain a resized image.
With dynamic programming, Avidan and Shamir  presented a simple image-resizing method called Seam Carving, and then Rubinstein et al.  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.  presented an improved algorithm called Stream Carving to induce an increase in the quality of the resized image. Mansfield et al.  proposed a scene-carving method, by decomposing the image-retargeting procedure into removing image content with minimal distortion and re-arrangement of known objects within the scene to maximize their visibility. Considering the distortion in both spatial and temporal dimensions, Grundmann et al.  presented a discontinuous Seam Carving for video retargeting to process the video frame sequentially and afford great flexibility.
Dong et al.  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.  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 time-consuming. Rubinstein et al.  compared a number of state-of-the-art 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.  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.  provided a similarity measure algorithm between images termed Bi-Directional 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 overall-similarity between the images. Maalouf and Larabi  defined a multi-scale bandelet-based 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.  presented a well-defined image distance function, which is formulated as a combination of patch-based bidirectional image Euclidean distance, image-dominant 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.
Compute the energy of every pixel in the image using the gradient energy function, then calculate the accumulative energy of all the eight-connected paths, and find a connected seam which has minimum cumulative energy (see ).
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 eight-connected paths, and find one particular path having the minimum energy . 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 . 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 dcomplete(S,T) measures the deviation of T from "completeness" w.r.t.S, the term dcohere(S,T) measures the deviation of T from "coherence" w.r.t. S. For details, please refer to the literature .
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.
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.
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 i-1 denotes the dissimilarity value between the original image and its resized image at the (i-1) th step.
In our proposed algorithm, we empirically set Δnrow (Δncolumn) 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 Δnrow (Δncolumn) 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 Δnrow (Δncolumn) 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.
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.
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.
Resize the original image by Seam Carving step by step.
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 θ.
If Δd i is less than θ, then go to step 2 and continue resizing; otherwise, go to step 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 (i-1) th step:
We scale the (i-1) th step image to ultimate size directly, denoting the (i-1) th step image with S1 and the final image with T1, and then use the Bidirectional Similarity iteration to update the image T1. 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 T1. For a pixel q in T1, let Q1,Q2,...,Q m denote all the patches containing the pixel q. Let P1,P2,...,P m denote the most similar patches in S1 corresponding to Q1,Q2,...,Q m , and p1,p2,...,p m be the corresponding pixels in P1,P2,...,P m to the pixel q within Q1,Q2,...,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 S1. For each patch, search the most similar patch in T1, and record all the corresponding pixels between the two pitches. Hence, for a pixel q in T1, it can get the votes by corresponding pixels within the patches in S1. The subscript symbol n is decided by the number of similar patches.
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 time-consuming, 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.
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.
- Vaquero D, Turk M, Pulli K, Tico M, Gelfand N: A survey of image retargeting techniques. Proceedings of SPIE-The 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):80-88.View ArticleGoogle Scholar
- Wang YS, Tai CL, Sorkine O, Lee TY: Optimized scale-and-stretch for image resizing. ACM Trans Graph 2008,27(5):Article number 118.View ArticleGoogle Scholar
- Ren TW, Liu Y, Wu GS: Image retargeting using multi-map constrained region warping. Proceedings of the Seventeen ACM International Conference on Multimedia 2009, 853-856.View ArticleGoogle Scholar
- Pritch Y, Kav-Venaki 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 content-aware image resizing. ACM Trans Graph 2007,26(3):10-18. 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, 38-41.Google Scholar
- Rubinstein M, Shamir A, Avidan S: Multi-operator 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: Real-time content-aware image resizing using reduced linear model. Proceedings of 2010 IEEE 17th International Conference on Image Processing 2010, 2813-2816.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, 1-8.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, 95-104.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):353-364. 10.1007/s00530-003-0105-4View 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, 148-155.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: 59-68.View ArticleGoogle Scholar
- Zhang GX, Cheng MM, Hu SM, Martin RR: A shape-preserving approach to image resizing. Comput Graph Forum 2009,28(7):1897-1906. 10.1111/j.1467-8659.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, 901-904.View ArticleGoogle Scholar
- Mansfield A, Gehler P, Van Gool L, Rother C: Scene carving: scene consistent image retargeting. 2010, 143-156.Google Scholar
- Grundmann M, Kwatra V, Han M, Essa I: Discontinuous seam-carving for video retargeting. Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition 2010, 569-576.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, 133-137.Google Scholar
- Arevalillo-Herráez M, Domingo J, Ferri FJ: Combining similarity measures in content-based image retrieval. Pattern Recognition Lett 2008,29(16):2174-2181. 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, 725-728.View ArticleGoogle Scholar
- Maalouf A, Larabi MC: Image retargeting using a bandelet-based similarity measure. IEEE International Conference on Acoustics, Speech and Signal Processing--Proceedings 2010, 942-945.Google Scholar
- Srivastava A, Biswas KK: Fast content aware image retargeting. Sixth Indian Conference on Computer Vision, Graphics and Image Processing 2008, 505-511.View ArticleGoogle Scholar
- Wei LY, Han JW, Zhou K, Bao HJ, Guo BN, Shum HY: Inverse texture synthesis. ACM Trans Graph 2008,27(3):1-9.Google Scholar
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.