From 1d2704ce5ed3532c4bccacb9954a12529507e660 Mon Sep 17 00:00:00 2001 From: JoeAllen <2494136784@qq.com> Date: Fri, 29 Jul 2022 14:17:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=A3=80=E6=B5=8B=E5=88=B0?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E7=9A=84=E6=97=B6=E9=97=B4=E5=92=8C=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: JoeAllen <2494136784@qq.com> --- src/main/java/cn/heavenlybook/Main.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/cn/heavenlybook/Main.java b/src/main/java/cn/heavenlybook/Main.java index 48caeec..e05c6f5 100644 --- a/src/main/java/cn/heavenlybook/Main.java +++ b/src/main/java/cn/heavenlybook/Main.java @@ -57,13 +57,13 @@ public class Main { // 显示视频图像 canvas.showImage(frame); if (bestItem.getProbability() == 1.0 && !"非动物".equals(bestItem.getClassName())) { - File outPutFile = - new File(String.valueOf(Paths.get("src/test/resources/" + i++ + "coffee.png"))); - assert buffImg != null; - if (!outPutFile.exists()) { - log.info(String.valueOf(outPutFile.createNewFile())); + File outPutFile = Paths.get("src/test/resources/coffee" + i++ + ".png").toFile(); + if (buffImg != null) { + if (!outPutFile.exists()) { + log.info(String.valueOf(outPutFile.createNewFile())); + } + ImageIO.write(buffImg, "png", outPutFile); } - ImageIO.write(buffImg, "png", outPutFile); } } canvas.dispose();