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.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ: "not an image" errors using IMAQdx Snap

Solved!
Go to solution

Hello,

 

Adding the IMAQ cast doesn't solves the problem. Other ideas ?

Concerning the averaging procedure, I want each pixel value to be the mean of the same pixel on various pictures. So I have to add all the values and divide it by the number of pictures. Since summing all the pixel values of the various pictures in one can exceed the maximum value of a pixel, I chose to divide each pixel value before adding it, which numerically gives the same result.

0 Kudos
Message 11 of 14
(2,741 Views)

Hi,

what happens if you put the cheese button inside the second tab and push it.

0 Kudos
Message 12 of 14
(2,730 Views)
Solution
Accepted by Gawel

@Gawel wrote:

Hello,

 

Adding the IMAQ cast doesn't solves the problem. Other ideas ?

Concerning the averaging procedure, I want each pixel value to be the mean of the same pixel on various pictures. So I have to add all the values and divide it by the number of pictures. Since summing all the pixel values of the various pictures in one can exceed the maximum value of a pixel, I chose to divide each pixel value before adding it, which numerically gives the same result.


Hello,

 

yes it is true that you can use addition with the same denominator, but still you are dividing integer numbers, and the result is floating point number. If I am correct, IMAQ divide casts back to U16 in your case and you lose the floating point precision. I don't know how much error this accounts for in the end, but I would probably use SGL datatype for the operations and then cast the output average image to U16.

 

Regarding your error - it occurs because your FALSE case of "Take a picture" dereferences the image. Look at the working example below - remember to pass the reference "Average" through the FALSE case. I have also put the "IMAQdx Configure Grab" outside the loop - no need to call it every iteration. Also, I have replaced the "Snap" with "Grab" to continue the acquisition after the average image is calculated. In addition to that, you shold make the code more readable (but this is just a suggestion, hope you don't mind :)).

 

CCD_BD.png

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 13 of 14
(2,719 Views)

Great ! always check the "false" case... Smiley Embarassed

One last question, how would you implement your suggestion of using sgl datatype through the whole averaging process? Transform the image to an array before operations? or just casting it to U16 in the last step ?

 

I admit that this is REALLY messy. And getting worse. Your were brave to look through it !

 

Thank you for your help !

0 Kudos
Message 14 of 14
(2,708 Views)