I am new to matlab and programming. I have a RGB image of size [640 780]. Now lets say I need only those pixels whose red value is more than 100 and remaining less pixels I convert to 255. Now I would like to know how can I store those needed pixels in a different matrix so that I can use those values to directly navigate in the original RGB picture for drawing an ROI ???
a = 1; b = 1;
maybe_red = RGB;
for i = 1:sizeim(1)
for j = 1:sizeim(2)
if RGB(i,j,1) > 100
red_trace_x(a) = i;
red_trace_y(b) = j;
b = b+1;
else
maybe_red(i,j,:) = 1;
end
end
a = a+1;
end
Currently I am storing x
and y
in separate arrays. But I would like to know how to store both x,y
values in single matrix.
Thank you.!