static void makeXPixelInfo(XPixelInfo *info, XImage *img, Display *disp, Colormap cmap) { if ( img->depth <= 8 ) { XColor *cdata = info->cinfo; int entries = 1<<img->depth; int i; for(i=0; i<entries; i++) cdata[i].pixel = i; if ( !cmap ) cmap = DefaultColormap(disp, DefaultScreen(disp)); XQueryColors(disp, cmap, cdata, entries); } else { info->cinfo = 0; info->r_shift = shift_for_mask(img->red_mask); info->g_shift = shift_for_mask(img->green_mask); info->b_shift = shift_for_mask(img->blue_mask); info->r_fill = 16 - mask_width(img->red_mask); info->g_fill = 16 - mask_width(img->green_mask); info->b_fill = 16 - mask_width(img->blue_mask); } }
/*! \fn CvGabor::Init(double dPhi, int iNu, double dSigma, double dF) Initilize the.gabor Parameters: dPhi The orientations iNu The scale can be from -5 to infinit dSigma The Sigma value of gabor, Normally set to 2*PI dF The spatial frequence , normally is sqrt(2) Returns: None Initilize the.gabor with the orientation dPhi, the scale iNu, the sigma dSigma, the frequency dF, it will call the function creat_kernel(); So a gabor is created.filename The name of the image file file_format The format of the file, e.g. GAN_PNG_FORMAT image The image structure to be written to the file octrlstr Format-dependent control structure */ void CvGabor::Init(double dPhi, int iNu, double dSigma, double dF) { bInitialised = false; bKernel = false; Sigma = dSigma; F = dF; Kmax = PI/2; // Absolute value of K K = Kmax / pow(F, (double)iNu); Phi = dPhi; bInitialised = true; Width = mask_width(); Real = cvCreateMat( Width, Width, CV_32FC1); Imag = cvCreateMat( Width, Width, CV_32FC1); creat_kernel(); }
/** * @brief Initilize the.gabor with the orientation iMu, the scale iNu, * the sigma dSigma, the frequency dF, it will call the function * creat_kernel(); So a gabor is created. * @param iMu The orientations which is iMu*PI.8 * @param iNu The scale can be from -5 to infinit * @param dSigma The Sigma value of gabor, Normally set to 2*PI * @param dF The spatial frequence , normally is sqrt(2) */ void CvGabor::Init(int iMu, int iNu, double dSigma, double dF) { // printf("CvGabor::Init: start\n"); //Initilise the parameters bInitialised = false; bKernel = false; Sigma = dSigma; F = dF; Kmax = PI/2; // Absolute value of K K = Kmax / pow(F, (double)iNu); Phi = PI*iMu/8; bInitialised = true; Width = mask_width(); Real = cvCreateMat( Width, Width, CV_32FC1); Imag = cvCreateMat( Width, Width, CV_32FC1); creat_kernel(); // printf("CvGabor::Init: done\n"); }