Tabnine Logo
FDistort
Code IndexAdd Tabnine to your IDE (free)

How to use
FDistort
in
boofcv.abst.distort

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

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-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/demonstrations

@Override
public void setActiveAlgorithm(String name, Object cookie) {
  DisplayGaussianKernelApp.DerivType dt = (DisplayGaussianKernelApp.DerivType)cookie;
  // add basis
  SteerableKernel<K> steerable = createKernel(dt.orderX,dt.orderY);
  basisPanel.reset();
  for( int i = 0; i < steerable.getBasisSize(); i++ ) {
    T smallImg = GKernelMath.convertToImage(steerable.getBasis(i));
    new FDistort(smallImg,largeImg).scaleExt().interpNN().apply();
    double maxValue = GImageStatistics.maxAbs(largeImg);
    BufferedImage out = VisualizeImageData.colorizeSign(largeImg,null,maxValue);
    basisPanel.addImage(out,"Basis "+i);
  }
  // add steered kernels
  steerPanel.reset();
  for( int i = 0; i <= 20; i++  ) {
    double angle = Math.PI*i/20.0;
    K kernel = steerable.compute(angle);
    T smallImg = GKernelMath.convertToImage(kernel);
    new FDistort(smallImg,largeImg).scaleExt().interpNN().apply();
    double maxValue = GImageStatistics.maxAbs(largeImg);
    BufferedImage out = VisualizeImageData.colorizeSign(largeImg,null,maxValue);
    steerPanel.addImage(out,String.format("%5d",(int)(180.0*angle/Math.PI)));
  }
  repaint();
}
origin: org.boofcv/demonstrations

new FDistort(unscaled,input0).scaleExt().apply();
ConvertBufferedImage.convertFrom(image1, unscaled, false);
new FDistort(unscaled,input1).scaleExt().apply();
origin: org.boofcv/visualize

  private synchronized void setLevel( int level ) {
//        System.out.println("level "+level);
    if( level > 0 && ss != null ) {

      ImageGray small = ss.getLayer(level-1);
      ImageGray enlarge = GeneralizedImageOps.createSingleBand(small.getClass(), ss.getInputWidth(), ss.getInputHeight());
      new FDistort(small,enlarge).interpNN().apply();

      // if the size isn't the same null it so a new image will be declared
      if( levelImage != null &&
          (levelImage.getWidth() != enlarge.width || levelImage.getHeight() != enlarge.height )) {
        levelImage = null;
      }
      levelImage = ConvertBufferedImage.convertTo(enlarge,levelImage,true);

      double scale = ss.getScale(level-1);
      levelPoints.clear();
      for( ScalePoint p : points ) {
        if( p.scale == scale ) {
          levelPoints.add(p);
        }
      }
    } else {
      levelPoints.clear();
      levelPoints.addAll(points);
    }

    this.activeLevel = level;
  }

origin: org.boofcv/boofcv-ip

new FDistort(image,imageRotated).rotate(angle).apply();
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

/**
 * 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

/**
 * Sets interpolation to use nearest-neighbor
 */
