docstring InsetCitation::xhtml(XHTMLStream & xs, OutputParams const &) const { string const & cmd = getCmdName(); if (cmd == "nocite") return docstring(); // have to output this raw, because generateLabel() will include tags xs << XHTMLStream::ESCAPE_NONE << generateLabel(true); return docstring(); }
int InsetCitation::plaintext(odocstringstream & os, OutputParams const &, size_t) const { string const & cmd = getCmdName(); if (cmd == "nocite") return 0; docstring const label = generateLabel(false); os << label; return label.size(); }
void LabelItem::paint(QPainter *painter) { // possible optimization: make _dirty actually work to save label // regeneration on 'paint'. Unlikely to be noticeable though. //if (_dirty || 1) { generateLabel(painter); //} if (_labelRc) { painter->save(); painter->setTransform(_paintTransform, true); Label::paintLabel(*_labelRc, painter); painter->restore(); } }
void InsetCitation::updateBuffer(ParIterator const &, UpdateType) { if (!cache.recalculate && buffer().citeLabelsValid()) return; // The label may have changed, so we have to re-create it. docstring const glabel = generateLabel(); unsigned int const maxLabelChars = 45; docstring label = glabel; if (label.size() > maxLabelChars) { label.erase(maxLabelChars - 3); label += "..."; } cache.recalculate = false; cache.generated_label = glabel; cache.screen_label = label; }
void InsetCitation::updateBuffer(ParIterator const &, UpdateType) { CiteEngine const engine = buffer().params().citeEngine(); if (cache.params == params() && cache.engine == engine) return; // The label has changed, so we have to re-create it. docstring const glabel = generateLabel(); unsigned int const maxLabelChars = 45; docstring label = glabel; if (label.size() > maxLabelChars) { label.erase(maxLabelChars - 3); label += "..."; } cache.engine = engine; cache.params = params(); cache.generated_label = glabel; cache.screen_label = label; }
void JoyButtonWidget::refreshLabel() { setText(generateLabel()); }
void playLoop(IplImage* frameBuffer[], int frameCount) { Blob* pBlobs = NULL; int pBlobCount = 0; CvMemStorage* storage = cvCreateMemStorage(0); /////////////////////////////////////////// // Etape 1: construction du modele de fond MedianModel medianModel; // Apprentissage du modele learnMedianModel(&medianModel, "../View_008", "%s/frame_%04d.jpg", frameCount, 0.95); char filename[255]; int i, pb, b; IplImage* frame = NULL, *segFrame = NULL; for(i = 0; i < frameCount; i++) { frame = frameBuffer[i]; //////////////////////////////////////////// // Etape 2: segmentation utilisant un modele segFrame = segmentMedianStdDev(frame, 2.0, &medianModel); opening(segFrame, segFrame, 3); closing(segFrame, segFrame, 3); /////////////////////////////////////////////////////////// // Etape 3: extraction des blobs et de leur caracteristiques Blob* blobs; DistMetrics m; // Extraction des blobs int blobCount = extractBlobs(segFrame, frame, &blobs, storage); if(pBlobs != NULL) { // Matrice des combinaisons de recouvrements spatiaux m.mSpatial = cvCreateMat(blobCount, pBlobCount, CV_32FC1); // Matrices des differences d'histogramme m.mHist5 = cvCreateMat(blobCount, pBlobCount, CV_32FC3); m.mHist10 = cvCreateMat(blobCount, pBlobCount, CV_32FC3); m.mHist15 = cvCreateMat(blobCount, pBlobCount, CV_32FC3); float coverage, absDiff; Blob *b1, *b2; int step = m.mSpatial->step, hstep = m.mHist5->step; for(b = 0; b < blobCount; b++) { for(pb = 0; pb < pBlobCount; pb++) { b1 = &blobs[b]; b2 = &pBlobs[pb]; coverage = percentOverlap(b1, b2); ((float*)(m.mSpatial->data.ptr + b*step))[pb] = coverage; absDiff = absDiffHistograms(&b1->h5, &b2->h5, 0); ((float*)(m.mHist5->data.ptr + b*hstep))[pb*3] = absDiff; absDiff = absDiffHistograms(&b1->h10, &b2->h10, 0); ((float*)(m.mHist10->data.ptr + b*hstep))[pb*3] = absDiff; absDiff = absDiffHistograms(&b1->h15, &b2->h15, 0); ((float*)(m.mHist15->data.ptr + b*hstep))[pb*3] = absDiff; // TODO: Faire les autres canaux } } ////////////////////////////////////////////////////////// // Etape 4: association temporelle avec le frame precedent int assocMatrix[blobCount]; association(blobs, pBlobs, &m, assocMatrix); // Transfer des identites (etiquettes) aux nouveaux blobs for(b = 0; b < blobCount; b++) { int index = assocMatrix[b]; if(index != -1) blobs[b].label = pBlobs[index].label; else blobs[b].label = generateLabel(); } } else { // Attribution d'une premiere etiquette a chaque blob for(b = 0; b < blobCount; b++) blobs[b].label = generateLabel(); } // Images binaires drawBoundingRects(segFrame, blobs, blobCount); drawLabels(segFrame, blobs, blobCount); sprintf(filename, "bbox_%04d.jpg", i); cvSaveImage(filename, segFrame); // Image originales drawBoundingRects(frame, blobs, blobCount); drawLabels(frame, blobs, blobCount); sprintf(filename, "suivi_%04d.jpg", i); cvSaveImage(filename, frame); pBlobCount = blobCount; pBlobs = blobs; } cvReleaseMemStorage(&storage); }