Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Use external cam instead of integrated webcam in Processing 2.1.1

$
0
0

Hi guys , when i run the following code , it uses my integrated laptop webcam instead of the external webcam (Logitech QuickCam C9000 ) . How do i modify the code such that it uses the external webcam instead of my laptop's integrated one ?

import gab.opencv.*;
import processing.video.*;
import java.awt.*;

Capture video;
OpenCV opencv;

void setup() {
  size(640, 480);
  video = new Capture(this, 640/2, 480/2);
  opencv = new OpenCV(this, 640/2, 480/2);
  opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);

  video.start();
}

void draw() {
  scale(2);
  opencv.loadImage(video);

  image(video, 0, 0 );

  noFill();
  stroke(0, 255, 0);
  strokeWeight(3);
  Rectangle[] faces = opencv.detect();
  println(faces.length);

  for (int i = 0; i < faces.length; i++) {
    println(faces[i].x + "," + faces[i].y);
    rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
  }
}

void captureEvent(Capture c) {
  c.read();
}

My external webcam is under /dev/video1 and running lsusb gives me the following :

Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 011: ID 04b3:310c IBM Corp. Wheel Mouse
Bus 002 Device 004: ID 04f2:b18a Chicony Electronics Co., Ltd
Bus 002 Device 015: ID 046d:0990 Logitech, Inc. QuickCam Pro 9000

Thanks in advance !


Viewing all articles
Browse latest Browse all 2896

Trending Articles