public FDistort interpNN() {
  return interp(InterpolationType.NEAREST_NEIGHBOR);
}
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/visualize

  private void scaleUpLayers() {
    T l = pyramid.getLayer(0);
    if( upscale == null ) {
      interp = (InterpolatePixelS<T>) FactoryInterpolation.nearestNeighborPixelS(l.getClass());
      upscale = (T)l.createNew(l.width,l.height);
    } else {
      upscale.reshape(l.width,l.height);
    }

    int N = pyramid.getNumLayers();

    for( int i = 0; i < N; i++ ) {
      new FDistort(pyramid.getLayer(i),upscale).interpNN().scaleExt().apply();
      BufferedImage b = ConvertBufferedImage.convertTo(upscale,null,true);
      if( showScales )
        addImage(b,String.format("%5.2f",pyramid.getScale(i)));
      else
        addImage(b,String.format("%5.2f",pyramid.getSigma(i)));
    }
  }
}
origin: org.boofcv/demonstrations

  public static void main(String[] args) {
    BufferedImage original = UtilImageIO.loadImage(UtilIO.pathExample("simple_objects.jpg"));

    Planar<GrayF32> input = new Planar<>(GrayF32.class,
        original.getWidth(),original.getHeight(),3);

    ConvertBufferedImage.convertFromPlanar(original,input,true,GrayF32.class);

    Planar<GrayF32> output = new Planar<>(GrayF32.class,
        original.getWidth()/3,original.getHeight()/3,3);
    Planar<GrayF32> output2 = new Planar<>(GrayF32.class,
        original.getWidth()/3,original.getHeight()/3,3);

    AverageDownSampleOps.down(input, output);
    new FDistort(input,output2).scaleExt().apply();

    BufferedImage outputFull = ConvertBufferedImage.convertTo_F32(output, null, true);
    BufferedImage outputFull2 = ConvertBufferedImage.convertTo_F32(output2, null, true);

    ShowImages.showWindow(original,"Original");
    ShowImages.showWindow(outputFull,"3x small average");
    ShowImages.showWindow(outputFull2,"3x small bilinear");
  }
}
origin: org.boofcv/boofcv-swing

  private synchronized void setLevel( int level ) {
//        System.out.println("level "+level);
    if( level > 0 && ss != null ) {

      ImageGray small = (ImageGray)ss.getLayer(level-1);
      ImageGray enlarge = GeneralizedImageOps.createSingleBand(small.getClass(), ss.getInputWidth(), ss.getInputHeight());
      new FDistort(small,enlarge).interpNN().apply();

      // if the size isn't the same null it so a new image will be declared
      if( levelImage != null &&
          (levelImage.getWidth() != enlarge.width || levelImage.getHeight() != enlarge.height )) {
        levelImage = null;
      }
      levelImage = ConvertBufferedImage.convertTo(enlarge,levelImage,true);

      double scale = ss.getScale(level-1);
      levelPoints.clear();
      for( ScalePoint p : points ) {
        if( p.scale == scale ) {
          levelPoints.add(p);
        }
      }
    } else {
      levelPoints.clear();
      levelPoints.addAll(points);
    }

    this.activeLevel = level;
  }

origin: org.boofcv/geo

distort.input(input).apply();
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/demonstrations

@Override
public void setActiveAlgorithm(String name, Object cookie) {
  DerivType type = (DerivType)cookie;
  panel.reset();
  for( int radius = 1; radius <= 40; radius += 2 ) {
    int maxOrder = Math.max(type.orderX,type.orderY);
    double sigma = FactoryKernelGaussian.sigmaForRadius(radius,maxOrder);
    Class typeKer1 = FactoryKernel.getKernelType(imageType,1);
    Kernel1D kerX =  FactoryKernelGaussian.derivativeK(typeKer1,type.orderX,sigma,radius);
    Kernel1D kerY = FactoryKernelGaussian.derivativeK(typeKer1,type.orderY,sigma,radius);
    Kernel2D kernel = GKernelMath.convolve(kerY, kerX);
    T smallImg = GKernelMath.convertToImage(kernel);
    new FDistort(smallImg,largeImg).interpNN().scaleExt().apply();
    double maxValue = GImageStatistics.maxAbs(largeImg);
    BufferedImage out = VisualizeImageData.colorizeSign(largeImg,null,maxValue);
    panel.addImage(out,String.format("%5d",radius));
  }
}
origin: org.boofcv/recognition

  AverageDownSampleOps.down(inputGray,scaled);
} else {
  new FDistort(inputGray,scaled).scaleExt().apply();
boofcv.abst.distortFDistort

Javadoc

High level interface for rendering a distorted image into another one. Uses a flow style interface to remove much of the drugery.

If you are changing the input images and avoiding declaring new memory then you need to be careful how this class is used. For example, call #setRefs(ImageBase,ImageBase) instead of #init(ImageBase,ImageBase). Init() will discard the previous settings while with setRefs() it's possible to update only what has changed. Make sure you follow the instructions in setRefs() and browsing the code in this class might help you understand what's going on.

Most used methods

  • <init>
    Constructor
  • apply
    Applies the distortion.
  • interp
    Specifies the interpolation used by type.
  • scaleExt
    Scales the image and sets the border to BorderType#EXTENDED. This is normally what you want to do wh
  • interpNN
    Sets interpolation to use nearest-neighbor
  • transform
    Used to manually specify a transform. From output to input
  • affine
  • border
    Sets how the interpolation handles borders.
  • input
    Changes the input image. The previous distortion is thrown away only if the input image has a differ
  • output
    Changes the output image. The previous distortion is thrown away only if the output image has a diff
  • scale
    Applies a distortion which will rescale the input image into the output image. You might want to con
  • borderExt
    Sets the border to EXTEND.
  • scale,
  • borderExt,
  • init,
  • rotate

Popular in Java

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • onRequestPermissionsResult (Fragment)
  • getSystemService (Context)
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • JComboBox (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Runner (org.openjdk.jmh.runner)
  • Best IntelliJ plugins
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