-
21-12-2019 - |
题
我有一张图像,我希望能够从图像上的特定点获取色调值。
我一直在使用 impixel 来获取颜色值,但想知道是否有像 impixel 这样的函数来获取特定像素的色调值。
解决方案
使用 rgb2hsv
后 impixel
.
例子:
im = imread('peppers.png'); %// example image
im = im2double(im); %// convert to double values in [0, 1]
c = [12 146 410]; %// column coordinates of desired pixels
r = [104 156 129]; %// row coordinates of desired pixels
pixels = impixel(im,c,r); %// rgb values of pixels
hsv = rgb2hsv(pixels); %// convert to hsv
hue = hsv(:,1); %// hue is first column of hsv
不隶属于 StackOverflow