Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Commits
07eed8c4
Commit
07eed8c4
authored
Jul 12, 2011
by
Evgeniy Kozinov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring latentSVM
parent
ea8e2796
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
81 additions
and
81 deletions
+81
-81
objdetect.hpp
modules/objdetect/include/opencv2/objdetect/objdetect.hpp
+6
-10
_latentsvm.h
modules/objdetect/src/_latentsvm.h
+3
-6
_lsvm_error.h
modules/objdetect/src/_lsvm_error.h
+1
-0
_lsvm_routine.h
modules/objdetect/src/_lsvm_routine.h
+3
-3
_lsvm_types.h
modules/objdetect/src/_lsvm_types.h
+14
-19
featurepyramid.cpp
modules/objdetect/src/featurepyramid.cpp
+0
-0
latentsvm.cpp
modules/objdetect/src/latentsvm.cpp
+4
-5
lsvmparser.cpp
modules/objdetect/src/lsvmparser.cpp
+1
-2
matching.cpp
modules/objdetect/src/matching.cpp
+0
-0
routine.cpp
modules/objdetect/src/routine.cpp
+49
-36
No files found.
modules/objdetect/include/opencv2/objdetect/objdetect.hpp
View file @
07eed8c4
...
@@ -160,9 +160,9 @@ CVAPI(int) cvRunHaarClassifierCascade( const CvHaarClassifierCascade* cascade,
...
@@ -160,9 +160,9 @@ CVAPI(int) cvRunHaarClassifierCascade( const CvHaarClassifierCascade* cascade,
// (x, y) - coordinate in level l
// (x, y) - coordinate in level l
typedef
struct
typedef
struct
{
{
unsigned
int
x
;
int
x
;
unsigned
int
y
;
int
y
;
unsigned
int
l
;
int
l
;
}
CvLSVMFilterPosition
;
}
CvLSVMFilterPosition
;
// DataType: STRUCT filterObject
// DataType: STRUCT filterObject
...
@@ -179,16 +179,12 @@ typedef struct
...
@@ -179,16 +179,12 @@ typedef struct
// used formula H[(j * sizeX + i) * p + k], where
// used formula H[(j * sizeX + i) * p + k], where
// k - component of feature vector in cell (i, j)
// k - component of feature vector in cell (i, j)
// END OF FILTER DESCRIPTION
// END OF FILTER DESCRIPTION
// xp - auxillary parameter for internal use
// size of row in feature vectors
// (yp = (int) (p / xp); p = xp * yp)
typedef
struct
{
typedef
struct
{
CvLSVMFilterPosition
V
;
CvLSVMFilterPosition
V
;
float
fineFunction
[
4
];
float
fineFunction
[
4
];
unsigned
int
sizeX
;
int
sizeX
;
unsigned
int
sizeY
;
int
sizeY
;
unsigned
int
p
;
int
numFeatures
;
unsigned
int
xp
;
float
*
H
;
float
*
H
;
}
CvLSVMFilterObject
;
}
CvLSVMFilterObject
;
...
...
modules/objdetect/src/_latentsvm.h
View file @
07eed8c4
...
@@ -37,10 +37,7 @@
...
@@ -37,10 +37,7 @@
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
getFeaturePyramid
(
IplImage
*
image
,
int
getFeaturePyramid
(
IplImage
*
image
,
CvLSVMFeaturePyramid
**
maps
);
const
int
lambda
,
const
int
k
,
const
int
startX
,
const
int
startY
,
const
int
W
,
const
int
H
,
CvLSVMFeaturePyramid
**
maps
);
/*
/*
// Getting feature map for the selected subimage
// Getting feature map for the selected subimage
...
@@ -55,7 +52,7 @@ int getFeaturePyramid(IplImage * image,
...
@@ -55,7 +52,7 @@ int getFeaturePyramid(IplImage * image,
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
getFeatureMaps
_dp
(
const
IplImage
*
image
,
const
int
k
,
CvLSVMFeatureMap
**
map
);
int
getFeatureMaps
(
const
IplImage
*
image
,
const
int
k
,
CvLSVMFeatureMap
**
map
);
/*
/*
...
@@ -71,7 +68,7 @@ int getFeatureMaps_dp(const IplImage * image, const int k, CvLSVMFeatureMap **ma
...
@@ -71,7 +68,7 @@ int getFeatureMaps_dp(const IplImage * image, const int k, CvLSVMFeatureMap **ma
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
normaliz
ationAndTruncationFeatureMaps
(
CvLSVMFeatureMap
*
map
,
const
float
alfa
);
int
normaliz
eAndTruncate
(
CvLSVMFeatureMap
*
map
,
const
float
alfa
);
/*
/*
// Feature map reduction
// Feature map reduction
...
...
modules/objdetect/src/_lsvm_error.h
View file @
07eed8c4
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define LSVM_ERROR
#define LSVM_ERROR
#define LATENT_SVM_OK 0
#define LATENT_SVM_OK 0
#define LATENT_SVM_MEM_NULL 2
#define DISTANCE_TRANSFORM_OK 1
#define DISTANCE_TRANSFORM_OK 1
#define DISTANCE_TRANSFORM_GET_INTERSECTION_ERROR -1
#define DISTANCE_TRANSFORM_GET_INTERSECTION_ERROR -1
#define DISTANCE_TRANSFORM_ERROR -2
#define DISTANCE_TRANSFORM_ERROR -2
...
...
modules/objdetect/src/_lsvm_routine.h
View file @
07eed8c4
...
@@ -13,18 +13,18 @@
...
@@ -13,18 +13,18 @@
// Error status is return value
// Error status is return value
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
int
allocFilterObject
(
CvLSVMFilterObject
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
int
allocFilterObject
(
CvLSVMFilterObject
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
p
,
const
int
xp
);
const
int
p
);
int
freeFilterObject
(
CvLSVMFilterObject
**
obj
);
int
freeFilterObject
(
CvLSVMFilterObject
**
obj
);
int
allocFeatureMapObject
(
CvLSVMFeatureMap
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
int
allocFeatureMapObject
(
CvLSVMFeatureMap
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
p
,
const
int
xp
);
const
int
p
);
int
freeFeatureMapObject
(
CvLSVMFeatureMap
**
obj
);
int
freeFeatureMapObject
(
CvLSVMFeatureMap
**
obj
);
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
extern
"C"
#endif
#endif
int
allocFeaturePyramidObject
(
CvLSVMFeaturePyramid
**
obj
,
int
allocFeaturePyramidObject
(
CvLSVMFeaturePyramid
**
obj
,
const
int
lambda
,
const
int
countLevel
);
const
int
countLevel
);
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
extern
"C"
...
...
modules/objdetect/src/_lsvm_types.h
View file @
07eed8c4
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
// The number of elements in bin
// The number of elements in bin
// The number of sectors in gradient histogram building
// The number of sectors in gradient histogram building
#define
CNTPARTION
9
#define
NUM_SECTOR
9
// The number of levels in image resize procedure
// The number of levels in image resize procedure
// We need Lambda levels to resize image twice
// We need Lambda levels to resize image twice
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
// Block size. Used in feature pyramid building procedure
// Block size. Used in feature pyramid building procedure
#define SIDE_LENGTH 8
#define SIDE_LENGTH 8
#define VAL_OF_TRUNCATE 0.2f
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// main data structures //
// main data structures //
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
...
@@ -30,31 +32,24 @@
...
@@ -30,31 +32,24 @@
// DataType: STRUCT featureMap
// DataType: STRUCT featureMap
// FEATURE MAP DESCRIPTION
// FEATURE MAP DESCRIPTION
// Rectangular map (sizeX x sizeY),
// Rectangular map (sizeX x sizeY),
// every cell stores feature vector (dimension =
p
)
// every cell stores feature vector (dimension =
numFeatures
)
//
H
- matrix of feature vectors
//
map
- matrix of feature vectors
// to set and get feature vectors (i,j)
// to set and get feature vectors (i,j)
// used formula
M
ap[(j * sizeX + i) * p + k], where
// used formula
m
ap[(j * sizeX + i) * p + k], where
// k - component of feature vector in cell (i, j)
// k - component of feature vector in cell (i, j)
// END OF FEATURE MAP DESCRIPTION
// xp - auxillary parameter for internal use
// size of row in feature vectors
// (yp = (int) (p / xp); p = xp * yp)
typedef
struct
{
typedef
struct
{
int
sizeX
;
int
sizeX
;
int
sizeY
;
int
sizeY
;
int
p
;
int
numFeatures
;
int
xp
;
float
*
map
;
float
*
Map
;
}
CvLSVMFeatureMap
;
}
CvLSVMFeatureMap
;
// DataType: STRUCT featurePyramid
// DataType: STRUCT featurePyramid
//
//
// countLevel - number of levels in the feature pyramid
// numLevels - number of levels in the feature pyramid
// lambda - resize scale coefficient
// pyramid - array of pointers to feature map at different levels
// pyramid - array of pointers to feature map at different levels
typedef
struct
{
typedef
struct
{
int
countLevel
;
int
numLevels
;
int
lambda
;
CvLSVMFeatureMap
**
pyramid
;
CvLSVMFeatureMap
**
pyramid
;
}
CvLSVMFeaturePyramid
;
}
CvLSVMFeaturePyramid
;
...
@@ -74,14 +69,14 @@ typedef struct{
...
@@ -74,14 +69,14 @@ typedef struct{
// DataType: STRUCT fftImage
// DataType: STRUCT fftImage
// The structure stores FFT image
// The structure stores FFT image
//
//
//
p
- number of channels
//
numFeatures
- number of channels
// x - array of FFT images for 2d signals
// x - array of FFT images for 2d signals
// n - number of rows
// n - number of rows
// m - number of collums
// m - number of collums
typedef
struct
{
typedef
struct
{
unsigned
int
p
;
int
numFeatures
;
unsigned
int
dimX
;
int
dimX
;
unsigned
int
dimY
;
int
dimY
;
float
**
channels
;
float
**
channels
;
}
CvLSVMFftImage
;
}
CvLSVMFftImage
;
...
...
modules/objdetect/src/featurepyramid.cpp
View file @
07eed8c4
This diff is collapsed.
Click to expand it.
modules/objdetect/src/latentsvm.cpp
View file @
07eed8c4
...
@@ -127,8 +127,7 @@ CvLSVMFeaturePyramid* createFeaturePyramidWithBorder(IplImage *image,
...
@@ -127,8 +127,7 @@ CvLSVMFeaturePyramid* createFeaturePyramidWithBorder(IplImage *image,
CvLSVMFeaturePyramid
*
H
;
CvLSVMFeaturePyramid
*
H
;
// Obtaining feature pyramid
// Obtaining feature pyramid
opResult
=
getFeaturePyramid
(
image
,
LAMBDA
,
SIDE_LENGTH
,
0
,
0
,
opResult
=
getFeaturePyramid
(
image
,
&
H
);
image
->
width
,
image
->
height
,
&
H
);
if
(
opResult
!=
LATENT_SVM_OK
)
if
(
opResult
!=
LATENT_SVM_OK
)
{
{
...
@@ -139,7 +138,7 @@ CvLSVMFeaturePyramid* createFeaturePyramidWithBorder(IplImage *image,
...
@@ -139,7 +138,7 @@ CvLSVMFeaturePyramid* createFeaturePyramidWithBorder(IplImage *image,
// Addition nullable border for each feature map
// Addition nullable border for each feature map
// the size of the border for root filters
// the size of the border for root filters
computeBorderSize
(
maxXBorder
,
maxYBorder
,
&
bx
,
&
by
);
computeBorderSize
(
maxXBorder
,
maxYBorder
,
&
bx
,
&
by
);
for
(
level
=
0
;
level
<
H
->
countLevel
;
level
++
)
for
(
level
=
0
;
level
<
H
->
numLevels
;
level
++
)
{
{
addNullableBorder
(
H
->
pyramid
[
level
],
bx
,
by
);
addNullableBorder
(
H
->
pyramid
[
level
],
bx
,
by
);
}
}
...
@@ -196,7 +195,7 @@ int searchObject(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObject **all_F
...
@@ -196,7 +195,7 @@ int searchObject(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObject **all_F
// Transformation filter displacement from the block space
// Transformation filter displacement from the block space
// to the space of pixels at the initial image
// to the space of pixels at the initial image
// that settles at the level number LAMBDA
// that settles at the level number LAMBDA
convertPoints
(
H
->
countLevel
,
H
->
lambda
,
LAMBDA
,
(
*
points
),
convertPoints
(
H
->
numLevels
,
LAMBDA
,
LAMBDA
,
(
*
points
),
(
*
levels
),
(
*
partsDisplacement
),
(
*
kPoints
),
n
,
(
*
levels
),
(
*
partsDisplacement
),
(
*
kPoints
),
n
,
maxXBorder
,
maxYBorder
);
maxXBorder
,
maxYBorder
);
...
@@ -305,7 +304,7 @@ int searchObjectThreshold(const CvLSVMFeaturePyramid *H,
...
@@ -305,7 +304,7 @@ int searchObjectThreshold(const CvLSVMFeaturePyramid *H,
// Transformation filter displacement from the block space
// Transformation filter displacement from the block space
// to the space of pixels at the initial image
// to the space of pixels at the initial image
// that settles at the level number LAMBDA
// that settles at the level number LAMBDA
convertPoints
(
H
->
countLevel
,
H
->
lambda
,
LAMBDA
,
(
*
points
),
convertPoints
(
H
->
numLevels
,
LAMBDA
,
LAMBDA
,
(
*
points
),
(
*
levels
),
(
*
partsDisplacement
),
(
*
kPoints
),
n
,
(
*
levels
),
(
*
partsDisplacement
),
(
*
kPoints
),
n
,
maxXBorder
,
maxYBorder
);
maxXBorder
,
maxYBorder
);
...
...
modules/objdetect/src/lsvmparser.cpp
View file @
07eed8c4
...
@@ -658,8 +658,7 @@ void parserModel(FILE * xmlf, CvLSVMFilterObject *** model, int *last, int *max,
...
@@ -658,8 +658,7 @@ void parserModel(FILE * xmlf, CvLSVMFilterObject *** model, int *last, int *max,
if
(
tagVal
==
EMODEL
){
if
(
tagVal
==
EMODEL
){
//printf("</Model>\n");
//printf("</Model>\n");
for
(
ii
=
0
;
ii
<=
*
last
;
ii
++
){
for
(
ii
=
0
;
ii
<=
*
last
;
ii
++
){
(
*
model
)[
ii
]
->
p
=
p
;
(
*
model
)[
ii
]
->
numFeatures
=
p
;
(
*
model
)[
ii
]
->
xp
=
9
;
}
}
*
count
=
N_comp
;
*
count
=
N_comp
;
return
;
return
;
...
...
modules/objdetect/src/matching.cpp
View file @
07eed8c4
This diff is collapsed.
Click to expand it.
modules/objdetect/src/routine.cpp
View file @
07eed8c4
#include "precomp.hpp"
#include "precomp.hpp"
#include "_lsvm_routine.h"
#include "_lsvm_routine.h"
int
allocFilterObject
(
CvLSVMFilterObject
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
p
,
const
int
xp
){
int
allocFilterObject
(
CvLSVMFilterObject
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
numFeatures
)
{
int
i
;
int
i
;
(
*
obj
)
=
(
CvLSVMFilterObject
*
)
malloc
(
sizeof
(
CvLSVMFilterObject
));
(
*
obj
)
=
(
CvLSVMFilterObject
*
)
malloc
(
sizeof
(
CvLSVMFilterObject
));
(
*
obj
)
->
sizeX
=
sizeX
;
(
*
obj
)
->
sizeX
=
sizeX
;
(
*
obj
)
->
sizeY
=
sizeY
;
(
*
obj
)
->
sizeY
=
sizeY
;
(
*
obj
)
->
p
=
p
;
(
*
obj
)
->
numFeatures
=
numFeatures
;
(
*
obj
)
->
xp
=
xp
;
(
*
obj
)
->
fineFunction
[
0
]
=
0.0
f
;
(
*
obj
)
->
fineFunction
[
0
]
=
0.0
f
;
(
*
obj
)
->
fineFunction
[
1
]
=
0.0
f
;
(
*
obj
)
->
fineFunction
[
1
]
=
0.0
f
;
(
*
obj
)
->
fineFunction
[
2
]
=
0.0
f
;
(
*
obj
)
->
fineFunction
[
2
]
=
0.0
f
;
...
@@ -15,75 +16,87 @@ int allocFilterObject(CvLSVMFilterObject **obj, const int sizeX, const int sizeY
...
@@ -15,75 +16,87 @@ int allocFilterObject(CvLSVMFilterObject **obj, const int sizeX, const int sizeY
(
*
obj
)
->
V
.
x
=
0
;
(
*
obj
)
->
V
.
x
=
0
;
(
*
obj
)
->
V
.
y
=
0
;
(
*
obj
)
->
V
.
y
=
0
;
(
*
obj
)
->
V
.
l
=
0
;
(
*
obj
)
->
V
.
l
=
0
;
(
*
obj
)
->
H
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
(
sizeX
*
sizeY
*
p
));
(
*
obj
)
->
H
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
for
(
i
=
0
;
i
<
sizeX
*
sizeY
*
p
;
i
++
){
(
sizeX
*
sizeY
*
numFeatures
));
for
(
i
=
0
;
i
<
sizeX
*
sizeY
*
numFeatures
;
i
++
)
{
(
*
obj
)
->
H
[
i
]
=
0.0
f
;
(
*
obj
)
->
H
[
i
]
=
0.0
f
;
}
}
return
LATENT_SVM_OK
;
return
LATENT_SVM_OK
;
}
}
int
freeFilterObject
(
CvLSVMFilterObject
**
obj
){
int
freeFilterObject
(
CvLSVMFilterObject
**
obj
)
if
(
*
obj
==
NULL
)
return
0
;
{
if
(
*
obj
==
NULL
)
return
LATENT_SVM_MEM_NULL
;
free
((
*
obj
)
->
H
);
free
((
*
obj
)
->
H
);
free
(
*
obj
);
free
(
*
obj
);
(
*
obj
)
=
NULL
;
(
*
obj
)
=
NULL
;
return
LATENT_SVM_OK
;
return
LATENT_SVM_OK
;
}
}
int
allocFeatureMapObject
(
CvLSVMFeatureMap
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
p
,
const
int
xp
){
int
allocFeatureMapObject
(
CvLSVMFeatureMap
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
numFeatures
)
{
int
i
;
int
i
;
(
*
obj
)
=
(
CvLSVMFeatureMap
*
)
malloc
(
sizeof
(
CvLSVMFeatureMap
));
(
*
obj
)
=
(
CvLSVMFeatureMap
*
)
malloc
(
sizeof
(
CvLSVMFeatureMap
));
(
*
obj
)
->
sizeX
=
sizeX
;
(
*
obj
)
->
sizeX
=
sizeX
;
(
*
obj
)
->
sizeY
=
sizeY
;
(
*
obj
)
->
sizeY
=
sizeY
;
(
*
obj
)
->
p
=
p
;
(
*
obj
)
->
numFeatures
=
numFeatures
;
(
*
obj
)
->
xp
=
xp
;
(
*
obj
)
->
map
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
(
*
obj
)
->
Map
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
(
sizeX
*
sizeY
*
p
));
(
sizeX
*
sizeY
*
numFeatures
));
for
(
i
=
0
;
i
<
sizeX
*
sizeY
*
p
;
i
++
){
for
(
i
=
0
;
i
<
sizeX
*
sizeY
*
numFeatures
;
i
++
)
(
*
obj
)
->
Map
[
i
]
=
0.0
;
{
(
*
obj
)
->
map
[
i
]
=
0.0
f
;
}
}
return
LATENT_SVM_OK
;
return
LATENT_SVM_OK
;
}
}
int
freeFeatureMapObject
(
CvLSVMFeatureMap
**
obj
){
int
freeFeatureMapObject
(
CvLSVMFeatureMap
**
obj
)
if
(
*
obj
==
NULL
)
return
0
;
{
free
((
*
obj
)
->
Map
);
if
(
*
obj
==
NULL
)
return
LATENT_SVM_MEM_NULL
;
free
((
*
obj
)
->
map
);
free
(
*
obj
);
free
(
*
obj
);
(
*
obj
)
=
NULL
;
(
*
obj
)
=
NULL
;
return
LATENT_SVM_OK
;
return
LATENT_SVM_OK
;
}
}
int
allocFeaturePyramidObject
(
CvLSVMFeaturePyramid
**
obj
,
const
int
lambda
,
const
int
countLevel
){
int
allocFeaturePyramidObject
(
CvLSVMFeaturePyramid
**
obj
,
const
int
numLevels
)
{
(
*
obj
)
=
(
CvLSVMFeaturePyramid
*
)
malloc
(
sizeof
(
CvLSVMFeaturePyramid
));
(
*
obj
)
=
(
CvLSVMFeaturePyramid
*
)
malloc
(
sizeof
(
CvLSVMFeaturePyramid
));
(
*
obj
)
->
countLevel
=
countLevel
;
(
*
obj
)
->
numLevels
=
numLevels
;
(
*
obj
)
->
pyramid
=
(
CvLSVMFeatureMap
**
)
malloc
(
sizeof
(
CvLSVMFeatureMap
*
)
*
countLevel
);
(
*
obj
)
->
pyramid
=
(
CvLSVMFeatureMap
**
)
malloc
(
(
*
obj
)
->
lambda
=
lambda
;
sizeof
(
CvLSVMFeatureMap
*
)
*
numLevels
)
;
return
LATENT_SVM_OK
;
return
LATENT_SVM_OK
;
}
}
int
freeFeaturePyramidObject
(
CvLSVMFeaturePyramid
**
obj
){
int
freeFeaturePyramidObject
(
CvLSVMFeaturePyramid
**
obj
)
{
int
i
;
int
i
;
if
(
*
obj
==
NULL
)
return
0
;
if
(
*
obj
==
NULL
)
return
LATENT_SVM_MEM_NULL
;
for
(
i
=
0
;
i
<
(
*
obj
)
->
countLevel
;
i
++
)
for
(
i
=
0
;
i
<
(
*
obj
)
->
numLevels
;
i
++
)
{
freeFeatureMapObject
(
&
((
*
obj
)
->
pyramid
[
i
]));
freeFeatureMapObject
(
&
((
*
obj
)
->
pyramid
[
i
]));
}
free
((
*
obj
)
->
pyramid
);
free
((
*
obj
)
->
pyramid
);
free
(
*
obj
);
free
(
*
obj
);
(
*
obj
)
=
NULL
;
(
*
obj
)
=
NULL
;
return
LATENT_SVM_OK
;
return
LATENT_SVM_OK
;
}
}
int
allocFFTImage
(
CvLSVMFftImage
**
image
,
int
p
,
int
dimX
,
int
dimY
)
int
allocFFTImage
(
CvLSVMFftImage
**
image
,
int
numFeatures
,
int
dimX
,
int
dimY
)
{
{
int
i
,
j
,
size
;
int
i
,
j
,
size
;
*
image
=
(
CvLSVMFftImage
*
)
malloc
(
sizeof
(
CvLSVMFftImage
));
*
image
=
(
CvLSVMFftImage
*
)
malloc
(
sizeof
(
CvLSVMFftImage
));
(
*
image
)
->
p
=
p
;
(
*
image
)
->
numFeatures
=
numFeatures
;
(
*
image
)
->
dimX
=
dimX
;
(
*
image
)
->
dimX
=
dimX
;
(
*
image
)
->
dimY
=
dimY
;
(
*
image
)
->
dimY
=
dimY
;
(
*
image
)
->
channels
=
(
float
**
)
malloc
(
sizeof
(
float
*
)
*
p
);
(
*
image
)
->
channels
=
(
float
**
)
malloc
(
sizeof
(
float
*
)
*
numFeatures
);
size
=
2
*
dimX
*
dimY
;
size
=
2
*
dimX
*
dimY
;
for
(
i
=
0
;
i
<
p
;
i
++
)
for
(
i
=
0
;
i
<
numFeatures
;
i
++
)
{
{
(
*
image
)
->
channels
[
i
]
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
size
);
(
*
image
)
->
channels
[
i
]
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
size
);
for
(
j
=
0
;
j
<
size
;
j
++
)
for
(
j
=
0
;
j
<
size
;
j
++
)
{
{
(
*
image
)
->
channels
[
i
][
j
]
=
0.0
;
(
*
image
)
->
channels
[
i
][
j
]
=
0.0
f
;
}
}
}
}
return
LATENT_SVM_OK
;
return
LATENT_SVM_OK
;
...
@@ -91,9 +104,9 @@ int allocFFTImage(CvLSVMFftImage **image, int p, int dimX, int dimY)
...
@@ -91,9 +104,9 @@ int allocFFTImage(CvLSVMFftImage **image, int p, int dimX, int dimY)
int
freeFFTImage
(
CvLSVMFftImage
**
image
)
int
freeFFTImage
(
CvLSVMFftImage
**
image
)
{
{
unsigned
i
;
int
i
;
if
(
*
image
==
NULL
)
return
LATENT_SVM_OK
;
if
(
*
image
==
NULL
)
return
LATENT_SVM_OK
;
for
(
i
=
0
;
i
<
(
*
image
)
->
p
;
i
++
)
for
(
i
=
0
;
i
<
(
*
image
)
->
numFeatures
;
i
++
)
{
{
free
((
*
image
)
->
channels
[
i
]);
free
((
*
image
)
->
channels
[
i
]);
(
*
image
)
->
channels
[
i
]
=
NULL
;
(
*
image
)
->
channels
[
i
]
=
NULL
;
...
...
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