Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
harmeling opened this issue May 19, 2020 · 9 comments

Comments

@harmeling
Copy link

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
Copy link
Owner

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
Copy link

wizerdo commented Nov 19, 2021

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

@CmdrDats
Copy link
Owner

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
Copy link

wizerdo commented Nov 19, 2021

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
Copy link

wizerdo commented Nov 19, 2021

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.

igoki.app.zip

@CmdrDats
Copy link
Owner

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
Copy link

wizerdo commented Nov 19, 2021

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
Copy link

wizerdo commented Nov 19, 2021

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

@CmdrDats
Copy link
Owner

awesome, thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants