Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li><p>As there are no classes in j2se that can be used to capture video from a webcam, so you need an external library like JMF or JavaCV, to do the same. </p></li> <li><p>To install JavaCV you will find instructions on these links:</p> <p>a. ganeshtiwaridotcomdotnp.blogspot.in <a href="http://ganeshtiwaridotcomdotnp.blogspot.in/2011/12/opencv-javacv-eclipse-project.html" rel="nofollow">Link</a></p> <p>b. code.google.com <a href="http://code.google.com/p/javacv/" rel="nofollow">Link</a></p></li> <li><p>The code to capture video in real time from camera: </p> <pre><code>import com.googlecode.javacv.CanvasFrame; import com.googlecode.javacv.FrameGrabber; import com.googlecode.javacv.VideoInputFrameGrabber; import com.googlecode.javacv.cpp.opencv_core.IplImage; import static com.googlecode.javacv.cpp.opencv_core.cvFlip; class GrabberShow implements Runnable { IplImage image; CanvasFrame canvas = new CanvasFrame("Web Cam"); public GrabberShow() { canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); } @Override public void run() { FrameGrabber grabber = new VideoInputFrameGrabber(0); // 1 for next camera try { grabber.start(); IplImage img; while (true) { img = grabber.grab(); if (img != null) { cvFlip(img, img, 1);// l-r = 90_degrees_steps_anti_clockwise canvas.showImage(img); } } } catch (Exception e) {} } } public class Main { public static void main(String[] args) { GrabberShow gs = new GrabberShow(); Thread th = new Thread(gs); th.start(); } } </code></pre></li> </ol> <p>hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload