Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create BridJ Mapping for method with IplImage* parameter #35

Open
ochafik opened this issue Mar 18, 2015 · 1 comment
Open

Create BridJ Mapping for method with IplImage* parameter #35

ochafik opened this issue Mar 18, 2015 · 1 comment

Comments

@ochafik
Copy link
Member

ochafik commented Mar 18, 2015

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:

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!

Thank you!

Andreas Piening

Copied from original issue: nativelibs4java/nativelibs4java#337

@ochafik
Copy link
Member Author

ochafik commented Mar 18, 2015

From @apiening on September 19, 2012 19:30

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?

Thank you!

Andreas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant