HSV Help - Imshow two thresholds

Hey all,
I'm trying to display the following image in HSV, and setting the red and green thresholds. How can I do it so the user specifies with an input? Cheers
redlevel = input('Please insert a value between 0 and 1 for Red.\n','s');
red=str2double(redlevel);
objectofintrest = (objectofintrest(:,:,1)<(red));
greenlevel = input('Please insert a value between 0 and 1 for Green.\n','s');
green=str2double(greenlevel);
objectofintrest = ((objectofintrest(:,:,2))<(green));
% redgreen= [redlevel & grelevel];
imshow(objectofintrest, red, green);

5 件のコメント

Image Analyst
Image Analyst 2013 年 4 月 18 日
Did that work? By the way, it appears to be RGB color space, not HSV color space. See my interactive thresholding app: http://www.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image
Ian
Ian 2013 年 4 月 18 日
No it didnt work. Do you only use (:,:,1) in RGB? I converted the image to HSV earlier in the program. Ill check it out, thanks alot.
Image Analyst
Image Analyst 2013 年 4 月 18 日
編集済み: Image Analyst 2013 年 4 月 18 日
I don't know what you are trying to do. Why are you using the word red when you're thresholding the hue channel and the red hues are less than about 0.1 and more than about 0.9?
Ian
Ian 2013 年 4 月 18 日
Updated to this, which gets a HSV image, but trying to convert it to binary from that.. Any ideas?
redChannel = objectofintrest(:,:,1);
greenChannel = objectofintrest(:,:,2);
redlevel = input('Please insert a value between 0 and 1 for Red.\n','s');
red=str2double(redlevel);
greenlevel = input('Please insert a value between 0 and 1 for Green.\n','s');
green=str2double(greenlevel);
redgreen= red & green;
imshow(objectofintrest, redgreen);
Image Analyst
Image Analyst 2013 年 4 月 18 日
編集済み: Image Analyst 2013 年 4 月 18 日
Is objectofintrest an RGB image or an HSV image? What is the range of it? Between 0 and 255 or between 0 and 1?

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2013 年 4 月 18 日
編集済み: Image Analyst 2013 年 4 月 18 日

0 投票

Check out my color segmentation tutorials. There is one that works in HSV color space. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862

質問済み:

Ian
2013 年 4 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by