Combining HSV to get a full image?

5 views (last 30 days)
Gieniek
Gieniek on 29 Dec 2013
Edited: Walter Roberson on 29 Dec 2013
Hello,
I duying project, who must detect edges in HSV images.
I have problem whith connect chanels H,S,V to one full image who schows detected edges.
Problem is when I try to show image useing "imshow" function.
I was try use "cat" function, but it's not working -I think.
It work with rgb image, when I use it to HSV image, it's show me errors.
So I don't know, if problem is with "cat" or "imshow" becouse, when I delete "imshow" from code, and when I run the program, the errors not show.
This is code my project:
L=imread('mercek1.jpg');
K=rgb2hsv(L);
h = K(:, :, 1);
s = K(:, :, 2);
v = K(:, :, 3);
A = edge(h, 'canny');
B = edge(s, 'canny');
C = edge(v, 'canny');
D=cat(3, A,B,C);
imshow(D)
Errors:
_Error using imageDisplayValidateParams>validateCData (line 121)
If input is logical (binary), it must be two-dimensional.
Error in imageDisplayValidateParams (line 31)
common_args.CData = validateCData(common_args.CData,image_type);
Error in imageDisplayParseInputs (line 79)
common_args = imageDisplayValidateParams(common_args);
Error in imshow (line 220)
[common_args,specific_args] = ...
Error in Untitled7dzialajacehsv (line 29)
imshow(D)_
I will be very great full for help.
Sorry for my englisch, he's not perfect, but I hope that it can be understand.
I hope for quick answer.

Answers (3)

Walter Roberson
Walter Roberson on 29 Dec 2013
imshow(double(D))

Gieniek
Gieniek on 29 Dec 2013
Great, it's working, very thanks.

Image Analyst
Image Analyst on 29 Dec 2013
D must either be in the range of 0-1 or be uint8.
You might be interested in this:

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!