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
cf68a011
Commit
cf68a011
authored
Oct 02, 2017
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
saliency: cleanup module and samples
parent
3f4e7dfc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
56 deletions
+7
-56
saliencyBaseClasses.hpp
...saliency/include/opencv2/saliency/saliencyBaseClasses.hpp
+0
-11
computeSaliency.cpp
modules/saliency/samples/computeSaliency.cpp
+6
-13
motionSaliencyBinWangApr2014.cpp
modules/saliency/src/motionSaliencyBinWangApr2014.cpp
+1
-14
saliency.cpp
modules/saliency/src/saliency.cpp
+0
-18
No files found.
modules/saliency/include/opencv2/saliency/saliencyBaseClasses.hpp
View file @
cf68a011
...
...
@@ -67,11 +67,6 @@ class CV_EXPORTS_W Saliency : public virtual Algorithm
*/
virtual
~
Saliency
();
/**
* \brief Create Saliency by saliency type.
*/
static
Ptr
<
Saliency
>
create
(
const
String
&
saliencyType
);
/**
* \brief Compute the saliency
* \param image The image.
...
...
@@ -80,12 +75,6 @@ class CV_EXPORTS_W Saliency : public virtual Algorithm
*/
CV_WRAP
bool
computeSaliency
(
InputArray
image
,
OutputArray
saliencyMap
);
/**
* \brief Get the name of the specific saliency type
* \return The name of the tracker initializer
*/
CV_WRAP
String
getClassName
()
const
;
protected
:
virtual
bool
computeSaliencyImpl
(
InputArray
image
,
OutputArray
saliencyMap
)
=
0
;
...
...
modules/saliency/samples/computeSaliency.cpp
View file @
cf68a011
...
...
@@ -95,13 +95,7 @@ int main( int argc, char** argv )
Mat
frame
;
//instantiates the specific Saliency
Ptr
<
Saliency
>
saliencyAlgorithm
=
Saliency
::
create
(
saliency_algorithm
);
if
(
saliencyAlgorithm
==
NULL
)
{
cout
<<
"***Error in the instantiation of the saliency algorithm...***
\n
"
;
return
-
1
;
}
Ptr
<
Saliency
>
saliencyAlgorithm
;
Mat
binaryMap
;
Mat
image
;
...
...
@@ -117,6 +111,7 @@ int main( int argc, char** argv )
if
(
saliency_algorithm
.
find
(
"SPECTRAL_RESIDUAL"
)
==
0
)
{
Mat
saliencyMap
;
saliencyAlgorithm
=
StaticSaliencySpectralResidual
::
create
();
if
(
saliencyAlgorithm
->
computeSaliency
(
image
,
saliencyMap
)
)
{
StaticSaliencySpectralResidual
spec
;
...
...
@@ -132,6 +127,7 @@ int main( int argc, char** argv )
else
if
(
saliency_algorithm
.
find
(
"FINE_GRAINED"
)
==
0
)
{
Mat
saliencyMap
;
saliencyAlgorithm
=
StaticSaliencyFineGrained
::
create
();
if
(
saliencyAlgorithm
->
computeSaliency
(
image
,
saliencyMap
)
)
{
imshow
(
"Saliency Map"
,
saliencyMap
);
...
...
@@ -151,6 +147,7 @@ int main( int argc, char** argv )
else
{
saliencyAlgorithm
=
ObjectnessBING
::
create
();
vector
<
Vec4i
>
saliencyMap
;
saliencyAlgorithm
.
dynamicCast
<
ObjectnessBING
>
()
->
setTrainingPath
(
training_path
);
saliencyAlgorithm
.
dynamicCast
<
ObjectnessBING
>
()
->
setBBResDir
(
training_path
+
"/Results"
);
...
...
@@ -164,8 +161,7 @@ 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
=
MotionSaliencyBinWangApr2014
::
create
();
saliencyAlgorithm
.
dynamicCast
<
MotionSaliencyBinWangApr2014
>
()
->
setImagesize
(
image
.
cols
,
image
.
rows
);
saliencyAlgorithm
.
dynamicCast
<
MotionSaliencyBinWangApr2014
>
()
->
init
();
...
...
@@ -183,10 +179,7 @@ int main( int argc, char** argv )
cvtColor
(
frame
,
frame
,
COLOR_BGR2GRAY
);
Mat
saliencyMap
;
if
(
saliencyAlgorithm
->
computeSaliency
(
frame
,
saliencyMap
)
)
{
//std::cout << "current frame motion saliency done" << std::endl;
}
saliencyAlgorithm
->
computeSaliency
(
frame
,
saliencyMap
);
imshow
(
"image"
,
frame
);
imshow
(
"saliencyMap"
,
saliencyMap
*
255
);
...
...
modules/saliency/src/motionSaliencyBinWangApr2014.cpp
View file @
cf68a011
...
...
@@ -621,7 +621,7 @@ bool MotionSaliencyBinWangApr2014::decisionThresholdAdaptation()
return
true
;
}
bool
MotionSaliencyBinWangApr2014
::
computeSaliencyImpl
(
const
InputArray
image
,
OutputArray
saliencyMap
)
bool
MotionSaliencyBinWangApr2014
::
computeSaliencyImpl
(
InputArray
image
,
OutputArray
saliencyMap
)
{
Mat
highResBFMask
,
u_highResBFMask
;
Mat
lowResBFMask
,
u_lowResBFMask
;
...
...
@@ -646,24 +646,11 @@ bool MotionSaliencyBinWangApr2014::computeSaliencyImpl( const InputArray image,
decisionThresholdAdaptation
();
}
//double t = (double) getTickCount();
templateOrdering
();
/*t = ( (double) getTickCount() - t ) / getTickFrequency();
std::cout << "T :" << t << std::endl;
*/
templateReplacement
(
saliencyMap
.
getMat
(),
image
.
getMat
()
);
//double t2 = (double) getTickCount();
templateOrdering
();
//t2 = ( (double) getTickCount() - t2 ) / getTickFrequency();
//std::cout << "T2 :" << t2 << std::endl;
activityControlFlag
=
true
;
return
true
;
}
...
...
modules/saliency/src/saliency.cpp
View file @
cf68a011
...
...
@@ -51,19 +51,6 @@ Saliency::~Saliency()
}
Ptr
<
Saliency
>
Saliency
::
create
(
const
String
&
saliencyType
)
{
if
(
saliencyType
==
"SPECTRAL_RESIDUAL"
)
return
makePtr
<
StaticSaliencySpectralResidual
>
();
else
if
(
saliencyType
==
"FINE_GRAINED"
)
return
makePtr
<
StaticSaliencyFineGrained
>
();
else
if
(
saliencyType
==
"BING"
)
return
makePtr
<
ObjectnessBING
>
();
else
if
(
saliencyType
==
"BinWangApr2014"
)
return
makePtr
<
MotionSaliencyBinWangApr2014
>
();
return
Ptr
<
Saliency
>
();
}
bool
Saliency
::
computeSaliency
(
InputArray
image
,
OutputArray
saliencyMap
)
{
if
(
image
.
empty
()
)
...
...
@@ -72,10 +59,5 @@ bool Saliency::computeSaliency( InputArray image, OutputArray saliencyMap )
return
computeSaliencyImpl
(
image
,
saliencyMap
);
}
String
Saliency
::
getClassName
()
const
{
return
className
;
}
}
/* namespace saliency */
}
/* namespace cv */
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