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

Raspberry pi issue with webcam.open() #189

Open
shahbaz- opened this issue Mar 8, 2014 · 10 comments
Open

Raspberry pi issue with webcam.open() #189

shahbaz- opened this issue Mar 8, 2014 · 10 comments

Comments

@shahbaz-
Copy link

shahbaz- commented Mar 8, 2014

Hello, I have created a program that uses webcam-capture 0.3.10-RC4. At first it wouldn't load the libs for Bridj and OpenImaj. I put the libs for both of those in the same folder where my application jar is. I ran my program and got the following output:

pi@rpi-smd1 /media/C4E7-7422/wcngs $ sudo java -jar wcngs.jar
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Java HotSpot(TM) Client VM warning: You have loaded library /media/C4E7-7422/wcngs/libbridj.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: com.github.sarxos.webcam.WebcamException: Cannot execute task
    at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.process(WebcamProcessor.java:57)
    at com.github.sarxos.webcam.WebcamProcessor.process(WebcamProcessor.java:122)
    at com.github.sarxos.webcam.WebcamTask.process(WebcamTask.java:38)
    at com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.open(WebcamOpenTask.java:20)
    at com.github.sarxos.webcam.Webcam.open(Webcam.java:189)
    at com.github.sarxos.webcam.Webcam.open(Webcam.java:149)
    at com.github.sarxos.webcam.WebcamPanel.start(WebcamPanel.java:566)
    at com.github.sarxos.webcam.WebcamPanel.<init>(WebcamPanel.java:515)
    at com.github.sarxos.webcam.WebcamPanel.<init>(WebcamPanel.java:476)
    at com.github.sarxos.webcam.WebcamPanel.<init>(WebcamPanel.java:465)
    at main.Main.main(Main.java:12)
    ... 5 more
Caused by: java.lang.NullPointerException
    at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.startSession(Native Method)
    at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDevice.open(WebcamDefaultDevice.java:253)
    at com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.handle(WebcamOpenTask.java:38)
    at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.run(WebcamProcessor.java:66)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

Sorry for the bad text wrapping.
Any idea of what I am doing wrong?

@shahbaz-
Copy link
Author

shahbaz- commented Mar 8, 2014

My code:

public static void main(String[] args) {

    WebcamPanel panel = new WebcamPanel(Webcam.getWebcams().get(0));
    panel.setFPSDisplayed(true);

    JFrame frame = new JFrame("Webcam Capture Demo");
    frame.add(panel);
    frame.pack();
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

@shahbaz- shahbaz- closed this as completed Mar 8, 2014
@shahbaz- shahbaz- reopened this Mar 8, 2014
@shahbaz-
Copy link
Author

shahbaz- commented Mar 8, 2014

Also I used the libs that came with the JAR. I ran the program and got the from /tmp/BridjExtractedLibraries-********/. The program wouldn't even load the libraries otherwise.

@shahbaz-
Copy link
Author

Thanks for the reply. I'll try to recompile the OpenImaj binaries.

@sarxos
Copy link
Owner

sarxos commented Mar 13, 2014

Hi @shahbaz-

Please put the recompiled binaries in the same directory as your application - it will then use OpenIMAJGrabber.so instead of the one embedded in JAR.

Please let me know if this fixed your issue.

@shahbaz-
Copy link
Author

Still the exact same issue. Still getting an InvocationTargetException when I run it.

@shahbaz-
Copy link
Author

I also tried letting it use the Bridj library with the JAR. Still no luck.

@shahbaz-
Copy link
Author

Your getting the exception when constructing OpenIMAJ. It should be constructed OpenIMAJ(int, int, double). I'll try to look into the source of webcam-capture and OpenIMAJ.
EDIT: On line 56 of WebcamDefaultDriver.java you start OpenIMAJ with no params. When I ran the program another time it said that it should be constructed with the params above. Makes no sense to me because the OpenImaj.java constructor you have doesn't require any params.

@He-Pin
Copy link

He-Pin commented Mar 14, 2014

hi,the armhf is ok,I have done this before,
and the performance is so low ,especially when you want send the image via Network.

@sarxos
Copy link
Owner

sarxos commented Mar 14, 2014

@shahbaz-, the InvocationTargetException is caused directly by the NPE in OpenIMAJGrabber.startSession(Native Method) and the warning about the missing params you saw is just some rubbish message which has been already fixed in newer BridJ (in 0.6.3 and above).

@shahbaz-
Copy link
Author

Ok.What else could I try to do to fix it?

sarxos added a commit that referenced this issue Feb 26, 2015
refs #286
refs #315
refs #244
refs #219
refs #194
refs #192
refs #189
refs #184
refs #176
refs #153
refs #152
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