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

WebcamPanelExample.java does not open anything #224

Closed
edoniti opened this issue Jun 16, 2014 · 9 comments
Closed

WebcamPanelExample.java does not open anything #224

edoniti opened this issue Jun 16, 2014 · 9 comments

Comments

@edoniti
Copy link

edoniti commented Jun 16, 2014

Hello,

First of all congratulations for your work. I am trying to run WebcamPanelExample.java but it does not do anything, earlier I had problems with logback, sometimes the camera view openned but just showed an error with logback library, now I have logback classic 1.1.2, and logback core 1.1.2 and the are not any errors on classes and it compiles great, but on execution I get only the below log and nothing happens. This happens with other example classes too, they do not do the thing they are meant to do.

Best regards,
Edoniti.

21:23:35.315 [main] INFO  com.github.sarxos.webcam.Webcam - WebcamDefaultDriver capture driver will be used
21:23:35.337 [webcam-discovery-service] DEBUG c.g.s.w.d.b.WebcamDefaultDriver - Searching devices
21:23:36.039 [webcam-discovery-service] DEBUG c.g.s.w.d.b.WebcamDefaultDriver - Found device Integrated Webcam 0
21:23:36.178 [main] DEBUG com.github.sarxos.webcam.WebcamPanel - Starting panel rendering and trying to open attached webcam
21:23:36.179 [main] DEBUG com.github.sarxos.webcam.WebcamLock - Lock Webcam Integrated Webcam 0
21:23:36.194 [atomic-processor-1] INFO  c.g.s.webcam.ds.cgt.WebcamOpenTask - Opening webcam Integrated Webcam 0
21:23:36.195 [atomic-processor-1] DEBUG c.g.s.w.d.b.WebcamDefaultDevice - Opening webcam device Integrated Webcam 0
21:23:36.195 [atomic-processor-1] DEBUG c.g.s.w.d.b.WebcamDefaultDevice - Webcam device 0 starting session, size java.awt.Dimension[width=176,height=144]
21:23:41.317 [webcam-discovery-service] DEBUG c.g.s.w.d.b.WebcamDefaultDriver - Searching devices 
@sarxos
Copy link
Owner

sarxos commented Jun 16, 2014

Hi @edoniti,

Thank you. May I know what OS are you using? I presume you are referring to the newest version of Webcam Capture API?

@edoniti
Copy link
Author

edoniti commented Jun 16, 2014

Hello,

I am using Windows 8. I am using "webcam-capture-0.3.10-RC6-dist".

Best regards,
Edoniti.

@sarxos
Copy link
Owner

sarxos commented Jun 16, 2014

I would like you to do the following things:

  1. Download this JAR (this is the newest Webcam Capture API) and replace it with the one from the ZIP you downloaded (simply remove webcam-capture-0.3.10-RC6.jar and put webcam-capture-0.3.10-20140611.221425-25.jar instead).
  2. Verify if the problem still persist. If it's still there, please go to the next point. If it does not exist any more than we have problem solved :)
  3. Restart your Windows. Microsoft stuff behaves pretty weird when it comes to Java and webcam hardware. Some pointers in memory are not deallocated when you force Java application shutdown (aka application kill, or red "stop" button in Eclipse) which in some cases makes webcam unusable until Windows is restarted. Solution to avoid this is to always perform clean shutdown instead of forced one. After the Windows is restarted, check the problem again. If it does not exist any more we again have problem solved :) If it's still there, please jump to the next point.
  4. Please execute this example. What is the output? This example should fetch 1000 image frames and measure how long it takes to do that. You may need to decrease number of frames from 1000 to e.g. 20. Please let me know if it's working as expected. Did it print "capturing time"?

@edoniti
Copy link
Author

edoniti commented Jun 16, 2014

Hello,

Thanks for your fast reply.

  1. I have downloaded it and used but still the same problem, earlier I was not using the JAR but the folder com from folder src. But still the same problem with this new JAR.

  2. I have restarted the PC but still the same problem.

  3. I have executed it but it does not output anything, using System.out.println I can see that the code breaks as soon as it goes at line "boolean started = grabber.startSession(320, 240, 30, Pointer.pointerTo(device));" and ecplise is saying that "pointerTo" is deprecated.

p.s. Is this version of logback the one that you use too?

Best regards,
Edoniti.

@sarxos
Copy link
Owner

sarxos commented Jun 16, 2014

Ok, the grabber.startSession(..) is the lowest method call we have access to - all behind it is the native code from OpenIMAJ.

The logback version doesn't matter - you can choose whatever you are more familiar with. You only need it when you have Webcam Capture source code. The compiled version can work without it. You can replace it with any logging framework for which there is a SLF4J binding created (which actually means almost all logging frameworks which exists).

In regards to you problem - it seems like OpenIMAJ or underlying VideoLibrary which works on top of DirectShow may have some problems opening your camera hardware. The only solution I can suggest is to use different capture driver, e.g. lti-civil driver which should work as-it-is, or gstreamer driver (for which you will need to install GStreamer, please see driver description for more details).

