Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

imgGrab Image Process in LabWindows


    // Get the frame after tne next Vertical Blank  
            imgGrab (Sid, (void **)&ImaqBuffer, TRUE);

I am just using the standard HLGrab in the IMAQ library.  I have the image (frame).... Do I have to read the data from the buffer into an array byte by byte in order to do processing such as Histogram.... It seems like there should be an easier way just to do a histogram on the image frame by passing the starting address of the buffer?????

Also, I would like to stream my image to disk in PGM format, I do it now in PNG format which is straight forward is there any code out there which writes it in PGM format???


thanks for any help,
John.



0 Kudos
Message 1 of 4
(3,607 Views)
John,
 
    So you're grabbing your image, and then pulling it out of memory byte by byte?  I wasn't aware that was possible, at least without using much more low level fuctions.  How are you doing this?  As far as I know, most of those types of analysis functions take only image references anyway.
 
    PGM format, though it's an easily programmable format, is not very common and our functions tend to use the more common ones -- .bmp, .jpg, .png, etc.  It looks, though, like a .pgm is really just an array of values.  It's possible we can find a way to get the image out in the right format.
 
-Allison S.
Applications Engineering
-Allison S.
Calibration Services
Product Support Engineer
0 Kudos
Message 2 of 4
(3,589 Views)
Hey Allison:

Maybe I stated that incorrectly.  I don't have my code in front of me but I am using the IMAQ library functions and each of those after doing a grab or snap the image is stored in a buffer at a memory location (at least this is my perception of what is going on...) I want to do some image processing on that image such as histogram and some edge detection...etc but those routines at least the ones in the Advanced Analysis library want you to pass a double array as the input not a buffer.  I assume there is an image to array function to convert that to an array then pass it into the function?

I don't have the NI VISION toolkit maybe it has more capability that allows me to do image processing on the image *Image?????


thanks,
JS.

0 Kudos
Message 3 of 4
(3,587 Views)

John,

    The IMAQ driver's functions are intended for image acquisition, some basic analysis, and exporting images for non-image functions; ImageToArray.vi is included with IMAQ, for instance.  The Vision software on the other hand is created for analysis once the image has already been acquired; ArrayToImage.vi is in Vision.  The more complex analysis functions that it sounds like you need (Color Histogram, Find Edge) are in Vision, and most all of them take an image reference, not necessarily an array, as input.

-Allison S.

Applications Engineering

 

-Allison S.
Calibration Services
Product Support Engineer
0 Kudos
Message 4 of 4
(3,560 Views)