static void WrapHistograms( vec_double& histbins) { for (int row = 0; row < GRIDHEIGHT; row++) for (int col = 0; col < GRIDWIDTH; col++) { const int ibin = HistIndex(row, col, 0); histbins[ibin] += histbins[ibin + BINS_PER_HIST]; // 360 wraps to 0 } }
static void CopyHistsToDesc( // copy histograms to descriptor, skipping pad bins VEC& desc, // out const vec_double& histbins) // in { for (int row = 0; row < GRIDHEIGHT; row++) for (int col = 0; col < GRIDWIDTH; col++) memcpy(Buf(desc) + (row * GRIDWIDTH + col) * BINS_PER_HIST, &histbins[HistIndex(row, col, 0)], BINS_PER_HIST * sizeof(histbins[0])); }
void GetHistograms( // get all histogram bins vec_double& histbins, // out const int patchwidth, // in: in pixels const vec_double& mags, // in const vec_double& orients, // in const vec_int& row_indices, // in const vec_double& row_fracs, // in const vec_int& col_indices, // in const vec_double& col_fracs) // in { const int npix = SQ(patchwidth); // number of pixels in image patch const int nhistbins = (1 + GRIDHEIGHT + 1) * (1 + GRIDWIDTH + 1) * (BINS_PER_HIST + 1); // resize and clear (the fill is needed if the size of histbins // doesn't change, because in that case resize does nothing) histbins.resize(nhistbins); fill(histbins.begin(), histbins.end(), 0.); for (int ipix = 0; ipix < npix; ipix++) { const double orient = orients[ipix]; const int iorient = int(floor(orient)); CV_DbgAssert(iorient >= 0 && iorient < BINS_PER_HIST); const int ibin = HistIndex(row_indices[ipix], col_indices[ipix], iorient); double* const p = &histbins[ibin]; TrilinearAccumulate( // apportion grad mag across eight orientation bins p[0], // ThisOrient p[1], // NextOrient p[BINS_PER_HIST + 1], // NextCol ThisOrient p[BINS_PER_HIST + 2], // NextCol NextOrient p[(GRIDWIDTH+2) * (BINS_PER_HIST+1)], // NextRow ThisOrient p[(GRIDWIDTH+2) * (BINS_PER_HIST+1) + 1], // NextRow NextOrient p[(GRIDWIDTH+3) * (BINS_PER_HIST+1)], // NextRow NextCol ThisOrient p[(GRIDWIDTH+3) * (BINS_PER_HIST+1) + 1], // NextRow NextCol NextOrient mags[ipix], // the mag that gets apportioned row_fracs[ipix], // rowfrac col_fracs[ipix], // colfrac orient - iorient); // orientfrac } }
void GRIHist1DGridScrollWidget::SetYLabel(GRIHistogrammer *h, QString ylabel) { if (HistIsPresent(h)) { hist_ylabel_vec_[HistIndex(h)] = ylabel; } ResetGrid(); }
void GRIHist1DGridScrollWidget::SetAutoScale(GRIHistogrammer *h, bool autoscale_on) { if (HistIsPresent(h)) { hist_autoscale_on_vec_[HistIndex(h)] = autoscale_on; } ResetGrid(); }
void GRIHist1DGridScrollWidget::SetLogScale(GRIHistogrammer *h, bool logscale_on) { if (HistIsPresent(h)) { hist_logscale_on_vec_[HistIndex(h)] = logscale_on; } ResetGrid(); }
void GRIHist1DGridScrollWidget::SetOutlineColor(GRIHistogrammer *h, QColor qcolor) { if (HistIsPresent(h)) { hist_outline_color_vec_[HistIndex(h)] = qcolor; } ResetGrid(); }
void GRIHist1DGridScrollWidget::SetBackgroundColor(GRIHistogrammer *h, QColor qcolor) { if (HistIsPresent(h)) { hist_background_color_vec_[HistIndex(h)] = qcolor; } ResetGrid(); }