How to display a monochrome color from a true color image?
Mostrar comentarios más antiguos
I have trouble displaying only the Red, Green and Blue components of my edge detection algorithm I'm using. The edges are detected for my true color RGB image, but I need to display three images representing the RED, GREEN and BLUE edge detections respectively.
I can do the edge detection for gray scale images, but the RGB one's are troublesome. Could some one please help me with this? I'm attaching my code below.
Kind regards, Louis
clear all; close all; clc;
[filename path] = uigetfile('*.*');
m=imread(filename);
figure,image(m); % Display the original picture
r=m(:,:,1); %extract the red color
g=m(:,:,2); %extract the green color
b=m(:,:,3); %extract the blue
hx =[ -1 -2 -1; 0 0 0; 1 2 1];
hy =[ -1 0 1; -2 0 2; -1 0 1];
% x dirction 'sobel' processing
xr=filter2(hx,r);
xg=filter2(hx,g);
xb=filter2(hx,b);
%combine the three color
t1(:,:,1)=xr;
t1(:,:,2)=xg;
t1(:,:,3)=xb;
size(t1)
t=uint8(t1);
figure, image(t);
% y dirction 'sobel' processing
yr=filter2(hy,r);
yg=filter2(hy,g);
yb=filter2(hy,b);
%combine the three color
t2(:,:,1)=yr;
t2(:,:,2)=yg;
t2(:,:,3)=yb;
t=uint8(t2);
figure, image(t);
%combine x and y direction processing
t3(:,:,1)=xr+yr;
t3(:,:,2)=xg+yg;
t3(:,:,3)=xb+yb;
t = uint8(t3);
figure, image(t);
Respuesta aceptada
Más respuestas (2)
Louis Kok
el 20 de Mayo de 2012
1 comentario
Image Analyst
el 20 de Mayo de 2012
See my answer in this: http://www.mathworks.com/matlabcentral/answers/29527-criteria-of-a-good-image-testing
Louis Kok
el 20 de Mayo de 2012
Categorías
Más información sobre Modify Image Colors en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!