MATLAB: How to make hsv converted image two dimensional

hsvMATLABtwo dimensional

I have converted an image to hsv image…now i need to find the edges by using canny.But while doing i am getting an error…
Error using ==> iptcheckinput Function EDGE expected its first input, I, to be two-dimensional.
Error in ==> edge>parse_inputs at 541 iptcheckinput(I,{'numeric','logical'},{'nonsparse','2d'},mfilename,'I',1);
Error in ==> edge at 197 [a,method,thresh,sigma,thinning,H,kx,ky] = parse_inputs(varargin{:});
Error in ==> mergealgo at 37 im_canny = edge(inputgray, 'canny');
how to make hsv image two dimensional?

Best Answer

You have to decide for one channel, e.g.:
RGB = rand(100, 200, 3);
HSV = rgb2hsv(RGB);
im_canny = edge(HSV(:, :, 1), 'canny');
Depending on your problem the H, S or V channel is best to recognize edges.