void test_appl_main(void *arg) { unsigned n = (unsigned) arg; int rc; printf("%s\n", "test_appl task starting..."); rc = k9_sem_take(test_sem, n, n == 10 ? 10 : K9_TMOUT_FOREVER); printf("test_appl: "); PRINT_EXPR("%d", rc); printf("\n"); printf("%s\n", "test_appl task exiting"); }
HOGFeatureExtractor::HOGFeatureExtractor(int nAngularBins, bool unsignedGradients, int cellSize): _nAngularBins(nAngularBins), _unsignedGradients(unsignedGradients), _cellSize(cellSize) { _kernelDx.ReAllocate(CShape(3, 1, 1), derivKvals, false, 1); _kernelDx.origin[0] = 1; _kernelDy.ReAllocate(CShape(1, 3, 1), derivKvals, false, 1); _kernelDy.origin[0] = 1; // For visualization // A set of patches representing the bin orientations. When drawing a hog cell // we multiply each patch by the hog bin value and add all contributions up to // form the visual representation of one cell. Full HOG is achieved by stacking // the viz for individual cells horizontally and vertically. _oriMarkers.resize(_nAngularBins); const int ms = 11; CShape markerShape(ms, ms, 1); // First patch is a horizontal line _oriMarkers[0].ReAllocate(markerShape, true); _oriMarkers[0].ClearPixels(); for(int i = 1; i < ms - 1; i++) _oriMarkers[0].Pixel(/*floor(*/ ms/2 /*)*/, i, 0) = 1; #if 0 // debug std::cout << "DEBUG:" << __FILE__ << ":" << __LINE__ << std::endl; for(int i = 0; i < ms; i++) { for(int j = 0; j < ms; j++) { std::cout << _oriMarkers[0].Pixel(j, i, 0) << " "; } std::cout << std::endl; } std::cout << std::endl; char debugFName[2000]; sprintf(debugFName, "/tmp/debug%03d.tga", 0); PRINT_EXPR(debugFName); WriteFile(_oriMarkers[0], debugFName); #endif // The other patches are obtained by rotating the first one CTransform3x3 T = CTransform3x3::Translation((ms - 1) / 2.0, (ms - 1) / 2.0); for(int angBin = 1; angBin < _nAngularBins; angBin++) { double theta; if(unsignedGradients) theta = 180.0 * (double(angBin) / _nAngularBins); else theta = 360.0 * (double(angBin) / _nAngularBins); CTransform3x3 R = T * CTransform3x3::Rotation(theta) * T.Inverse(); _oriMarkers[angBin].ReAllocate(markerShape, true); _oriMarkers[angBin].ClearPixels(); WarpGlobal(_oriMarkers[0], _oriMarkers[angBin], R, eWarpInterpLinear); #if 0 // debug char debugFName[2000]; sprintf(debugFName, "/tmp/debug%03d.tga", angBin); PRINT_EXPR(debugFName); WriteFile(_oriMarkers[angBin], debugFName); #endif } }