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
7f28c23e
Commit
7f28c23e
authored
Jul 18, 2014
by
jaco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
templateUpdate function integrated in fullResolutionDetection function
parent
6bf41074
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
19 deletions
+19
-19
saliencySpecializedClasses.hpp
...y/include/opencv2/saliency/saliencySpecializedClasses.hpp
+1
-1
motionSaliencyBinWangApr2014.cpp
modules/saliency/src/motionSaliencyBinWangApr2014.cpp
+18
-18
No files found.
modules/saliency/include/opencv2/saliency/saliencySpecializedClasses.hpp
View file @
7f28c23e
...
@@ -116,7 +116,7 @@ class CV_EXPORTS_W MotionSaliencyBinWangApr2014 : public MotionSaliency
...
@@ -116,7 +116,7 @@ class CV_EXPORTS_W MotionSaliencyBinWangApr2014 : public MotionSaliency
// classification (and adaptation) functions
// classification (and adaptation) functions
bool
fullResolutionDetection
(
Mat
image
,
Mat
highResBFMask
);
bool
fullResolutionDetection
(
Mat
image
,
Mat
highResBFMask
);
bool
lowResolutionDetection
(
Mat
image
,
Mat
lowResBFMask
);
bool
lowResolutionDetection
(
Mat
image
,
Mat
lowResBFMask
);
bool
templateUpdate
(
Mat
highResBFMask
);
//
bool templateUpdate( Mat highResBFMask );
// Background model maintenance functions
// Background model maintenance functions
bool
templateOrdering
();
bool
templateOrdering
();
...
...
modules/saliency/src/motionSaliencyBinWangApr2014.cpp
View file @
7f28c23e
...
@@ -100,12 +100,12 @@ MotionSaliencyBinWangApr2014::~MotionSaliencyBinWangApr2014()
...
@@ -100,12 +100,12 @@ MotionSaliencyBinWangApr2014::~MotionSaliencyBinWangApr2014()
bool
MotionSaliencyBinWangApr2014
::
fullResolutionDetection
(
Mat
image
,
Mat
highResBFMask
)
bool
MotionSaliencyBinWangApr2014
::
fullResolutionDetection
(
Mat
image
,
Mat
highResBFMask
)
{
{
Mat
currentTemplateMat
;
Mat
currentTemplateMat
;
float
currentB
;
float
*
currentB
;
float
currentC
;
float
*
currentC
;
Vec2f
elem
;
Vec2f
elem
;
float
currentPixelValue
;
float
currentPixelValue
;
float
currentEpslonValue
;
float
currentEpslonValue
;
//bool backgFlag=
false;
bool
backgFlag
=
false
;
// Initially, all pixels are considered as foreground and then we evaluate with the background model
// Initially, all pixels are considered as foreground and then we evaluate with the background model
highResBFMask
.
setTo
(
1
);
highResBFMask
.
setTo
(
1
);
...
@@ -125,32 +125,32 @@ bool MotionSaliencyBinWangApr2014::fullResolutionDetection( Mat image, Mat highR
...
@@ -125,32 +125,32 @@ bool MotionSaliencyBinWangApr2014::fullResolutionDetection( Mat image, Mat highR
currentTemplateMat
=
backgroundModel
[
z
];
// Current Background Model matrix
currentTemplateMat
=
backgroundModel
[
z
];
// Current Background Model matrix
// TODO replace "at" with more efficient matrix access
// TODO replace "at" with more efficient matrix access
elem
=
currentTemplateMat
.
at
<
Vec2f
>
(
i
,
j
);
elem
=
currentTemplateMat
.
at
<
Vec2f
>
(
i
,
j
);
currentB
=
elem
[
0
];
currentB
=
&
elem
[
0
];
currentC
=
elem
[
1
];
currentC
=
&
elem
[
1
];
if
(
currentC
>
0
)
//The current template is active
if
(
currentC
>
0
)
//The current template is active
{
{
// If there is a match with a current background template
// If there is a match with a current background template
if
(
abs
(
currentPixelValue
-
currentB
)
<
currentEpslonValue
)
if
(
abs
(
currentPixelValue
-
*
(
currentB
)
)
<
currentEpslonValue
&&
!
backgFlag
)
{
{
// The correspondence pixel in the BF mask is set as background ( 0 value)
// The correspondence pixel in the BF mask is set as background ( 0 value)
// TODO replace "at" with more efficient matrix access
// TODO replace "at" with more efficient matrix access
highResBFMask
.
at
<
int
>
(
i
,
j
)
=
0
;
highResBFMask
.
at
<
int
>
(
i
,
j
)
=
0
;
// backgFlag=true;
*
currentC
+=
1
;
// increment the efficacy of this template
break
;
*
currentB
=
((
1
-
alpha
)
*
*
currentB
)
+
(
alpha
*
currentPixelValue
);
// Update the template value
backgFlag
=
true
;
//break;
}
}
else
{
currentC
-=
1
;
// decrement the efficacy of this template
}
}
}
}
// end "for" cicle of template vector
}
// end "for" cicle of template vector
// if the pixel has not matched with none of the active background models, is set as the foreground
// in the high resolution mask
//if(!backgFlag)
// highResBFMask.at<int>( i, j ) = 1;
}
}
}
// end "for" cicle of all image's pixels
}
// end "for" cicle of all image's pixels
//////// THERE WE CALL THE templateUpdate FUNCTION (to be implemented) ////////
templateUpdate
(
highResBFMask
);
return
true
;
return
true
;
}
}
...
@@ -159,11 +159,11 @@ bool MotionSaliencyBinWangApr2014::lowResolutionDetection( Mat image, Mat lowRes
...
@@ -159,11 +159,11 @@ bool MotionSaliencyBinWangApr2014::lowResolutionDetection( Mat image, Mat lowRes
return
true
;
return
true
;
}
}
bool
MotionSaliencyBinWangApr2014
::
templateUpdate
(
Mat
highResBFMask
)
/*
bool MotionSaliencyBinWangApr2014::templateUpdate( Mat highResBFMask )
{
{
return true;
return true;
}
}
*/
// Background model maintenance functions
// Background model maintenance functions
bool
MotionSaliencyBinWangApr2014
::
templateOrdering
()
bool
MotionSaliencyBinWangApr2014
::
templateOrdering
()
...
...
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