Beispiel #1
0
void computeAffineMap(
    const Mat1f &scale_map,
    const Mat1f &depth_map,
    float sw,
    float min_px_scale,
    Mat3f& affine_map )
{
  affine_map.create( depth_map.rows, depth_map.cols );

  const float nan = std::numeric_limits<float>::quiet_NaN();
  for ( int y = 0; y < depth_map.rows; y++ )
  {
    for ( int x = 0; x < depth_map.cols; ++x )
    {
      Vec2f grad;
      const float sp = getScale(scale_map[y][x], sw);
      if ( isnan(sp) || sp < min_px_scale ||
           !computeGradient( depth_map, x, y, sp, grad ) )
      {
        affine_map[y][x][0] = nan;
        affine_map[y][x][1] = nan;
        affine_map[y][x][2] = nan;
      }
      else
      {
        getAffParams( sw, grad, affine_map[y][x] );
      }
    }
  }
}
Beispiel #2
0
void computeAffineMapFixed(
    const Mat1f &depth_map,
    float sp,
    float f,
    Mat3f& affine_map )
{
  affine_map.create( depth_map.rows, depth_map.cols );

  const float sp_div_f = sp / f;

  for ( int y = 0; y < depth_map.rows; y++ )
  {
    for ( int x = 0; x < depth_map.cols; ++x )
    {
      Vec2f grad;
      if ( isnan(depth_map[y][x]) ||
           !computeGradient( depth_map, x, y, sp, grad ) )
      {
        affine_map[y][x][0] = nan;
        affine_map[y][x][1] = nan;
        affine_map[y][x][2] = nan;
      }
      else
      {
        const float sw = sp_div_f * depth_map[y][x];
        getAffParams( sw, grad, affine_map[y][x] );
      }
    }
  }
}