Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
35a39c19
Commit
35a39c19
authored
Jul 18, 2013
by
Alexander Shishkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes
parent
a29ce401
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
14 deletions
+13
-14
photo.hpp
modules/photo/include/opencv2/photo.hpp
+1
-1
hdr_fusion.cpp
modules/photo/src/hdr_fusion.cpp
+9
-10
tonemap.cpp
modules/photo/src/tonemap.cpp
+3
-3
No files found.
modules/photo/include/opencv2/photo.hpp
View file @
35a39c19
...
...
@@ -99,7 +99,7 @@ CV_EXPORTS_W void makeHDR(InputArrayOfArrays srcImgs, const std::vector<float>&
CV_EXPORTS_W
void
tonemap
(
InputArray
src
,
OutputArray
dst
,
int
algorithm
,
const
std
::
vector
<
float
>&
params
=
std
::
vector
<
float
>
());
CV_EXPORTS_W
void
exposureFusion
(
InputArrayOfArrays
srcImgs
,
OutputArray
dst
,
bool
align
=
false
,
float
wc
=
1
,
float
ws
=
1
,
float
we
=
0
);
CV_EXPORTS_W
void
exposureFusion
(
InputArrayOfArrays
srcImgs
,
OutputArray
dst
,
bool
align
=
false
,
float
wc
=
1
.0
f
,
float
ws
=
1.0
f
,
float
we
=
0.0
f
);
CV_EXPORTS_W
void
shiftMat
(
InputArray
src
,
Point
shift
,
OutputArray
dst
);
...
...
modules/photo/src/hdr_fusion.cpp
View file @
35a39c19
...
...
@@ -58,13 +58,13 @@ static void triangleWeights(float weights[])
static
void
generateResponce
(
float
responce
[])
{
for
(
int
i
=
0
;
i
<
256
;
i
++
)
{
responce
[
i
]
=
log
((
float
)
i
);
for
(
int
i
=
1
;
i
<
256
;
i
++
)
{
responce
[
i
]
=
log
f
((
float
)
i
);
}
responce
[
0
]
=
responce
[
1
];
}
static
void
checkImages
(
std
::
vector
<
Mat
>&
images
,
bool
hdr
,
const
std
::
vector
<
float
>&
_exp_times
=
std
::
vector
<
float
>
())
static
void
checkImages
(
const
std
::
vector
<
Mat
>&
images
,
bool
hdr
,
const
std
::
vector
<
float
>&
_exp_times
=
std
::
vector
<
float
>
())
{
if
(
images
.
empty
())
{
CV_Error
(
Error
::
StsBadArg
,
"Need at least one image"
);
...
...
@@ -85,7 +85,7 @@ static void checkImages(std::vector<Mat>& images, bool hdr, const std::vector<fl
}
}
static
void
alignImages
(
std
::
vector
<
Mat
>&
src
,
std
::
vector
<
Mat
>&
dst
)
static
void
alignImages
(
const
std
::
vector
<
Mat
>&
src
,
std
::
vector
<
Mat
>&
dst
)
{
dst
.
resize
(
src
.
size
());
...
...
@@ -120,7 +120,7 @@ void makeHDR(InputArrayOfArrays _images, const std::vector<float>& _exp_times, O
}
std
::
vector
<
float
>
exp_times
(
_exp_times
.
size
());
for
(
size_t
i
=
0
;
i
<
exp_times
.
size
();
i
++
)
{
exp_times
[
i
]
=
log
(
_exp_times
[
i
]);
exp_times
[
i
]
=
logf
(
_exp_times
[
i
]);
}
float
weights
[
256
],
responce
[
256
];
...
...
@@ -144,7 +144,7 @@ void makeHDR(InputArrayOfArrays _images, const std::vector<float>& _exp_times, O
}
}
for
(
int
channel
=
0
;
channel
<
3
;
channel
++
)
{
res_ptr
[
channel
]
=
exp
(
sum
[
channel
]
/
weight_sum
);
res_ptr
[
channel
]
=
expf
(
sum
[
channel
]
/
weight_sum
);
if
(
res_ptr
[
channel
]
>
max
)
{
max
=
res_ptr
[
channel
];
}
...
...
@@ -184,7 +184,7 @@ void exposureFusion(InputArrayOfArrays _images, OutputArray _dst, bool align, fl
pow
(
deviation
,
2.0
,
deviation
);
saturation
+=
deviation
;
}
sqrt
(
saturation
,
saturation
);
sqrt
(
saturation
,
saturation
);
wellexp
=
Mat
::
ones
(
gray
.
size
(),
CV_32FC1
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
...
...
@@ -203,7 +203,7 @@ void exposureFusion(InputArrayOfArrays _images, OutputArray _dst, bool align, fl
weights
[
im
]
=
weights
[
im
].
mul
(
wellexp
);
weight_sum
+=
weights
[
im
];
}
int
maxlevel
=
(
int
)(
log
((
double
)
max
(
images
[
0
].
rows
,
images
[
0
].
cols
))
/
log
(
2.0
))
-
1
;
int
maxlevel
=
static_cast
<
int
>
(
logf
(
static_cast
<
float
>
(
max
(
images
[
0
].
rows
,
images
[
0
].
cols
)))
/
logf
(
2.0
))
-
1
;
std
::
vector
<
Mat
>
res_pyr
(
maxlevel
+
1
);
for
(
size_t
im
=
0
;
im
<
images
.
size
();
im
++
)
{
...
...
@@ -242,4 +242,4 @@ void exposureFusion(InputArrayOfArrays _images, OutputArray _dst, bool align, fl
res_pyr
[
0
].
copyTo
(
result
);
}
};
\ No newline at end of file
};
modules/photo/src/tonemap.cpp
View file @
35a39c19
...
...
@@ -40,6 +40,7 @@
//
//M*/
#include "precomp.hpp"
#include "opencv2/photo.hpp"
#include "opencv2/imgproc.hpp"
...
...
@@ -52,8 +53,7 @@ static float getParam(const std::vector<float>& params, size_t i, float defval)
return
params
[
i
];
}
else
{
return
defval
;
}
}
}
static
void
DragoMap
(
Mat
&
src_img
,
Mat
&
dst_img
,
const
std
::
vector
<
float
>&
params
)
...
...
@@ -63,7 +63,7 @@ static void DragoMap(Mat& src_img, Mat &dst_img, const std::vector<float>& param
cvtColor
(
src_img
,
gray_img
,
COLOR_RGB2GRAY
);
Mat
log_img
;
log
(
gray_img
,
log_img
);
float
mean
=
exp
((
float
)
sum
(
log_img
)[
0
]
/
log_img
.
total
());
float
mean
=
exp
f
(
static_cast
<
float
>
(
sum
(
log_img
)[
0
])
/
log_img
.
total
());
gray_img
/=
mean
;
log_img
.
release
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment