Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   NI Vision Functions Documentation and Use (http://www.chiefdelphi.com/forums/showthread.php?t=100925)

malachias 22-01-2012 21:15

NI Vision Functions Documentation and Use
 
I have yet to find any good documentation on the C language NIVision API. Does anyone know of such a document? I have looked at NI LabView documentation and have not found it that helpful.

Absent the above documentation, perhaps someone can provide some insight on how to use some of the IMAQ functions. At present I am following the general pattern laid out the vision white paper. The WPILIB API appears to force one to work with IMAQ functions, because the *Image classes don't expose enough of the IMAQ methods. I think using particle analysis alone would have me reinventing much of what is already in IMAQ.

The first step is to construct a preliminary mask from the luminance plane of an HSLImage obtained from the AxisCamera. I exclude low luminancity pixels from the image using imaqColorThreshold using a replace value of 255 (I am using the Image from the returned MonoImage). I can write the resulting image out and FTP the file back to my computer for inspection. This part works. Next I run a size filter to exclude small particles. I use imaqSizeFilter and that appears to work. Next I use imaqConvexHull. This is the point at which I am stuck. The source image is a U8 format where values are either 0 or 255. I have inspected the source image and it looks reasonable -- a thick outlined square with some imperfections. The resulting image is black. I have not inspected the resulting image in detail. Does the convex hull method expect 0's and 1's or does it change all the 255's to 1's creating an almost black image? Or am I doing something else wrong?

A final question -- when I get an underlying Image from an ImageBase object am I responsible for disposing of it? If so, how?

bob.wolff68 23-01-2012 02:39

Re: NI Vision Functions Documentation and Use
 
While I don't have answers for you, I am digging in the same hole... and for me, I'm looking at NOT using the raw imaq functions. I'm looking at using the AxixCamera::GetImage followed by using ColorImage::HSLThreshold() which will give back a BinaryImage object. This is where it gets a bit fuzzy. Either you have to take this and simply run the particle analysis and stay in C++ land, or you've gotta do a BinaryImage::GetImage() at this point and pass the resulting Image* to imaqConvexHull() as the src and out to a dest Image*. Then (I think) memcpy() the destination image BACK into the src Image memory location and ultimately "trick" the BinaryImage class by having given it a substitute image ... then run the ParticleAnalysis from there. I plan on trying it both ways. The complexHull would be GREAT to have as part of it so the scoring (per the white paper) would work. If we can't do that, then it'll be more of a matter of dropping all the small particles and just moving forward without the additional scoring.

Thanks,
bob

malachias 23-01-2012 07:19

Re: NI Vision Functions Documentation and Use
 
I found the following document that explains a lot about how to use the functions available in the IMAQ library:
NI Vision Concepts Manual


All times are GMT -5. The time now is 17:39.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi