--- title: Saliency Detection for Content-aware Image Resizing tags: Papers --- # Saliency Detection for Content-aware Image Resizing 2009 16th IEEE International Conference on Image Processing (ICIP) * Radhakrishna Achanta * Sabine Su ̈sstrunk École Polytechnique Fédérale de Lausanne(洛桑聯邦理工學院), School of Computer and Communication Sciences(在瑞士) 124 citations(according to IEEE Xplore) ![](https://i.imgur.com/sQTt9Vr.png) 上排:原seam carving作法 下排:本篇論文 --- ### Recap / Background Content-aware **image re-targeting** : change image aspect ratios while preserving important features. * cropping: 沒有content-aware,會把重要的地方切掉 * image content adaptive warping * seam carving #### Method of seam carving 原圖 >> 畫出importance map(又叫energy map, saliency map) >> 切掉seam >> 再畫一次importance map >> 切掉seam >>> ... Assigning visual importance values is fundamental to all these automatic re-targeting methods. 簡單來說,畫出那張importance map是seam carving的重點 #### 畫map常用的方法: * L1 norm of grayscale intensity gradient:曼哈頓距離 * L2 norm of grayscale intensity gradient:歐氏距離 * object detectors: face ![](https://i.imgur.com/EQ7685k.png) --- ### This paper #### 主張: * color information is ignored * recompute the energy after seams are removed(要一直重複算importance value) * noise sensitive(原本的算法接近edge detection,所以很容易被noise干擾) #### 解決辦法: * Uniformly assign saliency values to entire salient regions, rather than just edges or texture regions. * This is achieved by **relying on the global contrast of a pixel** rather than local contrast, measured in terms of both color and intensity features #### Seam Carving review: 1. Define a vertical (horizontal) seam to be an 8-connected path of low energy pixels in the image from top to bottom (left to right) containing one, and only one, pixel in each row (column) of the image. ![](https://i.imgur.com/aJtD8ai.png) * I(x,y) is the grayscale intensity image * Eg(x,y) is the resulting importance value * 對一個pixel取偏導數,代表去取他的gradient。gradient有兩個方向,所以我們先取x方向的偏導數、再取y方向的偏導數,相加就是總梯度方向和大小。 1. DP to find global minimum seam #### Our saliency map: 1. Conduct gaussian blurring (using a 3x3 or 5x5 binomial kernel) --> img (n x m x 3) 2. Calculate average Lab vector --> vec (3x1) 3. Euclidean distance of vec and img ![](https://i.imgur.com/jp1gfhc.png) * **Elab(x, y)** is the importance value * **Iμ** is the average of all pixels' vectors * **In×n(x,y)** is the corresponding image pixel vector value in the Gaussian blurred version of the original image, * **∥∥** is the L2 norm (Euclidean distance in Lab color space) * ![](https://i.imgur.com/biqlJDN.png) --- ### Lab color space(CIELAB, CIE L * a * b *) Euclidean distances in this color space are approximately perceptually uniform. CIE(International Commission on Illumination(國際照明委員會)),關於光照、顏色的國際組織。 由一個亮度channel和兩個color channel組成。 - L*:亮度 - a*:綠色到紅色的分量 - b*:藍色到黃色的分量 Lab是基於人對顏色的感知來設計的(感知均勻的,**perceptual uniform**),也就是,如果數字(L/a/b)變化的幅度一樣,帶給視覺上的變化幅度也差不多。 相較於RGB和CMYK更符合人類視覺,也更容易調整:調亮度就條L,調色彩平衡就調a和b。 無關設備(**device-independent**):在給定color space中的白點(white point)後,這個color space就能明確的確定各個顏色,與使用的顯示設備沒有關係。 Lab的色域比RGB, CMYK都要大,超過人類視覺範圍 ![](https://i.imgur.com/mZBGaBd.png) #### 數值表示: - L*越大,亮度越高,0(黑色)~100(白色) - a*和b*為0時都代表灰色 - a*從負(綠色)~正(紅色) - b*從負(藍色)~正(黃色) - 數字範圍:Luminance takes values between 0 and 100, and the other coordinates typically take values between -100 and 100 #### RGB轉CIELAB: 1. 先將RGB的值調整為介於0~1之間 1. 再將色彩空間轉換至CIE XYZ色彩空間,以下為其轉換矩陣: ![](https://i.imgur.com/VrXbUML.png) 1. 再由CIE XYZ色彩空間轉換至CIELAB色彩空間,方法如下: ![](https://i.imgur.com/G8kgtlU.png) ![](https://i.imgur.com/7oxpxFn.png) #### References: * Lab color space: https://blog.csdn.net/gdymind/article/details/82357139 https://cg2010studio.com/2012/10/02/rgb%e8%88%87cielab%e8%89%b2%e5%bd%a9%e7%a9%ba%e9%96%93%e8%bd%89%e6%8f%9b/ https://en.wikipedia.org/wiki/CIELAB_color_space https://colorspace.r-forge.r-project.org/reference/LAB.html * Seam Carving: https://github.com/andrewdcampbell/seam-carving https://zhuanlan.zhihu.com/p/38974520 https://blog.csdn.net/a6333230/article/details/89886616