void MainWindow::Test_FindMinAndMax_P63_C3_9()
{
float a[12] = {1, 2, 3, 4, 5, 10, 6, 7, 8, 9, 10, 0};
Mat img = Mat(3, 4, CV_32FC1, a);
Mat imgs = Mat(2, 3, CV_32FC2, a);
double minVal, maxVal;
Point minIdx, maxIdx;
minMaxLoc(img, &minVal, &maxVal, &minIdx, &maxIdx);
cout << "max val in img: " << maxVal << " " << " at " << maxIdx << endl;
cout << "min val in img: " << minVal << " " << " at " << minIdx << endl;
Mat imgs_re = imgs.reshape(1, 4);
minMaxLoc(imgs_re, &minVal, &maxVal, &minIdx, &maxIdx);
cout << "max val in imgs: " << maxVal << " " << " at " << maxIdx << endl;
cout << "min val in imgs: " << minVal << " " << " at " << minIdx << endl;
return;
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)