|
@@ -18,6 +18,7 @@ import org.apache.http.impl.cookie.BasicClientCookie;
|
|
|
import org.bytedeco.javacpp.opencv_core;
|
|
|
import org.bytedeco.javacv.FFmpegFrameGrabber;
|
|
|
import org.bytedeco.javacv.Frame;
|
|
|
+import org.bytedeco.javacv.Java2DFrameConverter;
|
|
|
import org.openqa.selenium.Cookie;
|
|
|
import org.openqa.selenium.WebDriver;
|
|
|
import org.openqa.selenium.chrome.ChromeDriver;
|
|
@@ -182,14 +183,16 @@ public class OceanengineJob implements Job {
|
|
|
}
|
|
|
i++;
|
|
|
}
|
|
|
- opencv_core.IplImage img = f.image;
|
|
|
- int owidth = img.width();
|
|
|
- int oheight = img.height();
|
|
|
+// opencv_core.IplImage img = f.image;
|
|
|
+ int owidth = f.imageWidth;
|
|
|
+ int oheight = f.imageHeight;
|
|
|
+ Java2DFrameConverter converter =new Java2DFrameConverter();
|
|
|
+ BufferedImage fecthedImage =converter.getBufferedImage(f);
|
|
|
// 对截取的帧进行等比例缩放
|
|
|
int width = 800;
|
|
|
int height = (int) (((double) width / owidth) * oheight);
|
|
|
BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
|
|
|
- bi.getGraphics().drawImage(f.image.getBufferedImage().getScaledInstance(width, height, Image.SCALE_SMOOTH),
|
|
|
+ bi.getGraphics().drawImage(fecthedImage.getScaledInstance(width, height, Image.SCALE_SMOOTH),
|
|
|
0, 0, null);
|
|
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();//io流
|
|
|
ImageIO.write(bi, "jpg", baos);
|