PDA

View Full Version : selecting a pixel from an image and extracting info



romeoneverdies
04-05-2002, 12:59 AM
how can i select a pixel from an image in openGL, thru mouse clik and then extract information abt the pixel, like its brightness,color etc...

Bob
04-05-2002, 01:05 AM
Use glReadPixels to read the pixel value from a given position.

romeoneverdies
04-07-2002, 11:17 PM
so,when we use glReadpixels..how do we retrieve the info when we need it later ?? willya pls clarify ?? thanx

Bob
04-07-2002, 11:46 PM
Not sure I get what you mean. You want to get the pixel value and save it for later use?

Furrage
04-08-2002, 05:58 AM
You can use glReadPixels to return the RGBA values from the colour buffer. How you infer brightness, etc is up to you. If I'm correct about the documentation each colour component is shifted and packed with the other values so that they fit in one value. Value could be 16 bit, 32 bit etc. I think you have to specify it.

romeoneverdies
04-17-2002, 01:56 AM
well,once i get a pixel's color information, i need to find all its neighbouring pixels with a similar color value (ie) more or less of the same color.

so,how can i do this...can anyone suggest me a way pls...

this has to go like a chain reaction,in the sense that all neighbouring pixels of similar color values are to be found one level after another.

Gavin
04-17-2002, 02:14 AM
You want a grass fire algorithm, I am assuming this is for some kind of segmentation? Just recursively checks its 8 connected neighbours or whatever filter you are using..

romeoneverdies
04-17-2002, 08:59 PM
sorry, Im not exactly sure what a grass fire algorithm does,but then my problem requires me to check for similarity in color between the pixel chosen and its eight immediate neighbour pixels.once few of the eight pixels are found similar,the program should proceed to checking the eight neighbours of each of these similar pixels.It goes on recursively checking the whole image.