Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV Assertion Failed for Perspective Transform.

For this code

    Mat hg = Calib3d.findHomography(obj, scene, 8, 10);

    Mat obj_corners = new Mat(4,1,CvType.CV_32FC1);
    Mat scene_corners = new Mat(4,1,CvType.CV_32FC1);

    Core.perspectiveTransform(obj_corners, scene_corners, hg);

This is the error, also tried changing the type to CV_8UC1, CV_32F and CV_32FC1

08-06 05:37:35.219: E/cv::error()(17414): OpenCV Error: Assertion failed (scn + 1 == m.cols && (depth == CV_32F || depth == CV_64F)) in void cv::perspectiveTransform(cv::InputArray, cv::OutputArray, cv::InputArray), file /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/matmul.cpp, line 1926
08-06 05:37:35.229: W/dalvikvm(17414): threadid=11: thread exiting with uncaught exception (group=0x40ad59f0)
08-06 05:37:35.229: E/AndroidRuntime(17414): FATAL EXCEPTION: Thread-5874
08-06 05:37:35.229: E/AndroidRuntime(17414): CvException [org.opencv.core.CvException: /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/matmul.cpp:1926: error: (-215) scn + 1 == m.cols && (depth == CV_32F || depth == CV_64F) in function void cv::perspectiveTransform(cv::InputArray, cv::OutputArray, cv::InputArray)
08-06 05:37:35.229: E/AndroidRuntime(17414): ] 
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.core.Core.perspectiveTransform_0(Native Method)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.core.Core.perspectiveTransform(Core.java:5869)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at com.example.objectrecognition.MainActivity.onCameraFrame(MainActivity.java:279)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:376)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:294)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at java.lang.Thread.run(Thread.java:856)

The MainActivity.java:279 referes to the line

Core.perspectiveTransform(obj_corners, scene_corners, hg);

OpenCV Assertion Failed for Perspective Transform.

For this part of code from this application code

    Mat hg = Calib3d.findHomography(obj, scene, 8, 10);

    Mat obj_corners = new Mat(4,1,CvType.CV_32FC1);
    Mat scene_corners = new Mat(4,1,CvType.CV_32FC1);

    Core.perspectiveTransform(obj_corners, scene_corners, hg);

This is the error, also tried changing the type to CV_8UC1, CV_32F and CV_32FC1

08-06 05:37:35.219: E/cv::error()(17414): OpenCV Error: Assertion failed (scn + 1 == m.cols && (depth == CV_32F || depth == CV_64F)) in void cv::perspectiveTransform(cv::InputArray, cv::OutputArray, cv::InputArray), file /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/matmul.cpp, line 1926
08-06 05:37:35.229: W/dalvikvm(17414): threadid=11: thread exiting with uncaught exception (group=0x40ad59f0)
08-06 05:37:35.229: E/AndroidRuntime(17414): FATAL EXCEPTION: Thread-5874
08-06 05:37:35.229: E/AndroidRuntime(17414): CvException [org.opencv.core.CvException: /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/matmul.cpp:1926: error: (-215) scn + 1 == m.cols && (depth == CV_32F || depth == CV_64F) in function void cv::perspectiveTransform(cv::InputArray, cv::OutputArray, cv::InputArray)
08-06 05:37:35.229: E/AndroidRuntime(17414): ] 
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.core.Core.perspectiveTransform_0(Native Method)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.core.Core.perspectiveTransform(Core.java:5869)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at com.example.objectrecognition.MainActivity.onCameraFrame(MainActivity.java:279)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:376)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:294)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at java.lang.Thread.run(Thread.java:856)

The MainActivity.java:279 referes to the line

Core.perspectiveTransform(obj_corners, scene_corners, hg);

When I use log for the two I get

08-06 07:16:26.669: I/OCVSample::Activity(18718): obj Size: 1x33
08-06 07:16:26.669: I/OCVSample::Activity(18718): obj : Mat [ 33*1*CV_32FC2, isCont=true, isSubmat=false, nativeObj=0x677090, dataAddr=0x686e20 ]
08-06 07:16:26.679: I/OCVSample::Activity(18718): scene Size: 1x33
08-06 07:16:26.679: I/OCVSample::Activity(18718): scene : Mat [ 33*1*CV_32FC2, isCont=true, isSubmat=false, nativeObj=0x67fc40, dataAddr=0x650db0 ]

What am I missing here?

OpenCV Assertion Failed for Perspective Transform.

For this part of code from this application code

    Mat hg = Calib3d.findHomography(obj, scene, 8, 10);

    Mat obj_corners = new Mat(4,1,CvType.CV_32FC1);
    Mat scene_corners = new Mat(4,1,CvType.CV_32FC1);

    Core.perspectiveTransform(obj_corners, scene_corners, hg);

