Tabnine Logo
boofcv.abst.distort
Code IndexAdd Tabnine to your IDE (free)

How to use boofcv.abst.distort

Best Java code snippets using boofcv.abst.distort (Showing top 20 results out of 315)

origin: org.boofcv/boofcv-ip

/**
 * Scales the image and sets the border to {@link BorderType#EXTENDED}. This is normally what you want
 * to do when scaling an image.  If you don't use an extended border when you hit the right and bottom
 * boundaries it will go outside the image bounds and if a fixed value of 0 is used it will average towards
 * zero.
 */
public FDistort scaleExt() {
  return scale().borderExt();
}
origin: org.boofcv/boofcv-ip

/**
 * Sets interpolation to use nearest-neighbor
 */
public FDistort interpNN() {
  return interp(InterpolationType.NEAREST_NEIGHBOR);
}
origin: org.boofcv/boofcv-ip

/**
 * <p>Sets the border to EXTEND.</p>
 */
public FDistort borderExt() {
  return border(BorderType.EXTENDED);
}
origin: org.boofcv/demonstrations

private void applyScaling() {
  scaledImage.reshape(panel.getWidth(), panel.getHeight());
  if( scaledImage.width <= 0 || scaledImage.height <= 0 ) {
    return;
  }
  if( latestImage.width != 0 && latestImage.height != 0 ) {
    new FDistort(latestImage, scaledImage).interp(interpType).border(BorderType.EXTENDED).scale().apply();
    BufferedImage out = ConvertBufferedImage.convertTo(scaledImage, null, true);
    panel.setImageUI(out);
    panel.repaint();
  }
}
origin: org.boofcv/demonstrations

private synchronized void render( Rectangle visibleRect ) {
  
  if( visibleRect.width == 0 || visibleRect.height == 0 )
    return;
  if( transformed.width != visibleRect.width || transformed.height != visibleRect.height ||
      workImage == null ) {
    transformed.reshape(visibleRect.width,visibleRect.height);
    workImage = new BufferedImage(visibleRect.width,visibleRect.height,BufferedImage.TYPE_INT_RGB);
  }
  double x = -visibleRect.x;
  double y = -visibleRect.y;
  new FDistort(input,transformed).interpNN().affine(scale,0,0,scale,x,y).apply();
  ConvertBufferedImage.convertTo(transformed,workImage,true);
}
origin: org.boofcv/boofcv-geo

/**
 * Constructor which specifies the characteristics of the undistorted image
 *
 * @param width Width of undistorted image
 * @param height Height of undistorted image
 * @param imageType Type of undistorted image
 */
public RemovePerspectiveDistortion( int width , int height , ImageType<T> imageType ) {
  this(width,height);
  output = imageType.createImage(width,height);
  distort = new FDistort(imageType);
  distort.output(output);
  distort.interp(InterpolationType.BILINEAR).transform(transform);
}
origin: org.boofcv/boofcv-geo

/**
 * Applies distortion removal to the specified region in the input image.  The undistorted image is returned.
 * @param input Input image
 * @param corner0 Top left corner
 * @param corner1 Top right corner
 * @param corner2 Bottom right corner
 * @param corner3 Bottom left corner
 * @return true if successful or false if it failed
 */
public boolean apply( T input ,
        Point2D_F64 corner0 , Point2D_F64 corner1 ,
        Point2D_F64 corner2 , Point2D_F64 corner3 )
{
  if( createTransform(corner0, corner1, corner2, corner3)) {
    distort.input(input).apply();
    return true;
  } else {
    return false;
  }
}
origin: lessthanoptimal/BoofAndroidDemo

@Override
public void initialize(int imageWidth, int imageHeight, int sensorOrientation) {
  binary.reshape(imageWidth, imageHeight);
  work.reshape(imageWidth, imageHeight);
  scaled.reshape(imageWidth/3,imageHeight/3);
  shrink = new FDistort();
}
origin: org.boofcv/boofcv-ip

/**
 * Specifies the input and output image and sets interpolation to BILINEAR, black image border, cache is off.
 */
public FDistort init(ImageBase input, ImageBase output) {
  this.input = input;
  this.output = output;
  inputType = input.getImageType();
  interp(InterpolationType.BILINEAR);
  border(0);
  cached = false;
  distorter = null;
  outputToInput = null;
  return this;
}
origin: org.boofcv/boofcv-ip

/**
 * Applies a distortion which will rotate the input image by the specified amount.
 */
public FDistort rotate( double angleInputToOutput ) {
  PixelTransform2_F32 outputToInput = DistortSupport.transformRotate(input.width/2,input.height/2,
      output.width/2,output.height/2,(float)angleInputToOutput);
  return transform(outputToInput);
}
origin: org.boofcv/boofcv-ip

