Hey all,
after successfully building OpenCV with contrib I ran into an error when trying to initialize a tracker. A smal example:
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.HighGui;
import org.opencv.imgproc.Imgproc;
import org.opencv.tracking.TrackerCSRT;
import org.opencv.tracking.TrackerKCF;
import org.opencv.video.Tracker;
import org.opencv.videoio.VideoCapture;
public class TrackTest {
static {System.loadLibrary(Core.NATIVE_LIBRARY_NAME);}
public static void main(String args[]) {
Rect roi;
Mat frame = new Mat();
// create a tracker object
Tracker tracker = TrackerCSRT.create();
// set input video
VideoCapture capture = new VideoCapture(0);
capture.read(frame);
// get bounding box
roi= new Rect(310,230,20,20);
// initialize the tracker
tracker.init(frame,roi);
while(true){
capture.read(frame);
tracker.update(frame,roi);
Imgproc.rectangle(frame,roi,new Scalar(255,0,0));
HighGui.imshow("Tracker",frame);
HighGui.waitKey(1);
}
}
}
When running the program i recive the following error massage:
Exception in thread “main” java.lang.Exception: unknown exception
at org.opencv.video.Tracker.init_0(Native Method)
at org.opencv.video.Tracker.init(Tracker.java:33)
at View.TrackTest.main(TrackTest.java:32)
Maybe someone has an idea whats wrong. I also tried to build a try catch block but i could not retrieve anymore usefull information.