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

Is it possible to use this project with c++/JNI openCV code? #74

Open
StainlessStlRat opened this issue Dec 22, 2022 · 4 comments
Open

Comments

@StainlessStlRat
Copy link

I just found this project, and it would be a huge boon to me to be able to use this instead of openCV4AndroidSDK

However, most of my openCV code is c++. Is it possible to use this project for that?

@skizzo
Copy link

skizzo commented Jun 10, 2024

Hey @StainlessStlRat , did you manage to use C++ for this?

@StainlessStlRat
Copy link
Author

@skizzo i just used the tried and true method of bringing in the project as a module

@skizzo
Copy link

skizzo commented Jun 11, 2024

@skizzo i just used the tried and true method of bringing in the project as a module

Could you share a code example?

@StainlessStlRat
Copy link
Author

@skizzo I only just realized this was on a non opencv forum. Go to openCV forum, download the openCV4AndroidSDK, follow their instructions for adding it as a module. That'll get you access to the Java part.

For c++ dev, you need to get a reference to the SDK/Libs. Assuming you know how to use CMake, here's what I do to get the reference. Note that ~/dev/OpenCV-... is where my sdk copy is.

set(OpenCVAndroidSDKLocation "~/dev/OpenCV-android-sdk")
set(OpenCV_DIR "${OpenCVAndroidSDKLocation}/sdk/native/jni/")
message(STATUS "Searching for openCV libs at: ${OpenCV_DIR}")
find_package(OpenCV REQUIRED java)
message(STATUS "opencv found: ${OpenCV_LIBS}")

Then you can add it to a target like this:

target_link_libraries(OpenCVUtil
${OpenCV_LIBS}
)

Hope that helps

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

No branches or pull requests

2 participants