I'm facing issues while converting IplImages to Mat. When I run the simple code below I get a fatal error runtime on the third instruction:
IplImage origImg = cvLoadImage(workingDir+filename, CV_LOAD_IMAGE_COLOR);
Mat imgMat = new Mat(origImg);
IplImage origImg2 = new IplImage(imgMat);
This is what I founded in console:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000000011a2ad060, pid=2703, tid=4867
#
# JRE version: Java(TM) SE Runtime Environment (7.0_60-b19) (build 1.7.0_60-b19)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.60-b09 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C [libopencv_core.3.0.dylib+0x16e060] _IplImage::_IplImage(cv::Mat const&)+0x80
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
I'm pretty sure that origiImg is properly initialized (I used it for other stuff), and the result no change with other Mat initialization, like this:
CvMat cvMatImg = origiImg.asCvMat();
Mat imgMat = new Mat(cvMatImg);
IplImage origImg2 = new IplImage(imgMat);
In this case the error is the following:
OpenCV Error: Assertion failed (m.dims <= 2) in _IplImage, file .../javacpp-presets-master/opencv/cppbuild/macosx-x86_64/opencv-3.0.0/modules/core/src/matrix.cpp, line 5411
Exception in thread "main" java.lang.RuntimeException: .../javacpp-presets-master/opencv/cppbuild/macosx-x86_64/opencv-3.0.0/modules/core/src/matrix.cpp:5411: error: (-215) m.dims <= 2 in function _IplImage
at org.bytedeco.javacpp.opencv_core$IplImage.allocate(Native Method)
at org.bytedeco.javacpp.opencv_core$IplImage.<init>(opencv_core.java:3229)
at org.bytedeco.javacv.OpenCVFaceRecognizer.detectFace(OpenCVFaceRecognizer.java:142)
at org.bytedeco.javacv.OpenCVFaceRecognizer.main(OpenCVFaceRecognizer.java:171)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Thanks in advance for your help.