Commit 29b45e70 authored by Ilya Lysenkov's avatar Ilya Lysenkov

Fixed cluster centers returning in cvKMeans2 (ticket #706)

parent f906c9b2
......@@ -2586,7 +2586,10 @@ cvKMeans2( const CvArr* _samples, int cluster_count, CvArr* _labels,
{
cv::Mat data = cv::cvarrToMat(_samples), labels = cv::cvarrToMat(_labels), centers;
if( _centers )
{
centers = cv::cvarrToMat(_centers);
centers = centers.reshape(1);
}
CV_Assert( labels.isContinuous() && labels.type() == CV_32S &&
(labels.cols == 1 || labels.rows == 1) &&
labels.cols + labels.rows - 1 == data.rows );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment