We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
Im trying to do some image processing with the openCV library and im trying to connect my android phone's camera to processing through an app called IP-Webcam, but I cant get the IP-Capture library to connect to my phone, heres the code im using :
` import gab.opencv.*; import java.awt.*; import ipcapture.*;
IPCapture cam; OpenCV opencv;
void setup() { size(640, 480); cam = new IPCapture(this, "192.168.1.9:8080", "", ""); //local ip for the ipwebcam cam.start(); opencv = new OpenCV(this, 640, 480); opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
}
void draw() { scale(2); //println(cam.isAvailable()); if (cam.isAvailable()) { cam.read(); image(cam,0,0); }
opencv.loadImage(cam);
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); } } `
The program doesnt find the camera, the cam.isAvailable() function returns false.
Thank you.
Answers
to wiew the stream from IP Webcam app in your sketch, replace
cam = new IPCapture(this, "192.168.1.9:8080", "", ""); //local ip for the ipwebcam cam.start();
withcam = new IPCapture(this); cam.start("http://192.168.1.9:8080/video", "", "");
adapt the ip, username and password parameters as necessary to work with the settings of the IP Webcam server.