red colour intensity display for comparison
3 次查看(过去 30 天)
显示 更早的评论
i have some images . 5 in number .all the images have red roses in it. my task is to just find out which image has the highest number of roses .and this i have to do it in most simple manner since i am a novice and have to start from ground zero.
hence i decided to just calculate the mean intensity of red colour in of each image.,
my codes are
I=imread('1.jpg'); rplane=i(:,:,1);
Z=mean(rplane)
question is "wheteher the image with maximum number of roses will have the maximum mean of red colour component"
whether such an idea is going to work out or i have to chalk out some other difficult stratergy....
please tell the very basic ideas as i am just a new hobbiesiest programmer trying to
0 个评论
采纳的回答
Walter Roberson
2011-9-17
Take a picture of a single rose close up. The one rose will fill most of the image, so most of the image will be red -- a high mean value.
Now, take a picture of a half dozen roses in a vase. There will probably be a fair bit of the image that is not the roses themselves (such as the image of the vase), so the mean value will be lower -- and yet the number of roses is higher.
Now, take a picture of a dozen roses that are a much paler red than the ones in the half-dozen picture. Will the total red be higher or lower than for the half-dozen? It could go either way.
Thus the answer to your first question is No, mean intensity of red is not a good way to detect the number of roses.
更多回答(1 个)
Image Analyst
2011-9-17
Assuming you have simple images for a beginning student project, your idea will probably suffice. For example all you have are roses (no other clutter such as leaves, vases and other stuff that varies from image to image) and all the roses are about the same size, etc. Just get the mean value of the red channel and look for the image with the highest mean red value, or the lowest mean blue value. It's not a super-robust method but I bet if you posted your images we'd find that it would work. I doubt you were supplied with very challenging images for a beginner exercise. If it doesn't work, then post your images so we can see what the complicating factors are.
Your code wouldn't exactly work because MATLAB is case sensitive so I is different than i. You shouldn't use i anyway since it's the imaginary variable. You should also use mean2() instead of mean().
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!