Ask Your Question

dhirwinjr's profile - activity

2020-04-17 00:17:46 -0600 received badge  Enthusiast
2020-04-13 12:28:54 -0600 asked a question How to best free up DNN and GPU resources when finished?

How to best free up DNN and GPU resources when finished? A little bit of context first...I'm using OpenCV 4.2 which I've

2019-11-30 07:47:38 -0600 received badge  Student (source)
2019-11-30 07:47:30 -0600 marked best answer Issue using OpenCV 4.1.1 and Tracking API in Java

All,

I'm trying to leverage the opencv-contrib's Tracking API in a Java application but am currently seeing an "java.lang.UnsatisfiedLinkError: org.opencv.tracking.TrackerCSRT.create_0()J" exception in my Java program. Here's what I've done to get to that point...realizing that the Tracking API is not included in the pre-built OpenCV releases I successfully built OpenCV 4.1.1 from source along with the opencv-contrib-4.1.1 release (where the Tracking API code resides). I've never built OpenCV before so it was all new to me but I finally got that working (sort of). Here's my environment:

  • Windows 7 64-bit
  • CMake 3.16.0-rc3
  • Microsoft Visual Studio Community 2019 (version 16.3.8)
  • OpenCV 4.1.1

I followed the instructions from here: https://cv-tricks.com/how-to/installa...

Initially, I did NOT have the BUILD_opencv_world option selected in CMake and so it was just building all of the *.dll files separately (including the "opencv_tracking411.dll" file) and didn't know how to easily load the necessary native libraries into my Java program (as a comparison, when you download the pre-built release of OpenCV, there's a "opencv-411.jar" file along with a single "opencv_java411.dll" file that I use to load into my Java program). I did not see the "opencv_java411.dll" file in the "build/bin/Release" directory when I originally built OpenCV from source. So I turned on the BUILD_opencv_world option and it generated the "opencv_world411.dll" file. Being a bit confused about what *.dll files I now need, I'm currently only loading the "opencv_world411.dll" file into my Java program. The program runs and loads OpenCV and works until it hits the code that leverages the Tracking API. In particular it throws the following exception when instantiating a Tracker object (I'm assuming that this is because the "opencv_tracking411.dll file isn't actually being loaded):

Caused by: java.lang.UnsatisfiedLinkError: org.opencv.tracking.TrackerCSRT.create_0()J
at org.opencv.tracking.TrackerCSRT.create_0(Native Method)
at org.opencv.tracking.TrackerCSRT.create(TrackerCSRT.java:32)

So at this point I have the following questions:

  1. What steps in the OpenCV build process do I need to follow to generate the "opencv_java411.dll" file. Is the "opencv_world411.dll" that file just renamed?
  2. Is the "opencv_tracking411.dll" file linked and included in the "opencv_world411.dll" file? If not, is there a way to configure that in CMake? Or will I need to load the "opencv_tracking411.dll" file in my Java program separate from the "opencv_world411.dll" file?
  3. If I need to load the "opencv_tracking411.dll" file separately, where can I find the native name that should be used? For reference, to load the core OpenCV library in my Java program I use " System.loadLibrary(Core.NATIVE_LIBRARY_NAME);" which works.

Thanks for any feedback and help.

Dave

2019-11-12 22:26:08 -0600 commented answer Issue using OpenCV 4.1.1 and Tracking API in Java

So I did a totally clean re-build of OpenCV 4.1.1 and also realized that I had accidentally included a 32-bit ffmpeg dll

2019-11-12 20:39:40 -0600 commented answer Issue using OpenCV 4.1.1 and Tracking API in Java

Thanks so much for the response. Your suggestions did result in generating the "opencv_java411.dll" file in the "build/l

2019-11-12 12:03:35 -0600 asked a question Issue using OpenCV 4.1.1 and Tracking API in Java

Issue using OpenCV 4.1.1 and Tracking API in Java All, I'm trying to leverage the opencv-contrib's Tracking API in a Ja