Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

A slight offset/error when calulcating IMAQ_CENTER_MASS_X and IMAQ_CENTER_MASS_Y. Why?

Hi,

I have an application searching for circular/elliptic fiducials. This is my program flow:
1) binarize the image using imaqAutoThreshold() with IMAQ_THRESH_METRIC
2) fill holes with imaqFillHoles()
3) filter out unwanted particles with imaqParticleFilter()
4) calculate center of mass of the ellipses using IMAQ_CENTER_MASS_X and Y with imaqCalcCoeff()

The strange thing is that when I mark the center of each ellipse in the original image, then it seems to be offset by approximately 0.5 pixels north-west. If I "manually" change the centerpoint with 0.5 pixels after calculations, then the it seems to hit the center more accurately.

Does anybody know why? Does imaqAutoThreshold(
) favourize north-west pixels of particles/blobs? Or is this happening because of some properties of my captured image? Or am I just doing it wrong?

(I am using PointGrey DragonFly 640x480 B/W FireWire camera for capturing)

-Thanks!

Torbjørn
0 Kudos
Message 1 of 3
(3,139 Views)
Hello Torbjørn,

Which version of IMAQ Vision are you using? Version 6.1 and earlier used the upper left corner of the pixel as the reference, while 7.0 uses the center of the pixel. This could explain the 0.5 pixel discrepancy you are seeing.


Regards,

Brent R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(3,139 Views)
I see. I'm using version 6.1. Then I'll adjust my centerpoints by 0.5 pixel.
0 Kudos
Message 3 of 3
(3,139 Views)