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.
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.
can we see the code, too ?
I have already done. It works in others computers, so I think nothing wrong with this.
I have solve this for a long time ,even change the opencv version and vs version and now everything might be the same.
did you mean "final" ?
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 ?
I have finally solved this. vs(Visual Studio) 2015 match to vc(Visual C++)14 lib vs 2017 match to vc15 lib I made a mistake, my vs version is 2015 but the lib library I use vc15 .After changing to vc14, my code finally works.
you can only use minMaxLoc IF your image was loaded correctly. so that call should go into the if block, too !
minMaxLoc only works on single channel images (see docs, again, please). maybe you need to load your image using the IMREAD_GRAYSCALE flag.
you used the 'mask' argument wrong. it should not be the same image, and it would need a single channel, binary image here. i guess, you don't need it at all.
The mask is discreteImg>0 ,sorry to miss this.
however, omitting the IMREAD_GRAYSCALE flag will read a 3 channel image, so please use that flag.
Hi, the outcome is :discreteImg.tpye()=5 discreteImg.channels()=1 I once thought that if the input Mat is umempty ,the function minMaxLoc will work normally.
type() == 5 would mean: float.
so again, there must be code there doing some conversion, which you don't show.
What will happen if the input of minMaxLoc type is 5? I just delete the imwrite and imread part. Now the input is origin image. What conversion should I do?
it should work all fine.