예제 #1
0
void pyramids(uint32_t nimages, uint32_t nlev, uint32_t r, uint32_t c, double **I, double **W,
              double *tmp_halfsize, double *tmp_quartsize, double *tmp2_quartsize,
              double ***pyrW, uint32_t **pyrW_r, uint32_t **pyrW_c,
              double ***pyrI, uint32_t **pyrI_r, uint32_t **pyrI_c){
    //multiresolution blending
    for (int n = 0; n < nimages; n++){
        //construct 1-channel gaussian pyramid from weights
        gaussian_pyramid(W[n],r,c,nlev,tmp_halfsize,pyrW[n],pyrW_r[n],pyrW_c[n]);
    }
    for (int n = 0; n < nimages; n++){
        //construct 3-channel laplacian pyramid from images
        laplacian_pyramid(I[n],r,c,nlev,tmp_halfsize,tmp_quartsize,tmp2_quartsize,pyrI[n],pyrI_r[n],pyrI_c[n]);
    }
}
예제 #2
0
void pyramids(uint32_t nimages, uint32_t nlev, uint32_t r, uint32_t c, double ***C, double **W,
              double *tmp_halfsize, double *tmp_quartsize, double *tmp2_quartsize,
              double ***pyrW, uint32_t **pyrW_r, uint32_t **pyrW_c,
              double ****pyrI, uint32_t **pyrI_r, uint32_t **pyrI_c){
    //multiresolution blending
    for (int n = 0; n < nimages; n++){
        //construct 1-channel gaussian pyramid from weights
        gaussian_pyramid(W[n],r,c,nlev,tmp_halfsize,pyrW[n],pyrW_r[n],pyrW_c[n]);
    }
    for (int n = 0; n < nimages; n++){
        for(int k = 0; k < CHANNELS; k++){
            double ***pyrIk = pyrI[k];
            laplacian_pyramid(C[n][k],r,c,nlev,tmp_halfsize,tmp_quartsize,tmp2_quartsize,pyrIk[n],pyrI_r[n],pyrI_c[n]);
        }
    }
}
예제 #3
0
파일: Hessian.cpp 프로젝트: caomw/sara
  vector<OERegion>
  ComputeDoHExtrema::
  operator()(const Image<float>& I, vector<Point2i> *scale_octave_pairs)
  {
    ImagePyramid<float>& gaussPyr = _gaussians;
    ImagePyramid<float>& det_hess_pyr = _det_hessians;

    gaussPyr = gaussian_pyramid(I, pyr_params_);
    det_hess_pyr = det_of_hessian_pyramid(gaussPyr);

    vector<OERegion> det_hess_extrema;
    det_hess_extrema.reserve(int(1e4));
    if (scale_octave_pairs)
    {
      scale_octave_pairs->clear();
      scale_octave_pairs->reserve(int(1e4));
    }

    for (int o = 0; o < det_hess_pyr.num_octaves(); ++o)
    {
      // Be careful of the bounds. We go from 1 to N-1.
      for (int s = 1; s < det_hess_pyr.num_scales_per_octave()-1; ++s)
      {
        vector<OERegion> new_det_hess_extrema(local_scale_space_extrema(
          det_hess_pyr, s, o, _extremum_thres, _edge_ratio_thres,
          _img_padding_sz, _extremum_refinement_iter) );

        append(det_hess_extrema, new_det_hess_extrema);

        if (scale_octave_pairs)
        {
          for (size_t i = 0; i != new_det_hess_extrema.size(); ++i)
            scale_octave_pairs->push_back(Point2i(s,o));
        }
      }
    }
    shrink_to_fit(det_hess_extrema);
    return det_hess_extrema;
  }
예제 #4
0
파일: LoG.cpp 프로젝트: caomw/sara
  vector<OERegion>
  ComputeLoGExtrema::operator()(const Image<float>& I,
                                vector<Point2i> *scale_octave_pairs)
  {
    auto& G = _gaussians;
    auto& L = _laplacians_of_gaussians;
    G = gaussian_pyramid(I, _params);
    L = laplacian_pyramid(G);

    auto extrema = vector<OERegion>{};
    const auto preallocated_size = int(1e4);
    extrema.reserve(preallocated_size);
    if (scale_octave_pairs)
    {
      scale_octave_pairs->clear();
      scale_octave_pairs->reserve(preallocated_size);
    }

    for (int o = 0; o < L.num_octaves(); ++o)
    {
      // Be careful of the bounds. We go from 1 to N-1.
      for (int s = 1; s < L.num_scales_per_octave() - 1; ++s)
      {
        auto new_extrema = local_scale_space_extrema(
          L, s, o, _extremum_thres, _edge_ratio_thres,
          _img_padding_sz, _extremum_refinement_iter);

        append(extrema, new_extrema);

        if (scale_octave_pairs)
        {
          for (size_t i = 0; i != new_extrema.size(); ++i)
            scale_octave_pairs->push_back(Point2i(s,o));
        }
      }
    }
    shrink_to_fit(extrema);
    return extrema;
  }
예제 #5
0
파일: DoG.cpp 프로젝트: caomw/sara
  vector<OERegion>
  ComputeDoGExtrema::operator()(const Image<float>& image,
                                vector<Point2i> *scale_octave_pairs)
  {
    auto& G = _gaussians;
    auto& D = _diff_of_gaussians;
    G = gaussian_pyramid(image, _pyramid_params);
    D = difference_of_gaussians_pyramid(G);

    auto extrema = vector<OERegion>{};
    extrema.reserve(int(1e4));
    if (scale_octave_pairs)
    {
      scale_octave_pairs->clear();
      scale_octave_pairs->reserve(10000);
    }

    for (int o = 0; o < D.num_octaves(); ++o)
    {
      // Be careful of the bounds. We go from 1 to N-1.
      for (int s = 1; s < D.num_scales_per_octave()-1; ++s)
      {
        auto new_extrema = local_scale_space_extrema(
          D, s, o, _extremum_thres, _edge_ratio_thres,
          _img_padding_sz, _extremum_refinement_iter);
        append(extrema, new_extrema);

        if (scale_octave_pairs)
        {
          for (size_t i = 0; i != new_extrema.size(); ++i)
            scale_octave_pairs->push_back(Point2i(s,o));
        }
      }
    }
    shrink_to_fit(extrema);
    return extrema;
  }