opencv assertion failed (ssize.width >0 && ......) and assertion failed (mv && n >0)
code:
if (!Img.empty()) {
std::cout << "can load picture" << "\n";
printf("Img.tpye()= %d Img.channels()=%d", dImg.type(), Img.channels());
}
minMaxLoc(Img, &minVal, &maxVal, NULL, NULL, Img>0);
- result: Img.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'
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(Img, &minVal, &maxVal, NULL, NULL, Img>0);
minVal = 15.5;
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
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.
thanks for the edit !
can we see the code, too ?
I have already done. It works in others computers, so I think nothing wrong with this.
i very much doubt so ;)
I have solve this for a long time ,even change the opencv version and vs version and now everything might be the same.
sorry to say so, but the problem is just lack of discipline on your side ...
I think I have find a fital problem. I use the vc15 but my vs version is 2015
did you mean "final" ?
and yes, use vc14 libs for VS2015
please start a new question, if you run into further problems.
I can not answer my owner question. I think I need to tell other new users this point ,what should I do ?