Page 1 of 1

Warum ist IMShow () -Methode in OpenCV nicht, wenn ich versuche, es in Intellij zu verwenden?

Posted: 04 Feb 2025, 14:48
by Guest
Ich kann die IMshow () -Methode von OpenCV nicht verwenden. Kann mir bitte jemand dabei helfen. Ich werde einen Screenshot der Fehler veröffentlichen, mit denen ich ausgesetzt bin. Ich würde mich auch bei der Konfiguration von Intellij für OpenCV freuen. Dies ist der Fehler im Gesicht: Ausnahme im Thread "Haupt" java.lang.runtimeexception: Unbekannte Ausnahme. .Main.main (main.java:35) < /p>
öffentliche Klasse Main {< /p>

Code: Select all

        public static void main(String[] args) {
Loader.load(opencv_core.class);

VideoCapture capture = new VideoCapture(0);

if (!capture.isOpened()){
System.out.println("error eerror");
return;
}

Mat frame = new Mat();

while (true){
if (capture.read(frame)){
opencv_highgui.imshow("camera" , frame);

}

if (opencv_highgui.waitKey(1) == 27 ){
break;
}
else {
System.out.println("Unable to capture frame");
break;
}
}

capture.release();
opencv_highgui.destroyAllWindows();
}

} this is what i wanted to try . The camera is turned on for a second and then this error pops up . Any help is appreciated . Thank you.