From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

getting a black image

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 

0 Kudos
Message 1 of 5
(2,593 Views)

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

0 Kudos
Message 2 of 5
(2,514 Views)

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

 

0 Kudos
Message 3 of 5
(2,492 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 5
(2,479 Views)

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

0 Kudos
Message 5 of 5
(2,462 Views)