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

How to use
apply
method
in
boofcv.abst.distort.FDistort

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

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: 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-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/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/geo

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

new FDistort(unscaled,input0).scaleExt().apply();
ConvertBufferedImage.convertFrom(image1, unscaled, false);
new FDistort(unscaled,input1).scaleExt().apply();
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/boofcv-swing

  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

@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/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/recognition

  AverageDownSampleOps.down(inputGray,scaled);
} else {
  new FDistort(inputGray,scaled).scaleExt().apply();
origin: org.boofcv/boofcv-ip

new FDistort(image,imageRotated).rotate(angle).apply();
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(featureImg,scaledIntensity).interpNN().scaleExt().apply();
boofcv.abst.distortFDistortapply

Javadoc

Applies the distortion.

Popular methods of FDistort

  • <init>
    Constructor
  • 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.
  • init
    Specifies the input and output image and sets interpolation to BILINEAR, black image border, cache i
  • borderExt,
  • init,
  • rotate

Popular in Java

  • Creating JSON documents from java classes using gson
  • getApplicationContext (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setRequestProperty (URLConnection)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • JComboBox (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • From CI to AI: The AI layer in your organization
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