cv-2.opencv示例stitching——图像拼接

运行cv示例stitching.cpp图像拼接器。

参数:

--d3 内部在每个图像上创建三个大块以增加拼接成功率

--mode(全景|扫描)确定拼接器的配置。默认值为'panorama'(全景)模式。扫描适合在仿射变换下缝合材料

--output 默认值为'result.jpg'。

用法示例:--d3 --try_use_gpu yes --mode scan left01.jpg left02.jpg \ n“;

left01.jpg

cv-2.opencv示例stitching——图像拼接_第1张图片

 left02.jpg

cv-2.opencv示例stitching——图像拼接_第2张图片

result.jpg

cv-2.opencv示例stitching——图像拼接_第3张图片(扫描模式先1后2)

cv-2.opencv示例stitching——图像拼接_第4张图片(全景模式先1后2)

cv-2.opencv示例stitching——图像拼接_第5张图片(全景模式先2后1)

cv-2.opencv示例stitching——图像拼接_第6张图片(扫描模式先2后1)

D:\Debug>opencv_0.exe  --d3 --mode scans left01.jpg left02.jpg

[ INFO:0] global C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\ocl.cpp (891) cv::ocl::haveOpenCL Initialize OpenCL runtime...
OpenCV(4.2.0) Error: Requested object was not found (could not open directory: C:\Users\PC\AppData\Local\Temp\opencv) in glob_rec, file C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\glob.cpp, line 267
[ INFO:0] global C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\ocl.cpp (433) cv::ocl::OpenCLBinaryCacheConfigurator::OpenCLBinaryCacheConfigurator Successfully initialized OpenCL cache directory: C:\Users\PC\AppData\Local\Temp\opencv\4.2\opencl_cache\
[ INFO:0] global C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\ocl.cpp (457) cv::ocl::OpenCLBinaryCacheConfigurator::prepareCacheDirectoryForContext Preparing OpenCL cache configuration for context: Intel_R__Corporation--Intel_R__HD_Graphics_630--24_20_100_6344
stitching completed successfully

D:\Debug>opencv_0.exe   --d3 --try_use_gpu yes --mode scans left01.jpg left02.jpg
[ WARN:0] global C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\utils\samples.cpp (59) cv::samples::findFile cv::samples::findFile('--try_use_gpu') => ''
OpenCV(4.2.0) Error: Unspecified error (OpenCV samples: Can't find required data file: --try_use_gpu) in cv::samples::findFile, file C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\utils\samples.cpp, line 62
OpenCV: terminate handler is called! The last OpenCV error is:
OpenCV(4.2.0) Error: Unspecified error (OpenCV samples: Can't find required data file: --try_use_gpu) in cv::samples::findFile, file C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\utils\samples.cpp, line 62

看到课堂上其他同学的效果(如下),我意识到我应该输入有点问题,这个应用是找图片中相同的特征进行拼接

cv-2.opencv示例stitching——图像拼接_第7张图片

新的输入:来自于一张照片的三个不同部分,左中右分别对应原图的中左右,就按这个顺序输入。

cv-2.opencv示例stitching——图像拼接_第8张图片cv-2.opencv示例stitching——图像拼接_第9张图片cv-2.opencv示例stitching——图像拼接_第10张图片

不加任何参数:(后更改顺序,输出效果不变)

cv-2.opencv示例stitching——图像拼接_第11张图片

增加d3参数:变窄了,而且3几乎看不见了,即使改变输入顺序也是如此。。。

cv-2.opencv示例stitching——图像拼接_第12张图片

opencv中不公开的类:

OpenCV: Non-free 2D Features Algorithms

OpenCV: Non-free 2D Features Algorithms

This section describes two popular algorithms for 2d feature detection, SIFT and SURF, that are known to be patented. You need to set the OPENCV_ENABLE_NONFREE option in cmake to use those. Use them at your own risk.

你可能感兴趣的:(cv相关草稿,学习笔记,opencv,计算机视觉,图像处理)