Class FDistort


  • public class FDistort
    extends java.lang.Object

    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.

    • Constructor Summary

      Constructors 
      Constructor Description
      FDistort()  
      FDistort​(boofcv.struct.image.ImageBase input, boofcv.struct.image.ImageBase output)
      Constructor in which input and output images are specified.
      FDistort​(boofcv.struct.image.ImageType inputType)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      FDistort affine​(double a11, double a12, double a21, double a22, double dx, double dy)
      Affine transform from input to output
      FDistort affine​(georegression.struct.affine.Affine2D_F64 affine)  
      FDistort apply()
      Applies the distortion.
      FDistort border​(double value)
      Sets the border to a fixed gray-scale value
      FDistort border​(boofcv.struct.border.BorderType type)
      Sets the border by type.
      FDistort border​(boofcv.struct.border.ImageBorder border)
      Sets how the interpolation handles borders.
      FDistort borderExt()
      Sets the border to EXTEND.
      FDistort cached​(boolean cached)
      used to turn on and off caching of the distortion
      FDistort init​(boofcv.struct.image.ImageBase input, boofcv.struct.image.ImageBase output)
      Specifies the input and output image and sets interpolation to BILINEAR, black image border, cache is off.
      FDistort input​(boofcv.struct.image.ImageBase input)
      Changes the input image.
      FDistort interp​(InterpolatePixelS interpolation)
      used to provide a custom interpolation algorithm
      FDistort interp​(InterpolationType type)
      Specifies the interpolation used by type.
      FDistort interpNN()
      Sets interpolation to use nearest-neighbor
      FDistort output​(boofcv.struct.image.ImageBase output)
      Changes the output image.
      FDistort rotate​(double angleInputToOutput)
      Applies a distortion which will rotate the input image by the specified amount.
      FDistort scale()
      Applies a distortion which will rescale the input image into the output image.
      FDistort scaleExt()
      Scales the image and sets the border to BorderType.EXTENDED.
      FDistort setRefs​(boofcv.struct.image.ImageBase input, boofcv.struct.image.ImageBase output)
      All this does is set the references to the images.
      FDistort transform​(boofcv.struct.distort.PixelTransform<georegression.struct.point.Point2D_F32> outputToInput)
      Used to manually specify a transform.
      FDistort transform​(boofcv.struct.distort.Point2Transform2_F32 outputToInput)
      Used to manually specify a transform.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FDistort

        public FDistort​(boofcv.struct.image.ImageBase input,
                        boofcv.struct.image.ImageBase output)
        Constructor in which input and output images are specified. Equivalent to calling init(ImageBase, ImageBase)
        Parameters:
        input - Input image
        output - output image
      • FDistort

        public FDistort​(boofcv.struct.image.ImageType inputType)
        Constructor
        Parameters:
        inputType - Type of input image
      • FDistort

        public FDistort()
    • Method Detail

      • init

        public FDistort init​(boofcv.struct.image.ImageBase input,
                             boofcv.struct.image.ImageBase output)
        Specifies the input and output image and sets interpolation to BILINEAR, black image border, cache is off.
      • setRefs

        public FDistort setRefs​(boofcv.struct.image.ImageBase input,
                                boofcv.struct.image.ImageBase output)
        All this does is set the references to the images. Nothing else is changed and its up to the user to correctly update everything else. If called the first time you need to do the following
         1) specify the interpolation method
         2) specify the transform
         3) specify the border
         
        If called again and the image shape has changed you need to do the following:
         1) Update the transform
         
      • input

        public FDistort input​(boofcv.struct.image.ImageBase input)
        Changes the input image. The previous distortion is thrown away only if the input image has a different shape
      • output

        public FDistort output​(boofcv.struct.image.ImageBase output)
        Changes the output image. The previous distortion is thrown away only if the output image has a different shape
      • border

        public FDistort border​(boofcv.struct.border.ImageBorder border)
        Sets how the interpolation handles borders.
        Parameters:
        border - Sets the border. If null then it will skip the border.
      • border

        public FDistort border​(boofcv.struct.border.BorderType type)
        Sets the border by type.
      • border

        public FDistort border​(double value)
        Sets the border to a fixed gray-scale value
      • borderExt

        public FDistort borderExt()

        Sets the border to EXTEND.

      • interp

        public FDistort interp​(InterpolatePixelS interpolation)
        used to provide a custom interpolation algorithm

        NOTE: This will force the distorter to be declared again, even if nothing has changed. This only matters if you are being very careful about your memory management.

      • interpNN

        public FDistort interpNN()
        Sets interpolation to use nearest-neighbor
      • cached

        public FDistort cached​(boolean cached)
        used to turn on and off caching of the distortion
      • transform

        public FDistort transform​(boofcv.struct.distort.PixelTransform<georegression.struct.point.Point2D_F32> outputToInput)
        Used to manually specify a transform. From output to input
      • transform

        public FDistort transform​(boofcv.struct.distort.Point2Transform2_F32 outputToInput)
        Used to manually specify a transform. From output to input
      • affine

        public FDistort affine​(double a11,
                               double a12,
                               double a21,
                               double a22,
                               double dx,
                               double dy)
        Affine transform from input to output
      • affine

        public FDistort affine​(georegression.struct.affine.Affine2D_F64 affine)
      • scale

        public FDistort scale()

        Applies a distortion which will rescale the input image into the output image. You might want to consider using scaleExt() instead since it sets the border behavior to extended, which is probably what you want to do.

        NOTE: Checks to see if it can recycle the previous transform and update it with a new affine model to avoid declaring new memory.
      • scaleExt

        public FDistort scaleExt()
        Scales the image and sets the border to 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.
      • rotate

        public FDistort rotate​(double angleInputToOutput)
        Applies a distortion which will rotate the input image by the specified amount.
      • apply

        public FDistort apply()
        Applies the distortion.