Using OpenCV Java with Eclipse
转自:http://docs.opencv.org/trunk/doc/tutorials/introduction/java_eclipse/java_eclipse.html
Using OpenCV Java with Eclipse
Since version 2.4.4 OpenCV supports Java. In this tutorial I will explain how to setup development environment for using OpenCV Java with Eclipse inWindows, so you can enjoy the benefits of garbage collected, very refactorable (rename variable, extract method
and whatnot) modern language that enables you to write code with less effort and make less mistakes. Here we go.
Configuring Eclipse
First, obtain a fresh release of OpenCV from download page and extract it under a simple location like
C:\OpenCV-2.4.6\. I am using version 2.4.6, but the steps are more or less the same for other versions.
Now, we will define OpenCV as a user library in Eclipse, so we can reuse the configuration for any project. Launch Eclipse and selectWindow –> Preferences from the menu.
Navigate under Java –> Build Path –> User Libraries and clickNew....
Enter a name, e.g. OpenCV-2.4.6, for your new library.
Now select your new user library and click Add External JARs....
Browse through C:\OpenCV-2.4.6\build\java\ and selectopencv-246.jar. After adding the jar, extend theopencv-246.jar
and select Native library location and pressEdit....
Select External Folder... and browse to select the folderC:\OpenCV-2.4.6\build\java\x64. If you have a 32-bit system you need to select thex86
folder instead of x64.
Your user library configuration should look like this:
Testing the configuration on a new Java project
Now start creating a new Java project.
On the Java Settings step, under
Libraries tab, select Add Library... and select
OpenCV-2.4.6, then click Finish.
Libraries should look like this:
Now you have created and configured a new Java project it is time to test it. Create a new java file. Here is a starter code for your convenience:
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat; public class Hello
{
public static void main( String[] args )
{
System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
Mat mat = Mat.eye( 3, 3, CvType.CV_8UC1 );
System.out.println( "mat = " + mat.dump() );
}
}
When you run the code you should see 3x3 identity matrix as output.
That is it, whenever you start a new project just add the OpenCV user library that you have defined to your project and you are good to go. Enjoy your powerful, less painful development environment :)
Help and Feedback
You did not find what you were looking for?
- Ask a question on the Q&A forum.
- If you think something is missing or wrong in the documentation, please file abug report.
转自:http://docs.opencv.org/trunk/doc/tutorials/introduction/java_eclipse/java_eclipse.html
Using OpenCV Java with Eclipse的更多相关文章
- 利用Eclipse使用Java OpenCV(Using OpenCV Java with Eclipse)
最近在上计算机视觉这门课程用到了OpenCV,于是找到了"Using OpenCV Java with Eclipse"这篇博文,是英文的,我将它翻译如下与大家分享 正文: 从2. ...
- Using OpenCV Java with Eclipse(转)
转自:http://docs.opencv.org/trunk/doc/tutorials/introduction/java_eclipse/java_eclipse.html Using Open ...
- How to decompile class file in Java and Eclipse - Javap command example(转)
Ability to decompile a Java class file is quite helpful for any Java developer who wants to look int ...
- ubuntu下安装java和eclipse
java安装 1 下载jdk http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html 2 ...
- Java基础-Eclipse第三方安装包管理工具之Maven
Java基础-Eclipse第三方安装包管理工具之Maven 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 玩过Linux的小伙伴应该都知道yum吧,我们只要把搭建好的yum仓库配 ...
- java基础-Eclipse开发工具介绍
java基础-Eclipse开发工具介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 所谓工欲善其事必先利其器,即将身为一名Java开发工程师怎么能没有一款好使的IDE呢?今天就 ...
- java web eclipse中项目的加载过程
java web eclipse中项目的加载过程: Tomcat默认从WEB-INF/目录下加载资源,Eclipse在发布程序的时候,并没有把User Libraries的相关资源拷贝到WEB-INF ...
- Android学习八---OpenCV JAVA API
OpenCV java API的文档说明在OpenCV-2.4.10-android-sdk/sdk/java/javadoc/index.html的文件夹下. 想用java API的方式进行Open ...
- WIN7系统JavaEE(java+tomcat7+Eclipse)环境配置
https://jingyan.baidu.com/article/3a2f7c2e62d25e26afd611fa.html WIN7系统JavaEE(java+tomcat7+Eclipse)环境 ...
随机推荐
- iOS开发——网络编程Swift篇&(四)异步Get方式
异步Get方式 // MARK: - 异步Get方式 func asynchronousGet() { //创建NSURL对象 var url:NSURL! = NSURL(string: " ...
- Linux中errno使用 - [Linux]
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明http://www.blogbus.com/wzgyantai-logs/24470871.html 当linux中的C api函数发 ...
- linux 安装xamp
前一久用上了ubuntu,想折腾下小窝,懒得自己去装Php啊,apache 之类的东西,刚才用上xampp,直接点,等以后要涉及深再弄,暂时先用着xampp.还不错,很好用,这里简单说下安装,(我是新 ...
- iOS实现自定义的弹出视图(popView)
前段时间,在项目中有个需求是支付完成后,弹出红包,实现这么一个发红包的功能.做了最后,实现的效果大致如下: 一.使用方法 整个ViewController的代码大致如下 // // SecondVi ...
- UrlPathEncode与UrlEncode的区别
UrlEncode与UrlPathEncode 的基本作用都是对 URL 字符串进行编码 不同点总结如下: 不同点 UrlEncode UrlPathEncode 处理空格的方式 替换成“+” 替换成 ...
- iOS之上线被拒
前言 感谢您付出宝贵的才华与时间来开发iOS应用程程序.从职业与报酬的角度而言,这对于成千上万的开发员来说一直都是一项值得投入的事业,我们希望帮助您加入这个成功的组织.我们发布了<App Sto ...
- JavaScript开发之路02(Sencha Touch使用时常见问题及解决办法)
1.Sencha中使用组件后通过layout: 'vbox'指定页面布局为垂直盒布局并且组件的高度采用height: '百分比'指定时,组件的背景色通过style: 'background:#F6F6 ...
- Codeforces Round #190 (Div. 2) 水果俩水题
后天考试,今天做题,我真佩服自己... 这次又只A俩水题... orz各路神犇... 话说这次模拟题挺多... 半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来... A: 算是模拟 ...
- https的工作流程
(1)客户端向服务器提出请求,发出SSL握手信号. (2)服务器发出回应,并出示服务器证书(公钥),显示服务器站点身份. (3)客户端验证服务器证书,并生成一个随机的会话密钥,密钥长度达到128位. ...
- [课程相关]homework-03
零.准备工作 这次的作业是结对编程,因为一些原因我们的队伍一共有三个人,成员为:梁杰.夏天晗.谢祖三.由于大家不在一个班,交流起来也不是特别方便,所以我们经过讨论决定三个人约一个时间在一起完成这次作业 ...