ColormapFunction::ColormapFunction() { invert_ = false; reverse_ = false; redScale_ = greenScale_ = blueScale_ = 1.0; setScales( 0.0, 0.0); }
ColormapFunction::ColormapFunction( PWLinear & red, PWLinear & green, PWLinear & blue) { red_ = red; green_ = green; blue_ = blue; invert_ = false; reverse_ = false; redScale_ = greenScale_ = blueScale_ = 1.0; setScales( 0.0, 0.0); }
matrix<double>& EvolDF1nlep::Df1Evolnlep(double mu, double M, orders order, orders_ew order_ew, schemes scheme) { switch (scheme) { case NDR: break; case LRI: case HV: default: std::stringstream out; out << scheme; throw std::runtime_error("EvolDF1nlep::Df1Evolnlep_EM(): scheme " + out.str() + " not implemented "); } if (mu == this->mu && M == this->M && scheme == this->scheme && order_ew == NULL_ew) return (*Evol(order)); if (mu == this->mu && M == this->M && scheme == this->scheme && order_ew == NLO_ew) return (*Evol(order_ew)); if (M < mu) { std::stringstream out; out << "M = " << M << " < mu = " << mu; throw out.str(); } setScales(mu, M); // also assign evol to identity double m_down = mu; double m_up = model.AboveTh(m_down); double nf = model.Nf(m_down); while (m_up < M) { Df1Evolnlep(m_down, m_up, nf, scheme); Df1threshold_nlep(m_up, nf+1.); m_down = m_up; m_up = model.AboveTh(m_down); nf += 1.; } Df1Evolnlep(m_down, M, nf, scheme); if(order_ew != NULL_ew){ return (*Evol(order_ew)); } else { return (*Evol(order)); } }
StarDetector::StarDetector(CvSize size, int n, float response_threshold, float line_threshold_projected, float line_threshold_binarized) : m_upright(NULL), m_tilted(NULL), m_flat(NULL), m_projected(NULL), m_scales(NULL), m_filter_sizes(NULL), m_nonmax(response_threshold, LineSuppressHybrid(line_threshold_projected, line_threshold_binarized)), m_filter_params(NULL) { // Pre-allocate all the memory we need setScales(n); setImageSize(size); }
gslpp::matrix<double>& EvolDC1Buras::DC1EvolBuras(double mu, double M, orders order, schemes scheme) { switch (scheme) { case NDR: break; case LRI: case HV: default: std::stringstream out; out << scheme; throw std::runtime_error("EvolDC1::Df1EvolDC1(): scheme " + out.str() + " not implemented "); } double alsMZ = model.getAlsMz(); double Mz = model.getMz(); if(alsMZ == alsMZ_cache && Mz == Mz_cache) { if (mu == this-> mu && M == this->M && scheme == this->scheme) return (*Evol(order)); } alsMZ_cache = alsMZ; Mz_cache = Mz; if (M < mu) { std::stringstream out; out << "M = " << M << " < mu = " << mu; throw out.str(); } setScales(mu, M); // also assign evol to identity double m_down = mu; double m_up = model.AboveTh(m_down); double nf = model.Nf(m_down); while (m_up < M) { DC1EvolBuras(m_down, m_up, nf, scheme); DC1PenguinThresholds(m_up, order); m_down = m_up; m_up = model.AboveTh(m_down); nf += 1.; } DC1EvolBuras(m_down, M, nf, scheme); return (*Evol(order)); }
void Transform3D::setScales(float s) { setScales(s, s, s); }
void FeatPyramid::featpyramid (const IplImage *im, const Model *model, int padX, int padY) { float sbin, interval; float sc; int imsize[2]; float maxScale; IplImage *imAux = NULL; int pad[3]; if (padX == -1 && padY == -1) { padX = getPaddingX(model); padY = getPaddingY(model); } sbin = (float)model->getSbin(); interval = (float) model->getInterval()+1.0; sc = pow (2, 1/(interval)); imsize[0] = im->height; imsize[1] = im->width; maxScale = 1 + floor ( log ( min (imsize[0], imsize[1]) / (5*sbin) ) / log(sc) ); // It is the number of elements that will contain pyramid->features // and pyramid->scales. At less must be 2*interval if ( (maxScale + interval) < (2*interval) ) setDim (int(2*interval)); else setDim (int(maxScale + interval)); assert (getDim() > 0); // _feat = new CvMatND* [getDim()]; // Suspicious _feat.reserve(getDim()); for (int i = 0; i < getDim(); i++) // Pre-allocate memory _feat.push_back(cv::Mat()); // assert (_feat != NULL); assert(!_feat.empty()); _scales = new float [getDim()]; // Suspicious assert (_scales != NULL); // Field imsize is setted assert (imsize[0] > 0); assert (imsize[1] > 0); setImSize (imsize); //cout << "Antes de bucle featpyramid" << endl; for (int i = 0; i < interval; i++) { // Image is resized imAux = resize (im, (1/pow(sc, i))); // "First" 2x interval //setFeat(process(imAux, sbin/2), i); setFeat(process2(imAux, sbin/2), i); setScales(2/pow(sc, i), i); // "Second" 2x interval //setFeat (process (imAux, sbin), (int)(i+interval)); setFeat (process2 (imAux, sbin), (int)(i+interval)); setScales (1/pow(sc, i), (int)(i+interval)); // Remaining intervals IplImage *imAux2; // mjmarin added for (int j = (int)(i+interval); j < (int)maxScale; j = j+(int)interval) { // mjmarin: memory leak fixed //imAux = resize (imAux, 0.5); // Old sentence imAux2 = resize (imAux, 0.5); cvReleaseImage(&imAux); imAux = imAux2; //setFeat (process (imAux, sbin), (int)(j+interval)); setFeat (process2 (imAux, sbin), (int)(j+interval)); setScales ((float)(0.5 * getScales()[j]), (int)(j+interval)); } // mjmarin: more release needed for imAux cvReleaseImage(&imAux); } // Second loop for (int i = 0; i < getDim(); i++ ) { // Add 1 to padding because feature generation deletes a 1-cell // Wide border around the feature map pad[0] = padY + 1; pad[1] = padX + 1; pad[2] = 0; //CvMatND* tmpfeat = getFeat()[i]; cv::Mat tmpfeat = getFeat()[i]; CvMatND tmpND = tmpfeat; //CvMatND* tmppad = padArray (tmpfeat, pad, 0); CvMatND* tmppad = padArray (&tmpND, pad, 0); setFeat (tmppad, i); //cvReleaseMatND(&tmpfeat); // mjmarin: commented out since it should be auto released with use of cv::Mat // Write boundary occlusion feature cv::Mat fMat = getFeat()[i]; for (int j = 0; j <= padY; j++) //for (int k = 0; k < getFeat()[i]->dim[1].size; k++) for (int k = 0; k < fMat.size.p[1]; k++) //cvSetReal3D (getFeat()[i], j, k, 31, 1); fMat.at<double>(j, k, 31) = 1; //for (int j = getFeat()[i]->dim[0].size - padY -1; j < getFeat()[i]->dim[0].size; j++) for (int j = fMat.size.p[0] - padY -1; j < fMat.size.p[0]; j++) //for (int k = 0; k < getFeat()[i]->dim[1].size; k++) for (int k = 0; k < fMat.size.p[1]; k++) //cvSetReal3D (getFeat()[i], j, k, 31, 1); fMat.at<double>(j, k, 31) = 1; //for (int j = 0; j < getFeat()[i]->dim[0].size; j++) for (int j = 0; j < fMat.size.p[0]; j++) for (int k = 0; k <= padX; k++) //cvSetReal3D (getFeat()[i], j, k, 31, 1); fMat.at<double>(j, k, 31) = 1; //for (int j = 0; j < getFeat()[i]->dim[0].size; j++) for (int j = 0; j < fMat.size.p[0]; j++) //for (int k = getFeat()[i]->dim[1].size - padX - 1; k < getFeat()[i]->dim[1].size; k++) for (int k = fMat.size.p[1] - padX - 1; k < fMat.size.p[1]; k++) //cvSetReal3D (getFeat()[i], j, k, 31, 1); fMat.at<double>(j, k, 31) = 1; } setPadX (padX); setPadY (padY); }