Eric Brotto
YaBB Newbies
Offline
Posts: 11
OpenCV - loadImage based on URL?
Mar 19th , 2010, 9:54am
The basic idea. I'm loading a collection of images from flicker and as they load I want to run them through a face detection algorithm. I'm using the openCV library found here: http://ubaa.net/shared/processing/opencv/ Here is a snippet of my code. photoURL[i] is an array of strings that are exactly that, URLs of photos. opencv = new OpenCV(this); opencv.loadImage( photoURL[i], width, height ); // open video stream PROBLEM HERE... THE URL IS NOT BEING RECOGNIZED. opencv.cascade( OpenCV.CASCADE_FRONTALFACE_ALT ); // load detection description, here-> front face detection : "haarcascade_frontalface_alt.xml" opencv.read(); Rectangle[] faces = opencv.detect( 1.2, 2, OpenCV.HAAR_DO_CANNY_PRUNING, 40, 40 ); if (faces.length > 0){ println("There are " + faces.length + " faces.");} else {println(" None");} I get an error at each iteration saying something along the lines of: The image file 'http://farm3.static.flickr.com/blahblahblah_s.jpg' can not be found in folders, you must specify the full path instead. I believe this means that opencv wants to read from an image that is from the folder instead of online. I thought of ways around this, like saving the image that I get from the URL to the folder, but don't know how. The save() function captures the whole screen, not just the tiny 75 by 75 image that I'm uploading. And mind you I want to upload a collection, ie. around 35. By the way, I know my photoURL[i] string is good, because it successfully uploads the code elsewhere. Any help or suggestions on how to deal with this problem? Thanks so much,