Search code examples
matlabimage-processingcolorshue

Getting out hue values of points in image


I have an image and I want to be able to get the hue values out of specific points on the image.

I've been using impixel to get out the color values, but was wondering if theres a function like impixel to get the hue value of speicifc pixels.


Solution

  • Use rgb2hsv after impixel.

    Example:

    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