public FDistort affine( Affine2D_F64 affine ) {
  return affine(affine.a11,affine.a12,affine.a21,affine.a22,affine.tx,affine.ty);
}
origin: org.boofcv/boofcv-ip

  public static PointDeformKeyPoints deformMls(ConfigDeformPointMLS config ) {
    if( config == null )
      config = new ConfigDeformPointMLS();

    ImageDeformPointMLS_F32 alg = new ImageDeformPointMLS_F32(config.type);
    alg.setAlpha(config.alpha);

    return new PointDeform_MLS(alg, config.rows, config.cols);
  }
}
origin: org.boofcv/demonstrations

  private void controlPointsModified() {
    synchronized (pointsUndistorted){
      try {
        // transform needs to go from distorted image to undistorted image
        alg.setSource(pointsDistorted);
        alg.setDestination(pointsUndistorted);
        validTransform = true;
      } catch( RuntimeException e ) {
//                System.out.println("Failed because of "+e.getMessage());
//                System.out.println("   total points "+pointsDistorted.size());
        validTransform = false;
      }
    }
    distortImage.setModel(p2p);
    if( inputMethod == InputMethod.IMAGE ) {
      renderDistorted(null, undistorted);
    }
    gui.repaint();
  }

origin: org.boofcv/boofcv-ip

/**
 * Constructor in which input and output images are specified.  Equivalent to calling
 * {@link #init(ImageBase, ImageBase)}
 *
 * @param input Input image
 * @param output output image
 */
public FDistort(ImageBase input, ImageBase output) {
  init(input, output);
}
origin: org.boofcv/demonstrations

@Override
public void handleAlgorithmChange() {
  alg = FactoryDistort.deformMls(control.getConfigMLS());
  p2p.setTransform(alg);
  alg.setImageShape(undistorted.width,undistorted.height);
  controlPointsModified();
}
origin: org.boofcv/boofcv-ip

/**
 * Used to manually specify a transform.  From output to input
 */
public FDistort transform( Point2Transform2_F32 outputToInput ) {
  return transform( new PointToPixelTransform_F32(outputToInput));
}
origin: org.boofcv/boofcv-ip

  /**
   * Sets the border to a fixed gray-scale value
   */
  public FDistort border( double value ) {
    // to recycle here the value also needs to be saved
//        if( borderType == BorderType.VALUE )
//            return this;
    borderType = BorderType.ZERO;
    return border(FactoryImageBorder.genericValue(value, inputType));
  }

origin: org.boofcv/boofcv-ip

/**
 * <p>Applies a distortion which will rescale the input image into the output image.  You
 * might want to consider using {@link #scaleExt()} instead since it sets the border behavior
 * to extended, which is probably what you want to do.</p>
 *
 * NOTE: Checks to see if it can recycle the previous transform and update it with a new affine model
 * to avoid declaring new memory.
 */
public FDistort scale() {
  if( outputToInput != null && outputToInput instanceof PixelTransformAffine_F32 ) {
    PixelTransformAffine_F32 affine = (PixelTransformAffine_F32)outputToInput;
    DistortSupport.transformScale(output, input, affine);
    return this;
  } else {
    return transform(DistortSupport.transformScale(output, input, null));
  }
}
origin: org.boofcv/boofcv-ip

/**
 * Sets the border by type.
 */
public FDistort border( BorderType type ) {
  if( borderType == type )
    return this;
  borderType = type;
  return border(FactoryImageBorder.generic(type, inputType));
}
origin: org.boofcv/boofcv-ip

/**
 * Affine transform from input to output
 */
public FDistort affine(double a11, double a12, double a21, double a22,
            double dx, double dy) {
  PixelTransformAffine_F32 transform;
  if( outputToInput != null && outputToInput instanceof PixelTransformAffine_F32 ) {
    transform = (PixelTransformAffine_F32)outputToInput;
  } else {
    transform = new PixelTransformAffine_F32();
  }
  Affine2D_F32 m = new Affine2D_F32();
  m.a11 = (float)a11;
  m.a12 = (float)a12;
  m.a21 = (float)a21;
  m.a22 = (float)a22;
  m.tx = (float)dx;
  m.ty = (float)dy;
  m.invert(transform.getModel());
  return transform(transform);
}
boofcv.abst.distort

Most used classes

  • FDistort
    High level interface for rendering a distorted image into another one. Uses a flow style interface t
  • ConfigDeformPointMLS
    Configuration for ImageDeformPointMLS_F32
  • PointDeformKeyPoints
    Defines a Point2Transform2_F32 which deforms the image based on the location of key points inside th
  • PointDeform_MLS
    Wrapper around ImageDeformPointMLS_F32 for PointDeformKeyPoints
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now