【问题标题】:Getting out hue values of points in image获取图像中点的色调值
【发布时间】:2014-05-27 03:38:41
【问题描述】:

我有一张图像,我希望能够从图像上的特定点获取色调值。

我一直在使用 impixel 来获取颜色值,但想知道是否有类似 impixel 的函数来获取特定像素的色调值。

【问题讨论】:

    标签: matlab image-processing colors hue


    【解决方案1】:

    impixel 之后使用rgb2hsv

    例子:

    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
    

    【讨论】:

    • 嗯,这比我尝试做的要简单得多。谢谢。
    • 您好,有人能告诉我为什么在尝试复制此示例时会出现此错误吗? '有效的颜色图不能有超出范围 [0,1] 的值'
    • @VeilEclipse 这是因为较新的 Matlab 版本中的 rgb2hsv 函数要求其输入为区间 [0, 1] 上的 double 值。我添加了一行im = im2double(im); 来解决这个问题。请参阅已编辑的答案;它现在应该可以工作了
    猜你喜欢
    • 2012-12-14
    • 2012-05-07
    • 2016-09-06
    • 2014-11-29
    • 2015-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多