|
|
@ -37,7 +37,7 @@ int main( int /*argc*/, char** /*argv*/ ) |
|
|
|
Mat points(sampleCount, 1, CV_32FC2), labels; |
|
|
|
Mat points(sampleCount, 1, CV_32FC2), labels; |
|
|
|
|
|
|
|
|
|
|
|
clusterCount = MIN(clusterCount, sampleCount); |
|
|
|
clusterCount = MIN(clusterCount, sampleCount); |
|
|
|
Mat centers; |
|
|
|
std::vector<Point2f> centers; |
|
|
|
|
|
|
|
|
|
|
|
/* generate random sample from multigaussian distribution */ |
|
|
|
/* generate random sample from multigaussian distribution */ |
|
|
|
for( k = 0; k < clusterCount; k++ ) |
|
|
|
for( k = 0; k < clusterCount; k++ ) |
|
|
@ -65,9 +65,9 @@ int main( int /*argc*/, char** /*argv*/ ) |
|
|
|
Point ipt = points.at<Point2f>(i); |
|
|
|
Point ipt = points.at<Point2f>(i); |
|
|
|
circle( img, ipt, 2, colorTab[clusterIdx], FILLED, LINE_AA ); |
|
|
|
circle( img, ipt, 2, colorTab[clusterIdx], FILLED, LINE_AA ); |
|
|
|
} |
|
|
|
} |
|
|
|
for (i = 0; i < centers.rows; ++i) |
|
|
|
for (i = 0; i < (int)centers.size(); ++i) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Point2f c = centers.at<Point2f>(i); |
|
|
|
Point2f c = centers[i]; |
|
|
|
circle( img, c, 40, colorTab[i], 1, LINE_AA ); |
|
|
|
circle( img, c, 40, colorTab[i], 1, LINE_AA ); |
|
|
|
} |
|
|
|
} |
|
|
|
cout << "Compactness: " << compactness << endl; |
|
|
|
cout << "Compactness: " << compactness << endl; |
|
|
|