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
75896858
Commit
75896858
authored
Mar 21, 2015
by
jiaolong_cvc228
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
corrected the testing data path for latentsvm detector and some typos
parent
63a86ac4
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
161 additions
and
161 deletions
+161
-161
_lsvmc_function.h
modules/latentsvm/src/_lsvmc_function.h
+5
-6
_lsvmc_latentsvm.h
modules/latentsvm/src/_lsvmc_latentsvm.h
+20
-20
_lsvmc_matching.h
modules/latentsvm/src/_lsvmc_matching.h
+3
-3
_lsvmc_parser.h
modules/latentsvm/src/_lsvmc_parser.h
+1
-1
_lsvmc_routine.h
modules/latentsvm/src/_lsvmc_routine.h
+6
-6
_lsvmc_types.h
modules/latentsvm/src/_lsvmc_types.h
+8
-8
lsvmc_featurepyramid.cpp
modules/latentsvm/src/lsvmc_featurepyramid.cpp
+11
-11
lsvmc_function.cpp
modules/latentsvm/src/lsvmc_function.cpp
+4
-4
lsvmc_latentsvm.cpp
modules/latentsvm/src/lsvmc_latentsvm.cpp
+29
-29
lsvmc_latentsvmdetector.cpp
modules/latentsvm/src/lsvmc_latentsvmdetector.cpp
+25
-25
lsvmc_matching.cpp
modules/latentsvm/src/lsvmc_matching.cpp
+3
-3
lsvmc_parser.cpp
modules/latentsvm/src/lsvmc_parser.cpp
+25
-25
lsvmc_routine.cpp
modules/latentsvm/src/lsvmc_routine.cpp
+11
-11
test_latentsvmdetector_cascade.cpp
modules/latentsvm/test/test_latentsvmdetector_cascade.cpp
+9
-8
test_main.cpp
modules/latentsvm/test/test_main.cpp
+1
-1
No files found.
modules/latentsvm/src/_lsvmc_function.h
View file @
75896858
...
...
@@ -49,10 +49,10 @@ namespace cv
namespace
lsvm
{
float
calcM
(
int
k
,
int
di
,
int
dj
,
const
CvLSVMFeaturePyramidCas
kade
*
H
,
const
CvLSVMFilterObjectCask
ade
*
filter
);
float
calcM_PCA
(
int
k
,
int
di
,
int
dj
,
const
CvLSVMFeaturePyramidCas
kade
*
H
,
const
CvLSVMFilterObjectCask
ade
*
filter
);
float
calcM_PCA_cash
(
int
k
,
int
di
,
int
dj
,
const
CvLSVMFeaturePyramidCas
kade
*
H
,
const
CvLSVMFilterObjectCask
ade
*
filter
,
float
*
cashM
,
int
*
maskM
,
int
step
);
float
calcFine
(
const
CvLSVMFilterObjectCas
k
ade
*
filter
,
int
di
,
int
dj
);
float
calcM
(
int
k
,
int
di
,
int
dj
,
const
CvLSVMFeaturePyramidCas
cade
*
H
,
const
CvLSVMFilterObjectCasc
ade
*
filter
);
float
calcM_PCA
(
int
k
,
int
di
,
int
dj
,
const
CvLSVMFeaturePyramidCas
cade
*
H
,
const
CvLSVMFilterObjectCasc
ade
*
filter
);
float
calcM_PCA_cash
(
int
k
,
int
di
,
int
dj
,
const
CvLSVMFeaturePyramidCas
cade
*
H
,
const
CvLSVMFilterObjectCasc
ade
*
filter
,
float
*
cashM
,
int
*
maskM
,
int
step
);
float
calcFine
(
const
CvLSVMFilterObjectCas
c
ade
*
filter
,
int
di
,
int
dj
);
}
}
#endif
\ No newline at end of file
#endif
modules/latentsvm/src/_lsvmc_latentsvm.h
View file @
75896858
...
...
@@ -61,29 +61,29 @@ namespace lsvm
// (pyramid constructed both contrast and non-contrast image)
//////////////////////////////////////////////////////////////
void
FeaturePyramid32
(
CvLSVMFeaturePyramidCas
k
ade
*
H
,
int
maxX
,
int
maxY
);
void
FeaturePyramid32
(
CvLSVMFeaturePyramidCas
c
ade
*
H
,
int
maxX
,
int
maxY
);
/*
// Creation P
S
A feature pyramid
// Creation P
C
A feature pyramid
//
// API
// featurePyramid* createP
S
A_FeaturePyramid(featurePyramid* H);
// featurePyramid* createP
C
A_FeaturePyramid(featurePyramid* H);
// INPUT
// H - feature pyramid
// OUTPUT
// RESULT
// P
S
A feature pyramid
// P
C
A feature pyramid
*/
CvLSVMFeaturePyramidCas
kade
*
createPCA_FeaturePyramid
(
CvLSVMFeaturePyramidCask
ade
*
H
,
CvLatentSvmDetectorCas
k
ade
*
detector
,
CvLSVMFeaturePyramidCas
cade
*
createPCA_FeaturePyramid
(
CvLSVMFeaturePyramidCasc
ade
*
H
,
CvLatentSvmDetectorCas
c
ade
*
detector
,
int
maxX
,
int
maxY
);
/*
// Getting feature pyramid
//
// API
// int getFeaturePyramid(IplImage * image, const CvLSVMFilterObjectCas
k
ade **all_F,
// int getFeaturePyramid(IplImage * image, const CvLSVMFilterObjectCas
c
ade **all_F,
const int n_f,
const int lambda, const int k,
const int startX, const int startY,
...
...
@@ -101,7 +101,7 @@ CvLSVMFeaturePyramidCaskade* createPCA_FeaturePyramid(CvLSVMFeaturePyramidCaskad
// RESULT
// Error status
*/
int
getFeaturePyramid
(
IplImage
*
image
,
CvLSVMFeaturePyramidCas
k
ade
**
maps
);
int
getFeaturePyramid
(
IplImage
*
image
,
CvLSVMFeaturePyramidCas
c
ade
**
maps
);
/*
// Getting feature map for the selected subimage
...
...
@@ -116,7 +116,7 @@ int getFeaturePyramid(IplImage * image, CvLSVMFeaturePyramidCaskade **maps);
// RESULT
// Error status
*/
int
getFeatureMaps
(
const
IplImage
*
image
,
const
int
k
,
CvLSVMFeatureMapCas
k
ade
**
map
);
int
getFeatureMaps
(
const
IplImage
*
image
,
const
int
k
,
CvLSVMFeatureMapCas
c
ade
**
map
);
/*
...
...
@@ -132,7 +132,7 @@ int getFeatureMaps(const IplImage * image, const int k, CvLSVMFeatureMapCaskade
// RESULT
// Error status
*/
int
normalizeAndTruncate
(
CvLSVMFeatureMapCas
k
ade
*
map
,
const
float
alfa
);
int
normalizeAndTruncate
(
CvLSVMFeatureMapCas
c
ade
*
map
,
const
float
alfa
);
/*
// Feature map reduction
...
...
@@ -148,7 +148,7 @@ int normalizeAndTruncate(CvLSVMFeatureMapCaskade *map, const float alfa);
// RESULT
// Error status
*/
int
PCAFeatureMaps
(
CvLSVMFeatureMapCas
k
ade
*
map
);
int
PCAFeatureMaps
(
CvLSVMFeatureMapCas
c
ade
*
map
);
//////////////////////////////////////////////////////////////
// search object
...
...
@@ -227,7 +227,7 @@ int clippingBoxes(int width, int height,
// RESULT
// Feature pyramid with nullable border
*/
CvLSVMFeaturePyramidCas
k
ade
*
createFeaturePyramidWithBorder
(
IplImage
*
image
,
CvLSVMFeaturePyramidCas
c
ade
*
createFeaturePyramidWithBorder
(
IplImage
*
image
,
int
maxXBorder
,
int
maxYBorder
);
/*
...
...
@@ -235,7 +235,7 @@ CvLSVMFeaturePyramidCaskade* createFeaturePyramidWithBorder(IplImage *image,
//
// API
// int searchObjectThresholdSomeComponents(const featurePyramid *H,
const CvLSVMFilterObjectCas
k
ade **filters,
const CvLSVMFilterObjectCas
c
ade **filters,
int kComponents, const int *kPartFilters,
const float *b, float scoreThreshold,
CvPoint **points, CvPoint **oppPoints,
...
...
@@ -255,9 +255,9 @@ CvLSVMFeaturePyramidCaskade* createFeaturePyramidWithBorder(IplImage *image,
// RESULT
// Error status
*/
int
searchObjectThresholdSomeComponents
(
const
CvLSVMFeaturePyramidCas
k
ade
*
H
,
const
CvLSVMFeaturePyramidCas
k
ade
*
H_PCA
,
const
CvLSVMFilterObjectCas
k
ade
**
filters
,
int
searchObjectThresholdSomeComponents
(
const
CvLSVMFeaturePyramidCas
c
ade
*
H
,
const
CvLSVMFeaturePyramidCas
c
ade
*
H_PCA
,
const
CvLSVMFilterObjectCas
c
ade
**
filters
,
int
kComponents
,
const
int
*
kPartFilters
,
const
float
*
b
,
float
scoreThreshold
,
CvPoint
**
points
,
CvPoint
**
oppPoints
,
...
...
@@ -294,7 +294,7 @@ int getOppositePoint(CvPoint point,
//
// API
// int showRootFilterBoxes(const IplImage *image,
const CvLSVMFilterObjectCas
k
ade *filter,
const CvLSVMFilterObjectCas
c
ade *filter,
CvPoint *points, int *levels, int kPoints,
CvScalar color, int thickness,
int line_type, int shift);
...
...
@@ -314,7 +314,7 @@ int getOppositePoint(CvPoint point,
// Error status
*/
int
showRootFilterBoxes
(
IplImage
*
image
,
const
CvLSVMFilterObjectCas
k
ade
*
filter
,
const
CvLSVMFilterObjectCas
c
ade
*
filter
,
CvPoint
*
points
,
int
*
levels
,
int
kPoints
,
CvScalar
color
,
int
thickness
,
int
line_type
,
int
shift
);
...
...
@@ -324,7 +324,7 @@ int showRootFilterBoxes(IplImage *image,
//
// API
// int showPartFilterBoxes(const IplImage *image,
const CvLSVMFilterObjectCas
k
ade *filter,
const CvLSVMFilterObjectCas
c
ade *filter,
CvPoint *points, int *levels, int kPoints,
CvScalar color, int thickness,
int line_type, int shift);
...
...
@@ -345,7 +345,7 @@ int showRootFilterBoxes(IplImage *image,
// Error status
*/
int
showPartFilterBoxes
(
IplImage
*
image
,
const
CvLSVMFilterObjectCas
k
ade
**
filters
,
const
CvLSVMFilterObjectCas
c
ade
**
filters
,
int
n
,
CvPoint
**
partsDisplacement
,
int
*
levels
,
int
kPoints
,
CvScalar
color
,
int
thickness
,
...
...
modules/latentsvm/src/_lsvmc_matching.h
View file @
75896858
...
...
@@ -85,7 +85,7 @@ int computeBorderSize(int maxXBorder, int maxYBorder, int *bx, int *by);
// RESULT
// Error status
*/
int
addNullableBorder
(
CvLSVMFeatureMapCas
k
ade
*
map
,
int
bx
,
int
by
);
int
addNullableBorder
(
CvLSVMFeatureMapCas
c
ade
*
map
,
int
bx
,
int
by
);
/*
// Perform non-maximum suppression algorithm (described in original paper)
...
...
@@ -117,12 +117,12 @@ int nonMaximumSuppression(int numBoxes, const CvPoint *points,
float
overlapThreshold
,
int
*
numBoxesOut
,
CvPoint
**
pointsOut
,
CvPoint
**
oppositePointsOut
,
float
**
scoreOut
);
int
getMaxFilterDims
(
const
CvLSVMFilterObjectCas
k
ade
**
filters
,
int
kComponents
,
int
getMaxFilterDims
(
const
CvLSVMFilterObjectCas
c
ade
**
filters
,
int
kComponents
,
const
int
*
kPartFilters
,
unsigned
int
*
maxXBorder
,
unsigned
int
*
maxYBorder
);
//}
int
getMaxFilterDims
(
const
CvLSVMFilterObjectCas
k
ade
**
filters
,
int
kComponents
,
int
getMaxFilterDims
(
const
CvLSVMFilterObjectCas
c
ade
**
filters
,
int
kComponents
,
const
int
*
kPartFilters
,
unsigned
int
*
maxXBorder
,
unsigned
int
*
maxYBorder
);
}
...
...
modules/latentsvm/src/_lsvmc_parser.h
View file @
75896858
...
...
@@ -116,7 +116,7 @@ namespace lsvm
const
char
*
modelPath
,
// model path
// output parametrs
CvLSVMFilterObjectCas
k
ade
***
filters
,
CvLSVMFilterObjectCas
c
ade
***
filters
,
int
*
kFilters
,
int
*
kComponents
,
int
**
kPartFilters
,
...
...
modules/latentsvm/src/_lsvmc_routine.h
View file @
75896858
...
...
@@ -58,18 +58,18 @@ namespace lsvm
// with all fields including arrays
// Error status is return value
//////////////////////////////////////////////////////////////
int
allocFilterObject
(
CvLSVMFilterObjectCas
k
ade
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
int
allocFilterObject
(
CvLSVMFilterObjectCas
c
ade
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
p
);
int
freeFilterObject
(
CvLSVMFilterObjectCas
k
ade
**
obj
);
int
freeFilterObject
(
CvLSVMFilterObjectCas
c
ade
**
obj
);
int
allocFeatureMapObject
(
CvLSVMFeatureMapCas
k
ade
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
int
allocFeatureMapObject
(
CvLSVMFeatureMapCas
c
ade
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
p
);
int
freeFeatureMapObject
(
CvLSVMFeatureMapCas
k
ade
**
obj
);
int
freeFeatureMapObject
(
CvLSVMFeatureMapCas
c
ade
**
obj
);
int
allocFeaturePyramidObject
(
CvLSVMFeaturePyramidCas
k
ade
**
obj
,
int
allocFeaturePyramidObject
(
CvLSVMFeaturePyramidCas
c
ade
**
obj
,
const
int
countLevel
);
int
freeFeaturePyramidObject
(
CvLSVMFeaturePyramidCas
k
ade
**
obj
);
int
freeFeaturePyramidObject
(
CvLSVMFeaturePyramidCas
c
ade
**
obj
);
}
}
...
...
modules/latentsvm/src/_lsvmc_types.h
View file @
75896858
...
...
@@ -96,7 +96,7 @@ typedef struct{
int
sizeY
;
int
numFeatures
;
float
*
map
;
}
CvLSVMFeatureMapCas
k
ade
;
}
CvLSVMFeatureMapCas
c
ade
;
// DataType: STRUCT featurePyramid
//
...
...
@@ -104,8 +104,8 @@ typedef struct{
// pyramid - array of pointers to feature map at different levels
typedef
struct
{
int
numLevels
;
CvLSVMFeatureMapCas
k
ade
**
pyramid
;
}
CvLSVMFeaturePyramidCas
k
ade
;
CvLSVMFeatureMapCas
c
ade
**
pyramid
;
}
CvLSVMFeaturePyramidCas
c
ade
;
// DataType: STRUCT filterDisposition
// The structure stores preliminary results in optimization process
...
...
@@ -147,7 +147,7 @@ typedef struct CvLSVMFilterPosition
// k - component of feature vector in cell (i, j)
// END OF FILTER DESCRIPTION
typedef
struct
CvLSVMFilterObjectCas
k
ade
{
typedef
struct
CvLSVMFilterObjectCas
c
ade
{
CvLSVMFilterPosition
V
;
float
fineFunction
[
4
];
int
sizeX
;
...
...
@@ -159,7 +159,7 @@ typedef struct CvLSVMFilterObjectCaskade{
float
Hypothesis_PCA
,
Deformation_PCA
;
int
deltaX
;
int
deltaY
;
}
CvLSVMFilterObjectCas
k
ade
;
}
CvLSVMFilterObjectCas
c
ade
;
// data type: STRUCT CvLatentSvmDetector
// structure contains internal representation of trained Latent SVM detector
...
...
@@ -170,17 +170,17 @@ typedef struct CvLSVMFilterObjectCaskade{
// b - biases for all model components
// score_threshold - confidence level threshold
typedef
struct
CvLatentSvmDetectorCas
k
ade
typedef
struct
CvLatentSvmDetectorCas
c
ade
{
int
num_filters
;
int
num_components
;
int
*
num_part_filters
;
CvLSVMFilterObjectCas
k
ade
**
filters
;
CvLSVMFilterObjectCas
c
ade
**
filters
;
float
*
b
;
float
score_threshold
;
float
*
pca
;
int
pca_size
;
}
CvLatentSvmDetectorCas
k
ade
;
}
CvLatentSvmDetectorCas
c
ade
;
}
}
#endif
modules/latentsvm/src/lsvmc_featurepyramid.cpp
View file @
75896858
...
...
@@ -64,7 +64,7 @@ namespace lsvm
int
getPathOfFeaturePyramid
(
IplImage
*
image
,
float
step
,
int
numStep
,
int
startIndex
,
int
sideLength
,
CvLSVMFeaturePyramidCas
k
ade
**
maps
);
int
sideLength
,
CvLSVMFeaturePyramidCas
c
ade
**
maps
);
/*
// Getting feature map for the selected subimage
...
...
@@ -79,7 +79,7 @@ int getPathOfFeaturePyramid(IplImage * image,
// RESULT
// Error status
*/
int
getFeatureMaps
(
const
IplImage
*
image
,
const
int
k
,
CvLSVMFeatureMapCas
k
ade
**
map
)
int
getFeatureMaps
(
const
IplImage
*
image
,
const
int
k
,
CvLSVMFeatureMapCas
c
ade
**
map
)
{
int
sizeX
,
sizeY
;
int
p
,
px
,
stringSize
;
...
...
@@ -289,7 +289,7 @@ int getFeatureMaps(const IplImage* image, const int k, CvLSVMFeatureMapCaskade *
// RESULT
// Error status
*/
int
normalizeAndTruncate
(
CvLSVMFeatureMapCas
k
ade
*
map
,
const
float
alfa
)
int
normalizeAndTruncate
(
CvLSVMFeatureMapCas
c
ade
*
map
,
const
float
alfa
)
{
int
i
,
j
,
ii
;
int
sizeX
,
sizeY
,
p
,
pos
,
pp
,
xp
,
pos1
,
pos2
;
...
...
@@ -413,7 +413,7 @@ int normalizeAndTruncate(CvLSVMFeatureMapCaskade *map, const float alfa)
// RESULT
// Error status
*/
int
PCAFeatureMaps
(
CvLSVMFeatureMapCas
k
ade
*
map
)
int
PCAFeatureMaps
(
CvLSVMFeatureMapCas
c
ade
*
map
)
{
int
i
,
j
,
ii
,
jj
,
k
;
int
sizeX
,
sizeY
,
p
,
pp
,
xp
,
yp
,
pos1
,
pos2
;
...
...
@@ -485,9 +485,9 @@ int PCAFeatureMaps(CvLSVMFeatureMapCaskade *map)
int
getPathOfFeaturePyramid
(
IplImage
*
image
,
float
step
,
int
numStep
,
int
startIndex
,
int
sideLength
,
CvLSVMFeaturePyramidCas
k
ade
**
maps
)
int
sideLength
,
CvLSVMFeaturePyramidCas
c
ade
**
maps
)
{
CvLSVMFeatureMapCas
k
ade
*
map
;
CvLSVMFeatureMapCas
c
ade
*
map
;
IplImage
*
scaleTmp
;
float
scale
;
int
i
;
...
...
@@ -513,11 +513,11 @@ public:
float
step
;
int
startIndex
;
int
sideLength
;
CvLSVMFeaturePyramidCas
k
ade
**
maps
;
CvLSVMFeaturePyramidCas
c
ade
**
maps
;
void
operator
()
(
const
Range
&
range
)
const
{
CvLSVMFeatureMapCas
k
ade
*
map
;
CvLSVMFeatureMapCas
c
ade
*
map
;
IplImage
*
scaleTmp
;
float
scale
;
int
err
;
...
...
@@ -538,7 +538,7 @@ public:
int
getPathOfFeaturePyramid_TBB
(
IplImage
*
image
,
float
step
,
int
numStep
,
int
startIndex
,
int
sideLength
,
CvLSVMFeaturePyramidCas
k
ade
**
maps
)
int
sideLength
,
CvLSVMFeaturePyramidCas
c
ade
**
maps
)
{
PathOfFeaturePyramid
str
;
str
.
step
=
step
;
...
...
@@ -557,7 +557,7 @@ int getPathOfFeaturePyramid_TBB(IplImage * image,
// Getting feature pyramid
//
// API
// int getFeaturePyramid(IplImage * image, const CvLSVMFilterObjectCas
k
ade **all_F,
// int getFeaturePyramid(IplImage * image, const CvLSVMFilterObjectCas
c
ade **all_F,
const int n_f,
const int lambda, const int k,
const int startX, const int startY,
...
...
@@ -569,7 +569,7 @@ int getPathOfFeaturePyramid_TBB(IplImage * image,
// RESULT
// Error status
*/
int
getFeaturePyramid
(
IplImage
*
image
,
CvLSVMFeaturePyramidCas
k
ade
**
maps
)
int
getFeaturePyramid
(
IplImage
*
image
,
CvLSVMFeaturePyramidCas
c
ade
**
maps
)
{
IplImage
*
imgResize
;
float
step
;
...
...
modules/latentsvm/src/lsvmc_function.cpp
View file @
75896858
...
...
@@ -46,7 +46,7 @@ namespace cv
namespace
lsvm
{
float
calcM
(
int
k
,
int
di
,
int
dj
,
const
CvLSVMFeaturePyramidCas
kade
*
H
,
const
CvLSVMFilterObjectCask
ade
*
filter
){
float
calcM
(
int
k
,
int
di
,
int
dj
,
const
CvLSVMFeaturePyramidCas
cade
*
H
,
const
CvLSVMFilterObjectCasc
ade
*
filter
){
int
i
,
j
;
float
m
=
0.0
f
;
for
(
j
=
dj
;
j
<
dj
+
filter
->
sizeY
;
j
++
){
...
...
@@ -57,7 +57,7 @@ float calcM (int k,int di,int dj, const CvLSVMFeaturePyramidCaskade * H, cons
}
return
m
;
}
float
calcM_PCA
(
int
k
,
int
di
,
int
dj
,
const
CvLSVMFeaturePyramidCas
kade
*
H
,
const
CvLSVMFilterObjectCask
ade
*
filter
){
float
calcM_PCA
(
int
k
,
int
di
,
int
dj
,
const
CvLSVMFeaturePyramidCas
cade
*
H
,
const
CvLSVMFilterObjectCasc
ade
*
filter
){
int
i
,
j
;
float
m
=
0.0
f
;
for
(
j
=
dj
;
j
<
dj
+
filter
->
sizeY
;
j
++
){
...
...
@@ -69,7 +69,7 @@ float calcM_PCA(int k,int di,int dj, const CvLSVMFeaturePyramidCaskade * H, cons
return
m
;
}
float
calcM_PCA_cash
(
int
k
,
int
di
,
int
dj
,
const
CvLSVMFeaturePyramidCas
kade
*
H
,
const
CvLSVMFilterObjectCask
ade
*
filter
,
float
*
cashM
,
int
*
maskM
,
int
step
){
float
calcM_PCA_cash
(
int
k
,
int
di
,
int
dj
,
const
CvLSVMFeaturePyramidCas
cade
*
H
,
const
CvLSVMFilterObjectCasc
ade
*
filter
,
float
*
cashM
,
int
*
maskM
,
int
step
){
int
i
,
j
,
n
;
float
m
=
0.0
f
;
float
tmp1
,
tmp2
,
tmp3
,
tmp4
;
...
...
@@ -119,7 +119,7 @@ float calcM_PCA_cash(int k,int di,int dj, const CvLSVMFeaturePyramidCaskade * H,
}
return
m
;
}
float
calcFine
(
const
CvLSVMFilterObjectCas
k
ade
*
filter
,
int
di
,
int
dj
){
float
calcFine
(
const
CvLSVMFilterObjectCas
c
ade
*
filter
,
int
di
,
int
dj
){
return
filter
->
fineFunction
[
0
]
*
di
+
filter
->
fineFunction
[
1
]
*
dj
+
filter
->
fineFunction
[
2
]
*
di
*
di
+
filter
->
fineFunction
[
3
]
*
dj
*
dj
;
}
...
...
modules/latentsvm/src/lsvmc_latentsvm.cpp
View file @
75896858
...
...
@@ -58,17 +58,17 @@ namespace lsvm
int
estimateBoxes
(
CvPoint
*
points
,
int
*
levels
,
int
kPoints
,
int
sizeX
,
int
sizeY
,
CvPoint
**
oppositePoints
);
int
searchObjectThreshold
(
const
CvLSVMFeaturePyramidCas
k
ade
*
H
,
const
CvLSVMFeaturePyramidCas
k
ade
*
H_PCA
,
const
CvLSVMFilterObjectCas
k
ade
**
all_F
,
int
n
,
int
searchObjectThreshold
(
const
CvLSVMFeaturePyramidCas
c
ade
*
H
,
const
CvLSVMFeaturePyramidCas
c
ade
*
H_PCA
,
const
CvLSVMFilterObjectCas
c
ade
**
all_F
,
int
n
,
float
b
,
int
maxXBorder
,
int
maxYBorder
,
float
scoreThreshold
,
CvPoint
**
points
,
int
**
levels
,
int
*
kPoints
,
float
**
score
,
CvPoint
***
partsDisplacement
);
void
FeaturePyramid32
(
CvLSVMFeaturePyramidCas
k
ade
*
H
,
int
maxX
,
int
maxY
){
CvLSVMFeatureMapCas
k
ade
*
H32
;
void
FeaturePyramid32
(
CvLSVMFeaturePyramidCas
c
ade
*
H
,
int
maxX
,
int
maxY
){
CvLSVMFeatureMapCas
c
ade
*
H32
;
int
i
,
j
,
k
,
l
;
int
p
=
H
->
pyramid
[
0
]
->
numFeatures
;
...
...
@@ -92,8 +92,8 @@ void FeaturePyramid32(CvLSVMFeaturePyramidCaskade* H, int maxX, int maxY){
}
}
CvLSVMFeaturePyramidCas
kade
*
createPCA_FeaturePyramid
(
CvLSVMFeaturePyramidCaskade
*
H
,
CvLatentSvmDetectorCask
ade
*
detector
,
int
maxX
,
int
maxY
){
CvLSVMFeaturePyramidCas
k
ade
*
H_PCA
;
CvLSVMFeaturePyramidCas
cade
*
createPCA_FeaturePyramid
(
CvLSVMFeaturePyramidCascade
*
H
,
CvLatentSvmDetectorCasc
ade
*
detector
,
int
maxX
,
int
maxY
){
CvLSVMFeaturePyramidCas
c
ade
*
H_PCA
;
int
i
,
j
,
k
,
l
;
int
max_l
=
detector
->
pca_size
;
int
p
=
H
->
pyramid
[
0
]
->
numFeatures
;
...
...
@@ -239,13 +239,13 @@ int clippingBoxes(int width, int height,
// RESULT
// Feature pyramid with nullable border
*/
CvLSVMFeaturePyramidCas
k
ade
*
createFeaturePyramidWithBorder
(
IplImage
*
image
,
CvLSVMFeaturePyramidCas
c
ade
*
createFeaturePyramidWithBorder
(
IplImage
*
image
,
int
maxXBorder
,
int
maxYBorder
)
{
int
opResult
;
int
bx
,
by
;
int
level
;
CvLSVMFeaturePyramidCas
k
ade
*
H
;
CvLSVMFeaturePyramidCas
c
ade
*
H
;
// Obtaining feature pyramid
opResult
=
getFeaturePyramid
(
image
,
&
H
);
...
...
@@ -303,7 +303,7 @@ int estimateBoxes(CvPoint *points, int *levels, int kPoints,
//
// API
// int searchObjectThreshold(const featurePyramid *H,
const CvLSVMFilterObjectCas
k
ade **all_F, int n,
const CvLSVMFilterObjectCas
c
ade **all_F, int n,
float b,
int maxXBorder, int maxYBorder,
float scoreThreshold,
...
...
@@ -329,9 +329,9 @@ int estimateBoxes(CvPoint *points, int *levels, int kPoints,
// RESULT
// Error status
*/
int
searchObjectThreshold
(
const
CvLSVMFeaturePyramidCas
k
ade
*
H
,
const
CvLSVMFeaturePyramidCas
k
ade
*
H_PCA
,
const
CvLSVMFilterObjectCas
k
ade
**
all_F
,
int
n
,
int
searchObjectThreshold
(
const
CvLSVMFeaturePyramidCas
c
ade
*
H
,
const
CvLSVMFeaturePyramidCas
c
ade
*
H_PCA
,
const
CvLSVMFilterObjectCas
c
ade
**
all_F
,
int
n
,
float
b
,
int
maxXBorder
,
int
maxYBorder
,
float
scoreThreshold
,
...
...
@@ -630,7 +630,7 @@ int getOppositePoint(CvPoint point,
//
// API
// int showRootFilterBoxes(const IplImage *image,
const CvLSVMFilterObjectCas
k
ade *filter,
const CvLSVMFilterObjectCas
c
ade *filter,
CvPoint *points, int *levels, int kPoints,
CvScalar color, int thickness,
int line_type, int shift);
...
...
@@ -650,7 +650,7 @@ int getOppositePoint(CvPoint point,
// Error status
*/
int
showRootFilterBoxes
(
IplImage
*
image
,
const
CvLSVMFilterObjectCas
k
ade
*
filter
,
const
CvLSVMFilterObjectCas
c
ade
*
filter
,
CvPoint
*
points
,
int
*
levels
,
int
kPoints
,
CvScalar
color
,
int
thickness
,
int
line_type
,
int
shift
)
...
...
@@ -679,7 +679,7 @@ int showRootFilterBoxes(IplImage *image,
//
// API
// int showPartFilterBoxes(const IplImage *image,
const CvLSVMFilterObjectCas
k
ade *filter,
const CvLSVMFilterObjectCas
c
ade *filter,
CvPoint *points, int *levels, int kPoints,
CvScalar color, int thickness,
int line_type, int shift);
...
...
@@ -700,7 +700,7 @@ int showRootFilterBoxes(IplImage *image,
// Error status
*/
int
showPartFilterBoxes
(
IplImage
*
image
,
const
CvLSVMFilterObjectCas
k
ade
**
filters
,
const
CvLSVMFilterObjectCas
c
ade
**
filters
,
int
n
,
CvPoint
**
partsDisplacement
,
int
*
levels
,
int
kPoints
,
CvScalar
color
,
int
thickness
,
...
...
@@ -770,7 +770,7 @@ int showBoxes(IplImage *img,
//// Computation maximum filter size for each dimension
////
//// API
//// int getMaxFilterDims(const CvLSVMFilterObjectCas
k
ade **filters, int kComponents,
//// int getMaxFilterDims(const CvLSVMFilterObjectCas
c
ade **filters, int kComponents,
// const int *kPartFilters,
// unsigned int *maxXBorder, unsigned int *maxYBorder);
//// INPUT
...
...
@@ -784,7 +784,7 @@ int showBoxes(IplImage *img,
//// RESULT
//// Error status
//*/
//int getMaxFilterDims(const CvLSVMFilterObjectCas
k
ade **filters, int kComponents,
//int getMaxFilterDims(const CvLSVMFilterObjectCas
c
ade **filters, int kComponents,
// const int *kPartFilters,
// unsigned int *maxXBorder, unsigned int *maxYBorder)
//{
...
...
@@ -812,9 +812,9 @@ int showBoxes(IplImage *img,
class
PathOfModel
:
public
ParallelLoopBody
{
int
*
componentIndex
;
const
CvLSVMFeaturePyramidCas
k
ade
*
H
;
const
CvLSVMFeaturePyramidCas
k
ade
*
H_PCA
;
const
CvLSVMFilterObjectCas
k
ade
**
filters
;
const
CvLSVMFeaturePyramidCas
c
ade
*
H
;
const
CvLSVMFeaturePyramidCas
c
ade
*
H_PCA
;
const
CvLSVMFilterObjectCas
c
ade
**
filters
;
const
int
*
kPartFilters
;
const
float
*
b
;
unsigned
int
maxXBorder
,
maxYBorder
;
...
...
@@ -826,9 +826,9 @@ class PathOfModel :public ParallelLoopBody{
public
:
PathOfModel
(
int
*
_componentIndex
,
const
CvLSVMFeaturePyramidCas
k
ade
*
_H
,
const
CvLSVMFeaturePyramidCas
k
ade
*
_H_PCA
,
const
CvLSVMFilterObjectCas
k
ade
**
_filters
,
const
CvLSVMFeaturePyramidCas
c
ade
*
_H
,
const
CvLSVMFeaturePyramidCas
c
ade
*
_H_PCA
,
const
CvLSVMFilterObjectCas
c
ade
**
_filters
,
const
int
*
_kPartFilters
,
const
float
*
_b
,
unsigned
int
_maxXBorder
,
unsigned
int
_maxYBorder
,
...
...
@@ -878,7 +878,7 @@ public:
//
// API
// int searchObjectThresholdSomeComponents(const featurePyramid *H,
const CvLSVMFilterObjectCas
k
ade **filters,
const CvLSVMFilterObjectCas
c
ade **filters,
int kComponents, const int *kPartFilters,
const float *b, float scoreThreshold,
CvPoint **points, CvPoint **oppPoints,
...
...
@@ -898,9 +898,9 @@ public:
// RESULT
// Error status
*/
int
searchObjectThresholdSomeComponents
(
const
CvLSVMFeaturePyramidCas
k
ade
*
H
,
const
CvLSVMFeaturePyramidCas
k
ade
*
H_PCA
,
const
CvLSVMFilterObjectCas
k
ade
**
filters
,
int
searchObjectThresholdSomeComponents
(
const
CvLSVMFeaturePyramidCas
c
ade
*
H
,
const
CvLSVMFeaturePyramidCas
c
ade
*
H_PCA
,
const
CvLSVMFilterObjectCas
c
ade
**
filters
,
int
kComponents
,
const
int
*
kPartFilters
,
const
float
*
b
,
float
scoreThreshold
,
CvPoint
**
points
,
CvPoint
**
oppPoints
,
...
...
modules/latentsvm/src/lsvmc_latentsvmdetector.cpp
View file @
75896858
...
...
@@ -51,10 +51,10 @@ std::string extractModelName( const std::string& filename );
const
int
pca_size
=
31
;
CvLatentSvmDetectorCas
kade
*
cvLoadLatentSvmDetectorCask
ade
(
const
char
*
filename
);
void
cvReleaseLatentSvmDetectorCas
kade
(
CvLatentSvmDetectorCask
ade
**
detector
);
CvSeq
*
cvLatentSvmDetectObjectsCas
k
ade
(
IplImage
*
image
,
CvLatentSvmDetectorCas
k
ade
*
detector
,
CvLatentSvmDetectorCas
cade
*
cvLoadLatentSvmDetectorCasc
ade
(
const
char
*
filename
);
void
cvReleaseLatentSvmDetectorCas
cade
(
CvLatentSvmDetectorCasc
ade
**
detector
);
CvSeq
*
cvLatentSvmDetectObjectsCas
c
ade
(
IplImage
*
image
,
CvLatentSvmDetectorCas
c
ade
*
detector
,
CvMemStorage
*
storage
,
float
overlap_threshold
);
...
...
@@ -62,17 +62,17 @@ CvSeq* cvLatentSvmDetectObjectsCaskade(IplImage* image,
// load trained detector from a file
//
// API
// CvLatentSvmDetectorCas
k
ade* cvLoadLatentSvmDetector(const char* filename);
// CvLatentSvmDetectorCas
c
ade* cvLoadLatentSvmDetector(const char* filename);
// INPUT
// filename - path to the file containing the parameters of
// - trained Latent SVM detector
// OUTPUT
// trained Latent SVM detector in internal representation
*/
CvLatentSvmDetectorCas
kade
*
cvLoadLatentSvmDetectorCask
ade
(
const
char
*
filename
)
CvLatentSvmDetectorCas
cade
*
cvLoadLatentSvmDetectorCasc
ade
(
const
char
*
filename
)
{
CvLatentSvmDetectorCas
k
ade
*
detector
=
0
;
CvLSVMFilterObjectCas
k
ade
**
filters
=
0
;
CvLatentSvmDetectorCas
c
ade
*
detector
=
0
;
CvLSVMFilterObjectCas
c
ade
**
filters
=
0
;
int
kFilters
=
0
;
int
kComponents
=
0
;
int
*
kPartFilters
=
0
;
...
...
@@ -84,7 +84,7 @@ CvLatentSvmDetectorCaskade* cvLoadLatentSvmDetectorCaskade(const char* filename)
err_code
=
loadModel
(
filename
,
&
filters
,
&
kFilters
,
&
kComponents
,
&
kPartFilters
,
&
b
,
&
scoreThreshold
,
&
PCAcoeff
);
if
(
err_code
!=
LATENT_SVM_OK
)
return
0
;
detector
=
(
CvLatentSvmDetectorCas
kade
*
)
malloc
(
sizeof
(
CvLatentSvmDetectorCask
ade
));
detector
=
(
CvLatentSvmDetectorCas
cade
*
)
malloc
(
sizeof
(
CvLatentSvmDetectorCasc
ade
));
detector
->
filters
=
filters
;
detector
->
b
=
b
;
detector
->
num_components
=
kComponents
;
...
...
@@ -98,15 +98,15 @@ CvLatentSvmDetectorCaskade* cvLoadLatentSvmDetectorCaskade(const char* filename)
}
/*
// release memory allocated for CvLatentSvmDetectorCas
k
ade structure
// release memory allocated for CvLatentSvmDetectorCas
c
ade structure
//
// API
// void cvReleaseLatentSvmDetector(CvLatentSvmDetectorCas
k
ade** detector);
// void cvReleaseLatentSvmDetector(CvLatentSvmDetectorCas
c
ade** detector);
// INPUT
// detector - CvLatentSvmDetectorCas
k
ade structure to be released
// detector - CvLatentSvmDetectorCas
c
ade structure to be released
// OUTPUT
*/
void
cvReleaseLatentSvmDetectorCas
kade
(
CvLatentSvmDetectorCask
ade
**
detector
)
void
cvReleaseLatentSvmDetectorCas
cade
(
CvLatentSvmDetectorCasc
ade
**
detector
)
{
free
((
*
detector
)
->
b
);
free
((
*
detector
)
->
num_part_filters
);
...
...
@@ -127,7 +127,7 @@ void cvReleaseLatentSvmDetectorCaskade(CvLatentSvmDetectorCaskade** detector)
//
// API
// CvSeq* cvLatentSvmDetectObjects(const IplImage* image,
// CvLatentSvmDetectorCas
k
ade* detector,
// CvLatentSvmDetectorCas
c
ade* detector,
// CvMemStorage* storage,
// float overlap_threshold = 0.5f);
// INPUT
...
...
@@ -139,13 +139,13 @@ void cvReleaseLatentSvmDetectorCaskade(CvLatentSvmDetectorCaskade** detector)
// OUTPUT
// sequence of detected objects (bounding boxes and confidence levels stored in CvObjectDetection structures)
*/
CvSeq
*
cvLatentSvmDetectObjectsCas
k
ade
(
IplImage
*
image
,
CvLatentSvmDetectorCas
k
ade
*
detector
,
CvSeq
*
cvLatentSvmDetectObjectsCas
c
ade
(
IplImage
*
image
,
CvLatentSvmDetectorCas
c
ade
*
detector
,
CvMemStorage
*
storage
,
float
overlap_threshold
)
{
CvLSVMFeaturePyramidCas
k
ade
*
H
=
0
;
CvLSVMFeaturePyramidCas
k
ade
*
H_PCA
=
0
;
CvLSVMFeaturePyramidCas
c
ade
*
H
=
0
;
CvLSVMFeaturePyramidCas
c
ade
*
H_PCA
=
0
;
CvPoint
*
points
=
0
,
*
oppPoints
=
0
;
int
kPoints
=
0
;
float
*
score
=
0
;
...
...
@@ -161,18 +161,18 @@ CvSeq* cvLatentSvmDetectObjectsCaskade(IplImage* image,
cvCvtColor
(
image
,
image
,
CV_BGR2RGB
);
// Getting maximum filter dimensions
getMaxFilterDims
((
const
CvLSVMFilterObjectCas
k
ade
**
)(
detector
->
filters
),
detector
->
num_components
,
getMaxFilterDims
((
const
CvLSVMFilterObjectCas
c
ade
**
)(
detector
->
filters
),
detector
->
num_components
,
detector
->
num_part_filters
,
&
maxXBorder
,
&
maxYBorder
);
// Create feature pyramid with nullable border
H
=
createFeaturePyramidWithBorder
(
image
,
maxXBorder
,
maxYBorder
);
// Create P
S
A feature pyramid
// Create P
C
A feature pyramid
H_PCA
=
createPCA_FeaturePyramid
(
H
,
detector
,
maxXBorder
,
maxYBorder
);
FeaturePyramid32
(
H
,
maxXBorder
,
maxYBorder
);
// Search object
error
=
searchObjectThresholdSomeComponents
(
H
,
H_PCA
,(
const
CvLSVMFilterObjectCas
k
ade
**
)(
detector
->
filters
),
error
=
searchObjectThresholdSomeComponents
(
H
,
H_PCA
,(
const
CvLSVMFilterObjectCas
c
ade
**
)(
detector
->
filters
),
detector
->
num_components
,
detector
->
num_part_filters
,
detector
->
b
,
detector
->
score_threshold
,
&
points
,
&
oppPoints
,
&
score
,
&
kPoints
);
if
(
error
!=
LATENT_SVM_OK
)
...
...
@@ -226,7 +226,7 @@ public:
size_t
getClassCount
()
const
;
private
:
std
::
vector
<
CvLatentSvmDetectorCas
k
ade
*>
detectors
;
std
::
vector
<
CvLatentSvmDetectorCas
c
ade
*>
detectors
;
std
::
vector
<
std
::
string
>
classNames
;
};
...
...
@@ -250,7 +250,7 @@ LSVMDetectorImpl::LSVMDetectorImpl( const std::vector<std::string>& filenames, c
if
(
filename
.
length
()
<
5
||
filename
.
substr
(
filename
.
length
()
-
4
,
4
)
!=
".xml"
)
continue
;
CvLatentSvmDetectorCas
kade
*
detector
=
cvLoadLatentSvmDetectorCask
ade
(
filename
.
c_str
()
);
CvLatentSvmDetectorCas
cade
*
detector
=
cvLoadLatentSvmDetectorCasc
ade
(
filename
.
c_str
()
);
if
(
detector
)
{
detectors
.
push_back
(
detector
);
...
...
@@ -267,7 +267,7 @@ LSVMDetectorImpl::LSVMDetectorImpl( const std::vector<std::string>& filenames, c
LSVMDetectorImpl
::~
LSVMDetectorImpl
()
{
for
(
size_t
i
=
0
;
i
<
detectors
.
size
();
i
++
)
cv
::
lsvm
::
cvReleaseLatentSvmDetectorCas
k
ade
(
&
detectors
[
i
]);
cv
::
lsvm
::
cvReleaseLatentSvmDetectorCas
c
ade
(
&
detectors
[
i
]);
}
bool
LSVMDetectorImpl
::
isEmpty
()
const
...
...
@@ -313,7 +313,7 @@ void LSVMDetectorImpl::detect( cv::Mat const &image,
{
IplImage
image_ipl
=
image
;
CvMemStorage
*
storage
=
cvCreateMemStorage
(
0
);
CvSeq
*
detections
=
cv
::
lsvm
::
cvLatentSvmDetectObjectsCas
kade
(
&
image_ipl
,
(
CvLatentSvmDetectorCask
ade
*
)(
detectors
[
classID
]),
storage
,
overlapThreshold
);
CvSeq
*
detections
=
cv
::
lsvm
::
cvLatentSvmDetectObjectsCas
cade
(
&
image_ipl
,
(
CvLatentSvmDetectorCasc
ade
*
)(
detectors
[
classID
]),
storage
,
overlapThreshold
);
// convert results
objectDetections
.
reserve
(
objectDetections
.
size
()
+
detections
->
total
);
...
...
modules/latentsvm/src/lsvmc_matching.cpp
View file @
75896858
...
...
@@ -91,7 +91,7 @@ int computeBorderSize(int maxXBorder, int maxYBorder, int *bx, int *by)
// RESULT
// Error status
*/
int
addNullableBorder
(
CvLSVMFeatureMapCas
k
ade
*
map
,
int
bx
,
int
by
)
int
addNullableBorder
(
CvLSVMFeatureMapCas
c
ade
*
map
,
int
bx
,
int
by
)
{
int
sizeX
,
sizeY
,
i
,
j
,
k
;
float
*
new_map
;
...
...
@@ -124,7 +124,7 @@ int addNullableBorder(CvLSVMFeatureMapCaskade *map, int bx, int by)
// Computation maximum filter size for each dimension
//
// API
// int getMaxFilterDims(const CvLSVMFilterObjectCas
k
ade **filters, int kComponents,
// int getMaxFilterDims(const CvLSVMFilterObjectCas
c
ade **filters, int kComponents,
const int *kPartFilters,
unsigned int *maxXBorder, unsigned int *maxYBorder);
// INPUT
...
...
@@ -138,7 +138,7 @@ int addNullableBorder(CvLSVMFeatureMapCaskade *map, int bx, int by)
// RESULT
// Error status
*/
int
getMaxFilterDims
(
const
CvLSVMFilterObjectCas
k
ade
**
filters
,
int
kComponents
,
int
getMaxFilterDims
(
const
CvLSVMFilterObjectCas
c
ade
**
filters
,
int
kComponents
,
const
int
*
kPartFilters
,
unsigned
int
*
maxXBorder
,
unsigned
int
*
maxYBorder
)
{
...
...
modules/latentsvm/src/lsvmc_parser.cpp
View file @
75896858
...
...
@@ -79,26 +79,26 @@ int isHYPOTHES (char *str);
int
isDEFORM
(
char
*
str
);
int
getTeg
(
char
*
str
);
void
addFilter
(
CvLSVMFilterObjectCas
k
ade
***
model
,
int
*
last
,
int
*
max
);
void
addFilter
(
CvLSVMFilterObjectCas
c
ade
***
model
,
int
*
last
,
int
*
max
);
void
parserCascadeThresholds
(
FILE
*
xmlf
,
CvLSVMFilterObjectCas
k
ade
*
model
);
void
parserCascadeThresholds
(
FILE
*
xmlf
,
CvLSVMFilterObjectCas
c
ade
*
model
);
void
parserRFilter
(
FILE
*
xmlf
,
int
p
,
int
pca
,
CvLSVMFilterObjectCas
k
ade
*
model
,
float
*
b
);
void
parserRFilter
(
FILE
*
xmlf
,
int
p
,
int
pca
,
CvLSVMFilterObjectCas
c
ade
*
model
,
float
*
b
);
void
parserV
(
FILE
*
xmlf
,
int
/*p*/
,
CvLSVMFilterObjectCas
k
ade
*
model
);
void
parserV
(
FILE
*
xmlf
,
int
/*p*/
,
CvLSVMFilterObjectCas
c
ade
*
model
);
void
parserD
(
FILE
*
xmlf
,
int
/*p*/
,
CvLSVMFilterObjectCas
k
ade
*
model
);
void
parserD
(
FILE
*
xmlf
,
int
/*p*/
,
CvLSVMFilterObjectCas
c
ade
*
model
);
void
parserPFilter
(
FILE
*
xmlf
,
int
p
,
int
pca
,
int
/*N_path*/
,
CvLSVMFilterObjectCas
k
ade
*
model
);
void
parserPFilter
(
FILE
*
xmlf
,
int
p
,
int
pca
,
int
/*N_path*/
,
CvLSVMFilterObjectCas
c
ade
*
model
);
void
parserPFilterS
(
FILE
*
xmlf
,
int
p
,
int
pca
,
CvLSVMFilterObjectCas
k
ade
***
model
,
int
*
last
,
int
*
max
);
void
parserPFilterS
(
FILE
*
xmlf
,
int
p
,
int
pca
,
CvLSVMFilterObjectCas
c
ade
***
model
,
int
*
last
,
int
*
max
);
void
parserComp
(
FILE
*
xmlf
,
int
p
,
int
pca
,
int
*
N_comp
,
CvLSVMFilterObjectCas
k
ade
***
model
,
float
*
b
,
int
*
last
,
int
*
max
);
void
parserComp
(
FILE
*
xmlf
,
int
p
,
int
pca
,
int
*
N_comp
,
CvLSVMFilterObjectCas
c
ade
***
model
,
float
*
b
,
int
*
last
,
int
*
max
);
void
parserModel
(
FILE
*
xmlf
,
CvLSVMFilterObjectCas
k
ade
***
model
,
int
*
last
,
int
*
max
,
int
**
comp
,
float
**
b
,
int
*
count
,
float
*
score
,
float
**
PCAcoeff
);
void
parserModel
(
FILE
*
xmlf
,
CvLSVMFilterObjectCas
c
ade
***
model
,
int
*
last
,
int
*
max
,
int
**
comp
,
float
**
b
,
int
*
count
,
float
*
score
,
float
**
PCAcoeff
);
void
LSVMparser
(
const
char
*
filename
,
CvLSVMFilterObjectCas
k
ade
***
model
,
CvLSVMFilterObjectCas
c
ade
***
model
,
int
*
last
,
int
*
max
,
int
**
comp
,
...
...
@@ -336,21 +336,21 @@ int getTeg(char *str){
return
sum
;
}
void
addFilter
(
CvLSVMFilterObjectCas
k
ade
***
model
,
int
*
last
,
int
*
max
)
void
addFilter
(
CvLSVMFilterObjectCas
c
ade
***
model
,
int
*
last
,
int
*
max
)
{
CvLSVMFilterObjectCas
k
ade
**
nmodel
;
CvLSVMFilterObjectCas
c
ade
**
nmodel
;
int
i
;
(
*
last
)
++
;
if
((
*
last
)
>=
(
*
max
)){
(
*
max
)
+=
10
;
nmodel
=
(
CvLSVMFilterObjectCas
kade
**
)
malloc
(
sizeof
(
CvLSVMFilterObjectCask
ade
*
)
*
(
*
max
));
nmodel
=
(
CvLSVMFilterObjectCas
cade
**
)
malloc
(
sizeof
(
CvLSVMFilterObjectCasc
ade
*
)
*
(
*
max
));
for
(
i
=
0
;
i
<
*
last
;
i
++
){
nmodel
[
i
]
=
(
*
model
)[
i
];
}
free
(
*
model
);
(
*
model
)
=
nmodel
;
}
(
*
model
)
[(
*
last
)]
=
(
CvLSVMFilterObjectCas
kade
*
)
malloc
(
sizeof
(
CvLSVMFilterObjectCask
ade
));
(
*
model
)
[(
*
last
)]
=
(
CvLSVMFilterObjectCas
cade
*
)
malloc
(
sizeof
(
CvLSVMFilterObjectCasc
ade
));
(
*
model
)
[(
*
last
)]
->
Hypothesis
=
0.0
f
;
(
*
model
)
[(
*
last
)]
->
Deformation
=
0.0
f
;
(
*
model
)
[(
*
last
)]
->
Hypothesis_PCA
=
0.0
f
;
...
...
@@ -359,7 +359,7 @@ void addFilter(CvLSVMFilterObjectCaskade *** model, int *last, int *max)
}
//##############################################
void
parserCascadeThresholds
(
FILE
*
xmlf
,
CvLSVMFilterObjectCas
k
ade
*
model
){
void
parserCascadeThresholds
(
FILE
*
xmlf
,
CvLSVMFilterObjectCas
c
ade
*
model
){
int
st
=
0
;
int
tag
;
int
tagVal
;
...
...
@@ -438,7 +438,7 @@ void parserCascadeThresholds (FILE * xmlf, CvLSVMFilterObjectCaskade * model){
}
//##############################################
void
parserRFilter
(
FILE
*
xmlf
,
int
p
,
int
pca
,
CvLSVMFilterObjectCas
k
ade
*
model
,
float
*
b
){
void
parserRFilter
(
FILE
*
xmlf
,
int
p
,
int
pca
,
CvLSVMFilterObjectCas
c
ade
*
model
,
float
*
b
){
int
st
=
0
;
int
sizeX
=
0
,
sizeY
=
0
;
int
tag
;
...
...
@@ -548,7 +548,7 @@ void parserRFilter (FILE * xmlf, int p, int pca, CvLSVMFilterObjectCaskade * mo
}
}
void
parserV
(
FILE
*
xmlf
,
int
/*p*/
,
CvLSVMFilterObjectCas
k
ade
*
model
){
void
parserV
(
FILE
*
xmlf
,
int
/*p*/
,
CvLSVMFilterObjectCas
c
ade
*
model
){
int
st
=
0
;
int
tag
;
int
tagVal
;
...
...
@@ -611,7 +611,7 @@ void parserV (FILE * xmlf, int /*p*/, CvLSVMFilterObjectCaskade * model){
}
}
}
void
parserD
(
FILE
*
xmlf
,
int
/*p*/
,
CvLSVMFilterObjectCas
k
ade
*
model
){
void
parserD
(
FILE
*
xmlf
,
int
/*p*/
,
CvLSVMFilterObjectCas
c
ade
*
model
){
int
st
=
0
;
int
tag
;
int
tagVal
;
...
...
@@ -700,7 +700,7 @@ void parserD (FILE * xmlf, int /*p*/, CvLSVMFilterObjectCaskade * model){
}
}
void
parserPFilter
(
FILE
*
xmlf
,
int
p
,
int
pca
,
int
/*N_path*/
,
CvLSVMFilterObjectCas
k
ade
*
model
){
void
parserPFilter
(
FILE
*
xmlf
,
int
p
,
int
pca
,
int
/*N_path*/
,
CvLSVMFilterObjectCas
c
ade
*
model
){
int
st
=
0
;
int
sizeX
=
0
,
sizeY
=
0
;
int
tag
;
...
...
@@ -806,7 +806,7 @@ void parserPFilter (FILE * xmlf, int p, int pca, int /*N_path*/, CvLSVMFilterOb
}
}
}
void
parserPFilterS
(
FILE
*
xmlf
,
int
p
,
int
pca
,
CvLSVMFilterObjectCas
k
ade
***
model
,
int
*
last
,
int
*
max
){
void
parserPFilterS
(
FILE
*
xmlf
,
int
p
,
int
pca
,
CvLSVMFilterObjectCas
c
ade
***
model
,
int
*
last
,
int
*
max
){
int
st
=
0
;
int
N_path
=
0
;
int
tag
;
...
...
@@ -850,7 +850,7 @@ void parserPFilterS (FILE * xmlf, int p, int pca, CvLSVMFilterObjectCaskade ***
}
}
}
void
parserComp
(
FILE
*
xmlf
,
int
p
,
int
pca
,
int
*
N_comp
,
CvLSVMFilterObjectCas
k
ade
***
model
,
float
*
b
,
int
*
last
,
int
*
max
){
void
parserComp
(
FILE
*
xmlf
,
int
p
,
int
pca
,
int
*
N_comp
,
CvLSVMFilterObjectCas
c
ade
***
model
,
float
*
b
,
int
*
last
,
int
*
max
){
int
st
=
0
;
int
tag
;
int
tagVal
;
...
...
@@ -895,7 +895,7 @@ void parserComp (FILE * xmlf, int p, int pca, int *N_comp, CvLSVMFilterObjectCas
}
}
}
void
parserModel
(
FILE
*
xmlf
,
CvLSVMFilterObjectCas
k
ade
***
model
,
int
*
last
,
int
*
max
,
int
**
comp
,
float
**
b
,
int
*
count
,
float
*
score
,
float
**
PCAcoeff
){
void
parserModel
(
FILE
*
xmlf
,
CvLSVMFilterObjectCas
c
ade
***
model
,
int
*
last
,
int
*
max
,
int
**
comp
,
float
**
b
,
int
*
count
,
float
*
score
,
float
**
PCAcoeff
){
int
p
=
0
,
pca
=
0
;
int
N_comp
=
0
;
int
*
cmp
;
...
...
@@ -1023,7 +1023,7 @@ void parserModel(FILE * xmlf, CvLSVMFilterObjectCaskade *** model, int *last, in
}
void
LSVMparser
(
const
char
*
filename
,
CvLSVMFilterObjectCas
k
ade
***
model
,
CvLSVMFilterObjectCas
c
ade
***
model
,
int
*
last
,
int
*
max
,
int
**
comp
,
...
...
@@ -1040,7 +1040,7 @@ void LSVMparser(const char * filename,
(
*
max
)
=
10
;
(
*
last
)
=
-
1
;
(
*
model
)
=
(
CvLSVMFilterObjectCas
kade
**
)
malloc
((
sizeof
(
CvLSVMFilterObjectCask
ade
*
))
*
(
*
max
));
(
*
model
)
=
(
CvLSVMFilterObjectCas
cade
**
)
malloc
((
sizeof
(
CvLSVMFilterObjectCasc
ade
*
))
*
(
*
max
));
//printf("parse : %s\n", filename);
xmlf
=
fopen
(
filename
,
"rb"
);
...
...
@@ -1075,7 +1075,7 @@ void LSVMparser(const char * filename,
int
loadModel
(
const
char
*
modelPath
,
CvLSVMFilterObjectCas
k
ade
***
filters
,
CvLSVMFilterObjectCas
c
ade
***
filters
,
int
*
kFilters
,
int
*
kComponents
,
int
**
kPartFilters
,
...
...
modules/latentsvm/src/lsvmc_routine.cpp
View file @
75896858
...
...
@@ -45,11 +45,11 @@ namespace cv
{
namespace
lsvm
{
int
allocFilterObject
(
CvLSVMFilterObjectCas
k
ade
**
obj
,
const
int
sizeX
,
int
allocFilterObject
(
CvLSVMFilterObjectCas
c
ade
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
numFeatures
)
{
int
i
;
(
*
obj
)
=
(
CvLSVMFilterObjectCas
kade
*
)
malloc
(
sizeof
(
CvLSVMFilterObjectCask
ade
));
(
*
obj
)
=
(
CvLSVMFilterObjectCas
cade
*
)
malloc
(
sizeof
(
CvLSVMFilterObjectCasc
ade
));
(
*
obj
)
->
sizeX
=
sizeX
;
(
*
obj
)
->
sizeY
=
sizeY
;
(
*
obj
)
->
numFeatures
=
numFeatures
;
...
...
@@ -68,7 +68,7 @@ int allocFilterObject(CvLSVMFilterObjectCaskade **obj, const int sizeX,
}
return
LATENT_SVM_OK
;
}
int
freeFilterObject
(
CvLSVMFilterObjectCas
k
ade
**
obj
)
int
freeFilterObject
(
CvLSVMFilterObjectCas
c
ade
**
obj
)
{
if
(
*
obj
==
NULL
)
return
LATENT_SVM_MEM_NULL
;
free
((
*
obj
)
->
H
);
...
...
@@ -77,11 +77,11 @@ int freeFilterObject (CvLSVMFilterObjectCaskade **obj)
return
LATENT_SVM_OK
;
}
int
allocFeatureMapObject
(
CvLSVMFeatureMapCas
k
ade
**
obj
,
const
int
sizeX
,
int
allocFeatureMapObject
(
CvLSVMFeatureMapCas
c
ade
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
numFeatures
)
{
int
i
;
(
*
obj
)
=
(
CvLSVMFeatureMapCas
kade
*
)
malloc
(
sizeof
(
CvLSVMFeatureMapCask
ade
));
(
*
obj
)
=
(
CvLSVMFeatureMapCas
cade
*
)
malloc
(
sizeof
(
CvLSVMFeatureMapCasc
ade
));
(
*
obj
)
->
sizeX
=
sizeX
;
(
*
obj
)
->
sizeY
=
sizeY
;
(
*
obj
)
->
numFeatures
=
numFeatures
;
...
...
@@ -93,7 +93,7 @@ int allocFeatureMapObject(CvLSVMFeatureMapCaskade **obj, const int sizeX,
}
return
LATENT_SVM_OK
;
}
int
freeFeatureMapObject
(
CvLSVMFeatureMapCas
k
ade
**
obj
)
int
freeFeatureMapObject
(
CvLSVMFeatureMapCas
c
ade
**
obj
)
{
if
(
*
obj
==
NULL
)
return
LATENT_SVM_MEM_NULL
;
free
((
*
obj
)
->
map
);
...
...
@@ -102,17 +102,17 @@ int freeFeatureMapObject (CvLSVMFeatureMapCaskade **obj)
return
LATENT_SVM_OK
;
}
int
allocFeaturePyramidObject
(
CvLSVMFeaturePyramidCas
k
ade
**
obj
,
int
allocFeaturePyramidObject
(
CvLSVMFeaturePyramidCas
c
ade
**
obj
,
const
int
numLevels
)
{
(
*
obj
)
=
(
CvLSVMFeaturePyramidCas
kade
*
)
malloc
(
sizeof
(
CvLSVMFeaturePyramidCask
ade
));
(
*
obj
)
=
(
CvLSVMFeaturePyramidCas
cade
*
)
malloc
(
sizeof
(
CvLSVMFeaturePyramidCasc
ade
));
(
*
obj
)
->
numLevels
=
numLevels
;
(
*
obj
)
->
pyramid
=
(
CvLSVMFeatureMapCas
k
ade
**
)
malloc
(
sizeof
(
CvLSVMFeatureMapCas
k
ade
*
)
*
numLevels
);
(
*
obj
)
->
pyramid
=
(
CvLSVMFeatureMapCas
c
ade
**
)
malloc
(
sizeof
(
CvLSVMFeatureMapCas
c
ade
*
)
*
numLevels
);
return
LATENT_SVM_OK
;
}
int
freeFeaturePyramidObject
(
CvLSVMFeaturePyramidCas
k
ade
**
obj
)
int
freeFeaturePyramidObject
(
CvLSVMFeaturePyramidCas
c
ade
**
obj
)
{
int
i
;
if
(
*
obj
==
NULL
)
return
LATENT_SVM_MEM_NULL
;
...
...
modules/latentsvm/test/test_latentsvmdetector_cascade.cpp
View file @
75896858
...
...
@@ -56,7 +56,7 @@ using namespace cv;
const
float
score_thr
=
0.05
f
;
class
LatentSVMDetectorCas
k
adeTest
:
public
cvtest
::
BaseTest
class
LatentSVMDetectorCas
c
adeTest
:
public
cvtest
::
BaseTest
{
protected
:
void
run
(
int
);
...
...
@@ -125,15 +125,16 @@ bool compareResults( const std::vector<lsvm::LSVMDetector::ObjectDetection>& cal
return
true
;
}
void
LatentSVMDetectorCas
k
adeTest
::
run
(
int
/* start_from */
)
void
LatentSVMDetectorCas
c
adeTest
::
run
(
int
/* start_from */
)
{
std
::
string
img_path_cat
=
std
::
string
(
ts
->
get_data_path
())
+
"cat.png"
;
std
::
string
img_path_cars
=
std
::
string
(
ts
->
get_data_path
())
+
"cars.png"
;
std
::
string
test_data_path
=
ts
->
get_data_path
()
+
"latentsvmdetector/"
;
std
::
string
img_path_cat
=
test_data_path
+
"cat.png"
;
std
::
string
img_path_cars
=
test_data_path
+
"cars.png"
;
std
::
string
model_path_cat
=
std
::
string
(
ts
->
get_data_path
())
+
"models_VOC2007_cascade/cat.xml"
;
std
::
string
model_path_car
=
std
::
string
(
ts
->
get_data_path
())
+
"models_VOC2007_cascade/car.xml"
;
std
::
string
model_path_cat
=
test_data_path
+
"models_VOC2007_cascade/cat.xml"
;
std
::
string
model_path_car
=
test_data_path
+
"models_VOC2007_cascade/car.xml"
;
std
::
string
true_res_path
=
std
::
string
(
ts
->
get_data_path
())
+
"results_cascade.xml"
;
std
::
string
true_res_path
=
test_data_path
+
"results_cascade.xml"
;
#ifdef HAVE_TBB
...
...
@@ -214,4 +215,4 @@ void LatentSVMDetectorCaskadeTest::run( int /* start_from */)
ts
->
set_failed_test_info
(
cvtest
::
TS
::
OK
);
}
TEST
(
Objdetect_LatentSVMDetectorCas
kade_cpp
,
regression
)
{
LatentSVMDetectorCask
adeTest
test
;
test
.
safe_run
();
}
TEST
(
Objdetect_LatentSVMDetectorCas
cade_cpp
,
regression
)
{
LatentSVMDetectorCasc
adeTest
test
;
test
.
safe_run
();
}
modules/latentsvm/test/test_main.cpp
View file @
75896858
#include "test_precomp.hpp"
CV_TEST_MAIN
(
"
latentsvm
"
)
CV_TEST_MAIN
(
"
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