LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Vision: Image Variance

Solved!
Go to solution

Hello,

 

i was wondering if there's a way to calculate the 2D-Variance of an image without converting it to an array.

It would be even better if i can choose, lets say, an annulus ROI and perform the operation only on that ROI.

 

Regards

Marvin

0 Kudos
Message 1 of 3
(3,227 Views)

First, what do you mean by the Variance of an Image?  Do you mean the variance of the intensity measured over all the pixels in the image (a measure of whether the image was all one color/intensity or completely random)?  Do you mean how much this image differs from similar images?

 

What are you comparing in your computation?  Is it color?  Is it greyscale intensity? Whatever it is, you need to get numbers to do computation, which seems to me to mean (no pun intended) you need numeric arrays.

 

Having said that, there are functions in the Vision Toolkit (like IMAQ Block Statistics) that do some of the messy computations "behind the scenes".  Investigate those functions and see if any of them can be adapted to suit the task you are considering (note that Block Statistics, by default, works on a 32 x 32 pixel "block").

 

Bob Schor

0 Kudos
Message 2 of 3
(3,205 Views)
Solution
Accepted by nollMarvin

Yes, I've written a VI to compute the local variance over the image, i.e. to return an image where each pixel contains its local variance.  It's fairly straight-forward if you recall that variance is computed as "the mean of the squares minus the square of the means".  A convolution with a kernel containing all ones is the simplest way to find the local mean, assuming you have a Float image.

 

IMAQ Variance_BD.png

 

 

Message 3 of 3
(3,179 Views)