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
30c13c2c
Commit
30c13c2c
authored
Aug 11, 2014
by
jaco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip window compile error fixing
parent
bc66cc27
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
32 deletions
+30
-32
saliencySpecializedClasses.hpp
...y/include/opencv2/saliency/saliencySpecializedClasses.hpp
+12
-9
computeSaliency.cpp
modules/saliency/samples/computeSaliency.cpp
+4
-4
CmFile.cpp
modules/saliency/src/BING/CmFile.cpp
+5
-3
objectnessBING.cpp
modules/saliency/src/BING/objectnessBING.cpp
+4
-4
motionSaliencyBinWangApr2014.cpp
modules/saliency/src/motionSaliencyBinWangApr2014.cpp
+0
-0
saliency_init.cpp
modules/saliency/src/saliency_init.cpp
+5
-12
No files found.
modules/saliency/include/opencv2/saliency/saliencySpecializedClasses.hpp
View file @
30c13c2c
...
...
@@ -100,12 +100,13 @@ class CV_EXPORTS_W MotionSaliencyBinWangApr2014 : public MotionSaliency
MotionSaliencyBinWangApr2014
();
~
MotionSaliencyBinWangApr2014
();
typedef
Ptr
<
Size
>
(
Algorithm
::*
SizeGetter
)();
typedef
void
(
Algorithm
::*
SizeSetter
)(
const
Ptr
<
Size
>
&
);
/*
typedef Ptr<Size> (Algorithm::*SizeGetter)();
typedef void (Algorithm::*SizeSetter)( const Ptr<Size> & );
Ptr
<
Size
>
getWsize
();
void
setWsize
(
const
Ptr
<
Size
>
&
newSize
);
Ptr<Size> getWsize();
void setWsize( const Ptr<Size> &newSize ); */
void
setImagesize
(
int
W
,
int
H
);
bool
init
();
protected
:
...
...
@@ -129,8 +130,8 @@ class CV_EXPORTS_W MotionSaliencyBinWangApr2014 : public MotionSaliency
// changing structure
std
::
vector
<
Ptr
<
Mat
>
>
backgroundModel
;
// The vector represents the background template T0---TK of reference paper.
// Matrices are two-channel matrix. In the first layer there are the B (background value)
// for each pixel. In the second layer, there are the C (efficacy) value for each pixel
// Matrices are two-channel matrix. In the first layer there are the B (background value)
// for each pixel. In the second layer, there are the C (efficacy) value for each pixel
Mat
potentialBackground
;
// Two channel Matrix. For each pixel, in the first level there are the Ba value (potential background value)
// and in the secon level there are the Ca value, the counter for each potential value.
Mat
epslonPixelsValue
;
// epslon threshold
...
...
@@ -141,8 +142,10 @@ class CV_EXPORTS_W MotionSaliencyBinWangApr2014 : public MotionSaliency
//fixed parameter
bool
neighborhoodCheck
;
int
N_DS
;
// Number of template to be downsampled and used in lowResolutionDetection function
Ptr
<
Size
>
imgSize
;
// Size of input image
int
N_DS
;
// Number of template to be downsampled and used in lowResolutionDetection function
//Ptr<Size> imgSize;
int
imageWidth
;
// Width of input image
int
imageHeight
;
//Height of input image
int
K
;
// Number of background model template
int
N
;
// NxN is the size of the block for downsampling in the lowlowResolutionDetection
float
alpha
;
// Learning rate
...
...
@@ -241,7 +244,7 @@ class CV_EXPORTS_W ObjectnessBING : public Objectness
bool
filtersLoaded
()
{
int
n
=
(
int
)
_svmSzIdxs
.
size
();
int
n
=
(
int
)
_svmSzIdxs
.
size
();
return
n
>
0
&&
_svmReW1f
.
size
()
==
Size
(
2
,
n
)
&&
_svmFilter
.
size
()
==
Size
(
_W
,
_W
);
}
void
predictBBoxSI
(
CMat
&
mag3u
,
ValStructVec
<
float
,
Vec4i
>
&
valBoxes
,
vecI
&
sz
,
int
NUM_WIN_PSZ
=
100
,
bool
fast
=
true
);
...
...
modules/saliency/samples/computeSaliency.cpp
View file @
30c13c2c
...
...
@@ -157,18 +157,18 @@ int main( int argc, char** argv )
else
if
(
saliency_algorithm
.
find
(
"BinWangApr2014"
)
==
0
)
{
Ptr
<
Size
>
size
=
Ptr
<
Size
>
(
new
Size
(
image
.
cols
,
image
.
rows
)
);
saliencyAlgorithm
.
dynamicCast
<
MotionSaliencyBinWangApr2014
>
()
->
set
Wsize
(
size
);
//
Ptr<Size> size = Ptr<Size>( new Size( image.cols, image.rows ) );
saliencyAlgorithm
.
dynamicCast
<
MotionSaliencyBinWangApr2014
>
()
->
set
Imagesize
(
image
.
cols
,
image
.
rows
);
saliencyAlgorithm
.
dynamicCast
<
MotionSaliencyBinWangApr2014
>
()
->
init
();
bool
paused
=
false
;
bool
paused
=
false
;
while
(
true
)
{
if
(
!
paused
)
{
cap
>>
frame
;
cvtColor
(
frame
,
frame
,
COLOR_BGR2GRAY
);
cvtColor
(
frame
,
frame
,
COLOR_BGR2GRAY
);
Mat
saliencyMap
;
if
(
saliencyAlgorithm
->
computeSaliency
(
frame
,
saliencyMap
)
)
...
...
modules/saliency/src/BING/CmFile.cpp
View file @
30c13c2c
...
...
@@ -41,7 +41,6 @@
#include "CmFile.h"
bool
CmFile
::
MkDir
(
CStr
&
_path
)
{
if
(
_path
.
size
()
==
0
)
...
...
@@ -58,7 +57,9 @@ bool CmFile::MkDir( CStr &_path )
buffer
[
i
]
=
'/'
;
}
}
return
CreateDirectoryA
(
_S
(
_path
),
0
);
CreateDirectoryA
(
_S
(
_path
),
0
);
return
true
;
#else
for
(
int
i
=
0
;
buffer
[
i
]
!=
0
;
i
++
)
{
...
...
@@ -69,6 +70,7 @@ bool CmFile::MkDir( CStr &_path )
buffer
[
i
]
=
'/'
;
}
}
return
mkdir
(
_S
(
_path
),
0
);
mkdir
(
_S
(
_path
),
0
);
return
true
;
#endif
}
modules/saliency/src/BING/objectnessBING.cpp
View file @
30c13c2c
...
...
@@ -116,7 +116,7 @@ int ObjectnessBING::loadTrainedModel( std::string modelName ) // Return -1, 0,
CV_Assert
(
_svmSzIdxs
.
size
()
>
1
&&
filters1f
.
size
()
==
Size
(
_W
,
_W
)
&&
filters1f
.
type
()
==
CV_32F
);
_svmFilter
=
filters1f
;
if
(
!
matRead
(
s2
,
_svmReW1f
)
||
_svmReW1f
.
size
()
!=
Size
(
2
,
_svmSzIdxs
.
size
()
)
)
if
(
!
matRead
(
s2
,
_svmReW1f
)
||
_svmReW1f
.
size
()
!=
Size
(
2
,
(
int
)
_svmSzIdxs
.
size
()
)
)
{
_svmReW1f
=
Mat
();
return
-
1
;
...
...
@@ -126,7 +126,7 @@ int ObjectnessBING::loadTrainedModel( std::string modelName ) // Return -1, 0,
void
ObjectnessBING
::
predictBBoxSI
(
CMat
&
img3u
,
ValStructVec
<
float
,
Vec4i
>
&
valBoxes
,
vecI
&
sz
,
int
NUM_WIN_PSZ
,
bool
fast
)
{
const
int
numSz
=
_svmSzIdxs
.
size
();
const
int
numSz
=
(
int
)
_svmSzIdxs
.
size
();
const
int
imgW
=
img3u
.
cols
,
imgH
=
img3u
.
rows
;
valBoxes
.
reserve
(
10000
);
sz
.
clear
();
...
...
@@ -374,7 +374,7 @@ void ObjectnessBING::gradientXY( CMat &x1i, CMat &y1i, Mat &mag1u )
const
int
*
x
=
x1i
.
ptr
<
int
>
(
r
),
*
y
=
y1i
.
ptr
<
int
>
(
r
);
BYTE
*
m
=
mag1u
.
ptr
<
BYTE
>
(
r
);
for
(
int
c
=
0
;
c
<
W
;
c
++
)
m
[
c
]
=
min
(
x
[
c
]
+
y
[
c
],
255
);
//((int)sqrt(sqr(x[c]) + sqr(y[c])), 255);
m
[
c
]
=
(
BYTE
)
min
(
x
[
c
]
+
y
[
c
],
255
);
//((int)sqrt(sqr(x[c]) + sqr(y[c])), 255);
}
}
...
...
@@ -491,7 +491,7 @@ bool ObjectnessBING::computeSaliencyImpl( const InputArray image, OutputArray ob
Mat
(
sortedBB
).
copyTo
(
objectnessBoundingBox
);
// List of the rectangles' objectness value
unsigned
long
int
valIdxesSize
=
finalBoxes
.
getvalIdxes
().
size
();
unsigned
long
int
valIdxesSize
=
(
unsigned
long
int
)
finalBoxes
.
getvalIdxes
().
size
();
objectnessValues
.
resize
(
valIdxesSize
);
for
(
uint
i
=
0
;
i
<
valIdxesSize
;
i
++
)
objectnessValues
[
i
]
=
finalBoxes
.
getvalIdxes
()[
i
].
first
;
...
...
modules/saliency/src/motionSaliencyBinWangApr2014.cpp
View file @
30c13c2c
This diff is collapsed.
Click to expand it.
modules/saliency/src/saliency_init.cpp
View file @
30c13c2c
...
...
@@ -45,11 +45,8 @@
namespace
cv
{
CV_INIT_ALGORITHM
(
StaticSaliencySpectralResidual
,
"SALIENCY.SPECTRAL_RESIDUAL"
,
obj
.
info
()
->
addParam
(
obj
,
"resImWidth"
,
obj
.
resImWidth
);
obj
.
info
()
->
addParam
(
obj
,
"resImHeight"
,
obj
.
resImHeight
));
CV_INIT_ALGORITHM
(
StaticSaliencySpectralResidual
,
"SALIENCY.SPECTRAL_RESIDUAL"
,
obj
.
info
()
->
addParam
(
obj
,
"resImWidth"
,
obj
.
resImWidth
);
obj
.
info
()
->
addParam
(
obj
,
"resImHeight"
,
obj
.
resImHeight
)
);
//CV_INIT_ALGORITHM( MotionSaliencySuBSENSE, "SALIENCY.SuBSENSE", );
...
...
@@ -57,19 +54,15 @@ CV_INIT_ALGORITHM(
ObjectnessBING
,
"SALIENCY.BING"
,
obj
.
info
()
->
addParam
(
obj
,
"_base"
,
obj
.
_base
);
obj
.
info
()
->
addParam
(
obj
,
"_NSS"
,
obj
.
_NSS
);
obj
.
info
()
->
addParam
(
obj
,
"_W"
,
obj
.
_W
)
);
CV_INIT_ALGORITHM
(
MotionSaliencyBinWangApr2014
,
"SALIENCY.BinWangApr2014"
,
obj
.
info
()
->
addParam
(
obj
,
"imgSize"
,
obj
.
imgSize
,
false
,
reinterpret_cast
<
SizeGetter
>
(
&
MotionSaliencyBinWangApr2014
::
getWsize
),
reinterpret_cast
<
SizeSetter
>
(
&
MotionSaliencyBinWangApr2014
::
setWsize
)
)
);
CV_INIT_ALGORITHM
(
MotionSaliencyBinWangApr2014
,
"SALIENCY.BinWangApr2014"
,
obj
.
info
()
->
addParam
(
obj
,
"imageWidth"
,
obj
.
imageWidth
);
obj
.
info
()
->
addParam
(
obj
,
"imageHeight"
,
obj
.
imageHeight
)
);
bool
initModule_saliency
(
void
)
{
bool
all
=
true
;
all
&=
!
StaticSaliencySpectralResidual_info_auto
.
name
().
empty
();
//all &= !MotionSaliencySuBSENSE_info_auto.name().empty();
all
&=
!
MotionSaliencyBinWangApr2014_info_auto
.
name
().
empty
();
all
&=
!
MotionSaliencyBinWangApr2014_info_auto
.
name
().
empty
();
all
&=
!
ObjectnessBING_info_auto
.
name
().
empty
();
return
all
;
...
...
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