Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in Quantify algorithm

I believe I have discovered a significant measurement error in the Quantify algorithm. The calibrated area is entirely inaccurate. Using the code below I obtained the following results:

 

Quantify:

Pixel Area = 17578

Calib Area = 0.19962

 

ParticleMeasurements:

Pixel Area = 17578

Calib Area = 1.2601

 

The calibration factor is 0.00846667 cm/pix. Assuming square pixels the ParticleMeasurement is accurate.

 

I will raise this as a Support Request.

 

 

 

            'calibrate images
            Dim gridDesc As New GridDescriptor
            gridDesc.Unit = CalibrationUnit.Centimeter
            gridDesc.XStep = My.Settings.SimpleCalXcm
            gridDesc.YStep = My.Settings.SimpleCalYcm
            Algorithms.SetSimpleCalibration(imgThresh, New CoordinateSystem(New PointContour(0, 1650)), gridDesc)
            Algorithms.SetSimpleCalibration(imgLabel, New CoordinateSystem(New PointContour(0, 1650)), gridDesc)

            '/Testing
            QRept = New QuantifyReport
            QRept = Algorithms.Quantify(GrayImage, imgLabel)

            Measurements.Clear()
            Measurements.Add(MeasurementType.MaxFeretDiameter)
            Measurements.Add(MeasurementType.Area)

            PRept = Algorithms.ParticleMeasurements(imgLabel, Measurements, Connectivity.Connectivity8, ParticleMeasurementsCalibrationMode.Both)

 

0 Kudos
Message 1 of 2
(3,060 Views)

Mea culpa (sort of).

 

There are three ways (maybe more?) to measure particle area using NI Vision:

  • Quantify
  • ParticleReport
  • ParticleMeasurementsReport

In all cases the source image must be calibrated. In the example code I provided above the gray image calibration was missing.

 

The last two methods (above) use the threshold or labeled images. These can be calibrated directly using the Algorithms.SetSimpleCalibration method. The calibration can also be applied by calibrating the original gray image prior to thresholding or labeling.

 

The Quantify function measures global properties of the source image (e.g., area, brightness, etc.). If an un-labeled binary image is supplied as the mask then it appears that the global report is a summary of all non-zero portions of the gray image. In this case, the global and region reports are identical. All non-zero pixels of the image are considered a single region.

 

If a labeled binary image is supplied as a mask, each blob is treated as a separate region. The global report is identical to the case above, however, there are seperate region reports for each blob.

 

Unfortunately, the documentation is sorely lacking regarding the use and output of these methods.

 

 

 

0 Kudos
Message 2 of 2
(3,029 Views)