Exemplo n.º 1
0
  MLPTesting(): c_(&camera_){
    static_assert(imgSize_*dx_*dy_<255,"imgSize to large for gradients");
    pixel_ = cv::Point2f(patchSize_/2+1,patchSize_/2+1);
    bearing_ = V3D(patchSize_/2+1,patchSize_/2+1,1);
    bearing_.normalize();
    c_.set_c(pixel_);
    warp_c_ << 0.1, 0.5, 0.7, -0.2;
    c_.set_warp_c(warp_c_);
    warp_nor_ = c_.get_warp_nor();

    stat_.localQualityRange_ = 3;
    stat_.localVisibilityRange_ = 4;
    stat_.minGlobalQualityRange_ = 5;

    img1_ = cv::Mat::zeros(imgSize_,imgSize_,CV_8UC1);
    uint8_t* img_ptr = (uint8_t*) img1_.data;
    for(int i=0;i<imgSize_;i++){
      for(int j=0;j<imgSize_;j++, ++img_ptr){
        *img_ptr = i*dy_+j*dx_;
      }
    }
    img2_ = cv::Mat::zeros(imgSize_,imgSize_,CV_8UC1);
    img_ptr = (uint8_t*) img2_.data;
    for(int i=0;i<imgSize_;i++){
      for(int j=0;j<imgSize_;j++, ++img_ptr){
        if(j<imgSize_/2 & i<imgSize_/2){
          *img_ptr = 0;
        } else {
          *img_ptr = 255;
        }
      }
    }
    pyr1_.computeFromImage(img1_);
    pyr2_.computeFromImage(img2_);
  }
Exemplo n.º 2
0
 /** \brief Transforms pixel coordinates between two pyramid levels.
  *
  * @Note Invalidates camera and bearing vector, since the camera model is not valid for arbitrary image levels.
  * @param cIn        - Input coordinates
  * @param cOut       - Output coordinates
  * @param l1         - Input pyramid level.
  * @param l2         - Output pyramid level.
  * @return the corresponding pixel coordinates on pyramid level l2.
  */
 void levelTranformCoordinates(const FeatureCoordinates& cIn,FeatureCoordinates& cOut,const int l1, const int l2) const{
   assert(l1<n_levels && l2<n_levels && l1>=0 && l2>=0);
   cOut.set_c((centers_[l1]-centers_[l2])*pow(0.5,l2)+cIn.get_c()*pow(0.5,l2-l1));
   if(cIn.mpCamera_ != nullptr){
     if(cIn.com_warp_c()){
       cOut.set_warp_c(cIn.get_warp_c());
     }
   }
   cOut.camID_ = -1;
   cOut.mpCamera_ = nullptr;
 }