clc;
clear all;
close all;
a= imread('cameraman.tif');
[row col]=size(a);
for x=1:1:row
for y=1:1:col
if 0<=a(x,y)&& a(x,y)<=6
red(x,y)=0;
blue(x,y)=0;
green(x,y)=0;
else if 7<=a(x,y)&&a(x,y)<=45
red(x,y)=0;
blue(x,y)=0;
green(x,y)=255;
else if 46<=a(x,y)&&a(x,y)<=66
red(x,y)=0;
blue(x,y)=255;
green(x,y)=0;
else if 67<=a(x,y)&&a(x,y)<=70
red(x,y)=255;
blue(x,y)=0;
green(x,y)=200;
else if 71<=a(x,y)&&a(x,y)<=255
red(x,y)=255;
blue(x,y)=0;
green(x,y)=0;
end
end
end
end
end
end
end
final=cat(3,red,green,blue);
subplot(2,2,1);
imshow(a);
subplot(2,2,2);
imshow(final);
No comments:
Post a Comment