Package boofcv.alg.sfm.d2
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 Summary
ConstructorDescriptionStitchingFromMotion2D
(ImageMotion2D<I, IT> motion, ImageDistort<I, I> distorter, StitchingTransform<IT> converter, double maxJumpFraction) Provides internal algorithms and tuning parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Specifies size of stitch image and the location of the initial coordinate system.getImageCorners
(int width, int height, @Nullable Quadrilateral_F64 corners) Returns the location of the input image's corners inside the stitch image.getWorldToCurr
(@Nullable Homography2D_F64 storage) Transform from world coordinate system into the current image frame.boolean
Estimates the image motion and updates stitched image.void
reset()
Throws away current results and starts over againvoid
resizeStitchImage
(int widthStitch, int heightStitch, IT newToOldStitch) Resizes the stitch image.void
Sets the current image to be the origin of the stitched coordinate system.
-
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 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 Details
-
configure
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
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
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
Transform from world coordinate system into the current image frame.- Returns:
- Transformation
-
getWorldToCurr
-
getStitchedImage
-
getMotion
-