@edoniti
Copy link
Author

edoniti commented Jun 16, 2014

Hello,

The strange thing is that it worked earlier. I will try on another PC too.

I tried the lti-civil driver but I can not make it work, I have Win 64bit and the .dll causes a problem, I got another .dll for 64 bit but I am not sure where to put it. I have tried JMF driver too but it does not have an implementation class.

23:44:25.460 [main] INFO  c.g.s.webcam.ds.civil.LtiCivilLoader - Loading native library: civil
23:44:25.570 [main] ERROR c.g.s.webcam.ds.civil.LtiCivilLoader - Exception when loading DLL library
java.lang.RuntimeException: Library file cannot be loaded: C:\Users\Edonit\AppData\Local\Temp\webcam-capture-lib-1402955065472\civil.dll
    at com.github.sarxos.webcam.ds.civil.LtiCivilLoader.load(LtiCivilLoader.java:159) ~[bin/:na]
    at com.github.sarxos.webcam.ds.civil.LtiCivilLoader.load(LtiCivilLoader.java:70) ~[bin/:na]
    at com.github.sarxos.webcam.ds.civil.LtiCivilDriver.<clinit>(LtiCivilDriver.java:22) [bin/:na]
    at GStreamerDriverExample.<clinit>(GStreamerDriverExample.java:12) [bin/:na]
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\Edonit\AppData\Local\Temp\webcam-capture-lib-1402955065472\civil.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
    at java.lang.ClassLoader$NativeLibrary.load(Native Method) ~[na:1.7.0_17]
    at java.lang.ClassLoader.loadLibrary1(Unknown Source) ~[na:1.7.0_17]
    at java.lang.ClassLoader.loadLibrary0(Unknown Source) ~[na:1.7.0_17]
    at java.lang.ClassLoader.loadLibrary(Unknown Source) ~[na:1.7.0_17]
    at java.lang.Runtime.load0(Unknown Source) ~[na:1.7.0_17]
    at java.lang.System.load(Unknown Source) ~[na:1.7.0_17]
    at com.github.sarxos.webcam.ds.civil.LtiCivilLoader.load(LtiCivilLoader.java:157) ~[bin/:na]
    ... 3 common frames omitted
Exception in thread "main" java.lang.ExceptionInInitializerError
    at GStreamerDriverExample.<clinit>(GStreamerDriverExample.java:12)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Library file cannot be loaded: C:\Users\Edonit\AppData\Local\Temp\webcam-capture-lib-1402955065472\civil.dll
    at com.github.sarxos.webcam.ds.civil.LtiCivilLoader.load(LtiCivilLoader.java:73)
    at com.github.sarxos.webcam.ds.civil.LtiCivilDriver.<clinit>(LtiCivilDriver.java:22)
    ... 1 more
Caused by: java.lang.RuntimeException: Library file cannot be loaded: C:\Users\Edonit\AppData\Local\Temp\webcam-capture-lib-1402955065472\civil.dll
    at com.github.sarxos.webcam.ds.civil.LtiCivilLoader.load(LtiCivilLoader.java:159)
    at com.github.sarxos.webcam.ds.civil.LtiCivilLoader.load(LtiCivilLoader.java:70)
    ... 2 more
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\Edonit\AppData\Local\Temp\webcam-capture-lib-1402955065472\civil.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(Unknown Source)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.github.sarxos.webcam.ds.civil.LtiCivilLoader.load(LtiCivilLoader.java:157)
    ... 3 more

Best regards,
Edoniti.

@edoniti
Copy link
Author

edoniti commented Jun 17, 2014

Hello,

It seems like that the problem is with my OS, since with the same type of laptop it is working. Just a last opinion, do you think with uninstalling Java JRE and installing it again it may work? Is OpenIMAJ part of Java JRE? Or the only solution can be with using other driver?

Best regards,
Edoniti.

@sarxos
Copy link
Owner

sarxos commented Jun 18, 2014

Hi,

You may try installing 32-bit JRE first, and then uninstall it and move to 64-bit JRE, but I don't know if this will help. You can try it since it will not harm your computer.

OpenIMAJ is an awesome open source project created on University of Southampton and it's not part of JRE. Webcam Capture API uses small part of it - the core-video-capture module.

It may be that you will have to use another driver. I saw that lately the 64-bit DLL for LTI-CIVIL has been created. This is something new since when I started this project, the LTI-CIVIL was not maintained any more. I may try to embed the newest 32- and 64-bit DLL for this driver so you can verify if it will work.

@edoniti
Copy link
Author

edoniti commented Jun 26, 2014

Hello,

Thanks a lot for your helps, I finished my work using my friends laptop since I did not have enough time because of deadline to try other solutions.

Best regards,
Edoniti.

@edoniti edoniti closed this as completed Jun 26, 2014
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

2 participants