finding the dominant color

October 25 [Fri], 2013, 15:36

Basically, I have a library of images, that I want to sort by color. So if the user specifies 'sort by blue', then the most blue images will appear at the top of the results, with the least blue appearing at the bottom.


I've tried about 3 or 4 different approaches, with varying results - none work well though, and 2 of these wencenenc10/25 were quite mathematical algorithms (which all work much better on paper than in practice haha).


getting the average rgb value for the whole image and comparing it to blue. Comparing was done using normalised rgb 3 space vectors and finding distances between them. This works the least well, an image with no blue could easily appear above an image with partial very strong blue.


finding the dominant color and comparing it to blue (again using 3 space vector distances). This didn't work as there might have been a large blue section of the image that wasn't the most (or in the top couple) of dominant color sections.


Cheap version: convert images to HSV color space, and for each pixel compute cos(H - target_hue) or a reasonable approximation (for blue, target_hue would be 240 degrees), multiply by saturation, and average that quantity over all of the pixels in the image. High values are best. Note that colors that are closer to yellow than to blue have "negative blueness", and that black, white, and pure gray have equally "zero blueness". Note that you really want エアジョーダン4 激安 HSV, not HSL, in this situation, because the "S" in HSL doesn't map well to perceptual saturation. a pure blue), but it looks nearly white.


The same color in HSV has エア ジョーダン 28 an "S" coordinate of only 3%, which is reasonable.Less cheap version: convert images to CIELAB color space, discard L, and compute the distance in a*b* space between each pixel and the target color, then average or RMS over each pixel. Low values are best.

プロフィール
  • プロフィール画像
  • アイコン画像 ニックネーム:xcenayangcen
読者になる
2013年10月
« 前の月  |  次の月 »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
最新コメント
ヤプミー!一覧
読者になる
P R
カテゴリアーカイブ
月別アーカイブ
http://yaplog.jp/xcenayangcen/index1_0.rdf