MCPcopy Create free account
hub / github.com/RoboMaster/RoboRTS / getFeatureMaps

Function getFeatureMaps

roborts_tracking/KCFcpp/src/fhog.cpp:80–275  ·  view source on GitHub ↗

// Getting feature map for the selected subimage // // API // int getFeatureMaps(const IplImage * image, const int k, featureMap **map); // INPUT // image - selected subimage // k - size of cells // OUTPUT // map - feature map // RESULT // Error status */

Source from the content-addressed store, hash-verified

78// Error status
79*/
80int getFeatureMaps(const IplImage* image, const int k, CvLSVMFeatureMapCaskade **map)
81{
82 int sizeX, sizeY;
83 int p, px, stringSize;
84 int height, width, numChannels;
85 int i, j, kk, c, ii, jj, d;
86 float * datadx, * datady;
87
88 int ch;
89 float magnitude, x, y, tx, ty;
90
91 IplImage * dx, * dy;
92 int *nearest;
93 float *w, a_x, b_x;
94
95 float kernel[3] = {-1.f, 0.f, 1.f};
96 CvMat kernel_dx = cvMat(1, 3, CV_32F, kernel);
97 CvMat kernel_dy = cvMat(3, 1, CV_32F, kernel);
98
99 float * r;
100 int * alfa;
101
102 float boundary_x[NUM_SECTOR + 1];
103 float boundary_y[NUM_SECTOR + 1];
104 float max, dotProd;
105 int maxi;
106
107 height = image->height;
108 width = image->width ;
109
110 numChannels = image->nChannels;
111
112 dx = cvCreateImage(cvSize(image->width, image->height),
113 IPL_DEPTH_32F, 3);
114 dy = cvCreateImage(cvSize(image->width, image->height),
115 IPL_DEPTH_32F, 3);
116
117 sizeX = width / k;
118 sizeY = height / k;
119 px = 3 * NUM_SECTOR;
120 p = px;
121 stringSize = sizeX * p;
122 allocFeatureMapObject(map, sizeX, sizeY, p);
123
124 cvFilter2D(image, dx, &kernel_dx, cvPoint(-1, 0));
125 cvFilter2D(image, dy, &kernel_dy, cvPoint(0, -1));
126
127 float arg_vector;
128 for(i = 0; i <= NUM_SECTOR; i++)
129 {
130 arg_vector = ( (float) i ) * ( (float)(PI) / (float)(NUM_SECTOR) );
131 boundary_x[i] = cosf(arg_vector);
132 boundary_y[i] = sinf(arg_vector);
133 }/*for(i = 0; i <= NUM_SECTOR; i++) */
134
135 r = (float *)malloc( sizeof(float) * (width * height));
136 alfa = (int *)malloc( sizeof(int ) * (width * height * 2));
137

Callers 1

getFeaturesMethod · 0.85

Calls 1

allocFeatureMapObjectFunction · 0.85

Tested by

no test coverage detected