0

I'm trying to create an Applet that will capture images from my Webcam.

I saw an sample in this thread but the imports don't work in my class. They weren't recognized.

I'm a newbie with Java, so, what i'm doing wrong ?

Community
  • 1
  • 1
Lucas_Santos
  • 4,638
  • 17
  • 71
  • 118

2 Answers2

0

You must include the required external libraries (.jar) in your project in order for the compiler to find its imports.

In the answer you refer to, JavaCV is the API of choice, and also in the answer is a tutorial on configuring JavaCV for use.

FThompson
  • 28,352
  • 13
  • 60
  • 93
  • I did the download of OpenCV. I did the include of external libraries with `Build External Files` ? I saw in http://ganeshtiwaridotcomdotnp.blogspot.com.br/2011/12/opencv-javacv-eclipse-project.html a sample that how to configure the OpenCV – Lucas_Santos Sep 24 '12 at 15:44
  • In Eclipse, you should right click your project, and then click "Build Path" -> "Add External Libraries". Here is where you reference the JavaCV jar (if it indeed has a jar; if not, select "Build Path" -> "Configure Build Path..." and then add the JavaCV classpath location as an "External Class Folder". – FThompson Sep 24 '12 at 15:54
0

In Webcam Capture project source code you can find webcam applet example and the working demo available here. This example does not require any additional JARs since it's shaded while the build. Shading is a process which packs all classes, from all dependent JARs, together, in only one file, referred then as shaded JAR. If you share all JARs you don;t have to build classpath since all imports are packed together.

From the code perspective there is no difference from using webcam API provided within Webcam Capture project in JFrame or JApplet. It contains WebcamPanel class which can be easily used to display image from camera in real time. For more details please check other examples.

The one important think you have to do, is to sigh your applet. This is required operation if you like to access host hardware. Without signing you would have to specify set of appropriate permissions, but I never did this, since, from my perspective JAR shading and signing with Maven a way easier.

Bartosz Firyn
  • 2,664
  • 2
  • 21
  • 18
  • feel free to create new ticket on the Webcam-Capture project issues page if you have problems with the code: https://github.com/sarxos/webcam-capture/issues – Bartosz Firyn May 07 '13 at 14:01
  • 1
    @Bartosz..but i have simple problem that i already imported your projcet in netbeans BUT it cant run it means when i m trying to run there is disable the run option.. why? – Java D May 08 '13 at 11:57
  • @kapil Please create new ticket on the project's page, we will work out this problem. It's hard to say what is wrong with your Netbeans project without necessary details provided. https://github.com/sarxos/webcam-capture/issues – Bartosz Firyn May 16 '13 at 14:06