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)
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
MAHDI JAVADI
MAHDI JAVADI on 10 Mar 2022
@Rik actually I can't understand line if but for my article I need totally description. so if you can help me please take me a paragraph for it. thanks
Rik
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

Sign in to comment.

Accepted Answer

Image Analyst
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));

More Answers (2)

MAHDI JAVADI
MAHDI JAVADI on 11 Mar 2022
@Rik I just wanted to thank you for your answers but I mistyped the question. I did not mean rudeness

MAHDI JAVADI
MAHDI JAVADI on 11 Mar 2022
Edited: MAHDI JAVADI on 11 Mar 2022
@image analyst thanks for your respond. that was a good points in your comment.

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!