【OpenCV Java】opencv官方java例程演示(Windows下)

0 下载与安装 (Windows下) https://opencv.org/

选择喜欢的版本安装,opencv3.4以后支持深度学习API

 


1 环境搭建  OpenCV Java with Eclipse:https://docs.opencv.org/trunk/d1/d0a/tutorial_java_eclipse.html

问题1:搭建opencv4.0环境失败

    Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_eye(III)J
    at org.opencv.core.Mat.n_eye(Native Method)
    at org.opencv.core.Mat.eye(Mat.java:507)
    at zeng.hello_opencv.main(hello_opencv.java:10)

解决方案:将opencv4.0.0 换成opencv3.4.2(本文使用),不报错

opencv java 官方文档与API位置  https://docs.opencv.org/3.4.4/


2 JAVA示例代码  (Windows下)

【代码位置】……opencv3.4.4/sources/samples/java/tutorial_code/

【代码中示例图片位置】……opencv3.4.4/sources/data/


 

【运行代码  AddingImages.java】 samples\java\tutorial_code\core\AddingImages

[

【运行例子会报错,图片路径不对】

 

【问题】使用自己图片,大小不一样,报错,

CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.4) C:\build\3_4_winpack-bindings-win64-vc14-static\opencv\modules\core\src\arithm.cpp:663: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'cv::arithm_op'

【解决方案】导入两张 一样大小  的图片,混合比为0.6

效果(图片自己下载)

【参考原理】https://blog.csdn.net/poem_qianmo/article/details/20911629


【程序:core.mat_operations.java】:仅做演示作用,不能运行

(  /*  Snippet code for Operations with images tutorial (not intended to be run) */)


【程序,features2D:akaze_matching.java】

【问题】无法导入 org.opencv.xfeatures2d.SURF   

【解决方法】SURF and SIFT algorithms doesn't work in OpenCV 3.0 Java


 【程序 轨迹条与图片加权的混合】AddingImagesTrackbar.java

    Eclipse中输入系统变量和运行参数


【程序 Histograms_Matching.histogram_calculation 】


【程序 灰度均衡化】histogram_equalization.java(图片是自己的)


【程序 画基本的几何图形】ImgProc.BasicGeometricDrawing.java


【程序 调整对比度与亮度】ImgProc.changing_contrast_brightness_image.java

"D:\\opencv-344\\opencv\\sources\\samples\\data\\lena.jpg"


【程序 阈值模板】ImgProc.threshold


【程序 candy边缘检测】ImgTrans.canny_detector.java


【程序 图像分割】Sample code showing how to segment overlapping objects using Laplacian filtering, in addition to Watershed  and Distance Transformation


 【程序 直线检测】ImgTrans.HoughLines.java. This program demonstrates line finding with the Hough transform


[程序  ml.introduction_to_pca.java】  This program demonstrates how to use OpenCV PCA to extract the orientation of an object. PCA提取物体的方向


【程序 video/BackgroundSubtractionDemo.java】这个可提取出运动目标

 


【补充:opencv.js】https://docs.opencv.org/3.4.1/d5/d10/tutorial_js_root.html 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

曾小蛙

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值