Closed zappybiby closed 7 years ago
Looking at some forums, this is caused by the wrong file type being used in the transformation.
See http://answers.opencv.org/question/18252/opencv-assertion-failed-for-perspective-transform/
Have you tried this one? http://stackoverflow.com/questions/15683184/assertion-failed-when-im-trying-to-use-getperspectivetransform-on-android-ndk-t This is android opencv problems, but I think it looks very similar to your problem. I hope it works. :)
Where do we define the type of the mat in our master branch?
In IPM::createMaps() in IPM.cpp, there are
m_mapX.create(m_dstSize, CV_32F); m_mapY.create(m_dstSize, CV_32F); ... m_invMapX.create(m_origSize, CV_32F); m_invMapY.create(m_origSize, CV_32F);
How about change CV_32F to CV_32FC2?
Still the same error :(
I have no idea
CV_32FC2 actually makes Release fail to work.
_origSize, _dstSize, _origPoints, _dstPoints are all size 4 according to the debugger. Not sure why its failing the assertion.
Looking at CvType, CV_32FC2 contains x and y coordinates. (reference) In our case, however, only one coordinate is used.
float* ptRowX = m_mapX.ptr
For this reason, I think there is an error in release mode.
I think CV_32FC1 is suitable in our case.
This is a little off-topic opinion, but if you execute the program which is built with debug mode, it will be REALLY slow.
At the early time of the project, I built the program with debug mode. Although the program did not have the steering function, I got less than 10 fps with Intel Haswell i7 processor.
Yep, debug disables the optimization parameters that Release has on by default.
CV_32FC1 still gives the error unfortunately.
This error occurs at startup while in Debug mode:
OpenCV Error: Assertion failed (src.checkVector(2, CV_32F) == 4 && dst.checkVect or(2, CV_32F) == 4) in cv::getPerspectiveTransform, file ...\opencv_sources\modules\imgproc\src\imgwarp.cpp, line 6353
This makes the program not run in Debug mode. This is a big problem for me, as Debug mode would allow for better debugging.
The program runs fine in Release mode.