r_filtdesign.m 1.23 KB
function r_filtdesign(imfile)
% R_FILTDESIGN - Generates nine monochrome images of different RGB channels
% and their combinations. This helps create a color filter to recognize
% particular objects in an RGB color space.
%
% Syntax:  r_filtdesign(imfile)
%
% Inputs:
%    imfile  - The jpeg image file name.
%
% Example:
%    r_filtdesign('im01000_interp.jpg')
%
% Other m-files required: Image Processing Toolbox
% Subfunctions: none
% MAT-files required: none
%
% See also: R_RECON, R_ISOLATE, R_SHOW

% Author: Dany Dumont
% UQAR/ISMER
% email: dany_dumont@uqar.ca
% Website: http://www.ismer.ca/dumont-dany
% July 2013
% ______________________________________________________________________

I = imread(imfile);

IR = I(:,:,1);
IG = I(:,:,2);
IB = I(:,:,3);

IRG = IR-IG;
IGB = IG-IB;
IBR = IB-IR;

IRB = IR-IB;
IGR = IG-IR;
IBG = IB-IG;
figure(1);clf
subplot(3,3,1)
imshow(IR)
title('R')
subplot(3,3,2)
imshow(IG)
title('G')
subplot(3,3,3)
imshow(IB)
title('B')
subplot(3,3,4)
imshow(IRG)
title('R-G')
subplot(3,3,5)
imshow(IGB)
title('G-B')
subplot(3,3,6)
imshow(IBR)
title('B-R')
subplot(3,3,7)
imshow(IRB)
title('R-B')
subplot(3,3,8)
imshow(IGR)
title('G-R')
subplot(3,3,9)
imshow(IBG)
title('B-G')
figure(2);clf
im_gray = rgb2gray(I);
imshow(im_gray)