Package boofcv.alg.sfm.d2
Class StitchingFromMotion2D<I extends boofcv.struct.image.ImageBase<I>,IT extends georegression.struct.InvertibleTransform>
- java.lang.Object
-
- boofcv.alg.sfm.d2.StitchingFromMotion2D<I,IT>
-
public class StitchingFromMotion2D<I extends boofcv.struct.image.ImageBase<I>,IT extends georegression.struct.InvertibleTransform> extends java.lang.ObjectStitches together sequences of images usingImageMotion2D, 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 aHomography2D_F64on output. The size of the stitch region is specified usingconfigure(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 thenprocess(boofcv.struct.image.ImageBase)will return false.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStitchingFromMotion2D.Corners
-
Constructor Summary
Constructors Constructor Description StitchingFromMotion2D(ImageMotion2D<I,IT> motion, boofcv.alg.distort.ImageDistort<I,I> distorter, StitchingTransform<IT> converter, double maxJumpFraction)Provides internal algorithms and tuning parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(int widthStitch, int heightStitch, IT worldToInit)Specifies size of stitch image and the location of the initial coordinate system.StitchingFromMotion2D.CornersgetImageCorners(int width, int height, StitchingFromMotion2D.Corners corners)Returns the location of the input image's corners inside the stitch image.ImageMotion2D<I,IT>getMotion()IgetStitchedImage()ITgetWorldToCurr()georegression.struct.homography.Homography2D_F64getWorldToCurr(georegression.struct.homography.Homography2D_F64 storage)Transform from world coordinate system into the current image frame.booleanprocess(I image)Estimates the image motion and updates stitched image.voidreset()Throws away current results and starts over againvoidresizeStitchImage(int widthStitch, int heightStitch, IT newToOldStitch)Resizes the stitch image.voidsetOriginToCurrent()Sets the current image to be the origin of the stitched coordinate system.
-
-
-
Constructor Detail
-
StitchingFromMotion2D
public StitchingFromMotion2D(ImageMotion2D<I,IT> motion, boofcv.alg.distort.ImageDistort<I,I> distorter, StitchingTransform<IT> converter, double maxJumpFraction)
Provides internal algorithms and tuning parameters.- Parameters:
motion- Estimates image motiondistorter- Applies found transformation to stitch imagesconverter- Converts internal model into a homogenous transformationmaxJumpFraction- If the view area changes by more than this fraction a fault is declared
-
-
Method Detail
-
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 intoheightStitch- Height of the image being stitched intoworldToInit- (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 callreset()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 afterprocess(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 StitchingFromMotion2D.Corners getImageCorners(int width, int height, StitchingFromMotion2D.Corners corners)
Returns the location of the input image's corners inside the stitch image.- Returns:
- image corners
-
getWorldToCurr
public georegression.struct.homography.Homography2D_F64 getWorldToCurr(georegression.struct.homography.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()
-
-