Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
d0f90205
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d0f90205
编写于
8月 31, 2017
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9510 from sturkmen72:update_samples
上级
05b99a4d
efa0e75e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
60 deletion
+39
-60
samples/cpp/stitching.cpp
samples/cpp/stitching.cpp
+39
-60
未找到文件。
samples/cpp/stitching.cpp
浏览文件 @
d0f90205
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include <iostream>
#include <fstream>
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/stitching.hpp"
#include <iostream>
using
namespace
std
;
using
namespace
cv
;
bool
try_use_gpu
=
false
;
bool
divide_images
=
false
;
Stitcher
::
Mode
mode
=
Stitcher
::
PANORAMA
;
vector
<
Mat
>
imgs
;
string
result_name
=
"result.jpg"
;
void
printUsage
();
void
printUsage
(
char
**
argv
);
int
parseCmdArgs
(
int
argc
,
char
**
argv
);
int
main
(
int
argc
,
char
*
argv
[])
...
...
@@ -73,25 +33,28 @@ int main(int argc, char* argv[])
}
imwrite
(
result_name
,
pano
);
cout
<<
"stitching completed successfully
\n
"
<<
result_name
<<
" saved!"
;
return
0
;
}
void
printUsage
()
void
printUsage
(
char
**
argv
)
{
cout
<<
"Images stitcher.
\n\n
"
"stitching img1 img2 [...imgN]
\n\n
"
"Flags:
\n
"
" --try_use_gpu (yes|no)
\n
"
" Try to use GPU. The default value is 'no'. All default values
\n
"
" are for CPU mode.
\n
"
" --mode (panorama|scans)
\n
"
" Determines configuration of stitcher. The default is 'panorama',
\n
"
" mode suitable for creating photo panoramas. Option 'scans' is suitable
\n
"
" for stitching materials under affine transformation, such as scans.
\n
"
" --output <result_img>
\n
"
" The default is 'result.jpg'.
\n
"
;
"Images stitcher.
\n\n
"
<<
"Usage :
\n
"
<<
argv
[
0
]
<<
" [Flags] img1 img2 [...imgN]
\n\n
"
"Flags:
\n
"
" --d3
\n
"
" internally creates three chunks of each image to increase stitching success"
" --try_use_gpu (yes|no)
\n
"
" Try to use GPU. The default value is 'no'. All default values
\n
"
" are for CPU mode.
\n
"
" --mode (panorama|scans)
\n
"
" Determines configuration of stitcher. The default is 'panorama',
\n
"
" mode suitable for creating photo panoramas. Option 'scans' is suitable
\n
"
" for stitching materials under affine transformation, such as scans.
\n
"
" --output <result_img>
\n
"
" The default is 'result.jpg'.
\n\n
"
"Example usage :
\n
"
<<
argv
[
0
]
<<
" --d3 --try_use_gpu yes --mode scans img1.jpg img2.jpg"
;
}
...
...
@@ -99,14 +62,15 @@ int parseCmdArgs(int argc, char** argv)
{
if
(
argc
==
1
)
{
printUsage
();
printUsage
(
argv
);
return
-
1
;
}
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
string
(
argv
[
i
])
==
"--help"
||
string
(
argv
[
i
])
==
"/?"
)
{
printUsage
();
printUsage
(
argv
);
return
-
1
;
}
else
if
(
string
(
argv
[
i
])
==
"--try_use_gpu"
)
...
...
@@ -122,6 +86,10 @@ int parseCmdArgs(int argc, char** argv)
}
i
++
;
}
else
if
(
string
(
argv
[
i
])
==
"--d3"
)
{
divide_images
=
true
;
}
else
if
(
string
(
argv
[
i
])
==
"--output"
)
{
result_name
=
argv
[
i
+
1
];
...
...
@@ -148,7 +116,18 @@ int parseCmdArgs(int argc, char** argv)
cout
<<
"Can't read image '"
<<
argv
[
i
]
<<
"'
\n
"
;
return
-
1
;
}
imgs
.
push_back
(
img
);
if
(
divide_images
)
{
Rect
rect
(
0
,
0
,
img
.
cols
/
2
,
img
.
rows
);
imgs
.
push_back
(
img
(
rect
).
clone
());
rect
.
x
=
img
.
cols
/
3
;
imgs
.
push_back
(
img
(
rect
).
clone
());
rect
.
x
=
img
.
cols
/
2
;
imgs
.
push_back
(
img
(
rect
).
clone
());
}
else
imgs
.
push_back
(
img
);
}
}
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录