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
30669702
Commit
30669702
authored
Sep 06, 2017
by
Maksim Shabunin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1352 from alalek:type_traits_issue_7599
parents
5472ac07
e242e87e
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
75 additions
and
72 deletions
+75
-72
bgfg_gmg.cpp
modules/bgsegm/src/bgfg_gmg.cpp
+11
-11
ccalib.hpp
modules/ccalib/include/opencv2/ccalib.hpp
+1
-1
ccalib.cpp
modules/ccalib/src/ccalib.cpp
+2
-2
simpleflow.cpp
modules/optflow/src/simpleflow.cpp
+1
-1
linemod.hpp
modules/rgbd/include/opencv2/rgbd/linemod.hpp
+1
-1
FilterTIG.cpp
modules/saliency/src/BING/FilterTIG.cpp
+17
-14
structured_light.hpp
...ght/include/opencv2/structured_light/structured_light.hpp
+1
-1
graycodepattern.cpp
modules/structured_light/src/graycodepattern.cpp
+3
-3
sinusoidalpattern.cpp
modules/structured_light/src/sinusoidalpattern.cpp
+2
-2
dtfilter_cpu.inl.hpp
modules/ximgproc/src/dtfilter_cpu.inl.hpp
+23
-23
fgs_filter.cpp
modules/ximgproc/src/fgs_filter.cpp
+7
-7
joint_bilateral_filter.cpp
modules/ximgproc/src/joint_bilateral_filter.cpp
+2
-2
test_domain_transform.cpp
modules/ximgproc/test/test_domain_transform.cpp
+1
-1
test_joint_bilateral_filter.cpp
modules/ximgproc/test/test_joint_bilateral_filter.cpp
+1
-1
test_structured_edge_detection.cpp
modules/ximgproc/test/test_structured_edge_detection.cpp
+2
-2
No files found.
modules/bgsegm/src/bgfg_gmg.cpp
View file @
30669702
...
...
@@ -194,7 +194,7 @@ private:
String
name_
;
Mat_
<
int
>
nfeatures_
;
Mat_
<
unsigned
int
>
colors_
;
Mat_
<
int
>
colors_
;
Mat_
<
float
>
weights_
;
Mat
buf_
;
...
...
@@ -223,7 +223,7 @@ void BackgroundSubtractorGMGImpl::initialize(Size frameSize, double minVal, doub
nfeatures_
.
setTo
(
Scalar
::
all
(
0
));
}
static
float
findFeature
(
unsigned
int
color
,
const
unsigned
int
*
colors
,
const
float
*
weights
,
int
nfeatures
)
static
float
findFeature
(
int
color
,
const
int
*
colors
,
const
float
*
weights
,
int
nfeatures
)
{
for
(
int
i
=
0
;
i
<
nfeatures
;
++
i
)
{
...
...
@@ -248,7 +248,7 @@ static void normalizeHistogram(float* weights, int nfeatures)
}
}
static
bool
insertFeature
(
unsigned
int
color
,
float
weight
,
unsigned
int
*
colors
,
float
*
weights
,
int
&
nfeatures
,
int
maxFeatures
)
static
bool
insertFeature
(
int
color
,
float
weight
,
int
*
colors
,
float
*
weights
,
int
&
nfeatures
,
int
maxFeatures
)
{
int
idx
=
-
1
;
for
(
int
i
=
0
;
i
<
nfeatures
;
++
i
)
...
...
@@ -266,7 +266,7 @@ static bool insertFeature(unsigned int color, float weight, unsigned int* colors
{
// move feature to beginning of list
::
memmove
(
colors
+
1
,
colors
,
idx
*
sizeof
(
unsigned
int
));
::
memmove
(
colors
+
1
,
colors
,
idx
*
sizeof
(
int
));
::
memmove
(
weights
+
1
,
weights
,
idx
*
sizeof
(
float
));
colors
[
0
]
=
color
;
...
...
@@ -276,7 +276,7 @@ static bool insertFeature(unsigned int color, float weight, unsigned int* colors
{
// discard oldest feature
::
memmove
(
colors
+
1
,
colors
,
(
nfeatures
-
1
)
*
sizeof
(
unsigned
int
));
::
memmove
(
colors
+
1
,
colors
,
(
nfeatures
-
1
)
*
sizeof
(
int
));
::
memmove
(
weights
+
1
,
weights
,
(
nfeatures
-
1
)
*
sizeof
(
float
));
colors
[
0
]
=
color
;
...
...
@@ -297,7 +297,7 @@ static bool insertFeature(unsigned int color, float weight, unsigned int* colors
template
<
typename
T
>
struct
Quantization
{
static
unsigned
int
apply
(
const
void
*
src_
,
int
x
,
int
cn
,
double
minVal
,
double
maxVal
,
int
quantizationLevels
)
static
int
apply
(
const
void
*
src_
,
int
x
,
int
cn
,
double
minVal
,
double
maxVal
,
int
quantizationLevels
)
{
const
T
*
src
=
static_cast
<
const
T
*>
(
src_
);
src
+=
x
*
cn
;
...
...
@@ -313,7 +313,7 @@ template <typename T> struct Quantization
class
GMG_LoopBody
:
public
ParallelLoopBody
{
public
:
GMG_LoopBody
(
const
Mat
&
frame
,
const
Mat
&
fgmask
,
const
Mat_
<
int
>&
nfeatures
,
const
Mat_
<
unsigned
int
>&
colors
,
const
Mat_
<
float
>&
weights
,
GMG_LoopBody
(
const
Mat
&
frame
,
const
Mat
&
fgmask
,
const
Mat_
<
int
>&
nfeatures
,
const
Mat_
<
int
>&
colors
,
const
Mat_
<
float
>&
weights
,
int
maxFeatures
,
double
learningRate
,
int
numInitializationFrames
,
int
quantizationLevels
,
double
backgroundPrior
,
double
decisionThreshold
,
double
maxVal
,
double
minVal
,
int
frameNum
,
bool
updateBackgroundModel
)
:
frame_
(
frame
),
fgmask_
(
fgmask
),
nfeatures_
(
nfeatures
),
colors_
(
colors
),
weights_
(
weights
),
...
...
@@ -331,7 +331,7 @@ private:
mutable
Mat_
<
uchar
>
fgmask_
;
mutable
Mat_
<
int
>
nfeatures_
;
mutable
Mat_
<
unsigned
int
>
colors_
;
mutable
Mat_
<
int
>
colors_
;
mutable
Mat_
<
float
>
weights_
;
int
maxFeatures_
;
...
...
@@ -349,7 +349,7 @@ private:
void
GMG_LoopBody
::
operator
()
(
const
Range
&
range
)
const
{
typedef
unsigned
int
(
*
func_t
)(
const
void
*
src_
,
int
x
,
int
cn
,
double
minVal
,
double
maxVal
,
int
quantizationLevels
);
typedef
int
(
*
func_t
)(
const
void
*
src_
,
int
x
,
int
cn
,
double
minVal
,
double
maxVal
,
int
quantizationLevels
);
static
const
func_t
funcs
[]
=
{
Quantization
<
uchar
>::
apply
,
...
...
@@ -375,10 +375,10 @@ void GMG_LoopBody::operator() (const Range& range) const
for
(
int
x
=
0
;
x
<
frame_
.
cols
;
++
x
,
++
featureIdx
)
{
int
nfeatures
=
nfeatures_row
[
x
];
unsigned
int
*
colors
=
colors_
[
featureIdx
];
int
*
colors
=
colors_
[
featureIdx
];
float
*
weights
=
weights_
[
featureIdx
];
unsigned
int
newFeatureColor
=
func
(
frame_row
,
x
,
cn
,
minVal_
,
maxVal_
,
quantizationLevels_
);
int
newFeatureColor
=
func
(
frame_row
,
x
,
cn
,
minVal_
,
maxVal_
,
quantizationLevels_
);
bool
isForeground
=
false
;
...
...
modules/ccalib/include/opencv2/ccalib.hpp
View file @
30669702
...
...
@@ -71,7 +71,7 @@ public:
bool
isInitialized
();
void
getPatternPoints
(
OutputArray
original_points
);
void
getPatternPoints
(
std
::
vector
<
KeyPoint
>&
original_points
);
/**<
Returns a vector<Point> of the original points.
*/
...
...
modules/ccalib/src/ccalib.cpp
View file @
30669702
...
...
@@ -405,9 +405,9 @@ bool CustomPattern::findPattern(InputArray image, OutputArray matched_features,
return
(
!
m_ftrs
.
empty
());
}
void
CustomPattern
::
getPatternPoints
(
OutputArray
original_points
)
void
CustomPattern
::
getPatternPoints
(
std
::
vector
<
KeyPoint
>&
original_points
)
{
return
Mat
(
keypoints
).
copyTo
(
original_points
)
;
original_points
=
keypoints
;
}
double
CustomPattern
::
getPixelSize
()
...
...
modules/optflow/src/simpleflow.cpp
View file @
30669702
...
...
@@ -131,7 +131,7 @@ public:
flag
(
flag_
),
spaceWeights
(
spaceWeights_
),
expLut
(
expLut_
)
{
CV_DbgAssert
(
joint
.
type
()
==
JointVec
::
type
&&
confidence
.
type
()
==
CV_32F
&&
src
.
type
()
==
dst
.
type
()
&&
src
.
type
()
==
SrcVec
::
typ
e
);
CV_DbgAssert
(
joint
.
type
()
==
traits
::
Type
<
JointVec
>::
value
&&
confidence
.
type
()
==
CV_32F
&&
src
.
type
()
==
dst
.
type
()
&&
src
.
type
()
==
traits
::
Type
<
SrcVec
>::
valu
e
);
CV_DbgAssert
(
joint
.
rows
==
src
.
rows
&&
confidence
.
rows
==
src
.
rows
&&
src
.
rows
==
dst
.
rows
+
2
*
radius
);
CV_DbgAssert
(
joint
.
cols
==
src
.
cols
&&
confidence
.
cols
==
src
.
cols
&&
src
.
cols
==
dst
.
cols
+
2
*
radius
);
}
...
...
modules/rgbd/include/opencv2/rgbd/linemod.hpp
View file @
30669702
...
...
@@ -80,7 +80,7 @@ struct CV_EXPORTS_W_SIMPLE Template
CV_PROP
int
width
;
CV_PROP
int
height
;
CV_PROP
int
pyramid_level
;
CV_PROP
std
::
vector
<
Feature
>
features
;
std
::
vector
<
Feature
>
features
;
// FIXIT: CV_PROP
void
read
(
const
FileNode
&
fn
);
void
write
(
FileStorage
&
fs
)
const
;
...
...
modules/saliency/src/BING/FilterTIG.cpp
View file @
30669702
...
...
@@ -47,19 +47,22 @@ namespace cv
namespace
saliency
{
typedef
int64_t
TIG_TYPE
;
typedef
double
MAT_TIG_TYPE
;
// cv::Mat has no native support for int64/uint64
struct
TIGbits
{
TIGbits
()
:
bc0
(
0
),
bc1
(
0
)
{}
inline
void
accumulate
(
int64_t
tig
,
int64_t
tigMask0
,
int64_t
tigMask1
,
uchar
shift
)
inline
void
accumulate
(
TIG_TYPE
tig
,
TIG_TYPE
tigMask0
,
TIG_TYPE
tigMask1
,
uchar
shift
)
{
bc0
+=
((
POPCNT64
(
tigMask0
&
tig
)
<<
1
)
-
POPCNT64
(
tig
))
<<
shift
;
bc1
+=
((
POPCNT64
(
tigMask1
&
tig
)
<<
1
)
-
POPCNT64
(
tig
))
<<
shift
;
}
int64_t
bc0
;
int64_t
bc1
;
TIG_TYPE
bc0
;
TIG_TYPE
bc1
;
};
float
ObjectnessBING
::
FilterTIG
::
dot
(
int64_t
tig1
,
int64_t
tig2
,
int64_t
tig4
,
int64_t
tig8
)
float
ObjectnessBING
::
FilterTIG
::
dot
(
TIG_TYPE
tig1
,
TIG_TYPE
tig2
,
TIG_TYPE
tig4
,
TIG_TYPE
tig8
)
{
TIGbits
x
;
x
.
accumulate
(
tig1
,
_bTIGs
[
0
],
_bTIGs
[
1
],
0
);
...
...
@@ -111,22 +114,22 @@ Mat ObjectnessBING::FilterTIG::matchTemplate( const Mat &mag1u )
{
const
int
H
=
mag1u
.
rows
,
W
=
mag1u
.
cols
;
const
Size
sz
(
W
+
1
,
H
+
1
);
// Expand original size to avoid dealing with boundary conditions
Mat_
<
int64_t
>
Tig1
=
Mat_
<
int64_t
>::
zeros
(
sz
),
Tig2
=
Mat_
<
int64_t
>::
zeros
(
sz
);
Mat_
<
int64_t
>
Tig4
=
Mat_
<
int64_t
>::
zeros
(
sz
),
Tig8
=
Mat_
<
int64_t
>::
zeros
(
sz
);
Mat_
<
MAT_TIG_TYPE
>
Tig1
=
Mat_
<
MAT_TIG_TYPE
>::
zeros
(
sz
),
Tig2
=
Mat_
<
MAT_TIG_TYPE
>::
zeros
(
sz
);
Mat_
<
MAT_TIG_TYPE
>
Tig4
=
Mat_
<
MAT_TIG_TYPE
>::
zeros
(
sz
),
Tig8
=
Mat_
<
MAT_TIG_TYPE
>::
zeros
(
sz
);
Mat_
<
BYTE
>
Row1
=
Mat_
<
BYTE
>::
zeros
(
sz
),
Row2
=
Mat_
<
BYTE
>::
zeros
(
sz
);
Mat_
<
BYTE
>
Row4
=
Mat_
<
BYTE
>::
zeros
(
sz
),
Row8
=
Mat_
<
BYTE
>::
zeros
(
sz
);
Mat_
<
float
>
scores
(
sz
);
for
(
int
y
=
1
;
y
<=
H
;
y
++
)
{
const
BYTE
*
G
=
mag1u
.
ptr
<
BYTE
>
(
y
-
1
);
int64_t
*
T1
=
Tig1
.
ptr
<
int64_t
>
(
y
);
// Binary TIG of current row
int64_t
*
T2
=
Tig2
.
ptr
<
int64_t
>
(
y
);
int64_t
*
T4
=
Tig4
.
ptr
<
int64_t
>
(
y
);
int64_t
*
T8
=
Tig8
.
ptr
<
int64_t
>
(
y
);
int64_t
*
Tu1
=
Tig1
.
ptr
<
int64_t
>
(
y
-
1
);
// Binary TIG of upper row
int64_t
*
Tu2
=
Tig2
.
ptr
<
int64_t
>
(
y
-
1
);
int64_t
*
Tu4
=
Tig4
.
ptr
<
int64_t
>
(
y
-
1
);
int64_t
*
Tu8
=
Tig8
.
ptr
<
int64_t
>
(
y
-
1
);
TIG_TYPE
*
T1
=
Tig1
.
ptr
<
TIG_TYPE
>
(
y
);
// Binary TIG of current row
TIG_TYPE
*
T2
=
Tig2
.
ptr
<
TIG_TYPE
>
(
y
);
TIG_TYPE
*
T4
=
Tig4
.
ptr
<
TIG_TYPE
>
(
y
);
TIG_TYPE
*
T8
=
Tig8
.
ptr
<
TIG_TYPE
>
(
y
);
TIG_TYPE
*
Tu1
=
Tig1
.
ptr
<
TIG_TYPE
>
(
y
-
1
);
// Binary TIG of upper row
TIG_TYPE
*
Tu2
=
Tig2
.
ptr
<
TIG_TYPE
>
(
y
-
1
);
TIG_TYPE
*
Tu4
=
Tig4
.
ptr
<
TIG_TYPE
>
(
y
-
1
);
TIG_TYPE
*
Tu8
=
Tig8
.
ptr
<
TIG_TYPE
>
(
y
-
1
);
BYTE
*
R1
=
Row1
.
ptr
<
BYTE
>
(
y
);
BYTE
*
R2
=
Row2
.
ptr
<
BYTE
>
(
y
);
BYTE
*
R4
=
Row4
.
ptr
<
BYTE
>
(
y
);
...
...
modules/structured_light/include/opencv2/structured_light/structured_light.hpp
View file @
30669702
...
...
@@ -78,7 +78,7 @@ class CV_EXPORTS_W StructuredLightPattern : public virtual Algorithm
@note All the images must be at the same resolution.
*/
CV_WRAP
virtual
bool
decode
(
InputArrayOfArrays
patternImages
,
OutputArray
disparityMap
,
virtual
bool
decode
(
const
std
::
vector
<
std
::
vector
<
Mat
>
>&
patternImages
,
OutputArray
disparityMap
,
InputArrayOfArrays
blackImages
=
noArray
(),
InputArrayOfArrays
whiteImages
=
noArray
(),
int
flags
=
DECODE_3D_UNDERWORLD
)
const
=
0
;
...
...
modules/structured_light/src/graycodepattern.cpp
View file @
30669702
...
...
@@ -56,7 +56,7 @@ class CV_EXPORTS_W GrayCodePattern_Impl : public GrayCodePattern
bool
generate
(
OutputArrayOfArrays
patternImages
);
// Decodes the gray code pattern, computing the disparity map
bool
decode
(
InputArrayOfArrays
patternImages
,
OutputArray
disparityMap
,
InputArrayOfArrays
blackImages
=
noArray
(),
bool
decode
(
const
std
::
vector
<
std
::
vector
<
Mat
>
>&
patternImages
,
OutputArray
disparityMap
,
InputArrayOfArrays
blackImages
=
noArray
(),
InputArrayOfArrays
whiteImages
=
noArray
(),
int
flags
=
DECODE_3D_UNDERWORLD
)
const
;
// Returns the number of pattern images for the graycode pattern
...
...
@@ -209,10 +209,10 @@ bool GrayCodePattern_Impl::generate( OutputArrayOfArrays pattern )
return
true
;
}
bool
GrayCodePattern_Impl
::
decode
(
InputArrayOfArrays
patternImages
,
OutputArray
disparityMap
,
bool
GrayCodePattern_Impl
::
decode
(
const
std
::
vector
<
std
::
vector
<
Mat
>
>&
patternImages
,
OutputArray
disparityMap
,
InputArrayOfArrays
blackImages
,
InputArrayOfArrays
whitheImages
,
int
flags
)
const
{
std
::
vector
<
std
::
vector
<
Mat
>
>&
acquired_pattern
=
*
(
std
::
vector
<
std
::
vector
<
Mat
>
>*
)
patternImages
.
getObj
()
;
const
std
::
vector
<
std
::
vector
<
Mat
>
>&
acquired_pattern
=
patternImages
;
if
(
flags
==
DECODE_3D_UNDERWORLD
)
{
...
...
modules/structured_light/src/sinusoidalpattern.cpp
View file @
30669702
...
...
@@ -56,7 +56,7 @@ public:
// Generate sinusoidal patterns
bool
generate
(
OutputArrayOfArrays
patternImages
);
bool
decode
(
InputArrayOfArrays
patternImages
,
OutputArray
disparityMap
,
bool
decode
(
const
std
::
vector
<
std
::
vector
<
Mat
>
>&
patternImages
,
OutputArray
disparityMap
,
InputArrayOfArrays
blackImages
=
noArray
(),
InputArrayOfArrays
whiteImages
=
noArray
(),
int
flags
=
0
)
const
;
...
...
@@ -258,7 +258,7 @@ bool SinusoidalPatternProfilometry_Impl::generate( OutputArrayOfArrays pattern )
return
true
;
}
bool
SinusoidalPatternProfilometry_Impl
::
decode
(
InputArrayOfArrays
patternImages
,
bool
SinusoidalPatternProfilometry_Impl
::
decode
(
const
std
::
vector
<
std
::
vector
<
Mat
>
>&
patternImages
,
OutputArray
disparityMap
,
InputArrayOfArrays
blackImages
,
InputArrayOfArrays
whiteImages
,
int
flags
)
const
...
...
modules/ximgproc/src/dtfilter_cpu.inl.hpp
View file @
30669702
...
...
@@ -69,7 +69,7 @@ DTFilterCPU* DTFilterCPU::create_p_(const Mat& guide, double sigmaSpatial, doubl
template
<
typename
GuideVec
>
void
DTFilterCPU
::
init_
(
Mat
&
guide
,
double
sigmaSpatial_
,
double
sigmaColor_
,
int
mode_
,
int
numIters_
)
{
CV_Assert
(
guide
.
type
()
==
cv
::
DataType
<
GuideVec
>::
typ
e
);
CV_Assert
(
guide
.
type
()
==
traits
::
Type
<
GuideVec
>::
valu
e
);
this
->
release
();
...
...
@@ -123,7 +123,7 @@ template <typename SrcVec>
void
DTFilterCPU
::
filter_
(
const
Mat
&
src
,
Mat
&
dst
,
int
dDepth
)
{
typedef
typename
DataType
<
Vec
<
WorkType
,
SrcVec
::
channels
>
>::
vec_type
WorkVec
;
CV_Assert
(
src
.
type
()
==
SrcVec
::
typ
e
);
CV_Assert
(
src
.
type
()
==
traits
::
Type
<
SrcVec
>::
valu
e
);
if
(
src
.
cols
!=
w
||
src
.
rows
!=
h
)
{
CV_Error
(
Error
::
StsBadSize
,
"Size of filtering image must be equal to size of guide image"
);
...
...
@@ -139,17 +139,17 @@ void DTFilterCPU::filter_(const Mat& src, Mat& dst, int dDepth)
if
(
dDepth
==
-
1
)
dDepth
=
src
.
depth
();
//small optimization to avoid extra copying of data
bool
useDstAsRes
=
(
dDepth
==
WorkVec
::
depth
&&
(
mode
==
DTF_NC
||
mode
==
DTF_RF
));
bool
useDstAsRes
=
(
dDepth
==
traits
::
Depth
<
WorkVec
>::
value
&&
(
mode
==
DTF_NC
||
mode
==
DTF_RF
));
if
(
useDstAsRes
)
{
dst
.
create
(
h
,
w
,
WorkVec
::
typ
e
);
dst
.
create
(
h
,
w
,
traits
::
Type
<
WorkVec
>::
valu
e
);
res
=
dst
;
}
if
(
mode
==
DTF_NC
)
{
Mat
resT
(
src
.
cols
,
src
.
rows
,
WorkVec
::
typ
e
);
src
.
convertTo
(
res
,
WorkVec
::
typ
e
);
Mat
resT
(
src
.
cols
,
src
.
rows
,
traits
::
Type
<
WorkVec
>::
valu
e
);
src
.
convertTo
(
res
,
traits
::
Type
<
WorkVec
>::
valu
e
);
FilterNC_horPass
<
WorkVec
>
horParBody
(
res
,
idistHor
,
resT
);
FilterNC_horPass
<
WorkVec
>
vertParBody
(
resT
,
idistVert
,
res
);
...
...
@@ -180,7 +180,7 @@ void DTFilterCPU::filter_(const Mat& src, Mat& dst, int dDepth)
}
else
if
(
mode
==
DTF_RF
)
{
src
.
convertTo
(
res
,
WorkVec
::
typ
e
);
src
.
convertTo
(
res
,
traits
::
Type
<
WorkVec
>::
valu
e
);
for
(
int
iter
=
1
;
iter
<=
numIters
;
iter
++
)
{
...
...
@@ -237,13 +237,13 @@ void DTFilterCPU::integrateSparseRow(const SrcVec *src, const float *dist, SrcWo
template
<
typename
WorkVec
>
void
DTFilterCPU
::
prepareSrcImg_IC
(
const
Mat
&
src
,
Mat
&
dst
,
Mat
&
dstT
)
{
Mat
dstOut
(
src
.
rows
,
src
.
cols
+
2
,
WorkVec
::
typ
e
);
Mat
dstOutT
(
src
.
cols
,
src
.
rows
+
2
,
WorkVec
::
typ
e
);
Mat
dstOut
(
src
.
rows
,
src
.
cols
+
2
,
traits
::
Type
<
WorkVec
>::
valu
e
);
Mat
dstOutT
(
src
.
cols
,
src
.
rows
+
2
,
traits
::
Type
<
WorkVec
>::
valu
e
);
dst
=
dstOut
(
Range
::
all
(),
Range
(
1
,
src
.
cols
+
1
));
dstT
=
dstOutT
(
Range
::
all
(),
Range
(
1
,
src
.
rows
+
1
));
src
.
convertTo
(
dst
,
WorkVec
::
typ
e
);
src
.
convertTo
(
dst
,
traits
::
Type
<
WorkVec
>::
valu
e
);
WorkVec
*
line
;
int
ri
=
dstOut
.
cols
-
1
;
...
...
@@ -270,7 +270,7 @@ template <typename WorkVec>
DTFilterCPU
::
FilterNC_horPass
<
WorkVec
>::
FilterNC_horPass
(
Mat
&
src_
,
Mat
&
idist_
,
Mat
&
dst_
)
:
src
(
src_
),
idist
(
idist_
),
dst
(
dst_
),
radius
(
1.0
f
)
{
CV_DbgAssert
(
src
.
type
()
==
WorkVec
::
type
&&
dst
.
type
()
==
WorkVec
::
typ
e
&&
dst
.
rows
==
src
.
cols
&&
dst
.
cols
==
src
.
rows
);
CV_DbgAssert
(
src
.
type
()
==
traits
::
Type
<
WorkVec
>::
value
&&
dst
.
type
()
==
traits
::
Type
<
WorkVec
>::
valu
e
&&
dst
.
rows
==
src
.
cols
&&
dst
.
cols
==
src
.
rows
);
}
template
<
typename
WorkVec
>
...
...
@@ -324,12 +324,12 @@ template <typename WorkVec>
DTFilterCPU
::
FilterIC_horPass
<
WorkVec
>::
FilterIC_horPass
(
Mat
&
src_
,
Mat
&
idist_
,
Mat
&
dist_
,
Mat
&
dst_
)
:
src
(
src_
),
idist
(
idist_
),
dist
(
dist_
),
dst
(
dst_
),
radius
(
1.0
f
)
{
CV_DbgAssert
(
src
.
type
()
==
WorkVec
::
type
&&
dst
.
type
()
==
WorkVec
::
typ
e
&&
dst
.
rows
==
src
.
cols
&&
dst
.
cols
==
src
.
rows
);
CV_DbgAssert
(
src
.
type
()
==
traits
::
Type
<
WorkVec
>::
value
&&
dst
.
type
()
==
traits
::
Type
<
WorkVec
>::
valu
e
&&
dst
.
rows
==
src
.
cols
&&
dst
.
cols
==
src
.
rows
);
#ifdef CV_GET_NUM_THREAD_WORKS_PROPERLY
isrcBuf
.
create
(
cv
::
getNumThreads
(),
src
.
cols
+
1
,
WorkVec
::
typ
e
);
isrcBuf
.
create
(
cv
::
getNumThreads
(),
src
.
cols
+
1
,
traits
::
Type
<
WorkVec
>::
valu
e
);
#else
isrcBuf
.
create
(
src
.
rows
,
src
.
cols
+
1
,
WorkVec
::
typ
e
);
isrcBuf
.
create
(
src
.
rows
,
src
.
cols
+
1
,
traits
::
Type
<
WorkVec
>::
valu
e
);
#endif
}
...
...
@@ -384,8 +384,8 @@ template <typename WorkVec>
DTFilterCPU
::
FilterRF_horPass
<
WorkVec
>::
FilterRF_horPass
(
Mat
&
res_
,
Mat
&
alphaD_
,
int
iteration_
)
:
res
(
res_
),
alphaD
(
alphaD_
),
iteration
(
iteration_
)
{
CV_DbgAssert
(
res
.
type
()
==
WorkVec
::
typ
e
);
CV_DbgAssert
(
res
.
type
()
==
WorkVec
::
typ
e
&&
res
.
size
()
==
res
.
size
());
CV_DbgAssert
(
res
.
type
()
==
traits
::
Type
<
WorkVec
>::
valu
e
);
CV_DbgAssert
(
res
.
type
()
==
traits
::
Type
<
WorkVec
>::
valu
e
&&
res
.
size
()
==
res
.
size
());
}
...
...
@@ -421,8 +421,8 @@ template <typename WorkVec>
DTFilterCPU
::
FilterRF_vertPass
<
WorkVec
>::
FilterRF_vertPass
(
Mat
&
res_
,
Mat
&
alphaD_
,
int
iteration_
)
:
res
(
res_
),
alphaD
(
alphaD_
),
iteration
(
iteration_
)
{
CV_DbgAssert
(
res
.
type
()
==
WorkVec
::
typ
e
);
CV_DbgAssert
(
res
.
type
()
==
WorkVec
::
typ
e
&&
res
.
size
()
==
res
.
size
());
CV_DbgAssert
(
res
.
type
()
==
traits
::
Type
<
WorkVec
>::
valu
e
);
CV_DbgAssert
(
res
.
type
()
==
traits
::
Type
<
WorkVec
>::
valu
e
&&
res
.
size
()
==
res
.
size
());
}
...
...
@@ -470,7 +470,7 @@ template <typename GuideVec>
DTFilterCPU
::
ComputeIDTHor_ParBody
<
GuideVec
>::
ComputeIDTHor_ParBody
(
DTFilterCPU
&
dtf_
,
Mat
&
guide_
,
Mat
&
dst_
)
:
dtf
(
dtf_
),
guide
(
guide_
),
dst
(
dst_
)
{
dst
.
create
(
guide
.
rows
,
guide
.
cols
+
1
,
IDistVec
::
typ
e
);
dst
.
create
(
guide
.
rows
,
guide
.
cols
+
1
,
traits
::
Type
<
IDistVec
>::
valu
e
);
}
template
<
typename
GuideVec
>
...
...
@@ -497,8 +497,8 @@ template <typename GuideVec>
DTFilterCPU
::
ComputeDTandIDTHor_ParBody
<
GuideVec
>::
ComputeDTandIDTHor_ParBody
(
DTFilterCPU
&
dtf_
,
Mat
&
guide_
,
Mat
&
dist_
,
Mat
&
idist_
)
:
dtf
(
dtf_
),
guide
(
guide_
),
dist
(
dist_
),
idist
(
idist_
)
{
dist
=
getWExtendedMat
(
guide
.
rows
,
guide
.
cols
,
IDistVec
::
typ
e
,
1
,
1
);
idist
=
getWExtendedMat
(
guide
.
rows
,
guide
.
cols
+
1
,
IDistVec
::
typ
e
);
dist
=
getWExtendedMat
(
guide
.
rows
,
guide
.
cols
,
traits
::
Type
<
IDistVec
>::
valu
e
,
1
,
1
);
idist
=
getWExtendedMat
(
guide
.
rows
,
guide
.
cols
+
1
,
traits
::
Type
<
IDistVec
>::
valu
e
);
maxRadius
=
dtf
.
getIterRadius
(
1
);
}
...
...
@@ -535,7 +535,7 @@ template <typename GuideVec>
DTFilterCPU
::
ComputeA0DTHor_ParBody
<
GuideVec
>::
ComputeA0DTHor_ParBody
(
DTFilterCPU
&
dtf_
,
Mat
&
guide_
)
:
dtf
(
dtf_
),
guide
(
guide_
)
{
dtf
.
a0distHor
.
create
(
guide
.
rows
,
guide
.
cols
-
1
,
DistVec
::
typ
e
);
dtf
.
a0distHor
.
create
(
guide
.
rows
,
guide
.
cols
-
1
,
traits
::
Type
<
DistVec
>::
valu
e
);
lna
=
std
::
log
(
dtf
.
getIterAlpha
(
1
));
}
...
...
@@ -565,7 +565,7 @@ template <typename GuideVec>
DTFilterCPU
::
ComputeA0DTVert_ParBody
<
GuideVec
>::
ComputeA0DTVert_ParBody
(
DTFilterCPU
&
dtf_
,
Mat
&
guide_
)
:
dtf
(
dtf_
),
guide
(
guide_
)
{
dtf
.
a0distVert
.
create
(
guide
.
rows
-
1
,
guide
.
cols
,
DistVec
::
typ
e
);
dtf
.
a0distVert
.
create
(
guide
.
rows
-
1
,
guide
.
cols
,
traits
::
Type
<
DistVec
>::
valu
e
);
lna
=
std
::
log
(
dtf
.
getIterAlpha
(
1
));
}
...
...
modules/ximgproc/src/fgs_filter.cpp
View file @
30669702
...
...
@@ -148,16 +148,16 @@ void FastGlobalSmootherFilterImpl::init(InputArray guide,double _lambda,double _
num_iter
=
_num_iter
;
num_stripes
=
getNumThreads
();
int
num_levels
=
3
*
256
*
256
;
weights_LUT
.
create
(
1
,
num_levels
,
WorkVec
::
typ
e
);
weights_LUT
.
create
(
1
,
num_levels
,
traits
::
Type
<
WorkVec
>::
valu
e
);
WorkType
*
LUT
=
(
WorkType
*
)
weights_LUT
.
ptr
(
0
);
parallel_for_
(
Range
(
0
,
num_stripes
),
ComputeLUT_ParBody
(
*
this
,
LUT
,
num_stripes
,
num_levels
));
w
=
guide
.
cols
();
h
=
guide
.
rows
();
Chor
.
create
(
h
,
w
,
WorkVec
::
typ
e
);
Cvert
.
create
(
h
,
w
,
WorkVec
::
typ
e
);
interD
.
create
(
h
,
w
,
WorkVec
::
typ
e
);
Chor
.
create
(
h
,
w
,
traits
::
Type
<
WorkVec
>::
valu
e
);
Cvert
.
create
(
h
,
w
,
traits
::
Type
<
WorkVec
>::
valu
e
);
interD
.
create
(
h
,
w
,
traits
::
Type
<
WorkVec
>::
valu
e
);
Mat
guideMat
=
guide
.
getMat
();
if
(
guide
.
channels
()
==
1
)
...
...
@@ -201,8 +201,8 @@ void FastGlobalSmootherFilterImpl::filter(InputArray src, OutputArray dst)
{
lambda
=
lambda_ref
;
Mat
cur_res
=
src_channels
[
i
].
clone
();
if
(
src
.
depth
()
!=
WorkVec
::
typ
e
)
cur_res
.
convertTo
(
cur_res
,
WorkVec
::
typ
e
);
if
(
src
.
depth
()
!=
traits
::
Type
<
WorkVec
>::
valu
e
)
cur_res
.
convertTo
(
cur_res
,
traits
::
Type
<
WorkVec
>::
valu
e
);
for
(
int
n
=
0
;
n
<
num_iter
;
n
++
)
{
...
...
@@ -212,7 +212,7 @@ void FastGlobalSmootherFilterImpl::filter(InputArray src, OutputArray dst)
}
Mat
dstMat
;
if
(
src
.
depth
()
!=
WorkVec
::
typ
e
)
if
(
src
.
depth
()
!=
traits
::
Type
<
WorkVec
>::
valu
e
)
cur_res
.
convertTo
(
dstMat
,
src
.
depth
());
else
dstMat
=
cur_res
;
...
...
modules/ximgproc/src/joint_bilateral_filter.cpp
View file @
30669702
...
...
@@ -77,7 +77,7 @@ public:
joint
(
joint_
),
src
(
src_
),
dst
(
dst_
),
radius
(
radius_
),
maxk
(
maxk_
),
scaleIndex
(
scaleIndex_
),
spaceOfs
(
spaceOfs_
),
spaceWeights
(
spaceWeights_
),
expLUT
(
expLUT_
)
{
CV_DbgAssert
(
joint
.
type
()
==
JointVec
::
type
&&
src
.
type
()
==
dst
.
type
()
&&
src
.
type
()
==
SrcVec
::
typ
e
);
CV_DbgAssert
(
joint
.
type
()
==
traits
::
Type
<
JointVec
>::
value
&&
src
.
type
()
==
dst
.
type
()
&&
src
.
type
()
==
traits
::
Type
<
SrcVec
>::
valu
e
);
CV_DbgAssert
(
joint
.
rows
==
src
.
rows
&&
src
.
rows
==
dst
.
rows
+
2
*
radius
);
CV_DbgAssert
(
joint
.
cols
==
src
.
cols
&&
src
.
cols
==
dst
.
cols
+
2
*
radius
);
}
...
...
@@ -223,7 +223,7 @@ public:
joint
(
joint_
),
src
(
src_
),
dst
(
dst_
),
radius
(
radius_
),
maxk
(
maxk_
),
spaceOfs
(
spaceOfs_
),
spaceWeights
(
spaceWeights_
),
expLUT
(
expLUT_
)
{
CV_DbgAssert
(
joint
.
type
()
==
JointVec
::
type
&&
src
.
type
()
==
dst
.
type
()
&&
src
.
type
()
==
SrcVec
::
typ
e
);
CV_DbgAssert
(
joint
.
type
()
==
traits
::
Type
<
JointVec
>::
value
&&
src
.
type
()
==
dst
.
type
()
&&
src
.
type
()
==
traits
::
Type
<
SrcVec
>::
valu
e
);
CV_DbgAssert
(
joint
.
rows
==
src
.
rows
&&
src
.
rows
==
dst
.
rows
+
2
*
radius
);
CV_DbgAssert
(
joint
.
cols
==
src
.
cols
&&
src
.
cols
==
dst
.
cols
+
2
*
radius
);
}
...
...
modules/ximgproc/test/test_domain_transform.cpp
View file @
30669702
...
...
@@ -168,7 +168,7 @@ Mat getChessMat1px(Size sz, double whiteIntensity = 255)
{
typedef
typename
DataType
<
SrcVec
>::
channel_type
SrcType
;
Mat
dst
(
sz
,
DataType
<
SrcVec
>::
typ
e
);
Mat
dst
(
sz
,
traits
::
Type
<
SrcVec
>::
valu
e
);
SrcVec
black
=
SrcVec
::
all
(
0
);
SrcVec
white
=
SrcVec
::
all
((
SrcType
)
whiteIntensity
);
...
...
modules/ximgproc/test/test_joint_bilateral_filter.cpp
View file @
30669702
...
...
@@ -113,7 +113,7 @@ template<typename JointVec, typename SrcVec>
void
jointBilateralFilterNaive_
(
InputArray
joint_
,
InputArray
src_
,
OutputArray
dst_
,
int
d
,
double
sigmaColor
,
double
sigmaSpace
,
int
borderType
)
{
CV_Assert
(
joint_
.
size
()
==
src_
.
size
());
CV_Assert
(
joint_
.
type
()
==
JointVec
::
type
&&
src_
.
type
()
==
SrcVec
::
typ
e
);
CV_Assert
(
joint_
.
type
()
==
traits
::
Type
<
JointVec
>::
value
&&
src_
.
type
()
==
traits
::
Type
<
SrcVec
>::
valu
e
);
typedef
Vec
<
float
,
SrcVec
::
channels
>
SrcVecf
;
if
(
sigmaColor
<=
0
)
...
...
modules/ximgproc/test/test_structured_edge_detection.cpp
View file @
30669702
...
...
@@ -22,9 +22,9 @@ TEST(ximpgroc_StructuredEdgeDetection, regression)
cv
::
String
previousResultName
=
dir
+
cv
::
format
(
"results/%02d.png"
,
i
+
1
);
cv
::
Mat
previousResult
=
cv
::
imread
(
previousResultName
,
0
);
previousResult
.
convertTo
(
previousResult
,
cv
::
DataType
<
float
>::
type
,
1
/
255.0
);
previousResult
.
convertTo
(
previousResult
,
CV_32F
,
1
/
255.0
);
src
.
convertTo
(
src
,
cv
::
DataType
<
float
>::
type
,
1
/
255.0
);
src
.
convertTo
(
src
,
CV_32F
,
1
/
255.0
);
cv
::
Mat
currentResult
(
src
.
size
(),
src
.
type
()
);
pDollar
->
detectEdges
(
src
,
currentResult
);
...
...
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