搭建opencv javaweb项目

用到的技术maven、git、ssm、opencv、javaweb

搭建opencv javaweb项目时,踩了很多坑;怀疑过spring,想过python,最后竟然一不小心成了,what.......闲话不多说,让我们看看这关键的一条命令

即把opencv jar包放到maven本地仓库中

mvn install:install-file -Dfile="G:\opencv\opencv\build\java\opencv-341.jar" -DgroupId=org.opencv -DartifactId=opencv -Dversion=3.4.1 -Dpackaging=jar

再看看一直报'javaClassNotDefound'的maven依赖配置

<dependency>
<groupId>org.opencv</groupId>
<artifactId>opencv</artifactId>
<version>3.4.1</version>
<systemPath>G:/opencv/opencv/build/java/opencv-341.jar</systemPath>
<scope>system</scope>
</dependency>

再看看不报错的配置

<dependency>
<groupId>org.opencv</groupId>
<artifactId>opencv</artifactId>
<version>3.4.1</version>
</dependency>

到这离成功已经很近了,我们还需要加载dll或者so文件

我们可以在用到opencv的类中用静态代码块加载dll或者so文件,

或者配置一个监听器如下,别忘了在web.xml中配置

package cn.edu.njupt.configure;

import cn.edu.njupt.utils.OpencvConstantUtils;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; public class InitOpencv implements ServletContextListener { @Override
public void contextDestroyed(ServletContextEvent servletContextEvent) { } public void contextInitialized(ServletContextEvent arg0) {
System.load("G:/opencv/opencv/build/java/x64/opencv_java341.dll");
} }

web.xml

<listener>
<listener-class>cn.edu.njupt.configure.InitOpencv</listener-class>
</listener>

到此项目可以说就搭建好了,liunx,mac只需要按照上述步骤把对应文件路径替换掉就可以了

本项目地址:https://github.com/YLDarren/stitp

相关项目地址:https://github.com/YLDarren/opencvHandleImg

最新文章

  1. .NET基础面试题整理
  2. Xcode磁盘空间大清理
  3. codevs 1001 舒适的路线(Kruskal)
  4. Effective C++ -----条款34:区分接口继承和实现继承
  5. 云计算和大数据时代网络技术揭秘(十二)自定义网络SDN
  6. Android -- The Manifest File
  7. Apache+PHP+Mysql OS X 10.9 Mavericks WEB 服务器配置
  8. spring事务管理-摘抄
  9. mongodb,redis,mysql 简要对比
  10. eclipse加速
  11. HW6.21
  12. PetaPoco 快速上手
  13. VS2012发布网站详细步骤问题
  14. PHP中的面向对象思想
  15. 用yum快速搭建LAMP平台
  16. Django积木块一——验证码
  17. Android Studio 插件(plugins)或者intellij idea 插件(plugins)无法安装
  18. mysql 数据库操作 数据库的增删改查
  19. pytho常用模块2——random
  20. css字符串转换为类map对象及反转

热门文章

  1. keras-yolo3-master
  2. JS中的作用域(一)-详谈
  3. java的main函数组成
  4. 在用单片机接受串口数据的时候,第一位是0x0A
  5. HTML中data-* 属性
  6. HTML网页音频控制
  7. OO第一单元作业总结之初识面向对象
  8. struts校验
  9. linux介绍、命令(基本命令、常用命令、使用方法、基本格式)
  10. jmeter的学习路线