Image Analyzing

Is it possible to simply analyze, pixel by pixel, and image from the axis camera as I would if were using the GetDiBits function in Win32? I would like to be able to analyze a raw image as a character array or an array of some sort. Is that possible?

It would certainly be possible; however, it may not be plausible or practical. Java, for example, lacks a lot of the features you’d use for image processing (primarily pointers and non-reference structures). In C++ it would much more simpler to do, but it may be more practical in most cases to use NIVision’s rather comprehensive IMAQ functions. I can’t claim to know everything about how the images are presented in C++ (I am using Java), but I would assume that a pointer to the image data, the format of the image data (color format and channel resolution), and the size of the image are all accessible. If this is true, then processing the pixel data yourself is perfectly plausible, if not entirely practical.

But how exactly do I get access to the raw data in the lowest level possible?

The exact method would depend on the language, but you generally want a few things: a pointer to the image data, a width and height, and color information, primarily format (RGB, RGBA, BGR, grayscale etc.) and channel depth (a 32-bit RGBA image has 4 color channels, and therefore has an 8-bit channel depth. A 24-bit RGB image has only 3 channels but the same channel depth). Once you have this, accessing the nth (where n=0 is the first) channel of a specific pixel would go something like this:

pixels(y*width+x)*bytesPerPixel + n]

where bytesPerPixel would be 4 for a 32-bit image, 3 for a 24-bit image, etc., x and y are in pixel units, width is the number of pixels per scanline, and pixels is a byte*, byte], uint8_t*, uint8_t], or whatever byte array or byte pointer type is provided by your language of choice.

Yes it it, but since that doesn’t take advantage of any of the advanced libraries available, that is almost certainly going to be a difficult and slow way to accomplish much.

To do it in LabVIEW, you use the functions listed below. You can use the first of them, then loop through them, index them randomly, etc. The second is used to put the pixels back.

If you go this route, I’d suggest identifying the sorts of algorithms you are looking for and using lots of reference textbooks on image processing. You will also need to pay much more attention to the language quirks for performance.

Greg McKaskle

Screen Shot 2012-02-04 at 9.31.31 PM.png
Screen Shot 2012-02-04 at 9.32.24 PM.png

Screen Shot 2012-02-04 at 9.31.31 PM.png
Screen Shot 2012-02-04 at 9.32.24 PM.png