This is the error, also tried changing the type to CV_8UC1, CV_32F and CV_32FC1

08-06 05:37:35.219: E/cv::error()(17414): OpenCV Error: Assertion failed (scn + 1 == m.cols && (depth == CV_32F || depth == CV_64F)) in void cv::perspectiveTransform(cv::InputArray, cv::OutputArray, cv::InputArray), file /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/matmul.cpp, line 1926
08-06 05:37:35.229: W/dalvikvm(17414): threadid=11: thread exiting with uncaught exception (group=0x40ad59f0)
08-06 05:37:35.229: E/AndroidRuntime(17414): FATAL EXCEPTION: Thread-5874
08-06 05:37:35.229: E/AndroidRuntime(17414): CvException [org.opencv.core.CvException: /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/matmul.cpp:1926: error: (-215) scn + 1 == m.cols && (depth == CV_32F || depth == CV_64F) in function void cv::perspectiveTransform(cv::InputArray, cv::OutputArray, cv::InputArray)
08-06 05:37:35.229: E/AndroidRuntime(17414): ] 
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.core.Core.perspectiveTransform_0(Native Method)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.core.Core.perspectiveTransform(Core.java:5869)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at com.example.objectrecognition.MainActivity.onCameraFrame(MainActivity.java:279)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:376)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:294)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at java.lang.Thread.run(Thread.java:856)

The MainActivity.java:279 referes to the line

Core.perspectiveTransform(obj_corners, scene_corners, hg);

When I use log for the two I get

08-06 07:16:26.669: I/OCVSample::Activity(18718): obj Size: 1x33
08-06 07:16:26.669: I/OCVSample::Activity(18718): obj obj_corners : Mat [ 33*1*CV_32FC2, 4*1*CV_32FC1, isCont=true, isSubmat=false, nativeObj=0x677090, dataAddr=0x686e20 nativeObj=0x677d18, dataAddr=0x7de5a0 ]
08-06 07:16:26.679: I/OCVSample::Activity(18718): scene Size: 1x33
08-06 07:16:26.679: I/OCVSample::Activity(18718): scene scene_corners : Mat [ 33*1*CV_32FC2, 4*1*CV_32FC1, isCont=true, isSubmat=false, nativeObj=0x67fc40, dataAddr=0x650db0 nativeObj=0x677d58, dataAddr=0x5d9c80 ]

What am I missing here?

click to hide/show revision 4
retagged

updated 2015-04-11 08:54:35 -0600

berak gravatar image

OpenCV Assertion Failed for Perspective Transform.

For this part of code from this application code

    Mat hg = Calib3d.findHomography(obj, scene, 8, 10);

    Mat obj_corners = new Mat(4,1,CvType.CV_32FC1);
    Mat scene_corners = new Mat(4,1,CvType.CV_32FC1);

    Core.perspectiveTransform(obj_corners, scene_corners, hg);

This is the error, also tried changing the type to CV_8UC1, CV_32F and CV_32FC1

08-06 05:37:35.219: E/cv::error()(17414): OpenCV Error: Assertion failed (scn + 1 == m.cols && (depth == CV_32F || depth == CV_64F)) in void cv::perspectiveTransform(cv::InputArray, cv::OutputArray, cv::InputArray), file /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/matmul.cpp, line 1926
08-06 05:37:35.229: W/dalvikvm(17414): threadid=11: thread exiting with uncaught exception (group=0x40ad59f0)
08-06 05:37:35.229: E/AndroidRuntime(17414): FATAL EXCEPTION: Thread-5874
08-06 05:37:35.229: E/AndroidRuntime(17414): CvException [org.opencv.core.CvException: /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/matmul.cpp:1926: error: (-215) scn + 1 == m.cols && (depth == CV_32F || depth == CV_64F) in function void cv::perspectiveTransform(cv::InputArray, cv::OutputArray, cv::InputArray)
08-06 05:37:35.229: E/AndroidRuntime(17414): ] 
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.core.Core.perspectiveTransform_0(Native Method)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.core.Core.perspectiveTransform(Core.java:5869)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at com.example.objectrecognition.MainActivity.onCameraFrame(MainActivity.java:279)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:376)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:294)
08-06 05:37:35.229: E/AndroidRuntime(17414):    at java.lang.Thread.run(Thread.java:856)

The MainActivity.java:279 referes to the line

Core.perspectiveTransform(obj_corners, scene_corners, hg);

When I use log for the two I get

obj_corners : Mat [ 4*1*CV_32FC1, isCont=true, isSubmat=false, nativeObj=0x677d18, dataAddr=0x7de5a0 ]
scene_corners : Mat [ 4*1*CV_32FC1, isCont=true, isSubmat=false, nativeObj=0x677d58, dataAddr=0x5d9c80 ]

What am I missing here?