how compute color std fast

2 次查看(过去 30 天)
michael scheinfeild
hi i want to detect areas in image where there is large diffrence in color for example [r,g,b] = [130 120 137]--> new binary image 0 [r,g,b] = [60 190 87]--> new binary image 1 (large difrence of colors) so i do loop but it seems not efficient
for(mi=1:m)
for(ni=1:n)
newimg(mi,ni) = squeeze(std(imd(m,n,:)));
end
end
then i do threshold on newimg

回答(3 个)

Image Analyst
Image Analyst 2014-9-9
You don't want to do it the way you propose. Trust me - I teach courses on color science. Color difference is called "Delta E" and is pretty much the distance between the colors plotted in CIE LAB color space (see my avatar to the left). I have an application that computes the local Delta E and returns that as an image. You first compute that image and then threshold that. For example see in the image below that areas with high color variation are the edges and those are segmented out (by thresholding the delta E image in the middle row, left column), along with areas where the color doesn't change much.

Ahmed
Ahmed 2014-9-9
编辑:Ahmed 2014-9-9
The std function can operate on any dimension. For details see the help of 'std'.
newimg = std(imd,0,3);
It might be faster, if you re-order your data matrix 'imd' such that the third dimension becomes the first.
imd = permute(imd,[3 1 2]);
newimg = squeeze(std(imd,0));

Michael scheinfeild
i realy didnt get what you mean but my idea works great even it can overcome ilumination that homomorphic transform didnt succes , this is the histogram and it make great segmentation for my case , i cant put the segmented image due to security reasons
  1 个评论
Image Analyst
Image Analyst 2014-9-10
OK, if your ad hoc method works for your images, then fine. Though, it doesn't measure color difference the same in different parts of color space because RGB color space is not linear with respect to human vision. For example the same stdDev around black or white does not produce the same apparent visual color difference to humans as when the colors are vivid red or blue. That's why CIE LAB color space was invented - see my avatar to the left. Hopefully some day you will have time to learn about color theory and the human visual system.

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by