How can I scientifically explain the following code in my article? I really need to know this as soon as possible. [m,n,l]=size(RGB); for i=1:m for j=1:n re
1 view (last 30 days)
Show older comments
How can I scientifically explain the following code in my article? I really need to know this as soon as possible.
[m,n,l]=size(RGB);
for i=1:m
for j=1:n
red = RGB(i,j,1);
green = RGB(i,j,2);
blue = RGB(i,j,3);
if (((red<green))||(red<blue))
RGB(i,j,1)=0;
RGB(i,j,2)=0;
RGB(i,j,3)=0;
end
end
end
5 Comments
Rik
on 11 Mar 2022
Edited: Rik
on 11 Mar 2022
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.
This page is now archived
Accepted Answer
Image Analyst
on 10 Mar 2022
I doubt this is good enough for a peer reviewed journal. I'd reject it too. Not just because you don't know what your code is doing, but for several other reasons too. Basically you're masking out pixels where the red is less than the blue and green values, like for example make the image black unless the pixel is bluish, greeninsh, or cyan-ish. If you can't describe what those simple lines are doing then you probably are not knowledgeable to deserve to have this in a peer reviewed journal. Sorry, I don't mean to hurt your feelings, I'm just being brutally honest.
Beyond that you need to decide if a simple color classification is a novel enough application to publish. I mean certainly color classification has been done before (and is not publication worthy by itself), and probably even color classification for leaf diseases has already been published, so what new discovery are you trying to publish?
% Get dimensions of image.
[m,n,l]=size(RGB);
% For every pixel, blacken the pixel if the red value is the darkest.
for i=1:m % For every row
for j=1:n % For every column
% Get the individual colors for this one pixel.
red = RGB(i,j,1);
green = RGB(i,j,2);
blue = RGB(i,j,3);
% See if the red value is the darkest.
if (((red<green))||(red<blue))
% The red value is the darkest so blacken the image at this pixel.
RGB(i,j,1)=0;
RGB(i,j,2)=0;
RGB(i,j,3)=0;
end
end
end
The whole thing could be done like in 3 lines like this:
[red, green, blue] = imsplit(RGB);
mask = (red < green) & (red < blue);
% Mask the image using bsxfun() function to multiply the mask by each channel individually. Works for gray scale as well as RGB Color images.
maskedRgbImage = bsxfun(@times, RGB, cast(mask, 'like', RGB));
0 Comments
More Answers (2)
See Also
Categories
Find more on Text Data Preparation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!