Mat Kernel::extractDescriptors(Mat image){ int w = image.cols, h=image.rows, size=32, delta=16; Mat result, temp, img; int i = (patches/14)*delta, j = (patches%14)*delta; if(filter=="DoG") img = DoGFilter(image); else if(filter=="CSDN") img = CSDNFilter(image); else if(filter=="Gaussian") img = GaussianFilter(image); else cerr << "Error, no filter choosed" << endl; img = img(Rect(i,j,size,size)); //img.convertTo(img, CV_32F); // Retirar isso depois //dct(img,img); // Isso tambem if(descriptor=="SIFT") calcSIFTDescriptors(img,temp); else if(descriptor=="MLBP") calcLBPHistogram(img,temp); else cerr << "Error, no descriptor choosed" << endl; normalize(temp,temp,1); result = temp.t(); return result; }
/*! \fn dogPGM(Pgm* pgmIn, Pgm* pgmOut, double sigma, int dim) * \brief Filter the image \a pgmIn with a DoG filter. Store the result in \a pgmOut. * * Apply a DoG filter to \a pgmIn. Refer to \link DoGFilter() DoGFilter() function \endlink for further information. * \param pgmIn Pointer to the input PGM image structure. * \param pgmOut Pointer to the output PGM image structure. * \param sigma The sigma of the external Gaussian. * \param dim The number of rows and columns of the filter. If it is set to 0 then the dimension * is the smallest odd number next to 6 \a sigma. * \return 0 on success, -1 if either pgmIn or pgmOut are NULL. */ int dogPGM(Pgm* pgmIn, Pgm* pgmOut, double sigma, int dim) { if(!pgmIn) { fprintf(stderr, "Error! No input data. Please Check.\n"); return -1; } if(!pgmOut) { fprintf(stderr, "Error! No space to store the result. Please Check.\n"); return -1; } Filter* filter; fprintf(stderr, "\nDoG filtering (sigma = %f)\n",sigma); filter = DoGFilter(sigma, dim); resetPGM(pgmOut); convolution2DPGM(pgmIn, pgmOut, filter); freeFilter(&filter); return 0; }