From: Alexander on
Hi there,

I'm new to image processing in Matlab and was wondering if any one could help.

I'm trying to select a pixel from an rgb image and then transform those values into the XYZ colour coordinate system using Matlabs srgb2xyz function, sounds simple but I can't get this to work, so far I have:

I_rgb = imread('peppers.png');
P = impixel(I_rgb,151,200)

C = makecform('srgb2xyz');
I_xyz = applycform(I_rgb,C);

Q = impixel(I_xyz,151,200)

The rgb values for that pixel is 105 67 33 and the desired output should be 8.107 7.127 2.387. In the end i will have to do this for every pixel in an image.

Does any one have any ideas on this; am I doing this completely wrong?, can this be done on single pixel values?

Any help would be greatly appreciated

Cheers

Alex