Class BackgroundModelMoving<T extends ImageBase<T>,MotionModel extends InvertibleTransform<MotionModel>>
- Direct Known Subclasses:
BackgroundMovingBasic
,BackgroundMovingGaussian
,BackgroundMovingGmm
Base class for classifying pixels and background based on the apparent motion of pixels when the camera is moving. The camera motion is provided externally.
There are three coordinate systems.- World is the background model's coordinate system.
- Home is the image which all the camera motion is relative to
- Current is the location of the current image.
The background model is composed of a single fixed sized image. The background image size is specified in
the initialize(int, int, InvertibleTransform)
function. After that the background model is updated
by calling updateBackground(InvertibleTransform, ImageBase)
. To flag pixels as background/motion
call segment(InvertibleTransform, ImageBase, GrayU8)
.
If a pixel in the current frame has no corresponding pixel in the background or the background
pixel hasn't been observed yet then it will be assigned a special value, which is user configurable.
The default value is 0, which is a background pixel. See BackgroundModel.setUnknownValue(int)
}
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Point2Transform2Model_F32<MotionModel>
protected int
protected int
protected Point2D_F32[]
protected MotionModel
protected MotionModel
protected MotionModel
protected MotionModel
Fields inherited from class boofcv.alg.background.BackgroundModel
imageType, unknownValue
-
Constructor Summary
ModifierConstructorDescriptionprotected
BackgroundModelMoving
(Point2Transform2Model_F32<MotionModel> transform, ImageType<T> imageType) Constructor which provides the motion model and image type -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
_segment
(MotionModel currentToWorld, T frame, GrayU8 segmented) abstract void
initialize
(int backgroundWidth, int backgroundHeight, MotionModel homeToWorld) Initializes background model.void
segment
(MotionModel homeToCurrent, T frame, GrayU8 segmented) Invoke to use the background image to segment the current frame into background and foreground pixelsprotected abstract void
updateBackground
(int x0, int y0, int x1, int y1, T frame) Call to update the background with the frame inside the bounding box.void
updateBackground
(MotionModel homeToCurrent, T frame) Updates the background with new image information.Methods inherited from class boofcv.alg.background.BackgroundModel
getImageType, getUnknownValue, reset, setUnknownValue
-
Field Details
-
_transform
protected final Point2Transform2Model_F32<MotionModel extends InvertibleTransform<MotionModel>> _transform -
homeToWorld
-
worldToHome
-
currentToWorld
-
worldToCurrent
-
backgroundWidth
protected int backgroundWidth -
backgroundHeight
protected int backgroundHeight -
corners
-
-
Constructor Details
-
BackgroundModelMoving
protected BackgroundModelMoving(Point2Transform2Model_F32<MotionModel> transform, ImageType<T> imageType) Constructor which provides the motion model and image type- Parameters:
transform
- Point transform which can be used to apply the motion modelimageType
- Type of input image
-
-
Method Details
-
initialize
Initializes background model. Specifies the size of the background image and transform from the "home" image to the background "world"- Parameters:
backgroundWidth
- Width of backgroundbackgroundHeight
- Height of backgroundhomeToWorld
- Transform from home to world.
-
updateBackground
Updates the background with new image information.- Parameters:
homeToCurrent
- Transform from home image to the current imageframe
- The current image in the sequence
-
updateBackground
Call to update the background with the frame inside the bounding box. Implementing class needs to make sure the rectangle is inside the background. -
segment
Invoke to use the background image to segment the current frame into background and foreground pixels- Parameters:
homeToCurrent
- Transform from home image to the current imageframe
- current imagesegmented
- Segmented image. 0 = background, 1 = foreground/moving
-
_segment
-