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
62e77e99
Commit
62e77e99
authored
Aug 24, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: fix usage of unsupported cv::Mat types
parent
e7547d61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
25 deletions
+28
-25
bgfg_gmg.cpp
modules/bgsegm/src/bgfg_gmg.cpp
+11
-11
FilterTIG.cpp
modules/saliency/src/BING/FilterTIG.cpp
+17
-14
No files found.
modules/bgsegm/src/bgfg_gmg.cpp
View file @
62e77e99
...
...
@@ -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/saliency/src/BING/FilterTIG.cpp
View file @
62e77e99
...
...
@@ -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
);
...
...
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