LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI Vision Acquisition Histogram - Standard Variation

Solved!
Go to solution

Hi everyone,

 

What is the difference between standard variation and standard deviation?

 

I'm using a 15x15 image in grayscale and these are the results of the histogram: 

 

9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 2, 7, 9, 9, 14, 19, 25, 36, 30, 10, 21, 12, 8, 4, 1, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

 

How can I get result Standard Variation (27,23) manually?

 

Front panelFront panel

Block diagramBlock diagram

Thanks!

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

Okay, after looking into the documentation the Standard Variation is the simply Standard Deviation. No idea why LabVIEW gave it this confusing name that is not used elsewhere..

 

Question: why would you want to calculate it by hand, if you can extract it from the histogram?

 

But, if you want to do it manually it's possible.

First off, the VI you posted is not correct; it converts all the numeric values in the histogram, i.e. minimal value, maximum value etc., into an array and calculates mean and SD from that. That does not make sense.

 

An image is simply a matrix (or 2D array) with numeric values - you can use the Image To Array VI for it. This matrix you can manipulate as you wish. LabVIEW's SD and Variance VI does not work with matrices, only arrays. A row-by-row calculation is cumbersome, so the easiest way is to calculate it yourself with the formula for SD (from Khan Academy):

image.png

 

The VI then looks something like this:

image.png

 

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

Hi irPaul,

 

Thanks for your answer but the results are different.

 

I really don't want to calculate it by hand, I'm documenting a work and I want to verify and explain each calculation.

 

front_histo_v1.png

diagram_histo_v1.png

I'm doing something wrong? I attached the image I'm using.

 

Thanks.

0 Kudos
Message 3 of 5
(2,535 Views)
Solution
Accepted by topic author SRodenas

Oops, normally I'm very alert on integer overflows.

The image was 8-bit, so LabVIEW calculates with 8-bits (maximum value 255). Conversion to 32-bit solves this.

mean_from_image.png

 

image.png

0 Kudos
Message 4 of 5
(2,520 Views)

This works ... many thanks irPaul.

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