code:
discreteImg.convertTo(discreteImg, CV_32S);
discreteImg.convertTo(discreteImg, CV_32F);
discreteImg = discreteImg*0.25; double minDiscreteVal, maxDiscreteVal;
if (!discreteImg.empty()) (!Img.empty()) {
std::cout << "can load picture" << "\n";
printf("discreteImg.tpye()= printf("Img.tpye()= %d discreteImg.channels()=%d", discreteImg.type(), discreteImg.channels()); Img.channels()=%d", dImg.type(), Img.channels());
}
minMaxLoc(discreteImg, &minDiscreteVal, &maxDiscreteVal, minMaxLoc(Img, &minVal, &maxVal, NULL, NULL, discreteImg>0);
Img>0);
- result:
discreteImg.tpye()=5 discreteImg.channels()=1Img.tpye()=5 Img.channels()=1
exception caught: OpenCV(3.4.3)
c:\build\3_4_winpack-build-win64-vc15\opencv\mod ules\core\src\minmax.cpp:753: error:
(-215:Assertion failed) (cn == 1 &&
(_mask. empty() || _mask.type() ==
CV_8U)) || (cn > 1 && _mask.empty() &&
!minIdx && !ma xIdx) in function
'cv::minMaxIdx'
OpenCV(3.4.3) Error: Assertion failed
(!ssize.empty()) in cv::resize, file
c:\bu
ild\3_4_winpack-build-win64-vc15\opencv\modules\imgproc\src\resize.cpp,
line 404 4 exception caught:
OpenCV(3.4.3)
c:\build\3_4_winpack-build-win64-vc15\opencv\mod ules\imgproc\src\resize.cpp:4044:
error: (-215:Assertion failed)
!ssize.empty() in function
'cv::resize'
I first met the assertion fail in the function minMaxLoc , I am sure that there is nothing wrong with my input because I imwrite and check it successfully.
code:
//minMaxLoc(discreteImg, &minDiscreteVal, &maxDiscreteVal, //minMaxLoc(Img, &minVal, &maxVal, NULL, NULL, discreteImg>0);
minDiscreteVal Img>0);
minVal = 15.5;
maxDiscreteVal maxVal = 21.5;
OpenCV(3.4.3) Error: Assertion failed
(mv && n > 0) in cv::merge, file
c:\build
\3_4_winpack-build-win64-vc15\opencv\modules\core\src\merge.cpp,
line 284
Then I just guess the max and min values of instead of using this function , but another assertion fail happens.
I get this project from my classmate, but it works normally in his computer with the same VS2015 and OPENCV 3.4.3
It costs me 2 days and I still can not find out why.I finally solve this because I use wrong vc lib. My vs version is 2015 but I use vc15 lib library .After changing to vc14 , it works.