Class ImageDistortCache_SB<Input extends boofcv.struct.image.ImageGray<Input>,​Output extends boofcv.struct.image.ImageGray<Output>>

  • All Implemented Interfaces:
    ImageDistort<Input,​Output>
    Direct Known Subclasses:
    ImageDistortCache_SB_MT

    public class ImageDistortCache_SB<Input extends boofcv.struct.image.ImageGray<Input>,​Output extends boofcv.struct.image.ImageGray<Output>>
    extends java.lang.Object
    implements ImageDistort<Input,​Output>
    Except for very simple functions, computing the per pixel distortion is an expensive operation. To overcome this problem the distortion is computed once and cached. Then when the image is distorted again the save results are simply recalled and not computed again.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void apply​(Input srcImg, Output dstImg)
      Applies the transform to the entire destination image.
      void apply​(Input srcImg, Output dstImg, int dstX0, int dstY0, int dstX1, int dstY1)
      Applies the transform to only the specified region inside the destination image.
      void apply​(Input srcImg, Output dstImg, boofcv.struct.image.GrayU8 mask)
      Applies the transform, but marks pixels in the mask as 1 = inside, 0 = outside.
      protected void applyOnlyInside()  
      protected void applyOnlyInside​(boofcv.struct.image.GrayU8 mask)  
      boofcv.struct.distort.PixelTransform<georegression.struct.point.Point2D_F32> getDstToSrc()  
      InterpolatePixelS<Input> getInterp()  
      georegression.struct.point.Point2D_F32[] getMap()  
      boofcv.struct.distort.PixelTransform<georegression.struct.point.Point2D_F32> getModel()
      Returns the distortion model.
      boolean getRenderAll()
      Returns the render all flag
      protected void init​(Input srcImg, Output dstImg)  
      protected void renderAll()  
      protected void renderAll​(boofcv.struct.image.GrayU8 mask)  
      void setModel​(boofcv.struct.distort.PixelTransform<georegression.struct.point.Point2D_F32> dstToSrc)
      Specifies how pixel coordinates are transformed from the destination to source images.
      void setRenderAll​(boolean renderAll)
      Specifies if the entire output image should be rendered, even if mapping to the source image is outside the source image.
      • Methods inherited from class java.lang.Object

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

      • width

        protected int width
      • height

        protected int height
      • map

        protected georegression.struct.point.Point2D_F32[] map
      • dstToSrc

        protected boofcv.struct.distort.PixelTransform<georegression.struct.point.Point2D_F32> dstToSrc
      • x0

        protected int x0
      • y0

        protected int y0
      • x1

        protected int x1
      • y1

        protected int y1
      • renderAll

        protected boolean renderAll
      • srcImg

        protected Input extends boofcv.struct.image.ImageGray<Input> srcImg
      • dstImg

        protected Output extends boofcv.struct.image.ImageGray<Output> dstImg
      • dirty

        protected boolean dirty
    • Method Detail

      • setModel

        public void setModel​(boofcv.struct.distort.PixelTransform<georegression.struct.point.Point2D_F32> dstToSrc)
        Description copied from interface: ImageDistort
        Specifies how pixel coordinates are transformed from the destination to source images.
        Specified by:
        setModel in interface ImageDistort<Input extends boofcv.struct.image.ImageGray<Input>,​Output extends boofcv.struct.image.ImageGray<Output>>
        Parameters:
        dstToSrc - Pixel coordinate transformation.
      • apply

        public void apply​(Input srcImg,
                          Output dstImg)
        Description copied from interface: ImageDistort
        Applies the transform to the entire destination image.
        Specified by:
        apply in interface ImageDistort<Input extends boofcv.struct.image.ImageGray<Input>,​Output extends boofcv.struct.image.ImageGray<Output>>
        Parameters:
        srcImg - Input image. Not modified.
        dstImg - Output image. Modified.
      • apply

        public void apply​(Input srcImg,
                          Output dstImg,
                          boofcv.struct.image.GrayU8 mask)
        Description copied from interface: ImageDistort
        Applies the transform, but marks pixels in the mask as 1 = inside, 0 = outside. Where inside pixels are pixels in the dst image with an equivalent pixel in the src image's bounds
        Specified by:
        apply in interface ImageDistort<Input extends boofcv.struct.image.ImageGray<Input>,​Output extends boofcv.struct.image.ImageGray<Output>>
        Parameters:
        srcImg - Input image. Not modified.
        dstImg - Output image. Modified.
        mask - Mask. Automatically resized to match dstImg. Modified.
      • apply

        public void apply​(Input srcImg,
                          Output dstImg,
                          int dstX0,
                          int dstY0,
                          int dstX1,
                          int dstY1)
        Description copied from interface: ImageDistort
        Applies the transform to only the specified region inside the destination image.
        Specified by:
        apply in interface ImageDistort<Input extends boofcv.struct.image.ImageGray<Input>,​Output extends boofcv.struct.image.ImageGray<Output>>
        Parameters:
        srcImg - Input image. Not modified.
        dstImg - Output image. Modified.
        dstX0 - Left most crop boundary. Inclusive.
        dstY0 - Top most crop boundary. Inclusive.
        dstX1 - Right most crop boundary. Exclusive.
        dstY1 - Bottom most crop boundary. Exclusive.
      • init

        protected void init​(Input srcImg,
                            Output dstImg)
      • renderAll

        protected void renderAll()
      • renderAll

        protected void renderAll​(boofcv.struct.image.GrayU8 mask)
      • applyOnlyInside

        protected void applyOnlyInside()
      • applyOnlyInside

        protected void applyOnlyInside​(boofcv.struct.image.GrayU8 mask)
      • getMap

        public georegression.struct.point.Point2D_F32[] getMap()
      • getDstToSrc

        public boofcv.struct.distort.PixelTransform<georegression.struct.point.Point2D_F32> getDstToSrc()
      • setRenderAll

        public void setRenderAll​(boolean renderAll)
        Description copied from interface: ImageDistort
        Specifies if the entire output image should be rendered, even if mapping to the source image is outside the source image.
        Specified by:
        setRenderAll in interface ImageDistort<Input extends boofcv.struct.image.ImageGray<Input>,​Output extends boofcv.struct.image.ImageGray<Output>>
        Parameters:
        renderAll - true to render all pixels. If false then only pixels inside the source image
      • getRenderAll

        public boolean getRenderAll()
        Description copied from interface: ImageDistort
        Returns the render all flag
        Specified by:
        getRenderAll in interface ImageDistort<Input extends boofcv.struct.image.ImageGray<Input>,​Output extends boofcv.struct.image.ImageGray<Output>>
        Returns:
        render all flag
      • getModel

        public boofcv.struct.distort.PixelTransform<georegression.struct.point.Point2D_F32> getModel()
        Description copied from interface: ImageDistort
        Returns the distortion model.
        Specified by:
        getModel in interface ImageDistort<Input extends boofcv.struct.image.ImageGray<Input>,​Output extends boofcv.struct.image.ImageGray<Output>>
        Returns:
        model dst to src