Page 1 of 1

Getting pixel coordinates of individual pixels in an image

Posted: 2012-08-01T09:47:59-07:00
by slimprize
Hi all,
How do I get the x and y coordinates and the brightness of all the pixels that comprise an image? Is the exportPixels method in the magick wand the way to go? I need to get these values for each pixel. I have a program in ansi C to which I need to pass these coordinates. I can however use C++ too since I am probably going to convert that program to c++.

I have also seen the commandline interface where the convert utility looks promising. However, I cannot tell what parameters to use for this utility.

My program will run chiefly on Linux (Ubuntu) but I plan to run it on the rasbperry pie too.
Pranav

Re: Getting pixel coordinates of individual pixels in an ima

Posted: 2012-08-01T11:01:14-07:00
by fmw42
In command line, see the txt: format for output. It has color values and x,y coordinates.

What do you mean by "brightness"? Do you just have a grayscale image? Brightness is usually associated with the B channel of HSB colorspace. Similarly Lightness is the L channel of HSL colorspace. When converting to grayscale you get an intensity from a given combination of R/G/B, which is also the Y channel of YUV/YIQ/YCbCr colorspaces.

see http://www.imagemagick.org/Usage/files/#txt

convert image txt:

Sorry I am not sure how you would express that in one of the IM APIs.

Re: Getting pixel coordinates of individual pixels in an ima

Posted: 2012-08-05T18:04:09-07:00
by slimprize
[quote="fmw42"]In command line, see the txt: format for output. It has color values and x,y coordinates.
PL] Many thanks. The txt file is what I needed.
What do you mean by "brightness"? Do you just have a grayscale image? Brightness is usually associated with the B channel of HSB colorspace. Similarly Lightness is the L channel of HSL colorspace. When converting to grayscale you get an intensity from a given combination of R/G/B, which is also the Y channel of YUV/YIQ/YCbCr colorspaces.
PL] I am converting to grayscale so I am using the average of RGB values.
see http://www.imagemagick.org/Usage/files/#txt
PL] Yes and this helpped.

Pranav

Re: Getting pixel coordinates of individual pixels in an ima

Posted: 2012-08-07T22:31:38-07:00
by anthony
Topic split to...
"colorspace: gray channel handling"
viewtopic.php?f=1&t=21608