Hi!
I have a question about how borders in the images affect calculation of "center of mass".
My original image (0) is a 640x480 grayscale image with border of 3.
I make a binarized image (1) of the original image (0) to search for particles. For each particle I find, I use the ROI for the particle to extract a third image (2) from the original image (0).
All of the images have borders of 3.
When using the ROI from particles in image (1), are the boundingBox-coordinates related to the outer edges of the image (which makes the image actually 646x486), or is it related to the original origo of the image (making the image "logically" 640x480)?
The same question goes for calculation of
center of mass for the particle, when using image (2). After running a particle filter on image (2), I use imaqCalcCoeff() to calculate IMAQ_CENTER_MASS_X and IMAQ_CENTER_MASS_Y, stored in local_x and local_y. To get the global_x and global_y, which is the center point of the particle related to the origo of image (0), I say that:
global_x = local_x + boundingBox.left;
global_y = local_y + boundingBox.top;
Do I need to make further adjustments since I am using borders, e.g. adding/extracting 3 from the global_x and global_y to have a correct answer, or is IMAQ vision taking care of this for me?
Do I have to actually define that:
global_x = local_y + boundingBox.left - borderSize;
or
global_x = local_y + boundingBox.left - 2*borderSize;
I guess (and hope) that the answer is no, that I can use:
global_x = local_x + boundingBox.left;
-but I need it confirmed...
Thanks,
Torbjørn