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!