1 | initial version |
these lines are wrong
new_image.at<Vec3b>(y,x)[0] = centers.at<int>(cluster_idx, 0);
new_image.at<Vec3b>(y,x)[1] = centers.at<int>(cluster_idx, 1);
new_image.at<Vec3b>(y,x)[2] = centers.at<int>(cluster_idx, 2);
size image is
Mat new_image(src.rows * src.cols, 3, CV_32S);
and loop limit are
for( int y = 0; y < src.rows; y++ )
for( int x = 0; x < src.cols; x++ )
2 | No.2 Revision |
these lines are wrong
new_image.at<Vec3b>(y,x)[0] = centers.at<int>(cluster_idx, 0);
new_image.at<Vec3b>(y,x)[1] = centers.at<int>(cluster_idx, 1);
new_image.at<Vec3b>(y,x)[2] = centers.at<int>(cluster_idx, 2);
size image is
Mat new_image(src.rows * src.cols, 3, CV_32S);
and loop limit are
for( int y = 0; y < src.rows; y++ )
for( int x = 0; x < src.cols; x++ )
read this post about kmeans