Hi I am trying to get some images (10 frames per second) from a webcam so that later I can detect the moving objects.. My code is the following but I dont know how to change it so that I can get 10 frames per second.Any help?
package video;
import java.io.*;
import java.net.*;
public class Main {
public static void main(String[] args) {
try {
String url ="http://studiocam1.disp.duke.edu/view/index.shtml";
HttpURLConnection con = (HttpURLConnection)((new URL(url).openConnection()));
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream("c:\\image.jpg"));
con.setDoInput(true);
con.setDoOutput(false);
con.setRequestMethod("GET");
BufferedInputStream in = new BufferedInputStream(con.getInputStream());
int bt = 0;
byte[] buffer = new byte[4096];
while ((bt = in.read(buffer, 0, 4096)) > -1) {
out.write(buffer, 0, bt);
}
in.close();
out.close();
System.out.println("Image saved");
} catch(Exception e) {
e.printStackTrace();
}}}