Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read buffer byte by byte for processing in Visual C++?

Hi,
I'm using a NIMAQ PCI-1428 with a Pulnix TMC1000 camera. I'm writing an image processing program in VC++6.0. My question is, how do i read the contents of imaqbuffer byte by byte (for each pixel)? I want to process the image prior to displaying in to screen.

rval = imgPlot(GUIHNDL window, void* buffer, uInt32 leftBufOffset, uInt32 topBufOffset, uInt32 xsize, uInt32 ysize, uInt32 xpos, uInt32 ypos, uInt32 flags)

Using the imgPlot, i can plot to window, and then using getPixel & setPixel i can do the processing (in this case, i want to do thresholding to the image). But this is too slow.

How can i access the memory pixel by pixel, and process it in the memory (change the content of memory) and the call
imgPlot to draw on a window?

And by the way, what's the memory content structure of the buffer?

Thx in advance.
0 Kudos
Message 1 of 2
(3,510 Views)
You can use imaqGetPixelAddress() to get a pointer to any pixel in the image. If you only need to perform a simple threshold on the image, then the imaqThreshold() function may be appropriate if you have the Vision toolset installed.

The structure of the IMAQ image in memory is shown in section 1 of the IMAQ Vision Concepts manual. With this structure and imaqGetPixelAddress(), you can arbitrarily access any pixel in the image.

http://www.ni.com/pdf/manuals/322916b.pdf

Regards,

Brent R
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,510 Views)