Class StitchingFromMotion2D<I extends ImageBase<I>,​IT extends InvertibleTransform<IT>>

java.lang.Object
boofcv.alg.sfm.d2.StitchingFromMotion2D<I,​IT>

public class StitchingFromMotion2D<I extends ImageBase<I>,​IT extends InvertibleTransform<IT>>
extends Object
Stitches together sequences of images using ImageMotion2D, typically used for image stabilization and creating mosaics. Internally any motion model in the Homogeneous family can be used. For convenience, those models are converted into a Homography2D_F64 on output. The size of the stitch region is specified using configure(int, int, georegression.struct.InvertibleTransform) which must be called before any images are processed. One of the parameters include an initial transform. The initial transform can be used to scale/translate/other the input image. A sudden change or jump in the shape of the view area can be an indication of a bad motion estimate. If a large jump larger than the user specified threshold is detected then process(boofcv.struct.image.ImageBase) will return false.
  • Constructor Details

    • StitchingFromMotion2D

      public StitchingFromMotion2D​(ImageMotion2D<I,​IT> motion, ImageDistort<I,​I> distorter, StitchingTransform<IT> converter, double maxJumpFraction)
      Provides internal algorithms and tuning parameters.
      Parameters:
      motion - Estimates image motion
      distorter - Applies found transformation to stitch images
      converter - Converts internal model into a homogenous transformation
      maxJumpFraction - If the view area changes by more than this fraction a fault is declared
  • Method Details

    • configure

      public void configure​(int widthStitch, int heightStitch, IT worldToInit)
      Specifies size of stitch image and the location of the initial coordinate system.
      Parameters:
      widthStitch - Width of the image being stitched into
      heightStitch - Height of the image being stitched into
      worldToInit - (Option) Used to change the location of the initial frame in stitched image. null means no transform.
    • process

      public boolean process​(I image)
      Estimates the image motion and updates stitched image. If it is unable to estimate the motion then false is returned and the stitched image is left unmodified. If false is returned then in most situations it is best to call reset() and start over.
      Parameters:
      image - Next image in the sequence
      Returns:
      True if the stitched image is updated and false if it failed and was not
    • reset

      public void reset()
      Throws away current results and starts over again
    • setOriginToCurrent

      public void setOriginToCurrent()
      Sets the current image to be the origin of the stitched coordinate system. The background is filled with a value of 0. Must be called after process(boofcv.struct.image.ImageBase).
    • resizeStitchImage

      public void resizeStitchImage​(int widthStitch, int heightStitch, IT newToOldStitch)
      Resizes the stitch image. If no transform is provided then the old stitch region is simply places on top of the new one and copied. Pixels which do not exist in the old image are filled with zero.
      Parameters:
      widthStitch - The new width of the stitch image.
      heightStitch - The new height of the stitch image.
      newToOldStitch - (Optional) Transform from new stitch image pixels to old stick pixels. Can be null.
    • getImageCorners

      public Quadrilateral_F64 getImageCorners​(int width, int height, @Nullable @Nullable Quadrilateral_F64 corners)
      Returns the location of the input image's corners inside the stitch image.
      Returns:
      image corners
    • getWorldToCurr

      public Homography2D_F64 getWorldToCurr​(@Nullable @Nullable Homography2D_F64 storage)
      Transform from world coordinate system into the current image frame.
      Returns:
      Transformation
    • getWorldToCurr

      public IT getWorldToCurr()
    • getStitchedImage

      public I getStitchedImage()
    • getMotion

      public ImageMotion2D<I,​IT> getMotion()