1 | initial version |
@ggrayce try something like this :
for (int i = 0; i < contours.size(); i++)
{
mu[i] = moments(contours[i], false);
double dMin=1e8;
for (size_t cP = 0; cP < contours[i].size(); cP++)
{
double d=norm(mu[i],contour[i][cP]);
if (d<dMin)
dMin=d;
}
}
dMin should be minimum distance between contour and gravity center
2 | No.2 Revision |
@ggrayce try something like this :
for (int i = 0; i < contours.size(); i++)
{
mu[i] = moments(contours[i], false);
double dMin=1e8;
for (size_t cP = 0; cP < contours[i].size(); cP++)
{
double d=norm(mu[i],contour[i][cP]);
d=norm(mu[i],contours[i][cP]);
if (d<dMin)
dMin=d;
}
}
dMin should be minimum distance between contour and gravity center
3 | No.3 Revision |
@ggrayce try something like this :
for (int i = 0; i < contours.size(); i++)
{
mu[i] = moments(contours[i], false);
Point g(mu.m10/mu.m00,mu01/mu.m00);
double dMin=1e8;
for (size_t cP = 0; cP < contours[i].size(); cP++)
{
// NO double d=norm(mu[i],contours[i][cP]);
if (d<dMin)
double d=norm(g,contours[i][cP]);
dMin=d;
}
}
if (d<dmin) dmin="d;" }="" }<="" p="">
dMin should be minimum distance between contour and gravity center
4 | No.4 Revision |
@ggrayce try something like this :
for (int i = 0; i < contours.size(); i++)
{
mu[i] = moments(contours[i], false);
Point g(mu.m10/mu.m00,mu01/mu.m00);
double dMin=1e8;
for (size_t cP = 0; cP < contours[i].size(); cP++)
{
// NO double d=norm(mu[i],contours[i][cP]);
double d=norm(g,contours[i][cP]);
double d=norm(g,contours[i][cP]);
if (d<dMin)
if (d<dmin) dmin="d;" }="" }<="" p="">
dMin=d;
}
}
dMin should be minimum distance between contour and gravity center