10-01-2019 04:21 AM
I am taking images using IDS camera (model=UI-3881LE) and then calculating its sharpness using Simple convolution program attached below which was working fine for me but then I changed a program slightly by taking ROI of image and now I am taking sharpness of an extracted image (2nd program attached below) but I am getting black images in between for 10-20 times in 100 turns. please help me out in solving this problem
10-01-2019 03:03 PM
Your "Grab" code is "unusual" (that's a polite way of saying "I think it is wrong"). Normally, you configure and start the Grab outside the Acquisition Loop, and let the IMAQdx Grab get you successive Images at the frame rate of the camera. One "gotcha" is that you want the only "slow" code in the loop to be the Grab -- it will wait (as its default behavior) until the Frame has been acquired, then present you with the Image (well, with a pointer to the Image).
Any processing of the Image should ideally be done in a separate parallel loop using a Producer/Consumer Design Pattern. You need to get the pixels of the Image out from the Camera Buffer (do you have enough buffers allocated? You didn't specify them in your Configure Grab function) so you won't have the Camera itself clearing buffers as it gets ready to save the next image ...
What is probably happening is that you are doing too much processing inside the Acquisition Loop and the Camera is stomping all over your previously-acquired Images in its Image Buffer as it gets ready to save the next Frame.
IMAQdx is not like DAQmx -- Images are stored in the Camera Driver and the IMAQdx functions allow you to manipulate them both in situ (within the Driver) or within a copy of the Buffer (IMAQ Create) that exists in your VI's program space.
Bob Schor
10-01-2019 05:34 PM
I'd agree, I don't think the IMAQ grab config should be called iteratively.
Also, you have to keep track of your IMAQ image references, you have the input original image, then some functions output a 'processed' image...if you keep 'reprocessing' the 'processed' image...all sorts of odd, but expected bad images will occur.
Example: The contrast function outputs a darken image, if you keep applying it...it will go completely black.
Good news is with vision you can see what you get..and what you don't get.
Regards
Jack
10-02-2019 03:33 AM
Since the IMAQdx image is a reference, it can be a good idea to have a 'buffer' of, say, 5-10 of them (2 might be enough) and rotate between captures. I had some issues in a project where i needed to process an image in a couple of steps and the solutions was to have a separate buffer for each step.
/Y
10-02-2019 07:22 AM
The bottom line is that IMAQdx's "data" (i.e. "Images") are subtly different from the usual data produced by, say, VISA, or DAQmx, where you are dealing with Strings, Arrays, or Waveforms. An "Image" is really a reference to a set of data stored somewhere else -- note that many IMAQdx functions talk about "src" and "dst", and there are lots of functions that deal with "Buffers".
Bob Schor