Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
838624bf
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,发现更多精彩内容 >>
提交
838624bf
编写于
12月 05, 2018
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13362 from alalek:photo_move_durand_contrib
上级
aee865fe
742f22c0
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
7 addition
and
151 deletion
+7
-151
doc/opencv.bib
doc/opencv.bib
+0
-11
doc/py_tutorials/py_photo/py_hdr/py_hdr.markdown
doc/py_tutorials/py_photo/py_hdr/py_hdr.markdown
+2
-4
doc/tutorials/photo/hdr_imaging/hdr_imaging.markdown
doc/tutorials/photo/hdr_imaging/hdr_imaging.markdown
+1
-1
modules/photo/include/opencv2/photo.hpp
modules/photo/include/opencv2/photo.hpp
+0
-37
modules/photo/src/tonemap.cpp
modules/photo/src/tonemap.cpp
+0
-88
modules/photo/test/test_hdr.cpp
modules/photo/test/test_hdr.cpp
+0
-6
samples/cpp/tutorial_code/photo/hdr_imaging/hdr_imaging.cpp
samples/cpp/tutorial_code/photo/hdr_imaging/hdr_imaging.cpp
+1
-1
samples/java/tutorial_code/photo/hdr_imaging/HDRImagingDemo.java
.../java/tutorial_code/photo/hdr_imaging/HDRImagingDemo.java
+2
-2
samples/python/tutorial_code/photo/hdr_imaging/hdr_imaging.py
...les/python/tutorial_code/photo/hdr_imaging/hdr_imaging.py
+1
-1
未找到文件。
doc/opencv.bib
浏览文件 @
838624bf
...
...
@@ -180,17 +180,6 @@
volume
=
{9}
,
publisher
=
{Walter de Gruyter}
}
@inproceedings
{
DD02
,
author
=
{Durand, Fr{\'e}do and Dorsey, Julie}
,
title
=
{Fast bilateral filtering for the display of high-dynamic-range images}
,
booktitle
=
{ACM Transactions on Graphics (TOG)}
,
year
=
{2002}
,
pages
=
{257--266}
,
volume
=
{21}
,
number
=
{3}
,
publisher
=
{ACM}
,
url
=
{https://www.researchgate.net/profile/Julie_Dorsey/publication/220184746_Fast_Bilateral_Filtering_for_the_Display_of_High_-_dynamic_-_range_Images/links/54566b000cf26d5090a95f96/Fast-Bilateral-Filtering-for-the-Display-of-High-dynamic-range-Images.pdf}
}
@inproceedings
{
DM03
,
author
=
{Drago, Fr{\'e}d{\'e}ric and Myszkowski, Karol and Annen, Thomas and Chiba, Norishige}
,
title
=
{Adaptive logarithmic mapping for displaying high contrast scenes}
,
...
...
doc/py_tutorials/py_photo/py_hdr/py_hdr.markdown
浏览文件 @
838624bf
...
...
@@ -85,10 +85,8 @@ we will later have to clip the data in order to avoid overflow.
@code{.py}
# Tonemap HDR image
tonemap1 = cv.createTonemap
Durand
(gamma=2.2)
tonemap1 = cv.createTonemap(gamma=2.2)
res_debevec = tonemap1.process(hdr_debevec.copy())
tonemap2 = cv.createTonemapDurand(gamma=1.3)
res_robertson = tonemap2.process(hdr_robertson.copy())
@endcode
### 4. Merge exposures using Mertens fusion
...
...
@@ -173,5 +171,5 @@ Additional Resources
Exercises
---------
1.
Try all tonemap algorithms: cv::TonemapDrago, cv::Tonemap
Durand, cv::Tonemap
Mantiuk and cv::TonemapReinhard
1.
Try all tonemap algorithms: cv::TonemapDrago, cv::TonemapMantiuk and cv::TonemapReinhard
2.
Try changing the parameters in the HDR calibration and tonemap methods.
doc/tutorials/photo/hdr_imaging/hdr_imaging.markdown
浏览文件 @
838624bf
...
...
@@ -171,7 +171,7 @@ Now it's time to look at the results. Note that HDR image can't be stored in one
formats, so we save it to Radiance image (.hdr). Also all HDR imaging functions return results in
[0, 1] range so we should multiply result by 255.
You can try other tonemap algorithms: cv::TonemapDrago, cv::Tonemap
Durand, cv::Tonemap
Mantiuk and cv::TonemapReinhard
You can try other tonemap algorithms: cv::TonemapDrago, cv::TonemapMantiuk and cv::TonemapReinhard
You can also adjust the parameters in the HDR calibration and tonemap methods for your own photos.
Results
...
...
modules/photo/include/opencv2/photo.hpp
浏览文件 @
838624bf
...
...
@@ -376,43 +376,6 @@ results, default value is 0.85.
*/
CV_EXPORTS_W
Ptr
<
TonemapDrago
>
createTonemapDrago
(
float
gamma
=
1.0
f
,
float
saturation
=
1.0
f
,
float
bias
=
0.85
f
);
/** @brief This algorithm decomposes image into two layers: base layer and detail layer using bilateral filter
and compresses contrast of the base layer thus preserving all the details.
This implementation uses regular bilateral filter from opencv.
Saturation enhancement is possible as in ocvTonemapDrago.
For more information see @cite DD02 .
*/
class
CV_EXPORTS_W
TonemapDurand
:
public
Tonemap
{
public:
CV_WRAP
virtual
float
getSaturation
()
const
=
0
;
CV_WRAP
virtual
void
setSaturation
(
float
saturation
)
=
0
;
CV_WRAP
virtual
float
getContrast
()
const
=
0
;
CV_WRAP
virtual
void
setContrast
(
float
contrast
)
=
0
;
CV_WRAP
virtual
float
getSigmaSpace
()
const
=
0
;
CV_WRAP
virtual
void
setSigmaSpace
(
float
sigma_space
)
=
0
;
CV_WRAP
virtual
float
getSigmaColor
()
const
=
0
;
CV_WRAP
virtual
void
setSigmaColor
(
float
sigma_color
)
=
0
;
};
/** @brief Creates TonemapDurand object
@param gamma gamma value for gamma correction. See createTonemap
@param contrast resulting contrast on logarithmic scale, i. e. log(max / min), where max and min
are maximum and minimum luminance values of the resulting image.
@param saturation saturation enhancement value. See createTonemapDrago
@param sigma_space bilateral filter sigma in color space
@param sigma_color bilateral filter sigma in coordinate space
*/
CV_EXPORTS_W
Ptr
<
TonemapDurand
>
createTonemapDurand
(
float
gamma
=
1.0
f
,
float
contrast
=
4.0
f
,
float
saturation
=
1.0
f
,
float
sigma_space
=
2.0
f
,
float
sigma_color
=
2.0
f
);
/** @brief This is a global tonemapping operator that models human visual system.
...
...
modules/photo/src/tonemap.cpp
浏览文件 @
838624bf
...
...
@@ -193,94 +193,6 @@ Ptr<TonemapDrago> createTonemapDrago(float gamma, float saturation, float bias)
return
makePtr
<
TonemapDragoImpl
>
(
gamma
,
saturation
,
bias
);
}
class
TonemapDurandImpl
CV_FINAL
:
public
TonemapDurand
{
public:
TonemapDurandImpl
(
float
_gamma
,
float
_contrast
,
float
_saturation
,
float
_sigma_color
,
float
_sigma_space
)
:
name
(
"TonemapDurand"
),
gamma
(
_gamma
),
contrast
(
_contrast
),
saturation
(
_saturation
),
sigma_color
(
_sigma_color
),
sigma_space
(
_sigma_space
)
{
}
void
process
(
InputArray
_src
,
OutputArray
_dst
)
CV_OVERRIDE
{
CV_INSTRUMENT_REGION
();
Mat
src
=
_src
.
getMat
();
CV_Assert
(
!
src
.
empty
());
_dst
.
create
(
src
.
size
(),
CV_32FC3
);
Mat
img
=
_dst
.
getMat
();
Ptr
<
Tonemap
>
linear
=
createTonemap
(
1.0
f
);
linear
->
process
(
src
,
img
);
Mat
gray_img
;
cvtColor
(
img
,
gray_img
,
COLOR_RGB2GRAY
);
Mat
log_img
;
log_
(
gray_img
,
log_img
);
Mat
map_img
;
bilateralFilter
(
log_img
,
map_img
,
-
1
,
sigma_color
,
sigma_space
);
double
min
,
max
;
minMaxLoc
(
map_img
,
&
min
,
&
max
);
float
scale
=
contrast
/
static_cast
<
float
>
(
max
-
min
);
exp
(
map_img
*
(
scale
-
1.0
f
)
+
log_img
,
map_img
);
log_img
.
release
();
mapLuminance
(
img
,
img
,
gray_img
,
map_img
,
saturation
);
pow
(
img
,
1.0
f
/
gamma
,
img
);
}
float
getGamma
()
const
CV_OVERRIDE
{
return
gamma
;
}
void
setGamma
(
float
val
)
CV_OVERRIDE
{
gamma
=
val
;
}
float
getSaturation
()
const
CV_OVERRIDE
{
return
saturation
;
}
void
setSaturation
(
float
val
)
CV_OVERRIDE
{
saturation
=
val
;
}
float
getContrast
()
const
CV_OVERRIDE
{
return
contrast
;
}
void
setContrast
(
float
val
)
CV_OVERRIDE
{
contrast
=
val
;
}
float
getSigmaColor
()
const
CV_OVERRIDE
{
return
sigma_color
;
}
void
setSigmaColor
(
float
val
)
CV_OVERRIDE
{
sigma_color
=
val
;
}
float
getSigmaSpace
()
const
CV_OVERRIDE
{
return
sigma_space
;
}
void
setSigmaSpace
(
float
val
)
CV_OVERRIDE
{
sigma_space
=
val
;
}
void
write
(
FileStorage
&
fs
)
const
CV_OVERRIDE
{
writeFormat
(
fs
);
fs
<<
"name"
<<
name
<<
"gamma"
<<
gamma
<<
"contrast"
<<
contrast
<<
"sigma_color"
<<
sigma_color
<<
"sigma_space"
<<
sigma_space
<<
"saturation"
<<
saturation
;
}
void
read
(
const
FileNode
&
fn
)
CV_OVERRIDE
{
FileNode
n
=
fn
[
"name"
];
CV_Assert
(
n
.
isString
()
&&
String
(
n
)
==
name
);
gamma
=
fn
[
"gamma"
];
contrast
=
fn
[
"contrast"
];
sigma_color
=
fn
[
"sigma_color"
];
sigma_space
=
fn
[
"sigma_space"
];
saturation
=
fn
[
"saturation"
];
}
protected:
String
name
;
float
gamma
,
contrast
,
saturation
,
sigma_color
,
sigma_space
;
};
Ptr
<
TonemapDurand
>
createTonemapDurand
(
float
gamma
,
float
contrast
,
float
saturation
,
float
sigma_color
,
float
sigma_space
)
{
return
makePtr
<
TonemapDurandImpl
>
(
gamma
,
contrast
,
saturation
,
sigma_color
,
sigma_space
);
}
class
TonemapReinhardImpl
CV_FINAL
:
public
TonemapReinhard
{
public:
...
...
modules/photo/test/test_hdr.cpp
浏览文件 @
838624bf
...
...
@@ -105,12 +105,6 @@ TEST(Photo_Tonemap, regression)
result
.
convertTo
(
result
,
CV_8UC3
,
255
);
checkEqual
(
result
,
expected
,
3
,
"Drago"
);
Ptr
<
TonemapDurand
>
durand
=
createTonemapDurand
(
gamma
);
durand
->
process
(
img
,
result
);
loadImage
(
test_path
+
"durand.png"
,
expected
);
result
.
convertTo
(
result
,
CV_8UC3
,
255
);
checkEqual
(
result
,
expected
,
3
,
"Durand"
);
Ptr
<
TonemapReinhard
>
reinhard
=
createTonemapReinhard
(
gamma
);
reinhard
->
process
(
img
,
result
);
loadImage
(
test_path
+
"reinhard.png"
,
expected
);
...
...
samples/cpp/tutorial_code/photo/hdr_imaging/hdr_imaging.cpp
浏览文件 @
838624bf
...
...
@@ -35,7 +35,7 @@ int main(int argc, char**argv)
//! [Tonemap HDR image]
Mat
ldr
;
Ptr
<
Tonemap
Durand
>
tonemap
=
createTonemapDurand
(
2.2
f
);
Ptr
<
Tonemap
>
tonemap
=
createTonemap
(
2.2
f
);
tonemap
->
process
(
hdr
,
ldr
);
//! [Tonemap HDR image]
...
...
samples/java/tutorial_code/photo/hdr_imaging/HDRImagingDemo.java
浏览文件 @
838624bf
...
...
@@ -13,7 +13,7 @@ import org.opencv.photo.CalibrateDebevec;
import
org.opencv.photo.MergeDebevec
;
import
org.opencv.photo.MergeMertens
;
import
org.opencv.photo.Photo
;
import
org.opencv.photo.Tonemap
Durand
;
import
org.opencv.photo.Tonemap
;
class
HDRImaging
{
public
void
loadExposureSeq
(
String
path
,
List
<
Mat
>
images
,
List
<
Float
>
times
)
{
...
...
@@ -71,7 +71,7 @@ class HDRImaging {
//! [Tonemap HDR image]
Mat
ldr
=
new
Mat
();
Tonemap
Durand
tonemap
=
Photo
.
createTonemapDurand
(
2.2f
,
4.0f
,
1.0f
,
2.0f
,
2.0
f
);
Tonemap
tonemap
=
Photo
.
createTonemap
(
2.2
f
);
tonemap
.
process
(
hdr
,
ldr
);
//! [Tonemap HDR image]
...
...
samples/python/tutorial_code/photo/hdr_imaging/hdr_imaging.py
浏览文件 @
838624bf
...
...
@@ -40,7 +40,7 @@ hdr = merge_debevec.process(images, times, response)
## [Make HDR image]
## [Tonemap HDR image]
tonemap
=
cv
.
createTonemap
Durand
(
2.2
)
tonemap
=
cv
.
createTonemap
(
2.2
)
ldr
=
tonemap
.
process
(
hdr
)
## [Tonemap HDR image]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录