问题
To capture video from a web-camera, I used the example code from the DisplayWebcamVideo.java
It was amended resolution:
params.setValue ("video_size", "640x480");
To save images added to the line:
private static void updateJavaWindow (BufferedImage javaImage)
{
mScreen.setImage (javaImage);
ImageIO.write (javaImage, "jpg", new File (fileOut));
}
All the remains, but while maintaining the periodic part of the image is painted gray. Besides, if I understood correctly, before saving the next frame - the previous image is deleted from the HDD, then create a new one. As a result, sometimes the image with a web-camera and are not stored in the folder where sozhranenie should happen - not the desired file.
Can you please tell how to properly save images from the WEB-cameras?
回答1:
I am using Xuggler for my project for transcoding between formats and this was one of the features that lead me to search thoroughly for various problems that it encounters. First problem is the one that you have tried, changing the resolution which in example is 320X240 but whenever it is changed to higher it leads to some or the other error which might be due to the fact that
Xuggle webcam support is lousy--As said by developer
Check at Xuggler's Google groups for more details. I would suggest you to either use it in 320X240 which works most of the time or use LTI-CIVIL (which I am also using) if you want to interface with webcam in more ways than Xuggler can provide.
来源:https://stackoverflow.com/questions/10613867/broken-images-when-saving-in-xuggler