Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
9c3e86b7
Commit
9c3e86b7
authored
Jan 12, 2020
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
parents
648db235
b639795a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
19 deletions
+51
-19
sparse_matching_gpc.cpp
modules/optflow/src/sparse_matching_gpc.cpp
+1
-0
tutorial_customizing_cn_tracker.cpp
modules/tracking/samples/tutorial_customizing_cn_tracker.cpp
+0
-1
tutorial_customizing_cn_tracker.markdown
...acking/tutorials/tutorial_customizing_cn_tracker.markdown
+1
-1
tonemap.hpp
modules/xphoto/include/opencv2/xphoto/tonemap.hpp
+3
-3
learning_based_color_balance.cpp
modules/xphoto/src/learning_based_color_balance.cpp
+18
-14
test_hdr.cpp
modules/xphoto/test/test_hdr.cpp
+28
-0
No files found.
modules/optflow/src/sparse_matching_gpc.cpp
View file @
9c3e86b7
...
...
@@ -41,6 +41,7 @@
//M*/
#include "precomp.hpp"
#undef CV_FORCE_SIMD128_CPP // mixed HAL SIMD/SSE code
#include "opencv2/core/core_c.h"
#include "opencv2/core/private.hpp"
#include "opencv2/flann/miniflann.hpp"
...
...
modules/tracking/samples/tutorial_customizing_cn_tracker.cpp
View file @
9c3e86b7
...
...
@@ -123,7 +123,6 @@ void sobelExtractor(const Mat img, const Rect roi, Mat& feat){
//! [sobel]
//! [postprocess]
feat
.
convertTo
(
feat
,
CV_64F
);
feat
=
feat
/
255.0
-
0.5
;
// normalize to range -0.5 .. 0.5
//! [postprocess]
}
modules/tracking/tutorials/tutorial_customizing_cn_tracker.markdown
View file @
9c3e86b7
...
...
@@ -68,6 +68,6 @@ If you need a more detailed information to use @ref cv::Tracker, please refer to
-#
**Post processing**
Make sure to
convert the feature into @ref cv::CV_64F data format and normalize its valu
e with range -0.5 to 0.5
Make sure to
normalize the featur
e with range -0.5 to 0.5
@snippet tracking/samples/tutorial_customizing_cn_tracker.cpp postprocess
modules/xphoto/include/opencv2/xphoto/tonemap.hpp
View file @
9c3e86b7
...
...
@@ -46,11 +46,11 @@ You need to set the OPENCV_ENABLE_NONFREE option in cmake to use those. Use them
@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
@param sigma_
color
bilateral filter sigma in color space
@param sigma_
space
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
);
createTonemapDurand
(
float
gamma
=
1.0
f
,
float
contrast
=
4.0
f
,
float
saturation
=
1.0
f
,
float
sigma_
color
=
2.0
f
,
float
sigma_space
=
2.0
f
);
}}
// namespace
#endif // OPENCV_XPHOTO_TONEMAP_HPP
modules/xphoto/src/learning_based_color_balance.cpp
View file @
9c3e86b7
...
...
@@ -262,26 +262,26 @@ void LearningBasedWBImpl::getAverageAndBrightestColorChromaticity(Vec2f &average
uint
sumB
=
0
,
sumG
=
0
,
sumR
=
0
;
uchar
*
src_ptr
=
src
.
ptr
<
uchar
>
();
#if CV_SIMD128
v_uint8x16
v_inB
,
v_inG
,
v_inR
,
v_mask
;
v_uint16x8
v_sR1
,
v_sR2
,
v_sG1
,
v_sG2
,
v_sB1
,
v_sB2
,
v_sum
;
v_uint16x8
v_max_sum
=
v_setall_u16
(
0
),
v_max_mask
,
v_brightestR
,
v_brightestG
,
v_brightestB
;
v_uint32x4
v_uint1
,
v_uint2
,
v_SB
=
v_setzero_u32
(),
v_SG
=
v_setzero_u32
(),
v_SR
=
v_setzero_u32
();
v_uint16x8
v_max_sum
=
v_setall_u16
(
0
),
v_brightestR
=
v_setall_u16
(
0
),
v_brightestG
=
v_setall_u16
(
0
),
v_brightestB
=
v_setall_u16
(
0
);
v_uint32x4
v_SB
=
v_setzero_u32
(),
v_SG
=
v_setzero_u32
(),
v_SR
=
v_setzero_u32
();
for
(;
i
<
src_len
-
15
;
i
+=
16
)
{
v_uint8x16
v_inB
,
v_inG
,
v_inR
;
v_load_deinterleave
(
src_ptr
+
3
*
i
,
v_inB
,
v_inG
,
v_inR
);
v_mask
=
v_load
(
mask_ptr
+
i
);
v_
uint8x16
v_
mask
=
v_load
(
mask_ptr
+
i
);
v_inB
&=
v_mask
;
v_inG
&=
v_mask
;
v_inR
&=
v_mask
;
v_uint16x8
v_sR1
,
v_sR2
,
v_sG1
,
v_sG2
,
v_sB1
,
v_sB2
;
v_expand
(
v_inB
,
v_sB1
,
v_sB2
);
v_expand
(
v_inG
,
v_sG1
,
v_sG2
);
v_expand
(
v_inR
,
v_sR1
,
v_sR2
);
// update the brightest (R,G,B) tuple (process left half):
v_sum
=
v_sB1
+
v_sG1
+
v_sR1
;
v_max_mask
=
(
v_sum
>
v_max_sum
);
v_
uint16x8
v_
sum
=
v_sB1
+
v_sG1
+
v_sR1
;
v_
uint16x8
v_
max_mask
=
(
v_sum
>
v_max_sum
);
v_max_sum
=
v_max
(
v_sum
,
v_max_sum
);
v_brightestB
=
(
v_sB1
&
v_max_mask
)
+
(
v_brightestB
&
(
~
v_max_mask
));
v_brightestG
=
(
v_sG1
&
v_max_mask
)
+
(
v_brightestG
&
(
~
v_max_mask
));
...
...
@@ -299,6 +299,8 @@ void LearningBasedWBImpl::getAverageAndBrightestColorChromaticity(Vec2f &average
v_sB1
=
v_sB1
+
v_sB2
;
v_sG1
=
v_sG1
+
v_sG2
;
v_sR1
=
v_sR1
+
v_sR2
;
v_uint32x4
v_uint1
,
v_uint2
;
v_expand
(
v_sB1
,
v_uint1
,
v_uint2
);
v_SB
+=
v_uint1
+
v_uint2
;
v_expand
(
v_sG1
,
v_uint1
,
v_uint2
);
...
...
@@ -351,27 +353,28 @@ void LearningBasedWBImpl::getAverageAndBrightestColorChromaticity(Vec2f &average
uint64
sumB
=
0
,
sumG
=
0
,
sumR
=
0
;
ushort
*
src_ptr
=
src
.
ptr
<
ushort
>
();
#if CV_SIMD128
v_uint16x8
v_inB
,
v_inG
,
v_inR
,
v_mask
,
v_mask_lower
=
v_setall_u16
(
255
);
v_uint32x4
v_iR1
,
v_iR2
,
v_iG1
,
v_iG2
,
v_iB1
,
v_iB2
,
v_sum
;
v_uint32x4
v_max_sum
=
v_setall_u32
(
0
),
v_max_mask
,
v_brightestR
,
v_brightestG
,
v_brightestB
;
v_uint64x2
v_uint64_1
,
v_uint64_2
,
v_SB
=
v_setzero_u64
(),
v_SG
=
v_setzero_u64
(),
v_SR
=
v_setzero_u64
();
const
v_uint16x8
v_mask_lower
=
v_setall_u16
(
255
);
v_uint32x4
v_max_sum
=
v_setall_u32
(
0
),
v_brightestR
=
v_setall_u32
(
0
),
v_brightestG
=
v_setall_u32
(
0
),
v_brightestB
=
v_setall_u32
(
0
);
v_uint64x2
v_SB
=
v_setzero_u64
(),
v_SG
=
v_setzero_u64
(),
v_SR
=
v_setzero_u64
();
for
(;
i
<
src_len
-
7
;
i
+=
8
)
{
v_uint16x8
v_inB
,
v_inG
,
v_inR
;
v_load_deinterleave
(
src_ptr
+
3
*
i
,
v_inB
,
v_inG
,
v_inR
);
v_mask
=
v_load_expand
(
mask_ptr
+
i
);
v_
uint16x8
v_
mask
=
v_load_expand
(
mask_ptr
+
i
);
v_mask
=
v_mask
|
((
v_mask
&
v_mask_lower
)
<<
8
);
v_inB
&=
v_mask
;
v_inG
&=
v_mask
;
v_inR
&=
v_mask
;
v_uint32x4
v_iR1
,
v_iR2
,
v_iG1
,
v_iG2
,
v_iB1
,
v_iB2
;
v_expand
(
v_inB
,
v_iB1
,
v_iB2
);
v_expand
(
v_inG
,
v_iG1
,
v_iG2
);
v_expand
(
v_inR
,
v_iR1
,
v_iR2
);
// update the brightest (R,G,B) tuple (process left half):
v_sum
=
v_iB1
+
v_iG1
+
v_iR1
;
v_max_mask
=
(
v_sum
>
v_max_sum
);
v_
uint32x4
v_
sum
=
v_iB1
+
v_iG1
+
v_iR1
;
v_
uint32x4
v_
max_mask
=
(
v_sum
>
v_max_sum
);
v_max_sum
=
v_max
(
v_sum
,
v_max_sum
);
v_brightestB
=
(
v_iB1
&
v_max_mask
)
+
(
v_brightestB
&
(
~
v_max_mask
));
v_brightestG
=
(
v_iG1
&
v_max_mask
)
+
(
v_brightestG
&
(
~
v_max_mask
));
...
...
@@ -389,6 +392,7 @@ void LearningBasedWBImpl::getAverageAndBrightestColorChromaticity(Vec2f &average
v_iB1
=
v_iB1
+
v_iB2
;
v_iG1
=
v_iG1
+
v_iG2
;
v_iR1
=
v_iR1
+
v_iR2
;
v_uint64x2
v_uint64_1
,
v_uint64_2
;
v_expand
(
v_iB1
,
v_uint64_1
,
v_uint64_2
);
v_SB
+=
v_uint64_1
+
v_uint64_2
;
v_expand
(
v_iG1
,
v_uint64_1
,
v_uint64_2
);
...
...
modules/xphoto/test/test_hdr.cpp
View file @
9c3e86b7
...
...
@@ -38,6 +38,34 @@ TEST(Photo_Tonemap, Durand_regression)
checkEqual
(
result
,
expected
,
3
,
"Durand"
);
}
TEST
(
Photo_Tonemap
,
Durand_property_regression
)
{
const
float
gamma
=
1.0
f
;
const
float
contrast
=
2.0
f
;
const
float
saturation
=
3.0
f
;
const
float
sigma_color
=
4.0
f
;
const
float
sigma_space
=
5.0
f
;
const
Ptr
<
TonemapDurand
>
durand1
=
createTonemapDurand
(
gamma
,
contrast
,
saturation
,
sigma_color
,
sigma_space
);
ASSERT_EQ
(
gamma
,
durand1
->
getGamma
());
ASSERT_EQ
(
contrast
,
durand1
->
getContrast
());
ASSERT_EQ
(
saturation
,
durand1
->
getSaturation
());
ASSERT_EQ
(
sigma_space
,
durand1
->
getSigmaSpace
());
ASSERT_EQ
(
sigma_color
,
durand1
->
getSigmaColor
());
const
Ptr
<
TonemapDurand
>
durand2
=
createTonemapDurand
();
durand2
->
setGamma
(
gamma
);
durand2
->
setContrast
(
contrast
);
durand2
->
setSaturation
(
saturation
);
durand2
->
setSigmaColor
(
sigma_color
);
durand2
->
setSigmaSpace
(
sigma_space
);
ASSERT_EQ
(
gamma
,
durand2
->
getGamma
());
ASSERT_EQ
(
contrast
,
durand2
->
getContrast
());
ASSERT_EQ
(
saturation
,
durand2
->
getSaturation
());
ASSERT_EQ
(
sigma_color
,
durand2
->
getSigmaColor
());
ASSERT_EQ
(
sigma_space
,
durand2
->
getSigmaSpace
());
}
#endif // OPENCV_ENABLE_NONFREE
}}
// namespace
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