from
COLOR
by Divakar Roy
Conversion of images into different colors.
|
| color(input_image, color_name, output_image)
|
% COLOR : Changes the color from RGB to one color
%
% Syntax: color(input_image_name, color_name, output_image_name)
% Colors : red, green, blue, yellow, cyan, magneta
% Example: color('Input.jpg','magneta','Output.jpg');
function color(input_image, color_name, output_image)
switch(color_name)
case ('red')
color_num=1;
case ('green')
color_num=2;
case ('blue')
color_num=3;
case ('yellow')
color_num=4;
case ('cyan')
color_num=5;
case ('magneta')
color_num=6;
end
img=imread(input_image);
dion=[1 0 0 ; 0 1 0 ; 0 0 1 ; 1 1 0 ; 0 1 1 ; 1 0 1];
img(:,:,~dion(color_num,:))=0;
imwrite(uint8(img),output_image);
|
|
Contact us at files@mathworks.com