how compute color std fast

조회 수: 3 (최근 30일)
michael scheinfeild
michael scheinfeild 2014년 9월 9일
댓글: Image Analyst 2014년 9월 10일
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.
  댓글 수: 1
Image Analyst
Image Analyst 2014년 9월 10일
So, Michael, what do you think?

댓글을 달려면 로그인하십시오.


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
Michael scheinfeild 2014년 9월 10일
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