Hi,
I am working on a Java project using OpenCV to capture and process video streams. Below is the code I am using in my main method:
public static void main(String gg[]) {
try {
Loader.load(org.bytedeco.opencv.opencv_java.class);
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
String streamUrl = "https://thisis urlvideo_h1.m3u8";
VideoCapture cap = new VideoCapture(streamUrl);
if (!cap.isOpened()) {
return;
}
Mat frame = new Mat();
while (cap.read(frame)) {
if (frame.empty()) {
break;
}
// Process and annotate the frame
System.out.println("====================================");
System.out.println(frame);
System.out.println("+++++++++++++++++++++++++++++++++++++");
}
cap.release();
} catch (Exception e) {
e.printStackTrace();
}
}
For dependencies, I am using the following Maven dependency:
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv-platform</artifactId>
<version>4.9.0-1.5.10</version>
</dependency>
Additionally, I installed OpenCV from the source with the following CMake flag:
-DBUILD_opencv_java=ON
However, when I run the code on my macOS machine, I encounter the following error:
java.lang.UnsatisfiedLinkError: 'long org.opencv.videoio.VideoCapture.VideoCapture_0()'
Could you please assist with resolving this UnsatisfiedLinkError issue? Is there anything specific to macOS I need to configure, or any steps I might have missed?
Thanks in advance!