简体   繁体   中英

How to determine color in MATLAB

I would like to map HSV values to color names in MATLAB. I have converted RGB to HSV and thresholded the values using a series of if statements in order to determine the color . However I would instead like to map the values to defined color names. Is this possible in MATLAB?

If you're working with an mxnx3 (ie 2D with 3 channels) RGB image im , then typically the red channel is im(:,:,1) , green is im(:,:,2) , and blue is im(:,:,3) . So if you want the RGB values at some point (x, y), then you can get the vector by im(x,y,:) .

If you just want to convert HSV values to RGB, then you can use the function hsv2rgb .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM