Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
7ab43585
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,发现更多精彩内容 >>
提交
7ab43585
编写于
9月 13, 2013
作者:
S
siddharth
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove cloning_example.cpp
上级
50c19423
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
243 deletion
+0
-243
samples/cpp/cloning_example.cpp
samples/cpp/cloning_example.cpp
+0
-243
未找到文件。
samples/cpp/cloning_example.cpp
已删除
100644 → 0
浏览文件 @
50c19423
/*
* cloning.cpp
*
* Author:
* Siddharth Kherada <siddharthkherada27[at]gmail[dot]com>
*
* This tutorial demonstrates how to use OpenCV seamless cloning
* module without GUI.
*
* 1- Normal Cloning
* 2- Mixed Cloning
* 3- Monochrome Transfer
* 4- Color Change
* 5- Illumination change
* 6- Texture Flattening
* The program takes as input a source and a destination image (for 1-3 methods)
* and ouputs the cloned image.
*/
#include "opencv2/photo.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core.hpp"
#include <iostream>
#include <stdlib.h>
using
namespace
std
;
using
namespace
cv
;
int
main
(
int
argc
,
char
**
argv
)
{
cout
<<
endl
;
cout
<<
"Cloning Module"
<<
endl
;
cout
<<
"---------------"
<<
endl
;
cout
<<
"Options: "
<<
endl
;
cout
<<
endl
;
cout
<<
"1) Normal Cloning "
<<
endl
;
cout
<<
"2) Mixed Cloning "
<<
endl
;
cout
<<
"3) Monochrome Transfer "
<<
endl
;
cout
<<
"4) Local Color Change "
<<
endl
;
cout
<<
"5) Local Illumination Change "
<<
endl
;
cout
<<
"6) Texture Flattening "
<<
endl
;
cout
<<
endl
;
cout
<<
"Press number 1-6 to choose from above techniques: "
;
int
num
;
cin
>>
num
;
cout
<<
endl
;
if
(
num
==
1
)
{
string
folder
=
"cloning/Normal_Cloning/"
;
string
original_path1
=
folder
+
"source1.png"
;
string
original_path2
=
folder
+
"destination1.png"
;
string
original_path3
=
folder
+
"mask.png"
;
Mat
source
=
imread
(
original_path1
,
IMREAD_COLOR
);
Mat
destination
=
imread
(
original_path2
,
IMREAD_COLOR
);
Mat
mask
=
imread
(
original_path3
,
IMREAD_COLOR
);
if
(
source
.
empty
())
{
cout
<<
"Could not load source image "
<<
original_path1
<<
endl
;
exit
(
0
);
}
if
(
destination
.
empty
())
{
cout
<<
"Could not load destination image "
<<
original_path2
<<
endl
;
exit
(
0
);
}
if
(
mask
.
empty
())
{
cout
<<
"Could not load mask image "
<<
original_path3
<<
endl
;
exit
(
0
);
}
Mat
result
;
Point
p
;
p
.
x
=
400
;
p
.
y
=
100
;
seamlessClone
(
source
,
destination
,
mask
,
p
,
result
,
1
);
imshow
(
"Output"
,
result
);
imwrite
(
folder
+
"cloned.png"
,
result
);
}
else
if
(
num
==
2
)
{
string
folder
=
"cloning/Mixed_Cloning/"
;
string
original_path1
=
folder
+
"source1.png"
;
string
original_path2
=
folder
+
"destination1.png"
;
string
original_path3
=
folder
+
"mask.png"
;
Mat
source
=
imread
(
original_path1
,
IMREAD_COLOR
);
Mat
destination
=
imread
(
original_path2
,
IMREAD_COLOR
);
Mat
mask
=
imread
(
original_path3
,
IMREAD_COLOR
);
if
(
source
.
empty
())
{
cout
<<
"Could not load source image "
<<
original_path1
<<
endl
;
exit
(
0
);
}
if
(
destination
.
empty
())
{
cout
<<
"Could not load destination image "
<<
original_path2
<<
endl
;
exit
(
0
);
}
if
(
mask
.
empty
())
{
cout
<<
"Could not load mask image "
<<
original_path3
<<
endl
;
exit
(
0
);
}
Mat
result
;
Point
p
;
p
.
x
=
destination
.
size
().
width
/
2
;
p
.
y
=
destination
.
size
().
height
/
2
;
seamlessClone
(
source
,
destination
,
mask
,
p
,
result
,
2
);
imshow
(
"Output"
,
result
);
imwrite
(
folder
+
"cloned.png"
,
result
);
}
else
if
(
num
==
3
)
{
string
folder
=
"cloning/Monochrome_Transfer/"
;
string
original_path1
=
folder
+
"source1.png"
;
string
original_path2
=
folder
+
"destination1.png"
;
string
original_path3
=
folder
+
"mask.png"
;
Mat
source
=
imread
(
original_path1
,
IMREAD_COLOR
);
Mat
destination
=
imread
(
original_path2
,
IMREAD_COLOR
);
Mat
mask
=
imread
(
original_path3
,
IMREAD_COLOR
);
if
(
source
.
empty
())
{
cout
<<
"Could not load source image "
<<
original_path1
<<
endl
;
exit
(
0
);
}
if
(
destination
.
empty
())
{
cout
<<
"Could not load destination image "
<<
original_path2
<<
endl
;
exit
(
0
);
}
if
(
mask
.
empty
())
{
cout
<<
"Could not load mask image "
<<
original_path3
<<
endl
;
exit
(
0
);
}
Mat
result
;
Point
p
;
p
.
x
=
destination
.
size
().
width
/
2
;
p
.
y
=
destination
.
size
().
height
/
2
;
seamlessClone
(
source
,
destination
,
mask
,
p
,
result
,
3
);
imshow
(
"Output"
,
result
);
imwrite
(
folder
+
"cloned.png"
,
result
);
}
else
if
(
num
==
4
)
{
string
folder
=
"cloning/Color_Change/"
;
string
original_path1
=
folder
+
"source1.png"
;
string
original_path2
=
folder
+
"mask.png"
;
Mat
source
=
imread
(
original_path1
,
IMREAD_COLOR
);
Mat
mask
=
imread
(
original_path2
,
IMREAD_COLOR
);
if
(
source
.
empty
())
{
cout
<<
"Could not load source image "
<<
original_path1
<<
endl
;
exit
(
0
);
}
if
(
mask
.
empty
())
{
cout
<<
"Could not load mask image "
<<
original_path2
<<
endl
;
exit
(
0
);
}
Mat
result
;
colorChange
(
source
,
mask
,
result
,
1.5
,
.5
,
.5
);
imshow
(
"Output"
,
result
);
imwrite
(
folder
+
"cloned.png"
,
result
);
}
else
if
(
num
==
5
)
{
string
folder
=
"cloning/Illumination_Change/"
;
string
original_path1
=
folder
+
"source1.png"
;
string
original_path2
=
folder
+
"mask.png"
;
Mat
source
=
imread
(
original_path1
,
IMREAD_COLOR
);
Mat
mask
=
imread
(
original_path2
,
IMREAD_COLOR
);
if
(
source
.
empty
())
{
cout
<<
"Could not load source image "
<<
original_path1
<<
endl
;
exit
(
0
);
}
if
(
mask
.
empty
())
{
cout
<<
"Could not load mask image "
<<
original_path2
<<
endl
;
exit
(
0
);
}
Mat
result
;
illuminationChange
(
source
,
mask
,
result
,
.2
,
.4
);
imshow
(
"Output"
,
result
);
imwrite
(
folder
+
"cloned.png"
,
result
);
}
else
if
(
num
==
6
)
{
string
folder
=
"cloning/Texture_Flattening/"
;
string
original_path1
=
folder
+
"source1.png"
;
string
original_path2
=
folder
+
"mask.png"
;
Mat
source
=
imread
(
original_path1
,
IMREAD_COLOR
);
Mat
mask
=
imread
(
original_path2
,
IMREAD_COLOR
);
if
(
source
.
empty
())
{
cout
<<
"Could not load source image "
<<
original_path1
<<
endl
;
exit
(
0
);
}
if
(
mask
.
empty
())
{
cout
<<
"Could not load mask image "
<<
original_path2
<<
endl
;
exit
(
0
);
}
Mat
result
;
textureFlattening
(
source
,
mask
,
result
,
30
,
45
,
3
);
imshow
(
"Output"
,
result
);
imwrite
(
folder
+
"cloned.png"
,
result
);
}
waitKey
(
0
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录