You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a library written in C++ using OpenCV 2.4.2 doing image analys and manipulation. I want to leave the chained processing in the C++ unit as much as possible (for performance and decoupling).
Basically I want to call the library from Java (Mac OS X 10.8.1) with the image-data and display the manipulated image on a swing JScrollPane canvas.
=> I have JavaCV running and I can create IplImage Objects and use them. Now I would like to pass a IplImage to my C++ library.
=> I have added a method signature in my header file with a IplImage* parameter
=> I use JNAerator to create the mapping code, but it fails:
java -Xmx1g -jar jnaerator-0.10-shaded.jar -I/opt/local/include/ BridJTest_so_Cpp/dist/Debug/GNU-MacOSX/libBridJTest_so_Cpp.dylib BridJTest_so_Cpp/Test.h -mode Jar
Warning: no -library option for file 'Test.h', using "Test".
Auto-configuring parser...
Parsing native headers...
/usr/include/sys/cdefs.h:74:25: warning: #warning "Unsupported compiler detected"
/opt/local/include/opencv2/core/operations.hpp:55:0: error: File not found: bits/atomicity.h in /opt/local/include /opt . /usr/include /usr/include/c++/4.2.1 /usr/include/c++/4.2.1/tr1
Looking into /opt/local/include/opencv2/core/operations.hpp it looks like bits/atomicity.h should not be included for my plattorm if i red the preprocessor directives correctly. But JNAerator tries it anyway and fails (wrong defines?).
I had success creating working mappings if I removed the OpenCV header includes and the IplImage parameter.
Please can you give me a hint how I get in the right direction? Is there a chance to use the JavaCP BridJ mapping and "extend" in that way that I can call my method with the IplImage* parameter?
Any help on this topic would be greatly appreciated!
I have tried a slightly different approach now, but still without success:
I added JavaCV to my testproject and added a method definition to a native interface file created by JNAerator manually:
import com.googlecode.javacv.cpp.opencv_core.CvArr;
...
public native void loadImage(CvArr image);
The original method signature in the C++ file:
void loadImage(const CvArr* image);
At runtime I get the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: bridjtest_java.bridj.Test.loadImage(Lcom/googlecode/javacv/cpp/opencv_core$CvArr;)V
at bridjtest_java.bridj.Test.loadImage(Native Method)
at javacvexample.JavaCVExample.main(JavaCVExample.java:43)
I expected the definitions to match and can't find what's wrong. Can someone please give me a hint?
From @apiening on September 16, 2012 22:11
Hi nativelibs4java team,
I have a library written in C++ using OpenCV 2.4.2 doing image analys and manipulation. I want to leave the chained processing in the C++ unit as much as possible (for performance and decoupling).
Basically I want to call the library from Java (Mac OS X 10.8.1) with the image-data and display the manipulated image on a swing JScrollPane canvas.
=> I have JavaCV running and I can create IplImage Objects and use them. Now I would like to pass a IplImage to my C++ library.
=> I have added a method signature in my header file with a IplImage* parameter
=> I use JNAerator to create the mapping code, but it fails:
Warning: no -library option for file 'Test.h', using "Test".
Auto-configuring parser...
Parsing native headers...
/usr/include/sys/cdefs.h:74:25: warning: #warning "Unsupported compiler detected"
/opt/local/include/opencv2/core/operations.hpp:55:0: error: File not found: bits/atomicity.h in /opt/local/include /opt . /usr/include /usr/include/c++/4.2.1 /usr/include/c++/4.2.1/tr1
Looking into /opt/local/include/opencv2/core/operations.hpp it looks like bits/atomicity.h should not be included for my plattorm if i red the preprocessor directives correctly. But JNAerator tries it anyway and fails (wrong defines?).
I had success creating working mappings if I removed the OpenCV header includes and the IplImage parameter.
Please can you give me a hint how I get in the right direction? Is there a chance to use the JavaCP BridJ mapping and "extend" in that way that I can call my method with the IplImage* parameter?
Any help on this topic would be greatly appreciated!
Thank you!
Andreas Piening
Copied from original issue: nativelibs4java/nativelibs4java#337
The text was updated successfully, but these errors were encountered: