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
191f25ae
Commit
191f25ae
authored
Oct 12, 2010
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed internal headers to avoid conflicts with system header files
parent
87f6e500
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
787 additions
and
848 deletions
+787
-848
_latentsvm.h
modules/objdetect/src/_latentsvm.h
+3
-4
_lsvm_distancetransform.h
modules/objdetect/src/_lsvm_distancetransform.h
+138
-139
_lsvm_error.h
modules/objdetect/src/_lsvm_error.h
+16
-15
_lsvm_fft.h
modules/objdetect/src/_lsvm_fft.h
+79
-80
_lsvm_matching.h
modules/objdetect/src/_lsvm_matching.h
+396
-396
_lsvm_resizeimg.h
modules/objdetect/src/_lsvm_resizeimg.h
+11
-10
_lsvm_routine.h
modules/objdetect/src/_lsvm_routine.h
+35
-35
_lsvm_types.h
modules/objdetect/src/_lsvm_types.h
+93
-93
_lsvmparser.h
modules/objdetect/src/_lsvmparser.h
+0
-66
distancetransform.cpp
modules/objdetect/src/distancetransform.cpp
+2
-1
featurepyramid.cpp
modules/objdetect/src/featurepyramid.cpp
+2
-1
fft.cpp
modules/objdetect/src/fft.cpp
+2
-1
latentsvm.cpp
modules/objdetect/src/latentsvm.cpp
+2
-1
latentsvmdetector.cpp
modules/objdetect/src/latentsvmdetector.cpp
+1
-1
matching.cpp
modules/objdetect/src/matching.cpp
+2
-1
precomp.hpp
modules/objdetect/src/precomp.hpp
+1
-1
resizeimg.cpp
modules/objdetect/src/resizeimg.cpp
+2
-2
routine.cpp
modules/objdetect/src/routine.cpp
+2
-1
No files found.
modules/objdetect/src/_latentsvm.h
View file @
191f25ae
...
@@ -6,10 +6,9 @@
...
@@ -6,10 +6,9 @@
#define SVM_LATENTSVM
#define SVM_LATENTSVM
#include <stdio.h>
#include <stdio.h>
#include "precomp.hpp"
#include "_lsvm_types.h"
#include "_types.h"
#include "_lsvm_error.h"
#include "_error.h"
#include "_lsvm_routine.h"
#include "_routine.h"
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// Building feature pyramid
// Building feature pyramid
...
...
modules/objdetect/src/_distancetransform.h
→
modules/objdetect/src/_
lsvm_
distancetransform.h
View file @
191f25ae
#ifndef DIST_TRANSFORM
#ifndef LSVM_DIST_TRANSFORM
#define DIST_TRANSFORM
#define LSVM_DIST_TRANSFORM
#include "precomp.hpp"
#include "_lsvm_types.h"
#include "_types.h"
#include "_lsvm_error.h"
#include "_error.h"
/*
// Computation the point of intersection functions
/*
// (parabolas on the variable y)
// Computation the point of intersection functions
// a(y - q1) + b(q1 - y)(q1 - y) + f[q1]
// (parabolas on the variable y)
// a(y - q2) + b(q2 - y)(q2 - y) + f[q2]
// a(y - q1) + b(q1 - y)(q1 - y) + f[q1]
//
// a(y - q2) + b(q2 - y)(q2 - y) + f[q2]
// API
//
// int GetPointOfIntersection(const F_type *f,
// API
const F_type a, const F_type b,
// int GetPointOfIntersection(const F_type *f,
int q1, int q2, F_type *point);
const F_type a, const F_type b,
// INPUT
int q1, int q2, F_type *point);
// f - function on the regular grid
// INPUT
// a - coefficient of the function
// f - function on the regular grid
// b - coefficient of the function
// a - coefficient of the function
// q1 - parameter of the function
// b - coefficient of the function
// q2 - parameter of the function
// q1 - parameter of the function
// OUTPUT
// q2 - parameter of the function
// point - point of intersection
// OUTPUT
// RESULT
// point - point of intersection
// Error status
// RESULT
*/
// Error status
int
GetPointOfIntersection
(
const
float
*
f
,
*/
const
float
a
,
const
float
b
,
int
GetPointOfIntersection
(
const
float
*
f
,
int
q1
,
int
q2
,
float
*
point
);
const
float
a
,
const
float
b
,
int
q1
,
int
q2
,
float
*
point
);
/*
// Decision of one dimensional problem generalized distance transform
/*
// on the regular grid at all points
// Decision of one dimensional problem generalized distance transform
// min (a(y' - y) + b(y' - y)(y' - y) + f(y')) (on y')
// on the regular grid at all points
//
// min (a(y' - y) + b(y' - y)(y' - y) + f(y')) (on y')
// API
//
// int DistanceTransformOneDimensionalProblem(const F_type *f, const int n,
// API
const F_type a, const F_type b,
// int DistanceTransformOneDimensionalProblem(const F_type *f, const int n,
F_type *distanceTransform,
const F_type a, const F_type b,
int *points);
F_type *distanceTransform,
// INPUT
int *points);
// f - function on the regular grid
// INPUT
// n - grid dimension
// f - function on the regular grid
// a - coefficient of optimizable function
// n - grid dimension
// b - coefficient of optimizable function
// a - coefficient of optimizable function
// OUTPUT
// b - coefficient of optimizable function
// distanceTransform - values of generalized distance transform
// OUTPUT
// points - arguments that corresponds to the optimal value of function
// distanceTransform - values of generalized distance transform
// RESULT
// points - arguments that corresponds to the optimal value of function
// Error status
// RESULT
*/
// Error status
int
DistanceTransformOneDimensionalProblem
(
const
float
*
f
,
const
int
n
,
*/
const
float
a
,
const
float
b
,
int
DistanceTransformOneDimensionalProblem
(
const
float
*
f
,
const
int
n
,
float
*
distanceTransform
,
const
float
a
,
const
float
b
,
int
*
points
);
float
*
distanceTransform
,
int
*
points
);
/*
// Computation next cycle element
/*
//
// Computation next cycle element
// API
//
// int GetNextCycleElement(int k, int n, int q);
// API
// INPUT
// int GetNextCycleElement(int k, int n, int q);
// k - index of the previous cycle element
// INPUT
// n - number of matrix rows
// k - index of the previous cycle element
// q - parameter that equal (number_of_rows * number_of_columns - 1)
// n - number of matrix rows
// OUTPUT
// q - parameter that equal (number_of_rows * number_of_columns - 1)
// None
// OUTPUT
// RESULT
// None
// Next cycle element
// RESULT
*/
// Next cycle element
int
GetNextCycleElement
(
int
k
,
int
n
,
int
q
);
*/
int
GetNextCycleElement
(
int
k
,
int
n
,
int
q
);
/*
// Transposition of cycle elements
/*
//
// Transposition of cycle elements
// API
//
// void TransposeCycleElements(F_type *a, int *cycle, int cycle_len);
// API
// INPUT
// void TransposeCycleElements(F_type *a, int *cycle, int cycle_len);
// a - initial matrix
// INPUT
// cycle - cycle
// a - initial matrix
// cycle_len - cycle length
// cycle - cycle
// OUTPUT
// cycle_len - cycle length
// a - matrix with transposed elements
// OUTPUT
// RESULT
// a - matrix with transposed elements
// None
// RESULT
*/
// None
void
TransposeCycleElements
(
float
*
a
,
int
*
cycle
,
int
cycle_len
);
*/
void
TransposeCycleElements
(
float
*
a
,
int
*
cycle
,
int
cycle_len
);
/*
// Getting transposed matrix
/*
//
// Getting transposed matrix
// API
//
// void Transpose(F_type *a, int n, int m);
// API
// INPUT
// void Transpose(F_type *a, int n, int m);
// a - initial matrix
// INPUT
// n - number of rows
// a - initial matrix
// m - number of columns
// n - number of rows
// OUTPUT
// m - number of columns
// a - transposed matrix
// OUTPUT
// RESULT
// a - transposed matrix
// Error status
// RESULT
*/
// Error status
void
Transpose
(
float
*
a
,
int
n
,
int
m
);
*/
void
Transpose
(
float
*
a
,
int
n
,
int
m
);
/*
// Decision of two dimensional problem generalized distance transform
/*
// on the regular grid at all points
// Decision of two dimensional problem generalized distance transform
// min{d2(y' - y) + d4(y' - y)(y' - y) +
// on the regular grid at all points
min(d1(x' - x) + d3(x' - x)(x' - x) + f(x',y'))} (on x', y')
// min{d2(y' - y) + d4(y' - y)(y' - y) +
//
min(d1(x' - x) + d3(x' - x)(x' - x) + f(x',y'))} (on x', y')
// API
//
// int DistanceTransformTwoDimensionalProblem(const F_type *f,
// API
const int n, const int m,
// int DistanceTransformTwoDimensionalProblem(const F_type *f,
const F_type coeff[4],
const int n, const int m,
F_type *distanceTransform,
const F_type coeff[4],
int *pointsX, int *pointsY);
F_type *distanceTransform,
// INPUT
int *pointsX, int *pointsY);
// f - function on the regular grid
// INPUT
// n - number of rows
// f - function on the regular grid
// m - number of columns
// n - number of rows
// coeff - coefficients of optimizable function
// m - number of columns
coeff[0] = d1, coeff[1] = d2,
// coeff - coefficients of optimizable function
coeff[2] = d3, coeff[3] = d4
coeff[0] = d1, coeff[1] = d2,
// OUTPUT
coeff[2] = d3, coeff[3] = d4
// distanceTransform - values of generalized distance transform
// OUTPUT
// pointsX - arguments x' that correspond to the optimal value
// distanceTransform - values of generalized distance transform
// pointsY - arguments y' that correspond to the optimal value
// pointsX - arguments x' that correspond to the optimal value
// RESULT
// pointsY - arguments y' that correspond to the optimal value
// Error status
// RESULT
*/
// Error status
int
DistanceTransformTwoDimensionalProblem
(
const
float
*
f
,
*/
const
int
n
,
const
int
m
,
int
DistanceTransformTwoDimensionalProblem
(
const
float
*
f
,
const
float
coeff
[
4
],
const
int
n
,
const
int
m
,
float
*
distanceTransform
,
const
float
coeff
[
4
],
int
*
pointsX
,
int
*
pointsY
);
float
*
distanceTransform
,
int
*
pointsX
,
int
*
pointsY
);
#endif
#endif
\ No newline at end of file
modules/objdetect/src/_error.h
→
modules/objdetect/src/_
lsvm_
error.h
View file @
191f25ae
#ifndef SVM_ERROR
#ifndef SVM_ERROR
#define SVM_ERROR
#define SVM_ERROR
#define LATENT_SVM_OK 0
#define LATENT_SVM_OK 0
#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
#define DISTANCE_TRANSFORM_EQUAL_POINTS -3
#define DISTANCE_TRANSFORM_EQUAL_POINTS -3
#define LATENT_SVM_GET_FEATURE_PYRAMID_FAILED -4
#define LATENT_SVM_GET_FEATURE_PYRAMID_FAILED -4
#define LATENT_SVM_SEARCH_OBJECT_FAILED -5
#define LATENT_SVM_SEARCH_OBJECT_FAILED -5
#define LATENT_SVM_FAILED_SUPERPOSITION -6
#define LATENT_SVM_FAILED_SUPERPOSITION -6
#define FILTER_OUT_OF_BOUNDARIES -7
#define FILTER_OUT_OF_BOUNDARIES -7
#define FFT_OK 2
#define FFT_OK 2
#define FFT_ERROR -8
#define FFT_ERROR -8
#endif
#endif
\ No newline at end of file
modules/objdetect/src/_fft.h
→
modules/objdetect/src/_
lsvm_
fft.h
View file @
191f25ae
#ifndef _FFT_H
#ifndef _LSVM_FFT_H
#define _FFT_H
#define _LSVM_FFT_H
#include "precomp.hpp"
#include "_lsvm_types.h"
#include "_types.h"
#include "_lsvm_error.h"
#include "_error.h"
#include <math.h>
#include <math.h>
/*
// 1-dimensional FFT
/*
//
// 1-dimensional FFT
// API
//
// int fft(float *x_in, float *x_out, int n, int shift);
// API
// INPUT
// int fft(float *x_in, float *x_out, int n, int shift);
// x_in - input signal
// INPUT
// n - number of elements for searching Fourier image
// x_in - input signal
// shift - shift between input elements
// n - number of elements for searching Fourier image
// OUTPUT
// shift - shift between input elements
// x_out - output signal (contains 2n elements in order
// OUTPUT
Re(x_in[0]), Im(x_in[0]), Re(x_in[1]), Im(x_in[1]) and etc.)
// x_out - output signal (contains 2n elements in order
// RESULT
Re(x_in[0]), Im(x_in[0]), Re(x_in[1]), Im(x_in[1]) and etc.)
// Error status
// RESULT
*/
// Error status
int
fft
(
float
*
x_in
,
float
*
x_out
,
int
n
,
int
shift
);
*/
int
fft
(
float
*
x_in
,
float
*
x_out
,
int
n
,
int
shift
);
/*
// Inverse 1-dimensional FFT
/*
//
// Inverse 1-dimensional FFT
// API
//
// int fftInverse(float *x_in, float *x_out, int n, int shift);
// API
// INPUT
// int fftInverse(float *x_in, float *x_out, int n, int shift);
// x_in - Fourier image of 1d input signal(contains 2n elements
// INPUT
in order Re(x_in[0]), Im(x_in[0]),
// x_in - Fourier image of 1d input signal(contains 2n elements
Re(x_in[1]), Im(x_in[1]) and etc.)
in order Re(x_in[0]), Im(x_in[0]),
// n - number of elements for searching counter FFT image
Re(x_in[1]), Im(x_in[1]) and etc.)
// shift - shift between input elements
// n - number of elements for searching counter FFT image
// OUTPUT
// shift - shift between input elements
// x_in - input signal (contains n elements)
// OUTPUT
// RESULT
// x_in - input signal (contains n elements)
// Error status
// RESULT
*/
// Error status
int
fftInverse
(
float
*
x_in
,
float
*
x_out
,
int
n
,
int
shift
);
*/
int
fftInverse
(
float
*
x_in
,
float
*
x_out
,
int
n
,
int
shift
);
/*
// 2-dimensional FFT
/*
//
// 2-dimensional FFT
// API
//
// int fft2d(float *x_in, float *x_out, int numRows, int numColls);
// API
// INPUT
// int fft2d(float *x_in, float *x_out, int numRows, int numColls);
// x_in - input signal (matrix, launched by rows)
// INPUT
// numRows - number of rows
// x_in - input signal (matrix, launched by rows)
// numColls - number of collumns
// numRows - number of rows
// OUTPUT
// numColls - number of collumns
// x_out - output signal (contains (2 * numRows * numColls) elements
// OUTPUT
in order Re(x_in[0][0]), Im(x_in[0][0]),
// x_out - output signal (contains (2 * numRows * numColls) elements
Re(x_in[0][1]), Im(x_in[0][1]) and etc.)
in order Re(x_in[0][0]), Im(x_in[0][0]),
// RESULT
Re(x_in[0][1]), Im(x_in[0][1]) and etc.)
// Error status
// RESULT
*/
// Error status
int
fft2d
(
float
*
x_in
,
float
*
x_out
,
int
numRows
,
int
numColls
);
*/
int
fft2d
(
float
*
x_in
,
float
*
x_out
,
int
numRows
,
int
numColls
);
/*
// Inverse 2-dimensional FFT
/*
//
// Inverse 2-dimensional FFT
// API
//
// int fftInverse2d(float *x_in, float *x_out, int numRows, int numColls);
// API
// INPUT
// int fftInverse2d(float *x_in, float *x_out, int numRows, int numColls);
// x_in - Fourier image of matrix (contains (2 * numRows * numColls)
// INPUT
elements in order Re(x_in[0][0]), Im(x_in[0][0]),
// x_in - Fourier image of matrix (contains (2 * numRows * numColls)
Re(x_in[0][1]), Im(x_in[0][1]) and etc.)
elements in order Re(x_in[0][0]), Im(x_in[0][0]),
// numRows - number of rows
Re(x_in[0][1]), Im(x_in[0][1]) and etc.)
// numColls - number of collumns
// numRows - number of rows
// OUTPUT
// numColls - number of collumns
// x_out - initial signal (matrix, launched by rows)
// OUTPUT
// RESULT
// x_out - initial signal (matrix, launched by rows)
// Error status
// RESULT
*/
// Error status
int
fftInverse2d
(
float
*
x_in
,
float
*
x_out
,
int
numRows
,
int
numColls
);
*/
int
fftInverse2d
(
float
*
x_in
,
float
*
x_out
,
int
numRows
,
int
numColls
);
#endif
#endif
\ No newline at end of file
modules/objdetect/src/_matching.h
→
modules/objdetect/src/_
lsvm_
matching.h
View file @
191f25ae
/*****************************************************************************/
/*****************************************************************************/
/* Matching procedure API */
/* Matching procedure API */
/*****************************************************************************/
/*****************************************************************************/
//
//
#ifndef SVM_MATCHING
#ifndef SVM_MATCHING
#define SVM_MATCHING
#define SVM_MATCHING
#include "_latentsvm.h"
#include "_latentsvm.h"
#include "_
error.h"
#include "_
lsvm_error.h"
#include "_
distancetransform.h"
#include "_
lsvm_distancetransform.h"
#include "_
fft.h"
#include "_
lsvm_fft.h"
#include "_
routine.h"
#include "_
lsvm_routine.h"
//extern "C" {
//extern "C" {
/*
/*
// Function for convolution computation
// Function for convolution computation
//
//
// API
// API
// int convolution(const filterObject *Fi, const featureMap *map, float *f);
// int convolution(const filterObject *Fi, const featureMap *map, float *f);
// INPUT
// INPUT
// Fi - filter object
// Fi - filter object
// map - feature map
// map - feature map
// OUTPUT
// OUTPUT
// f - the convolution
// f - the convolution
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
convolution
(
const
filterObject
*
Fi
,
const
featureMap
*
map
,
float
*
f
);
int
convolution
(
const
filterObject
*
Fi
,
const
featureMap
*
map
,
float
*
f
);
/*
/*
// Computation multiplication of FFT images
// Computation multiplication of FFT images
//
//
// API
// API
// int fftImagesMulti(float *fftImage1, float *fftImage2, int numRows, int numColls,
// int fftImagesMulti(float *fftImage1, float *fftImage2, int numRows, int numColls,
float *multi);
float *multi);
// INPUT
// INPUT
// fftImage1 - first fft image
// fftImage1 - first fft image
// fftImage2 - second fft image
// fftImage2 - second fft image
// (numRows, numColls) - image dimesions
// (numRows, numColls) - image dimesions
// OUTPUT
// OUTPUT
// multi - multiplication
// multi - multiplication
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
fftImagesMulti
(
float
*
fftImage1
,
float
*
fftImage2
,
int
numRows
,
int
numColls
,
int
fftImagesMulti
(
float
*
fftImage1
,
float
*
fftImage2
,
int
numRows
,
int
numColls
,
float
*
multi
);
float
*
multi
);
/*
/*
// Turnover filter matrix for the single feature
// Turnover filter matrix for the single feature
//
//
// API
// API
// int rot2PI(float *filter, int dimX, int dimY, float *rot2PIFilter,
// int rot2PI(float *filter, int dimX, int dimY, float *rot2PIFilter,
int p, int shift);
int p, int shift);
// INPUT
// INPUT
// filter - filter weight matrix
// filter - filter weight matrix
// (dimX, dimY) - dimension of filter matrix
// (dimX, dimY) - dimension of filter matrix
// p - number of features
// p - number of features
// shift - number of feature (or channel)
// shift - number of feature (or channel)
// OUTPUT
// OUTPUT
// rot2PIFilter - rotated matrix
// rot2PIFilter - rotated matrix
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
rot2PI
(
float
*
filter
,
int
dimX
,
int
dimY
,
float
*
rot2PIFilter
,
int
rot2PI
(
float
*
filter
,
int
dimX
,
int
dimY
,
float
*
rot2PIFilter
,
int
p
,
int
shift
);
int
p
,
int
shift
);
/*
/*
// Addition nullable bars to the dimension of feature map (single feature)
// Addition nullable bars to the dimension of feature map (single feature)
//
//
// API
// API
// int addNullableBars(float *rot2PIFilter, int dimX, int dimY,
// int addNullableBars(float *rot2PIFilter, int dimX, int dimY,
float *newFilter, int newDimX, int newDimY);
float *newFilter, int newDimX, int newDimY);
// INPUT
// INPUT
// rot2PIFilter - filter matrix for the single feature that was rotated
// rot2PIFilter - filter matrix for the single feature that was rotated
// (dimX, dimY) - dimension rot2PIFilter
// (dimX, dimY) - dimension rot2PIFilter
// (newDimX, newDimY)- dimension of feature map for the single feature
// (newDimX, newDimY)- dimension of feature map for the single feature
// OUTPUT
// OUTPUT
// newFilter - filter matrix with nullable bars
// newFilter - filter matrix with nullable bars
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
addNullableBars
(
float
*
rot2PIFilter
,
int
dimX
,
int
dimY
,
int
addNullableBars
(
float
*
rot2PIFilter
,
int
dimX
,
int
dimY
,
float
*
newFilter
,
int
newDimX
,
int
newDimY
);
float
*
newFilter
,
int
newDimX
,
int
newDimY
);
/*
/*
// Computation FFT image for filter object
// Computation FFT image for filter object
//
//
// API
// API
// int getFFTImageFilterObject(const filterObject *filter,
// int getFFTImageFilterObject(const filterObject *filter,
int mapDimX, int mapDimY,
int mapDimX, int mapDimY,
fftImage **image);
fftImage **image);
// INPUT
// INPUT
// filter - filter object
// filter - filter object
// (mapDimX, mapDimY)- dimension of feature map
// (mapDimX, mapDimY)- dimension of feature map
// OUTPUT
// OUTPUT
// image - fft image
// image - fft image
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
getFFTImageFilterObject
(
const
filterObject
*
filter
,
int
getFFTImageFilterObject
(
const
filterObject
*
filter
,
int
mapDimX
,
int
mapDimY
,
int
mapDimX
,
int
mapDimY
,
fftImage
**
image
);
fftImage
**
image
);
/*
/*
// Computation FFT image for feature map
// Computation FFT image for feature map
//
//
// API
// API
// int getFFTImageFeatureMap(const featureMap *map, fftImage **image);
// int getFFTImageFeatureMap(const featureMap *map, fftImage **image);
// INPUT
// INPUT
// OUTPUT
// OUTPUT
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
getFFTImageFeatureMap
(
const
featureMap
*
map
,
fftImage
**
image
);
int
getFFTImageFeatureMap
(
const
featureMap
*
map
,
fftImage
**
image
);
/*
/*
// Function for convolution computation using FFT
// Function for convolution computation using FFT
//
//
// API
// API
// int convFFTConv2d(const fftImage *featMapImage, const fftImage *filterImage,
// int convFFTConv2d(const fftImage *featMapImage, const fftImage *filterImage,
int filterDimX, int filterDimY, float **conv);
int filterDimX, int filterDimY, float **conv);
// INPUT
// INPUT
// featMapImage - feature map image
// featMapImage - feature map image
// filterImage - filter image
// filterImage - filter image
// (filterDimX,filterDimY) - filter dimension
// (filterDimX,filterDimY) - filter dimension
// OUTPUT
// OUTPUT
// conv - the convolution
// conv - the convolution
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
convFFTConv2d
(
const
fftImage
*
featMapImage
,
const
fftImage
*
filterImage
,
int
convFFTConv2d
(
const
fftImage
*
featMapImage
,
const
fftImage
*
filterImage
,
int
filterDimX
,
int
filterDimY
,
float
**
conv
);
int
filterDimX
,
int
filterDimY
,
float
**
conv
);
/*
/*
// Computation objective function D according the original paper
// Computation objective function D according the original paper
//
//
// API
// API
// int filterDispositionLevel(const filterObject *Fi, const featureMap *pyramid,
// int filterDispositionLevel(const filterObject *Fi, const featureMap *pyramid,
float **scoreFi,
float **scoreFi,
int **pointsX, int **pointsY);
int **pointsX, int **pointsY);
// INPUT
// INPUT
// Fi - filter object (weights and coefficients of penalty
// Fi - filter object (weights and coefficients of penalty
function that are used in this routine)
function that are used in this routine)
// pyramid - feature map
// pyramid - feature map
// OUTPUT
// OUTPUT
// scoreFi - values of distance transform on the level at all positions
// scoreFi - values of distance transform on the level at all positions
// (pointsX, pointsY)- positions that correspond to the maximum value
// (pointsX, pointsY)- positions that correspond to the maximum value
of distance transform at all grid nodes
of distance transform at all grid nodes
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
filterDispositionLevel
(
const
filterObject
*
Fi
,
const
featureMap
*
pyramid
,
int
filterDispositionLevel
(
const
filterObject
*
Fi
,
const
featureMap
*
pyramid
,
float
**
scoreFi
,
float
**
scoreFi
,
int
**
pointsX
,
int
**
pointsY
);
int
**
pointsX
,
int
**
pointsY
);
/*
/*
// Computation objective function D according the original paper using FFT
// Computation objective function D according the original paper using FFT
//
//
// API
// API
// int filterDispositionLevelFFT(const filterObject *Fi, const fftImage *featMapImage,
// int filterDispositionLevelFFT(const filterObject *Fi, const fftImage *featMapImage,
float **scoreFi,
float **scoreFi,
int **pointsX, int **pointsY);
int **pointsX, int **pointsY);
// INPUT
// INPUT
// Fi - filter object (weights and coefficients of penalty
// Fi - filter object (weights and coefficients of penalty
function that are used in this routine)
function that are used in this routine)
// featMapImage - FFT image of feature map
// featMapImage - FFT image of feature map
// OUTPUT
// OUTPUT
// scoreFi - values of distance transform on the level at all positions
// scoreFi - values of distance transform on the level at all positions
// (pointsX, pointsY)- positions that correspond to the maximum value
// (pointsX, pointsY)- positions that correspond to the maximum value
of distance transform at all grid nodes
of distance transform at all grid nodes
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
filterDispositionLevelFFT
(
const
filterObject
*
Fi
,
const
fftImage
*
featMapImage
,
int
filterDispositionLevelFFT
(
const
filterObject
*
Fi
,
const
fftImage
*
featMapImage
,
float
**
scoreFi
,
float
**
scoreFi
,
int
**
pointsX
,
int
**
pointsY
);
int
**
pointsX
,
int
**
pointsY
);
/*
/*
// Computation border size for feature map
// Computation border size for feature map
//
//
// API
// API
// int computeBorderSize(int maxXBorder, int maxYBorder, int *bx, int *by);
// int computeBorderSize(int maxXBorder, int maxYBorder, int *bx, int *by);
// INPUT
// INPUT
// maxXBorder - the largest root filter size (X-direction)
// maxXBorder - the largest root filter size (X-direction)
// maxYBorder - the largest root filter size (Y-direction)
// maxYBorder - the largest root filter size (Y-direction)
// OUTPUT
// OUTPUT
// bx - border size (X-direction)
// bx - border size (X-direction)
// by - border size (Y-direction)
// by - border size (Y-direction)
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
computeBorderSize
(
int
maxXBorder
,
int
maxYBorder
,
int
*
bx
,
int
*
by
);
int
computeBorderSize
(
int
maxXBorder
,
int
maxYBorder
,
int
*
bx
,
int
*
by
);
/*
/*
// Addition nullable border to the feature map
// Addition nullable border to the feature map
//
//
// API
// API
// int addNullableBorder(featureMap *map, int bx, int by);
// int addNullableBorder(featureMap *map, int bx, int by);
// INPUT
// INPUT
// map - feature map
// map - feature map
// bx - border size (X-direction)
// bx - border size (X-direction)
// by - border size (Y-direction)
// by - border size (Y-direction)
// OUTPUT
// OUTPUT
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
addNullableBorder
(
featureMap
*
map
,
int
bx
,
int
by
);
int
addNullableBorder
(
featureMap
*
map
,
int
bx
,
int
by
);
/*
/*
// Computation the maximum of the score function at the level
// Computation the maximum of the score function at the level
//
//
// API
// API
// int maxFunctionalScoreFixedLevel(const filterObject **all_F, int n,
// int maxFunctionalScoreFixedLevel(const filterObject **all_F, int n,
const featurePyramid *H,
const featurePyramid *H,
int level, float b,
int level, float b,
int maxXBorder, int maxYBorder,
int maxXBorder, int maxYBorder,
float *score, CvPoint **points, int *kPoints,
float *score, CvPoint **points, int *kPoints,
CvPoint ***partsDisplacement);
CvPoint ***partsDisplacement);
// INPUT
// INPUT
// all_F - the set of filters (the first element is root filter,
// all_F - the set of filters (the first element is root filter,
the other - part filters)
the other - part filters)
// n - the number of part filters
// n - the number of part filters
// H - feature pyramid
// H - feature pyramid
// level - feature pyramid level for computation maximum score
// level - feature pyramid level for computation maximum score
// b - linear term of the score function
// b - linear term of the score function
// maxXBorder - the largest root filter size (X-direction)
// maxXBorder - the largest root filter size (X-direction)
// maxYBorder - the largest root filter size (Y-direction)
// maxYBorder - the largest root filter size (Y-direction)
// OUTPUT
// OUTPUT
// score - the maximum of the score function at the level
// score - the maximum of the score function at the level
// points - the set of root filter positions (in the block space)
// points - the set of root filter positions (in the block space)
// levels - the set of levels
// levels - the set of levels
// kPoints - number of root filter positions
// kPoints - number of root filter positions
// partsDisplacement - displacement of part filters (in the block space)
// partsDisplacement - displacement of part filters (in the block space)
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
maxFunctionalScoreFixedLevel
(
const
filterObject
**
all_F
,
int
n
,
int
maxFunctionalScoreFixedLevel
(
const
filterObject
**
all_F
,
int
n
,
const
featurePyramid
*
H
,
const
featurePyramid
*
H
,
int
level
,
float
b
,
int
level
,
float
b
,
int
maxXBorder
,
int
maxYBorder
,
int
maxXBorder
,
int
maxYBorder
,
float
*
score
,
CvPoint
**
points
,
int
*
kPoints
,
float
*
score
,
CvPoint
**
points
,
int
*
kPoints
,
CvPoint
***
partsDisplacement
);
CvPoint
***
partsDisplacement
);
/*
/*
// Computation score function at the level that exceed threshold
// Computation score function at the level that exceed threshold
//
//
// API
// API
// int thresholdFunctionalScoreFixedLevel(const filterObject **all_F, int n,
// int thresholdFunctionalScoreFixedLevel(const filterObject **all_F, int n,
const featurePyramid *H,
const featurePyramid *H,
int level, float b,
int level, float b,
int maxXBorder, int maxYBorder,
int maxXBorder, int maxYBorder,
float scoreThreshold,
float scoreThreshold,
float **score, CvPoint **points, int *kPoints,
float **score, CvPoint **points, int *kPoints,
CvPoint ***partsDisplacement);
CvPoint ***partsDisplacement);
// INPUT
// INPUT
// all_F - the set of filters (the first element is root filter,
// all_F - the set of filters (the first element is root filter,
the other - part filters)
the other - part filters)
// n - the number of part filters
// n - the number of part filters
// H - feature pyramid
// H - feature pyramid
// level - feature pyramid level for computation maximum score
// level - feature pyramid level for computation maximum score
// b - linear term of the score function
// b - linear term of the score function
// maxXBorder - the largest root filter size (X-direction)
// maxXBorder - the largest root filter size (X-direction)
// maxYBorder - the largest root filter size (Y-direction)
// maxYBorder - the largest root filter size (Y-direction)
// scoreThreshold - score threshold
// scoreThreshold - score threshold
// OUTPUT
// OUTPUT
// score - score function at the level that exceed threshold
// score - score function at the level that exceed threshold
// points - the set of root filter positions (in the block space)
// points - the set of root filter positions (in the block space)
// levels - the set of levels
// levels - the set of levels
// kPoints - number of root filter positions
// kPoints - number of root filter positions
// partsDisplacement - displacement of part filters (in the block space)
// partsDisplacement - displacement of part filters (in the block space)
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
thresholdFunctionalScoreFixedLevel
(
const
filterObject
**
all_F
,
int
n
,
int
thresholdFunctionalScoreFixedLevel
(
const
filterObject
**
all_F
,
int
n
,
const
featurePyramid
*
H
,
const
featurePyramid
*
H
,
int
level
,
float
b
,
int
level
,
float
b
,
int
maxXBorder
,
int
maxYBorder
,
int
maxXBorder
,
int
maxYBorder
,
float
scoreThreshold
,
float
scoreThreshold
,
float
**
score
,
CvPoint
**
points
,
int
*
kPoints
,
float
**
score
,
CvPoint
**
points
,
int
*
kPoints
,
CvPoint
***
partsDisplacement
);
CvPoint
***
partsDisplacement
);
/*
/*
// Computation the maximum of the score function
// Computation the maximum of the score function
//
//
// API
// API
// int maxFunctionalScore(const filterObject **all_F, int n,
// int maxFunctionalScore(const filterObject **all_F, int n,
const featurePyramid *H, float b,
const featurePyramid *H, float b,
int maxXBorder, int maxYBorder,
int maxXBorder, int maxYBorder,
float *score,
float *score,
CvPoint **points, int **levels, int *kPoints,
CvPoint **points, int **levels, int *kPoints,
CvPoint ***partsDisplacement);
CvPoint ***partsDisplacement);
// INPUT
// INPUT
// all_F - the set of filters (the first element is root filter,
// all_F - the set of filters (the first element is root filter,
the other - part filters)
the other - part filters)
// n - the number of part filters
// n - the number of part filters
// H - feature pyramid
// H - feature pyramid
// b - linear term of the score function
// b - linear term of the score function
// maxXBorder - the largest root filter size (X-direction)
// maxXBorder - the largest root filter size (X-direction)
// maxYBorder - the largest root filter size (Y-direction)
// maxYBorder - the largest root filter size (Y-direction)
// OUTPUT
// OUTPUT
// score - the maximum of the score function
// score - the maximum of the score function
// points - the set of root filter positions (in the block space)
// points - the set of root filter positions (in the block space)
// levels - the set of levels
// levels - the set of levels
// kPoints - number of root filter positions
// kPoints - number of root filter positions
// partsDisplacement - displacement of part filters (in the block space)
// partsDisplacement - displacement of part filters (in the block space)
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
maxFunctionalScore
(
const
filterObject
**
all_F
,
int
n
,
int
maxFunctionalScore
(
const
filterObject
**
all_F
,
int
n
,
const
featurePyramid
*
H
,
float
b
,
const
featurePyramid
*
H
,
float
b
,
int
maxXBorder
,
int
maxYBorder
,
int
maxXBorder
,
int
maxYBorder
,
float
*
score
,
float
*
score
,
CvPoint
**
points
,
int
**
levels
,
int
*
kPoints
,
CvPoint
**
points
,
int
**
levels
,
int
*
kPoints
,
CvPoint
***
partsDisplacement
);
CvPoint
***
partsDisplacement
);
/*
/*
// Computation score function that exceed threshold
// Computation score function that exceed threshold
//
//
// API
// API
// int thresholdFunctionalScore(const filterObject **all_F, int n,
// int thresholdFunctionalScore(const filterObject **all_F, int n,
const featurePyramid *H,
const featurePyramid *H,
float b,
float b,
int maxXBorder, int maxYBorder,
int maxXBorder, int maxYBorder,
float scoreThreshold,
float scoreThreshold,
float **score,
float **score,
CvPoint **points, int **levels, int *kPoints,
CvPoint **points, int **levels, int *kPoints,
CvPoint ***partsDisplacement);
CvPoint ***partsDisplacement);
// INPUT
// INPUT
// all_F - the set of filters (the first element is root filter,
// all_F - the set of filters (the first element is root filter,
the other - part filters)
the other - part filters)
// n - the number of part filters
// n - the number of part filters
// H - feature pyramid
// H - feature pyramid
// b - linear term of the score function
// b - linear term of the score function
// maxXBorder - the largest root filter size (X-direction)
// maxXBorder - the largest root filter size (X-direction)
// maxYBorder - the largest root filter size (Y-direction)
// maxYBorder - the largest root filter size (Y-direction)
// scoreThreshold - score threshold
// scoreThreshold - score threshold
// OUTPUT
// OUTPUT
// score - score function values that exceed threshold
// score - score function values that exceed threshold
// points - the set of root filter positions (in the block space)
// points - the set of root filter positions (in the block space)
// levels - the set of levels
// levels - the set of levels
// kPoints - number of root filter positions
// kPoints - number of root filter positions
// partsDisplacement - displacement of part filters (in the block space)
// partsDisplacement - displacement of part filters (in the block space)
// RESULT
// RESULT
// Error status
// Error status
*/
*/
int
thresholdFunctionalScore
(
const
filterObject
**
all_F
,
int
n
,
int
thresholdFunctionalScore
(
const
filterObject
**
all_F
,
int
n
,
const
featurePyramid
*
H
,
const
featurePyramid
*
H
,
float
b
,
float
b
,
int
maxXBorder
,
int
maxYBorder
,
int
maxXBorder
,
int
maxYBorder
,
float
scoreThreshold
,
float
scoreThreshold
,
float
**
score
,
float
**
score
,
CvPoint
**
points
,
int
**
levels
,
int
*
kPoints
,
CvPoint
**
points
,
int
**
levels
,
int
*
kPoints
,
CvPoint
***
partsDisplacement
);
CvPoint
***
partsDisplacement
);
/*
/*
// Perform non-maximum suppression algorithm (described in original paper)
// Perform non-maximum suppression algorithm (described in original paper)
// to remove "similar" bounding boxes
// to remove "similar" bounding boxes
//
//
// API
// API
// int nonMaximumSuppression(int numBoxes, const CvPoint *points,
// int nonMaximumSuppression(int numBoxes, const CvPoint *points,
const CvPoint *oppositePoints, const float *score,
const CvPoint *oppositePoints, const float *score,
float overlapThreshold,
float overlapThreshold,
int *numBoxesout, CvPoint **pointsOut,
int *numBoxesout, CvPoint **pointsOut,
CvPoint **oppositePointsOut, float **scoreOut);
CvPoint **oppositePointsOut, float **scoreOut);
// INPUT
// INPUT
// numBoxes - number of bounding boxes
// numBoxes - number of bounding boxes
// points - array of left top corner coordinates
// points - array of left top corner coordinates
// oppositePoints - array of right bottom corner coordinates
// oppositePoints - array of right bottom corner coordinates
// score - array of detection scores
// score - array of detection scores
// overlapThreshold - threshold: bounding box is removed if overlap part
// overlapThreshold - threshold: bounding box is removed if overlap part
is greater than passed value
is greater than passed value
// OUTPUT
// OUTPUT
// numBoxesOut - the number of bounding boxes algorithm returns
// numBoxesOut - the number of bounding boxes algorithm returns
// pointsOut - array of left top corner coordinates
// pointsOut - array of left top corner coordinates
// oppositePointsOut - array of right bottom corner coordinates
// oppositePointsOut - array of right bottom corner coordinates
// scoreOut - array of detection scores
// scoreOut - array of detection scores
// RESULT
// RESULT
// Error status
// Error status
*/
*/
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
extern
"C"
#endif
#endif
int
nonMaximumSuppression
(
int
numBoxes
,
const
CvPoint
*
points
,
int
nonMaximumSuppression
(
int
numBoxes
,
const
CvPoint
*
points
,
const
CvPoint
*
oppositePoints
,
const
float
*
score
,
const
CvPoint
*
oppositePoints
,
const
float
*
score
,
float
overlapThreshold
,
float
overlapThreshold
,
int
*
numBoxesOut
,
CvPoint
**
pointsOut
,
int
*
numBoxesOut
,
CvPoint
**
pointsOut
,
CvPoint
**
oppositePointsOut
,
float
**
scoreOut
);
CvPoint
**
oppositePointsOut
,
float
**
scoreOut
);
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
extern
"C"
#endif
#endif
int
getMaxFilterDims
(
const
filterObject
**
filters
,
int
kComponents
,
int
getMaxFilterDims
(
const
filterObject
**
filters
,
int
kComponents
,
const
int
*
kPartFilters
,
const
int
*
kPartFilters
,
unsigned
int
*
maxXBorder
,
unsigned
int
*
maxYBorder
);
unsigned
int
*
maxXBorder
,
unsigned
int
*
maxYBorder
);
//}
//}
#endif
#endif
modules/objdetect/src/_resizeimg.h
→
modules/objdetect/src/_
lsvm_
resizeimg.h
View file @
191f25ae
#ifndef RESIZEIMG
#ifndef RESIZEIMG
#define RESIZEIMG
#define RESIZEIMG
#include "precomp.hpp"
#include "precomp.hpp"
#include "_types.h"
#include "_types.h"
IplImage
*
resize_opencv
(
IplImage
*
img
,
float
scale
);
IplImage
*
resize_opencv
(
IplImage
*
img
,
float
scale
);
IplImage
*
resize_article_dp1
(
IplImage
*
img
,
float
scale
,
const
int
k
);
IplImage
*
resize_article_dp1
(
IplImage
*
img
,
float
scale
,
const
int
k
);
IplImage
*
resize_article_dp
(
IplImage
*
img
,
float
scale
,
const
int
k
);
IplImage
*
resize_article_dp
(
IplImage
*
img
,
float
scale
,
const
int
k
);
#endif
#endif
\ No newline at end of file
modules/objdetect/src/_routine.h
→
modules/objdetect/src/_
lsvm_
routine.h
View file @
191f25ae
#ifndef _ROUTINE_H
#ifndef _LSVM_ROUTINE_H
#define _ROUTINE_H
#define _LSVM_ROUTINE_H
#include "precomp.hpp"
#include "_lsvm_types.h"
#include "_types.h"
#include "_lsvm_error.h"
#include "_error.h"
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// Memory management routines
// Memory management routines
// All paramaters names correspond to previous data structures description
// All paramaters names correspond to previous data structures description
// All "alloc" functions return allocated memory for 1 object
// All "alloc" functions return allocated memory for 1 object
// with all fields including arrays
// with all fields including arrays
// Error status is return value
// Error status is return value
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
int
allocFilterObject
(
filterObject
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
int
allocFilterObject
(
filterObject
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
p
,
const
int
xp
);
const
int
p
,
const
int
xp
);
int
freeFilterObject
(
filterObject
**
obj
);
int
freeFilterObject
(
filterObject
**
obj
);
int
allocFeatureMapObject
(
featureMap
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
int
allocFeatureMapObject
(
featureMap
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
p
,
const
int
xp
);
const
int
p
,
const
int
xp
);
int
freeFeatureMapObject
(
featureMap
**
obj
);
int
freeFeatureMapObject
(
featureMap
**
obj
);
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
extern
"C"
#endif
#endif
int
allocFeaturePyramidObject
(
featurePyramid
**
obj
,
int
allocFeaturePyramidObject
(
featurePyramid
**
obj
,
const
int
lambda
,
const
int
countLevel
);
const
int
lambda
,
const
int
countLevel
);
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
extern
"C"
#endif
#endif
int
freeFeaturePyramidObject
(
featurePyramid
**
obj
);
int
freeFeaturePyramidObject
(
featurePyramid
**
obj
);
int
allocFFTImage
(
fftImage
**
image
,
int
p
,
int
dimX
,
int
dimY
);
int
allocFFTImage
(
fftImage
**
image
,
int
p
,
int
dimX
,
int
dimY
);
int
freeFFTImage
(
fftImage
**
image
);
int
freeFFTImage
(
fftImage
**
image
);
#endif
#endif
\ No newline at end of file
modules/objdetect/src/_types.h
→
modules/objdetect/src/_
lsvm_
types.h
View file @
191f25ae
#ifndef SVM_TYPE
#ifndef SVM_TYPE
#define SVM_TYPE
#define SVM_TYPE
//#include "opencv2/core/core.hpp"
//#include "opencv2/core/core.hpp"
//#include "opencv2/highgui/highgui.hpp"
//#include "opencv2/highgui/highgui.hpp"
#include "precomp.hpp"
#include "precomp.hpp"
//#define FFT_CONV
//#define FFT_CONV
// PI
// PI
#define PI 3.1415926535897932384626433832795
#define PI 3.1415926535897932384626433832795
//
//
#define EPS 0.000001
#define EPS 0.000001
//
//
#define F_MAX 3.402823466e+38
#define F_MAX 3.402823466e+38
#define F_MIN -3.402823465e+38
#define F_MIN -3.402823465e+38
// 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 CNTPARTION 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
#define LAMBDA 10
#define LAMBDA 10
// Block size. Used in feature pyramid building procedure
// Block size. Used in feature pyramid building procedure
#define SIDE_LENGTH 8
#define SIDE_LENGTH 8
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// main data structures //
// main data structures //
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// 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 = p)
// H - matrix of feature vectors
// H - matrix of feature vectors
// to set and get feature vectors (i,j)
// to set and get feature vectors (i,j)
// used formula Map[(j * sizeX + i) * p + k], where
// used formula Map[(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
// END OF FEATURE MAP DESCRIPTION
// xp - auxillary parameter for internal use
// xp - auxillary parameter for internal use
// size of row in feature vectors
// size of row in feature vectors
// (yp = (int) (p / xp); p = xp * yp)
// (yp = (int) (p / xp); p = xp * yp)
typedef
struct
{
typedef
struct
{
int
sizeX
;
int
sizeX
;
int
sizeY
;
int
sizeY
;
int
p
;
int
p
;
int
xp
;
int
xp
;
float
*
Map
;
float
*
Map
;
}
featureMap
;
}
featureMap
;
// DataType: STRUCT featurePyramid
// DataType: STRUCT featurePyramid
//
//
// countLevel - number of levels in the feature pyramid
// countLevel - number of levels in the feature pyramid
// lambda - resize scale coefficient
// 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
countLevel
;
int
lambda
;
int
lambda
;
featureMap
**
pyramid
;
featureMap
**
pyramid
;
}
featurePyramid
;
}
featurePyramid
;
// DataType: STRUCT filterDisposition
// DataType: STRUCT filterDisposition
// The structure stores preliminary results in optimization process
// The structure stores preliminary results in optimization process
// with objective function D
// with objective function D
//
//
// x - array with X coordinates of optimization problems solutions
// x - array with X coordinates of optimization problems solutions
// y - array with Y coordinates of optimization problems solutions
// y - array with Y coordinates of optimization problems solutions
// score - array with optimal objective values
// score - array with optimal objective values
typedef
struct
{
typedef
struct
{
float
*
score
;
float
*
score
;
int
*
x
;
int
*
x
;
int
*
y
;
int
*
y
;
}
filterDisposition
;
}
filterDisposition
;
// DataType: STRUCT fftImage
// DataType: STRUCT fftImage
// The structure stores FFT image
// The structure stores FFT image
//
//
// p - number of channels
// p - 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
;
unsigned
int
p
;
unsigned
int
dimX
;
unsigned
int
dimX
;
unsigned
int
dimY
;
unsigned
int
dimY
;
float
**
channels
;
float
**
channels
;
}
fftImage
;
}
fftImage
;
#endif
#endif
modules/objdetect/src/_lsvmparser.h
deleted
100644 → 0
View file @
87f6e500
#ifndef LSVM_PARSER
#define LSVM_PARSER
#include "precomp.hpp"
#include "_types.h"
#define MODEL 1
#define P 2
#define COMP 3
#define SCORE 4
#define RFILTER 100
#define PFILTERs 101
#define PFILTER 200
#define SIZEX 150
#define SIZEY 151
#define WEIGHTS 152
#define TAGV 300
#define Vx 350
#define Vy 351
#define TAGD 400
#define Dx 451
#define Dy 452
#define Dxx 453
#define Dyy 454
#define BTAG 500
#define STEP_END 1000
#define EMODEL (STEP_END + MODEL)
#define EP (STEP_END + P)
#define ECOMP (STEP_END + COMP)
#define ESCORE (STEP_END + SCORE)
#define ERFILTER (STEP_END + RFILTER)
#define EPFILTERs (STEP_END + PFILTERs)
#define EPFILTER (STEP_END + PFILTER)
#define ESIZEX (STEP_END + SIZEX)
#define ESIZEY (STEP_END + SIZEY)
#define EWEIGHTS (STEP_END + WEIGHTS)
#define ETAGV (STEP_END + TAGV)
#define EVx (STEP_END + Vx)
#define EVy (STEP_END + Vy)
#define ETAGD (STEP_END + TAGD)
#define EDx (STEP_END + Dx)
#define EDy (STEP_END + Dy)
#define EDxx (STEP_END + Dxx)
#define EDyy (STEP_END + Dyy)
#define EBTAG (STEP_END + BTAG)
//extern "C" {
int
LSVMparser
(
const
char
*
filename
,
filterObject
***
model
,
int
*
last
,
int
*
max
,
int
**
comp
,
float
**
b
,
int
*
count
,
float
*
score
);
#ifdef __cplusplus
extern
"C"
#endif
int
loadModel
(
const
char
*
modelPath
,
filterObject
***
filters
,
int
*
kFilters
,
int
*
kComponents
,
int
**
kPartFilters
,
float
**
b
,
float
*
scoreThreshold
);
//};
#endif
\ No newline at end of file
modules/objdetect/src/distancetransform.cpp
View file @
191f25ae
#include "_distancetransform.h"
#include "precomp.hpp"
#include "_lsvm_distancetransform.h"
/*
/*
// Computation the point of intersection functions
// Computation the point of intersection functions
...
...
modules/objdetect/src/featurepyramid.cpp
View file @
191f25ae
#include "precomp.hpp"
#include "_latentsvm.h"
#include "_latentsvm.h"
#include "_resizeimg.h"
#include "_
lsvm_
resizeimg.h"
#ifndef max
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define max(a,b) (((a) > (b)) ? (a) : (b))
...
...
modules/objdetect/src/fft.cpp
View file @
191f25ae
#include "_fft.h"
#include "precomp.hpp"
#include "_lsvm_fft.h"
int
getEntireRes
(
int
number
,
int
divisor
,
int
*
entire
,
int
*
res
)
int
getEntireRes
(
int
number
,
int
divisor
,
int
*
entire
,
int
*
res
)
{
{
...
...
modules/objdetect/src/latentsvm.cpp
View file @
191f25ae
#include "precomp.hpp"
#include "_latentsvm.h"
#include "_latentsvm.h"
#include "_matching.h"
#include "_
lsvm_
matching.h"
/*
/*
// Transformation filter displacement from the block space
// Transformation filter displacement from the block space
...
...
modules/objdetect/src/latentsvmdetector.cpp
View file @
191f25ae
#include "precomp.hpp"
#include "precomp.hpp"
#include "_lsvmparser.h"
#include "_lsvmparser.h"
#include "_matching.h"
#include "_
lsvm_
matching.h"
/*
/*
// load trained detector from a file
// load trained detector from a file
...
...
modules/objdetect/src/matching.cpp
View file @
191f25ae
#include "_matching.h"
#include "precomp.hpp"
#include "_lsvm_matching.h"
#include <stdio.h>
#include <stdio.h>
#ifndef max
#ifndef max
...
...
modules/objdetect/src/precomp.hpp
View file @
191f25ae
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/core/core_c.h"
#include "opencv2/core/core_c.h"
#include "opencv2/highgui/highgui
_c.h
"
#include "opencv2/highgui/highgui
.hpp
"
#include "opencv2/core/internal.hpp"
#include "opencv2/core/internal.hpp"
#endif
#endif
modules/objdetect/src/resizeimg.cpp
View file @
191f25ae
#include "_resizeimg.h"
#include "precomp.hpp"
#include "_lsvm_resizeimg.h"
#include <stdio.h>
#include <stdio.h>
#include <assert.h>
#include <assert.h>
#include <math.h>
#include <math.h>
IplImage
*
resize_opencv
(
IplImage
*
img
,
float
scale
){
IplImage
*
resize_opencv
(
IplImage
*
img
,
float
scale
){
IplImage
*
imgTmp
;
IplImage
*
imgTmp
;
...
...
modules/objdetect/src/routine.cpp
View file @
191f25ae
#include "_routine.h"
#include "precomp.hpp"
#include "_lsvm_routine.h"
int
allocFilterObject
(
filterObject
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
p
,
const
int
xp
){
int
allocFilterObject
(
filterObject
**
obj
,
const
int
sizeX
,
const
int
sizeY
,
const
int
p
,
const
int
xp
){
int
i
;
int
i
;
...
...
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