Merge remote-tracking branch 'origin/2.4' into merge-2.4
Conflicts: doc/tutorials/introduction/linux_install/linux_install.rst modules/core/doc/operations_on_arrays.rst modules/core/include/opencv2/core/core.hpp modules/core/src/system.cpp modules/gpu/src/cuda/resize.cu modules/imgproc/doc/miscellaneous_transformations.rst modules/imgproc/doc/structural_analysis_and_shape_descriptors.rst modules/video/src/bgfg_gaussmix2.cpp
This commit is contained in:
@@ -4050,16 +4050,18 @@ double cv::kmeans( InputArray _data, int K,
|
||||
int flags, OutputArray _centers )
|
||||
{
|
||||
const int SPP_TRIALS = 3;
|
||||
Mat data = _data.getMat();
|
||||
bool isrow = data.rows == 1 && data.channels() > 1;
|
||||
int N = !isrow ? data.rows : data.cols;
|
||||
int dims = (!isrow ? data.cols : 1)*data.channels();
|
||||
int type = data.depth();
|
||||
Mat data0 = _data.getMat();
|
||||
bool isrow = data0.rows == 1 && data0.channels() > 1;
|
||||
int N = !isrow ? data0.rows : data0.cols;
|
||||
int dims = (!isrow ? data0.cols : 1)*data0.channels();
|
||||
int type = data0.depth();
|
||||
|
||||
attempts = std::max(attempts, 1);
|
||||
CV_Assert( data.dims <= 2 && type == CV_32F && K > 0 );
|
||||
CV_Assert( data0.dims <= 2 && type == CV_32F && K > 0 );
|
||||
CV_Assert( N >= K );
|
||||
|
||||
Mat data(N, dims, CV_32F, data0.data, isrow ? dims * sizeof(float) : static_cast<size_t>(data0.step));
|
||||
|
||||
_bestLabels.create(N, 1, CV_32S, -1, true);
|
||||
|
||||
Mat _labels, best_labels = _bestLabels.getMat();
|
||||
|
Reference in New Issue
Block a user