CmdrDats / igoki

Clojure Go Kifu recorder and OGS player
Eclipse Public License 1.0
161 stars 16 forks source link

Camera not found error? Problem possibly due to MacOS Catalina restrictions? #64

Open harmeling opened 4 years ago

harmeling commented 4 years ago

Trying your code on MacOS 10.15.4 (Catalina). I get some camera error. Might be due to restrictions to camera access in Catalina? The output in the Terminal is shown below. Thank you for your help!

I don't know Clojure good enough to find the command that asks for a camera to repair it myself...

SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/Users/harmeling/.m2/repository/org/slf4j/slf4j-log4j12/1.6.2/slf4j-log4j12-1.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/Users/harmeling/.m2/repository/ch/qos/logback/logback-classic/1.1.2/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. Sending board to 7043708d-a433-4fb6-a9b5-8640a74cb399 Unhandled event: from 7043708d-a433-4fb6-a9b5-8640a74cb399 - [:chsk/uidport-open] Hi Hi Exception in thread "Thread-10" java.lang.NullPointerException at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:301) at igoki.projector$start_cframe$fn__6744.invoke(projector.clj:258) at clojure.lang.AFn.run(AFn.java:22) at java.lang.Thread.run(Thread.java:745) QTKit didn't find any attached Video Input Devices! Warning, camera failed to properly initialize! Cleaned up camera. Error: Camera not opened OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /Users/jason/Projects/opencv/opencv-2.4.11/modules/imgproc/src/color.c

CmdrDats commented 4 years ago

Sorry, I don't have access to a Mac (my macbook is formatted with Arch because I got sick of OSX backward trending), so I won't be able to help. I use Java bindings of OpenCV, and query camera directly through there, so that might be a starting point to google?

I found this, but not sure if it'll be of help: https://stackoverflow.com/questions/56084303/opencv-command-line-app-cant-access-camera-under-macos-mojave

wizerdo commented 2 years ago

This problem still exists with macOS Monterey (latest version), can't grant access to access the camera.

CmdrDats commented 2 years ago

hmm, if you open terminal, cd Downloads (or wherever you've got the jar file) and start it with java -jar igoki.jar - could you let me know if that works?

wizerdo commented 2 years ago

nov. 19, 2021 8:59:13 P.M. nu.pattern.OpenCV$SharedLoader SEVERE: OpenCV.loadShared() is not supported in Java >= 12. Falling back to OpenCV.loadLocally(). 0 2021-11-19 20:59:32.925 java[40760:294339] Bad JNI lookup accessibilityHitTest 2021-11-19 20:59:32.927 java[40760:294339] ( 0 libawt_lwawt.dylib 0x00000001044c53a9 -[JavaComponentAccessibility accessibilityHitTest:withEnv:] + 153 1 libawt_lwawt.dylib 0x0000000104471543 -[AWTView accessibilityHitTest:] + 179 2 AppKit 0x00007ff8063cae95 -[NSWindow(NSWindowAccessibility) accessibilityHitTest:] + 302 3 AppKit 0x00007ff805f6029f -[NSApplication(NSApplicationAccessibility) accessibilityHitTest:] + 333 4 AppKit 0x00007ff805f30718 CopyElementAtPosition + 136 5 HIServices 0x00007ff808b51945 _AXXMIGCopyElementAtPosition + 388 6 HIServices 0x00007ff808b730cc _XCopyElementAtPosition + 351 7 HIServices 0x00007ff808b30bb9 mshMIGPerform + 182 8 CoreFoundation 0x00007ff803105ffa CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 41 9 CoreFoundation 0x00007ff803105ed6 CFRunLoopDoSource1 + 619 10 CoreFoundation 0x00007ff80310454b CFRunLoopRun + 2397 11 CoreFoundation 0x00007ff80310352d CFRunLoopRunSpecific + 563 12 HIToolbox 0x00007ff80bd213e1 RunCurrentEventLoopInMode + 292 13 HIToolbox 0x00007ff80bd21008 ReceiveNextEventCommon + 284 14 HIToolbox 0x00007ff80bd20ed5 _BlockUntilNextEventMatchingListInModeWithFilter + 70 15 AppKit 0x00007ff805b2e8f0 _DPSNextEvent + 886 16 AppKit 0x00007ff805b2cf5c -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1411 17 libosxapp.dylib 0x000000010110f56a -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 122 18 AppKit 0x00007ff805b1f359 -[NSApplication run] + 586 19 libosxapp.dylib 0x000000010110f339 +[NSApplicationAWT runAWTLoopWithApp:] + 169 20 libawt_lwawt.dylib 0x00000001044cd800 +[AWTStarter starter:headless:] + 496 21 libosxapp.dylib 0x000000010111100f +[ThreadUtilities invokeBlockCopy:] + 15 22 Foundation 0x00007ff803f8cd63 NSThreadPerformPerform + 179 23 CoreFoundation 0x00007ff80310584d CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 24 CoreFoundation 0x00007ff8031057b5 CFRunLoopDoSource0 + 180 25 CoreFoundation 0x00007ff803105534 CFRunLoopDoSources0 + 242 26 CoreFoundation 0x00007ff803103f6b CFRunLoopRun + 893 27 CoreFoundation 0x00007ff80310352d CFRunLoopRunSpecific + 563 28 libjli.dylib 0x00000001001860b2 CreateExecutionEnvironment + 386 29 libjli.dylib 0x0000000100181c15 JLI_Launch + 1413 30 java 0x000000010005cc09 main + 393 31 dyld 0x0000000104b394fe start + 462 ) Exception in thread "AppKit Thread" java.lang.NoSuchMethodError: accessibilityHitTest OpenCV: not authorized to capture video (status 0), requesting... OpenCV: can not spin main run loop from other thread, set OPENCV_AVFOUNDATION_SKIP_AUTH=1 to disable authorization request and perform it in your application. OpenCV: camera failed to properly initialize! Error: Camera not opened

wizerdo commented 2 years ago

above was what it gave me after I ran the newest version (0.7.1) it asked me to grant access to the terminal for access after granting I had "functioning" webcam/video though very low framerate, but it seems to have done the trick.

  1. fresh download
  2. cd Downloads
  3. java -jar igoki.jar
  4. produces a prompt asking to grant terminal access to camera -> y -> working now
  5. every time you want to use it you have to run that line.
  6. or use the app (apple script editor) I added to this directory, as a redneck solution.
  7. igoki.app.zip

CmdrDats commented 2 years ago

hmm https://youtrack.jetbrains.com/issue/JBR-3721 makes me thinks it's some weird jdk 17 bug.

The low framerate is actually intentional - I need to do some work there to enable faster framerates without making the board reading horrible - so sounds like it's working as it should!

wizerdo commented 2 years ago

yes I added a script that automates the terminal commands, as it appears you have to do It every time to run it. it only works if you leave the igoki.jar in the Downloads folder otherwise you have to modify it

wizerdo commented 2 years ago

thx anyway, going to experiment with it soon, I'll report back my findings!

CmdrDats commented 2 years ago

awesome, thank you :)