Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why my App crashes when i applied Imgproc.resize

As the illustration shows, now i have the 'original' frame, not fill fully the screen. And i expect to got a fullscreen frame like below part, so i choose using imgproc.resize to achieve this, but when i run my app on the mobilephone, the app quit unexpectedly, i don't know why, anyone can help me ? Thanks ! image description

Here is some related code:

    public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {

            Mat frame = inputFrame.rgba();
            Mat dst = new Mat();
            Imgproc.resize(frame,dst,new Size(),1.5,1.5,Imgproc.INTER_LINEAR);
            frame.release();
            return dst;
}

And this is debug error report: E/cv::error(): OpenCV(3.4.7) Error: Assertion failed (src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols) in void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv, jclass, jlong, jobject, jboolean), file /build/3_4_pack-android/opencv/modules/java/generator/src/cpp/utils.cpp, line 101 E/org.opencv.android.Utils: nMatToBitmap caught cv::Exception: OpenCV(3.4.7) /build/3_4_pack-android/opencv/modules/java/generator/src/cpp/utils.cpp:101: error: (-215:Assertion failed) src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols in function 'void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv, jclass, jlong, jobject, jboolean)' E/CameraBridge: Mat type: Mat [ 16202880CV_8UC4, isCont=true, isSubmat=false, nativeObj=0xffffffffc9934a88, dataAddr=0xffffffffc3100000 ] E/CameraBridge: Bitmap type: 19201080 E/CameraBridge: Utils.matToBitmap() throws an exception: OpenCV(3.4.7) /build/3_4_pack-android/opencv/modules/java/generator/src/cpp/utils.cpp:101: error: (-215:Assertion failed) src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols in function 'void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv, jclass, jlong, jobject, jboolean)'

click to hide/show revision 2
None

updated 2019-10-20 03:37:32 -0600

berak gravatar image

Why my App crashes when i applied Imgproc.resize

As the illustration shows, now i have the 'original' frame, not fill fully the screen. And i expect to got a fullscreen frame like below part, so i choose using imgproc.resize to achieve this, but when i run my app on the mobilephone, the app quit unexpectedly, i don't know why, anyone can help me ? Thanks ! image description

Here is some related code:

    public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {

            Mat frame = inputFrame.rgba();
            Mat dst = new Mat();
            Imgproc.resize(frame,dst,new Size(),1.5,1.5,Imgproc.INTER_LINEAR);
            frame.release();
            return dst;
}

And this is debug error report: report:

E/cv::error(): OpenCV(3.4.7) Error: Assertion failed (src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols) in void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv, Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv*, jclass, jlong, jobject, jboolean), file /build/3_4_pack-android/opencv/modules/java/generator/src/cpp/utils.cpp, line 101
E/org.opencv.android.Utils: nMatToBitmap caught cv::Exception: OpenCV(3.4.7) /build/3_4_pack-android/opencv/modules/java/generator/src/cpp/utils.cpp:101: error: (-215:Assertion failed) src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols in function 'void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv, Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv*, jclass, jlong, jobject, jboolean)'
E/CameraBridge: Mat type: Mat [ 16202880CV_8UC4, 1620*2880*CV_8UC4, isCont=true, isSubmat=false, nativeObj=0xffffffffc9934a88, dataAddr=0xffffffffc3100000 ]
E/CameraBridge: Bitmap type: 19201080
1920*1080
E/CameraBridge: Utils.matToBitmap() throws an exception: OpenCV(3.4.7) /build/3_4_pack-android/opencv/modules/java/generator/src/cpp/utils.cpp:101: error: (-215:Assertion failed) src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols in function 'void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv, Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv*, jclass, jlong, jobject, jboolean)'

jboolean)'
click to hide/show revision 3
retagged

updated 2019-10-20 03:42:52 -0600

berak gravatar image

Why my App crashes when i applied Imgproc.resize

As the illustration shows, now i have the 'original' frame, not fill fully the screen. And i expect to got a fullscreen frame like below part, so i choose using imgproc.resize to achieve this, but when i run my app on the mobilephone, the app quit unexpectedly, i don't know why, anyone can help me ? Thanks ! image description

Here is some related code:

    public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {

            Mat frame = inputFrame.rgba();
            Mat dst = new Mat();
            Imgproc.resize(frame,dst,new Size(),1.5,1.5,Imgproc.INTER_LINEAR);
            frame.release();
            return dst;
}

And this is debug error report:

E/cv::error(): OpenCV(3.4.7) Error: Assertion failed (src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols) in void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv*, jclass, jlong, jobject, jboolean), file /build/3_4_pack-android/opencv/modules/java/generator/src/cpp/utils.cpp, line 101
E/org.opencv.android.Utils: nMatToBitmap caught cv::Exception: OpenCV(3.4.7) /build/3_4_pack-android/opencv/modules/java/generator/src/cpp/utils.cpp:101: error: (-215:Assertion failed) src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols in function 'void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv*, jclass, jlong, jobject, jboolean)'
E/CameraBridge: Mat type: Mat [ 1620*2880*CV_8UC4, isCont=true, isSubmat=false, nativeObj=0xffffffffc9934a88, dataAddr=0xffffffffc3100000 ]
E/CameraBridge: Bitmap type: 1920*1080
E/CameraBridge: Utils.matToBitmap() throws an exception: OpenCV(3.4.7) /build/3_4_pack-android/opencv/modules/java/generator/src/cpp/utils.cpp:101: error: (-215:Assertion failed) src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols in function 'void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv*, jclass, jlong, jobject, jboolean)'