OpenCV-3.3.0测试

安装包目录下/samples/cpp里是各种例程

其中example_cmake里CMakeLists.txt已写好,直接cmake,make就可以,example.cpp是一个调用笔记本摄像头并显示的例程。

测试matchmethod_orb_akaze_brisk.cpp

mkdir matchmethod
cp matchmethod_orb_akaze_brisk.cpp matchmethod/
cp example_cmake/CMakeLists.txt matchmethod/
cd matchmethod
mkdir build
vi CMakeLists.txt,里边add_executalbe(opencv_example matchmethod_orb_akaze_brisk.cpp)
cd build
cmake ..
make

就在build目录下生成了opencv_example可执行文件,./opencv_example 1.png 2.png就可以做匹配了,会一张一张显示,按回车显示下一张匹配。

(一开始报错说1.png为空,因为是root权限下复制过来的,修改权限,ok)

 1 **********Match results**********
 2 Index     Index     distance
 3 in img1    in img2
 4 565    558    5
 5 561    553    7
 6 261    251    8
 7 425    414    8
 8 515    497    8
 9 272    256    9
10 424    413    9
11 582    573    9
12 389    383    10
13 518    500    10
14 524    511    10
15 576    566    10
16 109    104    11
17 228    222    11
18 414    407    11
19 95    178    12
20 407    401    12
21 540    526    12
22 74    66    13
23 167    75    13
24 310    300    13
25 417    408    13
26 437    516    13
27 474    457    13
28 530    517    13
29 78    71    14
30 103    97    14
31 210    201    14
32 365    358    14
33 379    375    14
34 Cumulative distance between keypoint match for different algorithm and feature detector 
35     We cannot say which is the best but we can say results are differents! 
36     BruteForce    BruteForce-L1    BruteForce-Hamming    BruteForce-Hamming(2)    
37 AKAZE-DESCRIPTOR_KAZE_UPRIGHT    866.219    759.206    -1    -1    
38 AKAZE    781.712    730.933    753.526    795.907    
39 ORB    839.2    778    900.526    765.367    
40 BRISK    695.861    862.392    793.24    768.135    
View Code

根据OpenCV描述:

第一行AKAZE-DESCRIPTOR_KAZE_UPRIGHT应该是不带旋转不变性的KAZE描述子,KAZE描述子还是类似SURF那样的浮点,所以没法用汉明距离匹配。

KAZE Feature:

 ----------2018.01.09--------DNN测试--------------

OpenCV3.3里的DNN只用于调用caffe模型,想自己训练是不支持的(之前只是推测,半夜无聊逛知乎,坐实了)

参考这里

在samples/cpp目录下:

mkdir caffeGoogleNet
cd caffeGoogleNet
mkdir build
cp ../../dnn/caffe_googlenet.cpp ./
cp ../example_cmake/CMakeLists.txt ./
vi CMakeLists.txt  修改: add_executable(opencv_example caffe_googlenet.cpp)
cd build
cmake 
make

就生成了可执行文件opencv_example

从其他目录拷贝:bvlc_googlenet.caffemodel bvlc_googlenet.prototxt synset_words.txt 和一张图片,比如aero1.jpg butterfly.jpg,然后就可以运行测试了:

--------2018.01.18-------------------

lkdemo.cpp光流法

关于waitkey(10)==27,参考这里,因为esc的ascii码值为27。

原文地址:https://www.cnblogs.com/zhengmeisong/p/7988949.html