Quantcast
Channel: MATLAB Central Newsreader - how to change specific colors of image?
Viewing all articles
Browse latest Browse all 5

how to change specific colors of image?

$
0
0
clear all;
RGB = imread('im5.jpg');

f1 = figure(); imshow(RGB);

[r c z] = size(RGB);
RGB = RGB(floor(r*0.2):r,:,:);
[r c z] = size(RGB);
I = zeros(r,c);

for i=1:r
    for j=1:c
        if((RGB(i,j,1)>100 && RGB(i,j,1)<250)&&(RGB(i,j,2)>50 && RGB(i,j,2)<180)&&(RGB(i,j,3)>0 && RGB(i,j,3)<100))
             I(i,j)=1;
        end
    end
end


this is a code which read image pixel wise, and changes yellow pixels to white and rest to black. I want to change color of all pixels to black except white. White should remain as white and rest all pixels should change to black.
Can somebody plz help me?

Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles



Latest Images