Insignificant Changes in mean value of RGB for Different Images with contrary color
1 次查看(过去 30 天)
显示 更早的评论
Hello.I'm newbie here.I want to ask opinion about my coding.My project is to detect color changes in fish body segment with different level concentration of water impurities.Color changes are defined through mean value of RGB .Below are the codes
RGB1=imread('C:\Users\user\Documents\MATLAB\C330min1crop.jpg');
A=RGB1;
R=A(:,:,1);
I2=histeq(R);
Pixel_Values_Imred=single(I2);
mean_I2= mean(Pixel_Values_Imred(:))
G=A(:,:,2);
I3=histeq(G);
Pixel_Values_Imgreen=single(I3);
mean_I3= mean(Pixel_Values_Imgreen(:))
B=A(:,:,3);
I4=histeq(B);
Pixel_Values_Imblue=single(I4);
mean_I4= mean(Pixel_Values_Imblue(:))
figure, subplot(3,1,1),imhist(R),title('Red Color Histogram');
subplot(3,1,2),imhist(G),title('Green Color Histogram');
subplot(3,1,3),imhist(B),title('Blue Color Histogram');
After running the codes,results show just a little changes in mean value for rgb histogram which only changes in point value.I expect the results will show significant changes since even just looking at the images with naked eyes, the color differences between images are in contrary.For example RED histogram,mean value of (concentration 1)Image1=127.6574 and (concentration 2)image 2=127.4563.Changes are insignificant.My question is is it normal for the value to only change in point or there are errors in my coding?Please correct me if I'm wrong :)Thank you
0 个评论
采纳的回答
Image Analyst
2015-5-2
I was just consulting with someone on a similar situation. They wanted to know why a rainbow/oil-slick-like corrosion/etching on metal did not show any meaningful difference in the delta E color change despite the surfaces looking quite different from nearly gray to pastel rainbows to vivid rainbows. Obviously one is a lot more colored than the other so delta E should show that right? No, not necessarily. When you use a colorimeter, spectrophotometer, radiometer, or digital image, you're calculating the location of the centroid color. Well two gamuts (clusters of points in RGB space or LAB color space) could have the same centroid but the cluster could be different widths, right? Look at my icon to the left. Imagine you had a point in that coordinate system for every pixel in your image. That collection of points is called the "gamut." So you can't just compare the distance between the centroids (the mean color) - you also have to look at the distance between every pixel and the mean color. That distance WILL be different if the cluster is larger or smaller. Attach your images and we can discuss in more detail.
3 个评论
Image Analyst
2015-5-2
Yes, that illustrates my point well. In fact red and green are on opposite sides of the lab color space (which you should be using) - see my icon to the left. So the mean color will be near the neutral axis, and won't change much even if the entire image went to all gray!
Use the method I said and you should be able to see a more substantial difference. A couple of pointers though. First, you might want to mask out dark and black pixels if they don't contribute at all to any color change. Or maybe you might want to measure the area fraction of black. Secondly, you have bad focus and specular reflections. You can knock out the specular reflections/glints with crossed polarizers - on in front of the light source and one you can turn on the lens. Rotate it until the reflections go away.
Secondly you should convert the images to lab with rgb2lab(). This uses a "book formula". if you want to be absolutely accurate, like I need to be, then you will need to calibrate to a known color standard in the image, like the x-rite color checker chart (<http://xritephoto.com/ph_product_overview.aspx?ID=1257&action=overview ColorChecker Passport>, which has known LAB values. This is the only way to get reproducible lab values out because your RGB values can change on a photo-by-photo basis. For any given fish, I can make the RGB values almost whatever I want by adjusting camera settings (like exposure) and that's no good. So you must have a standard embedded in your pictures.
If you want to do color segmentation to get area fractions, you might take a look at several color segmentation demos in my File Exchagne http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!