diff --git a/.idea/encodings.xml b/.idea/encodings.xml index aa00ffa..ec3631a 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -3,5 +3,6 @@ + \ No newline at end of file diff --git a/src/main/resources/lib/win/opencv_videoio_ffmpeg470_64.dll b/lib/win/opencv_videoio_ffmpeg470_64.dll similarity index 100% rename from src/main/resources/lib/win/opencv_videoio_ffmpeg470_64.dll rename to lib/win/opencv_videoio_ffmpeg470_64.dll diff --git a/src/main/resources/model/hat.onnx b/model/hat.onnx similarity index 100% rename from src/main/resources/model/hat.onnx rename to model/hat.onnx diff --git a/src/main/resources/model/hat.txt b/model/hat.txt similarity index 100% rename from src/main/resources/model/hat.txt rename to model/hat.txt diff --git a/src/main/resources/model/person.onnx b/model/person.onnx similarity index 100% rename from src/main/resources/model/person.onnx rename to model/person.onnx diff --git a/src/main/resources/model/person.txt b/model/person.txt similarity index 100% rename from src/main/resources/model/person.txt rename to model/person.txt diff --git a/pom.xml b/pom.xml index 67292e4..86a34e2 100644 --- a/pom.xml +++ b/pom.xml @@ -47,5 +47,36 @@ + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + + com.ly.VideoInferenceApp + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.1 + + + package + + shade + + + + + + \ No newline at end of file diff --git a/src/main/java/com/ly/play/opencv/VideoPlayer.java b/src/main/java/com/ly/play/opencv/VideoPlayer.java index 5ba77f6..5e10c71 100644 --- a/src/main/java/com/ly/play/opencv/VideoPlayer.java +++ b/src/main/java/com/ly/play/opencv/VideoPlayer.java @@ -15,6 +15,9 @@ import org.opencv.videoio.Videoio; import javax.swing.*; import java.awt.image.BufferedImage; +import java.io.*; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; import java.util.*; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; @@ -33,12 +36,14 @@ public class VideoPlayer { String OS = System.getProperty("os.name").toLowerCase(); if (OS.contains("win")) { // 使用发布版 FFmpeg DLL - System.load(ClassLoader.getSystemResource("lib/win/opencv_videoio_ffmpeg470_64.dll").getPath()); - // 如果需要调试版,取消注释以下行 - // System.load(ClassLoader.getSystemResource("lib/win/opencv_videoio_ffmpeg470_64d.dll").getPath()); + System.load(System.getProperty("user.dir") + "\\lib\\win\\opencv_videoio_ffmpeg470_64.dll"); } } + + + + private VideoCapture videoCapture; private volatile boolean isPlaying = false; private volatile boolean isPaused = false; diff --git a/src/main/resources/test/Snipaste_2024-10-10_23-55-18.jpg b/test/Snipaste_2024-10-10_23-55-18.jpg similarity index 100% rename from src/main/resources/test/Snipaste_2024-10-10_23-55-18.jpg rename to test/Snipaste_2024-10-10_23-55-18.jpg diff --git a/src/main/resources/test/test2.mp4 b/test/test2.mp4 similarity index 100% rename from src/main/resources/test/test2.mp4 rename to test/test2.mp4 diff --git a/src/main/resources/test/test4.mp4 b/test/test4.mp4 similarity index 100% rename from src/main/resources/test/test4.mp4 rename to test/test4.mp4