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
f3cada31
Commit
f3cada31
authored
Jun 19, 2014
by
jaco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BING code refined
parent
b7696377
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
474 additions
and
184 deletions
+474
-184
saliencySpecializedClasses.hpp
...y/include/opencv2/saliency/saliencySpecializedClasses.hpp
+80
-82
computeSaliency.cpp
modules/saliency/samples/computeSaliency.cpp
+42
-3
CmFile.cpp
modules/saliency/src/CmFile.cpp
+43
-2
CmFile.h
modules/saliency/src/CmFile.h
+41
-0
CmShow.cpp
modules/saliency/src/CmShow.cpp
+41
-0
CmShow.h
modules/saliency/src/CmShow.h
+41
-0
CmTimer.h
modules/saliency/src/CmTimer.h
+42
-1
FilterTIG.cpp
modules/saliency/src/FilterTIG.cpp
+41
-0
FilterTIG.h
modules/saliency/src/FilterTIG.h
+41
-0
ValStructVec.h
modules/saliency/src/ValStructVec.h
+42
-14
kyheader.h
modules/saliency/src/kyheader.h
+0
-0
motionSaliency.cpp
modules/saliency/src/motionSaliency.cpp
+0
-9
motionSaliencyPBAS.cpp
modules/saliency/src/motionSaliencyPBAS.cpp
+3
-22
objectness.cpp
modules/saliency/src/objectness.cpp
+0
-9
saliency_init.cpp
modules/saliency/src/saliency_init.cpp
+10
-7
staticSaliency.cpp
modules/saliency/src/staticSaliency.cpp
+0
-8
staticSaliencySpectralResidual.cpp
modules/saliency/src/staticSaliencySpectralResidual.cpp
+7
-27
No files found.
modules/saliency/include/opencv2/saliency/saliencySpecializedClasses.hpp
View file @
f3cada31
...
@@ -50,12 +50,6 @@
...
@@ -50,12 +50,6 @@
#include <string>
#include <string>
#include <iostream>
#include <iostream>
//TODO delete
//#define SALIENCY_DEBUG true
#ifdef SALIENCY_DEBUG
#include <opencv2/highgui.hpp>
#endif
namespace
cv
namespace
cv
{
{
...
@@ -68,13 +62,6 @@ namespace cv
...
@@ -68,13 +62,6 @@ namespace cv
class
CV_EXPORTS_W
StaticSaliencySpectralResidual
:
public
StaticSaliency
class
CV_EXPORTS_W
StaticSaliencySpectralResidual
:
public
StaticSaliency
{
{
public
:
public
:
/*struct CV_EXPORTS Params
{
Params();
Size resizedImageSize;
void read( const FileNode& fn );
void write( FileStorage& fs ) const;
}; */
//StaticSaliencySpectralResidual( const StaticSaliencySpectralResidual::Params ¶meters = StaticSaliencySpectralResidual::Params() );
//StaticSaliencySpectralResidual( const StaticSaliencySpectralResidual::Params ¶meters = StaticSaliencySpectralResidual::Params() );
StaticSaliencySpectralResidual
();
StaticSaliencySpectralResidual
();
...
@@ -91,11 +78,8 @@ class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency
...
@@ -91,11 +78,8 @@ class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency
protected
:
protected
:
bool
computeSaliencyImpl
(
const
InputArray
src
,
OutputArray
dst
);
bool
computeSaliencyImpl
(
const
InputArray
src
,
OutputArray
dst
);
AlgorithmInfo
*
info
()
const
;
AlgorithmInfo
*
info
()
const
;
CV_PROP_RW
CV_PROP_RW
Ptr
<
Size
>
resizedImageSize
;
Ptr
<
Size
>
resizedImageSize
;
private
:
//Params params;
};
};
...
@@ -109,12 +93,6 @@ class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency
...
@@ -109,12 +93,6 @@ class CV_EXPORTS_W StaticSaliencySpectralResidual : public StaticSaliency
class
CV_EXPORTS_W
MotionSaliencyPBAS
:
public
MotionSaliency
class
CV_EXPORTS_W
MotionSaliencyPBAS
:
public
MotionSaliency
{
{
public
:
public
:
/* struct CV_EXPORTS Params
{
Params();
void read( const FileNode& fn );
void write( FileStorage& fs ) const;
}; */
//MotionSaliencyPBAS( const MotionSaliencyPBAS::Params ¶meters = MotionSaliencyPBAS::Params() );
//MotionSaliencyPBAS( const MotionSaliencyPBAS::Params ¶meters = MotionSaliencyPBAS::Params() );
MotionSaliencyPBAS
();
MotionSaliencyPBAS
();
...
@@ -127,8 +105,6 @@ class CV_EXPORTS_W MotionSaliencyPBAS : public MotionSaliency
...
@@ -127,8 +105,6 @@ class CV_EXPORTS_W MotionSaliencyPBAS : public MotionSaliency
bool
computeSaliencyImpl
(
const
InputArray
src
,
OutputArray
dst
);
bool
computeSaliencyImpl
(
const
InputArray
src
,
OutputArray
dst
);
AlgorithmInfo
*
info
()
const
;
AlgorithmInfo
*
info
()
const
;
private
:
//Params params;
};
};
/************************************ Specific Objectness Specialized Classes ************************************/
/************************************ Specific Objectness Specialized Classes ************************************/
...
@@ -148,72 +124,94 @@ class CV_EXPORTS_W ObjectnessBING : public Objectness
...
@@ -148,72 +124,94 @@ class CV_EXPORTS_W ObjectnessBING : public Objectness
void
write
()
const
;
void
write
()
const
;
// Load trained model.
// Load trained model.
int
loadTrainedModel
(
std
::
string
modelName
=
""
);
// Return -1, 0, or 1 if partial, none, or all loaded
int
loadTrainedModel
(
std
::
string
modelName
=
""
);
// Return -1, 0, or 1 if partial, none, or all loaded
// Get potential bounding boxes, each of which is represented by a Vec4i for (minX, minY, maxX, maxY).
// Get potential bounding boxes, each of which is represented by a Vec4i for (minX, minY, maxX, maxY).
// The trained model should be prepared before calling this function: loadTrainedModel() or trainStageI() + trainStageII().
// The trained model should be prepared before calling this function: loadTrainedModel() or trainStageI() + trainStageII().
// Use numDet to control the final number of proposed bounding boxes, and number of per size (scale and aspect ratio)
// Use numDet to control the final number of proposed bounding boxes, and number of per size (scale and aspect ratio)
void
getObjBndBoxes
(
CMat
&
img3u
,
ValStructVec
<
float
,
Vec4i
>
&
valBoxes
,
int
numDetPerSize
=
120
);
void
getObjBndBoxes
(
CMat
&
img3u
,
ValStructVec
<
float
,
Vec4i
>
&
valBoxes
,
int
numDetPerSize
=
120
);
void
getObjBndBoxesForSingleImage
(
Mat
img
,
ValStructVec
<
float
,
Vec4i
>
&
boxes
,
int
numDetPerSize
);
void
getObjBndBoxesForSingleImage
(
Mat
img
,
ValStructVec
<
float
,
Vec4i
>
&
boxes
,
int
numDetPerSize
);
vector
<
float
>
getobjectnessValues
();
vector
<
float
>
getobjectnessValues
();
void
setColorSpace
(
int
clr
=
MAXBGR
);
void
setColorSpace
(
int
clr
=
MAXBGR
);
void
setTrainingPath
(
string
trainingPath
);
void
setTrainingPath
(
string
trainingPath
);
void
setBBResDir
(
string
resultsDir
);
void
setBBResDir
(
string
resultsDir
);
// Read matrix from binary file
// Read matrix from binary file
static
bool
matRead
(
const
std
::
string
&
filename
,
Mat
&
M
);
static
bool
matRead
(
const
std
::
string
&
filename
,
Mat
&
M
);
enum
{
MAXBGR
,
HSV
,
G
};
enum
{
inline
static
float
LoG
(
float
x
,
float
y
,
float
delta
)
{
float
d
=
-
(
x
*
x
+
y
*
y
)
/
(
2
*
delta
*
delta
);
return
-
1.0
f
/
((
float
)(
CV_PI
)
*
pow
(
delta
,
4
))
*
(
1
+
d
)
*
exp
(
d
);}
// Laplacian of Gaussian
MAXBGR
,
HSV
,
G
};
inline
static
float
LoG
(
float
x
,
float
y
,
float
delta
)
{
float
d
=
-
(
x
*
x
+
y
*
y
)
/
(
2
*
delta
*
delta
);
return
-
1.0
f
/
(
(
float
)
(
CV_PI
)
*
pow
(
delta
,
4
)
)
*
(
1
+
d
)
*
exp
(
d
);
}
// Laplacian of Gaussian
protected
:
protected
:
bool
computeSaliencyImpl
(
const
InputArray
src
,
OutputArray
dst
);
bool
computeSaliencyImpl
(
const
InputArray
src
,
OutputArray
dst
);
AlgorithmInfo
*
info
()
const
;
AlgorithmInfo
*
info
()
const
;
private
:
// Parameters
private
:
double
_base
,
_logBase
;
// base for window size quantization
// Parameters
int
_W
;
// As described in the paper: #Size, Size(_W, _H) of feature window.
double
_base
,
_logBase
;
// base for window size quantization
int
_NSS
;
// Size for non-maximal suppress
int
_W
;
// As described in the paper: #Size, Size(_W, _H) of feature window.
int
_maxT
,
_minT
,
_numT
;
// The minimal and maximal dimensions of the template
int
_NSS
;
// Size for non-maximal suppress
int
_maxT
,
_minT
,
_numT
;
// The minimal and maximal dimensions of the template
int
_Clr
;
//
static
const
char
*
_clrName
[
3
];
// Names and paths to read model and to store results
std
::
string
_modelName
,
_bbResDir
,
_trainingPath
,
_resultsDir
;
vecI
_svmSzIdxs
;
// Indexes of active size. It's equal to _svmFilters.size() and _svmReW1f.rows
Mat
_svmFilter
;
// Filters learned at stage I, each is a _H by _W CV_32F matrix
FilterTIG
_tigF
;
// TIG filter
Mat
_svmReW1f
;
// Re-weight parameters learned at stage II.
// List of the rectangles' objectness value, in the same order as
// the vector<Vec4i> objectnessBoundingBox returned by the algorithm (in computeSaliencyImpl function)
vector
<
float
>
objectnessValues
;
//vector<Vec4i> objectnessBoundingBox;
private
:
// Help functions
bool
filtersLoaded
()
{
int
n
=
_svmSzIdxs
.
size
();
return
n
>
0
&&
_svmReW1f
.
size
()
==
Size
(
2
,
n
)
&&
_svmFilter
.
size
()
==
Size
(
_W
,
_W
);}
int
_Clr
;
//
void
predictBBoxSI
(
CMat
&
mag3u
,
ValStructVec
<
float
,
Vec4i
>
&
valBoxes
,
vecI
&
sz
,
int
NUM_WIN_PSZ
=
100
,
bool
fast
=
true
);
static
const
char
*
_clrName
[
3
];
void
predictBBoxSII
(
ValStructVec
<
float
,
Vec4i
>
&
valBoxes
,
const
vecI
&
sz
);
// Calculate the image gradient: center option as in VLFeat
// Names and paths to read model and to store results
void
gradientMag
(
CMat
&
imgBGR3u
,
Mat
&
mag1u
)
;
std
::
string
_modelName
,
_bbResDir
,
_trainingPath
,
_resultsDir
;
static
void
gradientRGB
(
CMat
&
bgr3u
,
Mat
&
mag1u
);
vecI
_svmSzIdxs
;
// Indexes of active size. It's equal to _svmFilters.size() and _svmReW1f.rows
static
void
gradientGray
(
CMat
&
bgr3u
,
Mat
&
mag1u
);
Mat
_svmFilter
;
// Filters learned at stage I, each is a _H by _W CV_32F matrix
static
void
gradientHSV
(
CMat
&
bgr3u
,
Mat
&
mag1u
);
FilterTIG
_tigF
;
// TIG filter
static
void
gradientXY
(
CMat
&
x1i
,
CMat
&
y1i
,
Mat
&
mag1u
);
Mat
_svmReW1f
;
// Re-weight parameters learned at stage II.
static
inline
int
bgrMaxDist
(
const
Vec3b
&
u
,
const
Vec3b
&
v
)
{
int
b
=
abs
(
u
[
0
]
-
v
[
0
]),
g
=
abs
(
u
[
1
]
-
v
[
1
]),
r
=
abs
(
u
[
2
]
-
v
[
2
]);
b
=
max
(
b
,
g
);
return
max
(
b
,
r
);}
// List of the rectangles' objectness value, in the same order as
static
inline
int
vecDist3b
(
const
Vec3b
&
u
,
const
Vec3b
&
v
)
{
return
abs
(
u
[
0
]
-
v
[
0
])
+
abs
(
u
[
1
]
-
v
[
1
])
+
abs
(
u
[
2
]
-
v
[
2
]);}
// the vector<Vec4i> objectnessBoundingBox returned by the algorithm (in computeSaliencyImpl function)
vector
<
float
>
objectnessValues
;
//vector<Vec4i> objectnessBoundingBox;
//Non-maximal suppress
private
:
static
void
nonMaxSup
(
CMat
&
matchCost1f
,
ValStructVec
<
float
,
Point
>
&
matchCost
,
int
NSS
=
1
,
int
maxPoint
=
50
,
bool
fast
=
true
);
// Help functions
bool
filtersLoaded
()
{
int
n
=
_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
);
void
predictBBoxSII
(
ValStructVec
<
float
,
Vec4i
>
&
valBoxes
,
const
vecI
&
sz
);
// Calculate the image gradient: center option as in VLFeat
void
gradientMag
(
CMat
&
imgBGR3u
,
Mat
&
mag1u
);
static
void
gradientRGB
(
CMat
&
bgr3u
,
Mat
&
mag1u
);
static
void
gradientGray
(
CMat
&
bgr3u
,
Mat
&
mag1u
);
static
void
gradientHSV
(
CMat
&
bgr3u
,
Mat
&
mag1u
);
static
void
gradientXY
(
CMat
&
x1i
,
CMat
&
y1i
,
Mat
&
mag1u
);
static
inline
int
bgrMaxDist
(
const
Vec3b
&
u
,
const
Vec3b
&
v
)
{
int
b
=
abs
(
u
[
0
]
-
v
[
0
]
),
g
=
abs
(
u
[
1
]
-
v
[
1
]
),
r
=
abs
(
u
[
2
]
-
v
[
2
]
);
b
=
max
(
b
,
g
);
return
max
(
b
,
r
);
}
static
inline
int
vecDist3b
(
const
Vec3b
&
u
,
const
Vec3b
&
v
)
{
return
abs
(
u
[
0
]
-
v
[
0
]
)
+
abs
(
u
[
1
]
-
v
[
1
]
)
+
abs
(
u
[
2
]
-
v
[
2
]
);
}
//Non-maximal suppress
static
void
nonMaxSup
(
CMat
&
matchCost1f
,
ValStructVec
<
float
,
Point
>
&
matchCost
,
int
NSS
=
1
,
int
maxPoint
=
50
,
bool
fast
=
true
);
};
};
...
...
modules/saliency/samples/computeSaliency.cpp
View file @
f3cada31
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include <opencv2/core/utility.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/saliency.hpp>
#include <opencv2/saliency.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/highgui.hpp>
...
@@ -63,8 +104,6 @@ int main( int argc, char** argv )
...
@@ -63,8 +104,6 @@ int main( int argc, char** argv )
Mat
binaryMap
;
Mat
binaryMap
;
Mat
image
;
Mat
image
;
Mat
image2
=
imread
(
"/home/puja/src/BING_beta2_linux/VOC2007/oneVideoJpeg4Test/0011.jpg"
);
cap
>>
frame
;
cap
>>
frame
;
if
(
frame
.
empty
()
)
if
(
frame
.
empty
()
)
{
{
...
@@ -104,7 +143,7 @@ int main( int argc, char** argv )
...
@@ -104,7 +143,7 @@ int main( int argc, char** argv )
saliencyAlgorithm
.
dynamicCast
<
ObjectnessBING
>
()
->
setTrainingPath
(
training_path
);
saliencyAlgorithm
.
dynamicCast
<
ObjectnessBING
>
()
->
setTrainingPath
(
training_path
);
saliencyAlgorithm
.
dynamicCast
<
ObjectnessBING
>
()
->
setBBResDir
(
training_path
+
"/Results"
);
saliencyAlgorithm
.
dynamicCast
<
ObjectnessBING
>
()
->
setBBResDir
(
training_path
+
"/Results"
);
if
(
saliencyAlgorithm
->
computeSaliency
(
image
2
,
saliencyMap
)
)
if
(
saliencyAlgorithm
->
computeSaliency
(
image
,
saliencyMap
)
)
{
{
std
::
cout
<<
"-----------------OBJECTNESS-----------"
<<
std
::
endl
;
std
::
cout
<<
"-----------------OBJECTNESS-----------"
<<
std
::
endl
;
std
::
cout
<<
"OBJECTNESS BOUNDING BOX VECTOR SIZE"
<<
saliencyMap
.
size
()
<<
std
::
endl
;
std
::
cout
<<
"OBJECTNESS BOUNDING BOX VECTOR SIZE"
<<
saliencyMap
.
size
()
<<
std
::
endl
;
...
...
modules/saliency/src/CmFile.cpp
View file @
f3cada31
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "kyheader.h"
#include "kyheader.h"
#include "CmFile.h"
#include "CmFile.h"
...
@@ -55,8 +96,8 @@ int CmFile::GetNames(CStr& rootFolder, CStr &fileW, vecS &names)
...
@@ -55,8 +96,8 @@ int CmFile::GetNames(CStr& rootFolder, CStr &fileW, vecS &names)
int
subNum
=
CmFile
::
GetSubFolders
(
rootFolder
,
subFolders
);
//
int
subNum
=
CmFile
::
GetSubFolders
(
rootFolder
,
subFolders
);
//
for
(
int
i
=
0
;
i
<
subNum
;
i
++
){
for
(
int
i
=
0
;
i
<
subNum
;
i
++
){
subFolders
[
i
]
+=
"/"
;
subFolders
[
i
]
+=
"/"
;
int
subNum
=
GetNames
(
rootFolder
+
subFolders
[
i
],
fileW
,
tmpNames
);
int
subNum
_
=
GetNames
(
rootFolder
+
subFolders
[
i
],
fileW
,
tmpNames
);
for
(
int
j
=
0
;
j
<
subNum
;
j
++
)
for
(
int
j
=
0
;
j
<
subNum
_
;
j
++
)
names
.
push_back
(
subFolders
[
i
]
+
tmpNames
[
j
]);
names
.
push_back
(
subFolders
[
i
]
+
tmpNames
[
j
]);
}
}
return
(
int
)
names
.
size
();
return
(
int
)
names
.
size
();
...
...
modules/saliency/src/CmFile.h
View file @
f3cada31
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#pragma once
#pragma once
#ifdef _WIN32
#ifdef _WIN32
...
...
modules/saliency/src/CmShow.cpp
View file @
f3cada31
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "kyheader.h"
#include "kyheader.h"
#include "CmShow.h"
#include "CmShow.h"
#include "opencv2/core.hpp"
#include "opencv2/core.hpp"
...
...
modules/saliency/src/CmShow.h
View file @
f3cada31
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#pragma once
#pragma once
class
CmShow
class
CmShow
{
{
...
...
modules/saliency/src/CmTimer.h
View file @
f3cada31
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#pragma once
#pragma once
#ifndef CMTIMER_H
#ifndef CMTIMER_H
#define CMTIMER_H
#define CMTIMER_H
...
@@ -58,7 +99,7 @@ void CmTimer::Stop()
...
@@ -58,7 +99,7 @@ void CmTimer::Stop()
void
CmTimer
::
Reset
()
void
CmTimer
::
Reset
()
{
{
if
(
is_started
)
{
if
(
is_started
)
{
printf
(
"CmTimer '%s'is started during reset request.
\n
Only reset cumulative time.
\n
"
);
printf
(
"CmTimer '%s'is started during reset request.
\n
Only reset cumulative time.
\n
"
,
title
.
c_str
()
);
return
;
return
;
}
}
cumulative_clock
=
0
;
cumulative_clock
=
0
;
...
...
modules/saliency/src/FilterTIG.cpp
View file @
f3cada31
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "kyheader.h"
#include "kyheader.h"
#include "FilterTIG.h"
#include "FilterTIG.h"
#include "CmShow.h"
#include "CmShow.h"
...
...
modules/saliency/src/FilterTIG.h
View file @
f3cada31
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#pragma once
#pragma once
#include "kyheader.h"
#include "kyheader.h"
class
FilterTIG
class
FilterTIG
...
...
modules/saliency/src/ValStructVec.h
View file @
f3cada31
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#pragma once
#pragma once
/************************************************************************/
/************************************************************************/
...
@@ -74,7 +115,7 @@ void ValStructVec<VT, ST>::append( const ValStructVec<VT, ST> &newVals, int star
...
@@ -74,7 +115,7 @@ void ValStructVec<VT, ST>::append( const ValStructVec<VT, ST> &newVals, int star
{
{
int
newValsSize
=
newVals
.
size
();
int
newValsSize
=
newVals
.
size
();
for
(
int
i
=
0
;
i
<
newValsSize
;
i
++
)
for
(
int
i
=
0
;
i
<
newValsSize
;
i
++
)
pushBack
(
(
float
)
(
(
i
+
300
)
*
startV
)
/*newVals(i)*/
,
newVals
[
i
]
);
pushBack
(
(
float
)
(
(
i
+
300
)
*
startV
),
newVals
[
i
]
);
}
}
template
<
typename
VT
,
typename
ST
>
template
<
typename
VT
,
typename
ST
>
...
@@ -101,16 +142,3 @@ vector<pair<VT, int> > ValStructVec<VT, ST>::getvalIdxes()
...
@@ -101,16 +142,3 @@ vector<pair<VT, int> > ValStructVec<VT, ST>::getvalIdxes()
return
valIdxes
;
return
valIdxes
;
}
}
/*
void valStructVecDemo()
{
ValStructVec<int, string> sVals;
sVals.pushBack(3, "String 3");
sVals.pushBack(5, "String 5");
sVals.pushBack(4, "String 4");
sVals.pushBack(1, "String 1");
sVals.sort(false);
for (int i = 0; i < sVals.size(); i++)
printf("%d, %s\n", sVals(i), _S(sVals[i]));
}
*/
modules/saliency/src/kyheader.h
View file @
f3cada31
This diff is collapsed.
Click to expand it.
modules/saliency/src/motionSaliency.cpp
View file @
f3cada31
...
@@ -48,14 +48,5 @@ namespace cv
...
@@ -48,14 +48,5 @@ namespace cv
* Motion Saliency
* Motion Saliency
*/
*/
/**
* Parameters
*/
//MotionSaliency::Params::Params()
//{
//
//}
}
/* namespace cv */
}
/* namespace cv */
modules/saliency/src/motionSaliencyPBAS.cpp
View file @
f3cada31
...
@@ -48,25 +48,6 @@ namespace cv
...
@@ -48,25 +48,6 @@ namespace cv
* PBAS Motion Saliency
* PBAS Motion Saliency
*/
*/
/**
* Parameters
MotionSaliencyPBAS::Params::Params()
{
}
void MotionSaliencyPBAS::Params::read( const cv::FileNode& fn )
{
//resizedImageSize=Size(fn["resizedImageSize"]);
}
void MotionSaliencyPBAS::Params::write( cv::FileStorage& fs ) const
{
//fs << "resizedImageSize" << resizedImageSize;
} */
MotionSaliencyPBAS
::
MotionSaliencyPBAS
()
MotionSaliencyPBAS
::
MotionSaliencyPBAS
()
{
{
className
=
"PBAS"
;
className
=
"PBAS"
;
...
@@ -77,17 +58,17 @@ MotionSaliencyPBAS::~MotionSaliencyPBAS()
...
@@ -77,17 +58,17 @@ MotionSaliencyPBAS::~MotionSaliencyPBAS()
}
}
void
MotionSaliencyPBAS
::
read
(
const
cv
::
FileNode
&
/*fn*/
)
void
MotionSaliencyPBAS
::
read
(
const
cv
::
FileNode
&
/*fn*/
)
{
{
//params.read( fn );
//params.read( fn );
}
}
void
MotionSaliencyPBAS
::
write
(
cv
::
FileStorage
&
/*fs*/
)
const
void
MotionSaliencyPBAS
::
write
(
cv
::
FileStorage
&
/*fs*/
)
const
{
{
//params.write( fs );
//params.write( fs );
}
}
bool
MotionSaliencyPBAS
::
computeSaliencyImpl
(
const
InputArray
/*src*/
,
OutputArray
/*dst*/
)
bool
MotionSaliencyPBAS
::
computeSaliencyImpl
(
const
InputArray
/*src*/
,
OutputArray
/*dst*/
)
{
{
return
true
;
return
true
;
...
...
modules/saliency/src/objectness.cpp
View file @
f3cada31
...
@@ -48,14 +48,5 @@ namespace cv
...
@@ -48,14 +48,5 @@ namespace cv
* Objectness
* Objectness
*/
*/
/**
* Parameters
*/
//Objectness::Params::Params()
//{
//
//}
}
/* namespace cv */
}
/* namespace cv */
modules/saliency/src/saliency_init.cpp
View file @
f3cada31
...
@@ -45,15 +45,18 @@
...
@@ -45,15 +45,18 @@
namespace
cv
namespace
cv
{
{
CV_INIT_ALGORITHM
(
StaticSaliencySpectralResidual
,
"SALIENCY.SPECTRAL_RESIDUAL"
,
CV_INIT_ALGORITHM
(
obj
.
info
()
->
addParam
(
obj
,
"resizedImageSize"
,
obj
.
resizedImageSize
,
false
,
reinterpret_cast
<
SizeGetter
>
(
&
StaticSaliencySpectralResidual
::
getWsize
),
reinterpret_cast
<
SizeSetter
>
(
&
StaticSaliencySpectralResidual
::
setWsize
)));
StaticSaliencySpectralResidual
,
"SALIENCY.SPECTRAL_RESIDUAL"
,
obj
.
info
()
->
addParam
(
obj
,
"resizedImageSize"
,
obj
.
resizedImageSize
,
false
,
reinterpret_cast
<
SizeGetter
>
(
&
StaticSaliencySpectralResidual
::
getWsize
),
reinterpret_cast
<
SizeSetter
>
(
&
StaticSaliencySpectralResidual
::
setWsize
)
)
);
CV_INIT_ALGORITHM
(
MotionSaliencyPBAS
,
"SALIENCY.PBAS"
,);
CV_INIT_ALGORITHM
(
MotionSaliencyPBAS
,
"SALIENCY.PBAS"
,
);
CV_INIT_ALGORITHM
(
ObjectnessBING
,
"SALIENCY.BING"
,
CV_INIT_ALGORITHM
(
obj
.
info
()
->
addParam
(
obj
,
"_base"
,
obj
.
_base
);
ObjectnessBING
,
"SALIENCY.BING"
,
obj
.
info
()
->
addParam
(
obj
,
"_NSS"
,
obj
.
_NSS
);
obj
.
info
()
->
addParam
(
obj
,
"_base"
,
obj
.
_base
);
obj
.
info
()
->
addParam
(
obj
,
"_NSS"
,
obj
.
_NSS
);
obj
.
info
()
->
addParam
(
obj
,
"_W"
,
obj
.
_W
)
);
obj
.
info
()
->
addParam
(
obj
,
"_W"
,
obj
.
_W
));
bool
initModule_saliency
(
void
)
bool
initModule_saliency
(
void
)
{
{
...
...
modules/saliency/src/staticSaliency.cpp
View file @
f3cada31
...
@@ -48,14 +48,6 @@ namespace cv
...
@@ -48,14 +48,6 @@ namespace cv
* StaticSaliency
* StaticSaliency
*/
*/
/**
* Parameters
StaticSaliency::Params::Params()
{
} */
bool
StaticSaliency
::
computeBinaryMap
(
const
Mat
&
saliencyMap
,
Mat
&
BinaryMap
)
bool
StaticSaliency
::
computeBinaryMap
(
const
Mat
&
saliencyMap
,
Mat
&
BinaryMap
)
{
{
...
...
modules/saliency/src/staticSaliencySpectralResidual.cpp
View file @
f3cada31
...
@@ -48,38 +48,19 @@ namespace cv
...
@@ -48,38 +48,19 @@ namespace cv
* SaliencySpectralResidual
* SaliencySpectralResidual
*/
*/
/**
cv
::
Ptr
<
Size
>
StaticSaliencySpectralResidual
::
getWsize
()
* Parameters
StaticSaliencySpectralResidual::Params::Params()
{
resizedImageSize=Size(64,64);
}
void StaticSaliencySpectralResidual::Params::read( const cv::FileNode& fn )
{
{
//resizedImageSize=Size(fn["resizedImageSize"]);
return
resizedImageSize
;
}
}
void
StaticSaliencySpectralResidual
::
setWsize
(
const
cv
::
Ptr
<
Size
>&
newSize
)
void StaticSaliencySpectralResidual::Params::write( cv::FileStorage& fs ) const
{
{
//fs << "resizedImageSize" << resizedImageSize;
} */
cv
::
Ptr
<
Size
>
StaticSaliencySpectralResidual
::
getWsize
(){
return
resizedImageSize
;
}
void
StaticSaliencySpectralResidual
::
setWsize
(
const
cv
::
Ptr
<
Size
>&
newSize
){
resizedImageSize
=
newSize
;
resizedImageSize
=
newSize
;
}
}
StaticSaliencySpectralResidual
::
StaticSaliencySpectralResidual
()
StaticSaliencySpectralResidual
::
StaticSaliencySpectralResidual
()
{
{
className
=
"SPECTRAL_RESIDUAL"
;
className
=
"SPECTRAL_RESIDUAL"
;
resizedImageSize
=
Ptr
<
Size
>
(
new
Size
(
64
,
64
)
);
resizedImageSize
=
Ptr
<
Size
>
(
new
Size
(
64
,
64
)
);
}
}
StaticSaliencySpectralResidual
::~
StaticSaliencySpectralResidual
()
StaticSaliencySpectralResidual
::~
StaticSaliencySpectralResidual
()
...
@@ -87,12 +68,12 @@ StaticSaliencySpectralResidual::~StaticSaliencySpectralResidual()
...
@@ -87,12 +68,12 @@ StaticSaliencySpectralResidual::~StaticSaliencySpectralResidual()
}
}
void
StaticSaliencySpectralResidual
::
read
(
const
cv
::
FileNode
&
fn
)
void
StaticSaliencySpectralResidual
::
read
(
const
cv
::
FileNode
&
/*fn*/
)
{
{
//params.read( fn );
//params.read( fn );
}
}
void
StaticSaliencySpectralResidual
::
write
(
cv
::
FileStorage
&
fs
)
const
void
StaticSaliencySpectralResidual
::
write
(
cv
::
FileStorage
&
/*fs*/
)
const
{
{
//params.write( fs );
//params.write( fs );
}
}
...
@@ -101,7 +82,7 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image
...
@@ -101,7 +82,7 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image
{
{
Mat
grayTemp
,
grayDown
;
Mat
grayTemp
,
grayDown
;
std
::
vector
<
Mat
>
mv
;
std
::
vector
<
Mat
>
mv
;
Mat
realImage
(
*
resizedImageSize
,
CV_64F
);
Mat
realImage
(
*
resizedImageSize
,
CV_64F
);
Mat
imaginaryImage
(
*
resizedImageSize
,
CV_64F
);
Mat
imaginaryImage
(
*
resizedImageSize
,
CV_64F
);
imaginaryImage
.
setTo
(
0
);
imaginaryImage
.
setTo
(
0
);
Mat
combinedImage
(
*
resizedImageSize
,
CV_64FC2
);
Mat
combinedImage
(
*
resizedImageSize
,
CV_64FC2
);
...
@@ -159,7 +140,6 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image
...
@@ -159,7 +140,6 @@ bool StaticSaliencySpectralResidual::computeSaliencyImpl( const InputArray image
imshow
(
"Saliency Map Interna"
,
saliencyMap
);
imshow
(
"Saliency Map Interna"
,
saliencyMap
);
#endif
#endif
return
true
;
return
true
;
}
}
...
...
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