diff --git a/src/main/java/com/yuxue/controller/DetectFaceDemo.java b/src/main/java/com/yuxue/controller/FaceController.java similarity index 95% rename from src/main/java/com/yuxue/controller/DetectFaceDemo.java rename to src/main/java/com/yuxue/controller/FaceController.java index 0a271a9a..c3aee1dd 100644 --- a/src/main/java/com/yuxue/controller/DetectFaceDemo.java +++ b/src/main/java/com/yuxue/controller/FaceController.java @@ -11,14 +11,14 @@ import org.opencv.objdetect.CascadeClassifier; * Detects faces in an image, draws boxes around them, * and writes the results to "faceDetection.png". */ -public class DetectFaceDemo { +public class FaceController { static { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); } public static void main(String[] args) { - DetectFaceDemo demo = new DetectFaceDemo(); + FaceController demo = new FaceController(); demo.run(); } diff --git a/src/main/java/com/yuxue/controller/OpencvDemo.java b/src/main/java/com/yuxue/controller/OpencvDemo.java new file mode 100644 index 00000000..7162923f --- /dev/null +++ b/src/main/java/com/yuxue/controller/OpencvDemo.java @@ -0,0 +1,49 @@ +package com.yuxue.controller; + +import org.opencv.core.Core; +import org.opencv.core.CvType; +import org.opencv.core.Mat; +import org.opencv.core.Scalar; + + +/** + * opencv 官方demo + * 用于测试opencv环境是否正常 + * windows下环境配置: + * 1、官网下载对应版本的openvp:https://opencv.org/releases/page/2/ 当前使用4.0.1版本 + * 2、双击exe文件安装,将 安装目录下\build\java\x64\opencv_java401.dll 拷贝到\build\x64\vc14\bin\目录下 + * 3、eclipse添加User Libraries + * 4、项目邮件build path,添加步骤三新增的lib + * + * 官方demo,需要本地安装opencv,除该demo之前,均不需要安装,使用maven依赖即可, + * 二者之间具体有什么差别,暂时还没有时间去深入研究 + * @author yuxue + * @date 2020-04-22 14:04 + */ +public class OpencvDemo { + + static { + System.loadLibrary(Core.NATIVE_LIBRARY_NAME); + } + + public static void main(String[] args) { + System.out.println("Welcome to OpenCV " + Core.VERSION); + + + Mat m1 = Mat.eye(3, 3, CvType.CV_8UC1); + System.out.println("m = " + m1.dump()); + System.err.println("=================="); + + + Mat m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0)); + System.out.println("OpenCV Mat: " + m); + Mat mr1 = m.row(1); + mr1.setTo(new Scalar(1)); + Mat mc5 = m.col(5); + mc5.setTo(new Scalar(5)); + System.out.println("OpenCV Mat data:\n" + m.dump()); + + + } + +} diff --git a/src/main/java/com/yuxue/controller/OpenvpDemo.java b/src/main/java/com/yuxue/controller/OpenvpDemo.java deleted file mode 100644 index bf345992..00000000 --- a/src/main/java/com/yuxue/controller/OpenvpDemo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.yuxue.controller; - -import org.opencv.core.Core; -import org.opencv.core.CvType; -import org.opencv.core.Mat; - - -/** - * opencv 官方demo - * @author yuxue - * @date 2020-04-22 14:04 - */ -public class OpenvpDemo { - - public static void main(String[] args) { - System.out.println("Welcome to OpenCV " + Core.VERSION); - System.loadLibrary(Core.NATIVE_LIBRARY_NAME); - Mat m = Mat.eye(3, 3, CvType.CV_8UC1); - System.out.println("m = " + m.dump()); - } - -} diff --git a/src/main/java/com/yuxue/controller/PlateController.java b/src/main/java/com/yuxue/controller/PlateController.java index c17c515d..67927b7b 100644 --- a/src/main/java/com/yuxue/controller/PlateController.java +++ b/src/main/java/com/yuxue/controller/PlateController.java @@ -26,7 +26,7 @@ public class PlateController { @Autowired private PlateService service; - + /** * 扫描d:/PlateDetect目录图片的基础信息 * 将扫描到的信息,更新到数据库 diff --git a/src/main/java/com/yuxue/controller/SimpleSample.java b/src/main/java/com/yuxue/controller/SimpleSample.java deleted file mode 100644 index 35375f14..00000000 --- a/src/main/java/com/yuxue/controller/SimpleSample.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.yuxue.controller; - -import org.opencv.core.Core; -import org.opencv.core.Mat; -import org.opencv.core.CvType; -import org.opencv.core.Scalar; - - -/** - * 官方demo - * @author yuxue - * @date 2020-04-24 15:34 - */ -public class SimpleSample { - - static { - System.loadLibrary(Core.NATIVE_LIBRARY_NAME); - } - - public static void main(String[] args) { - System.out.println("Welcome to OpenCV " + Core.VERSION); - Mat m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0)); - System.out.println("OpenCV Mat: " + m); - Mat mr1 = m.row(1); - mr1.setTo(new Scalar(1)); - Mat mc5 = m.col(5); - mc5.setTo(new Scalar(5)); - System.out.println("OpenCV Mat data:\n" + m.dump()); - } - -}