public abstract class BackgroundModelMoving<T extends boofcv.struct.image.ImageBase,MotionModel extends georegression.struct.InvertibleTransform<MotionModel>> extends BackgroundModel<T>
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.
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)}
| Modifier and Type | Field and Description |
|---|---|
protected int |
backgroundHeight |
protected int |
backgroundWidth |
protected georegression.struct.point.Point2D_F32[] |
corners |
protected MotionModel |
currentToWorld |
protected MotionModel |
homeToWorld |
protected boofcv.struct.distort.Point2Transform2Model_F32<MotionModel> |
transform |
protected georegression.struct.point.Point2D_F32 |
work |
protected MotionModel |
worldToCurrent |
protected MotionModel |
worldToHome |
imageType, unknownValue| Constructor and Description |
|---|
BackgroundModelMoving(boofcv.struct.distort.Point2Transform2Model_F32<MotionModel> transform,
boofcv.struct.image.ImageType<T> imageType)
Constructor which provides the motion model and image type
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
_segment(MotionModel currentToWorld,
T frame,
boofcv.struct.image.GrayU8 segmented) |
abstract void |
initialize(int backgroundWidth,
int backgroundHeight,
MotionModel homeToWorld)
Initializes background model.
|
void |
segment(MotionModel homeToCurrent,
T frame,
boofcv.struct.image.GrayU8 segmented)
Invoke to use the background image to segment the current frame into background and foreground pixels
|
protected 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.
|
getImageType, getUnknownValue, reset, setUnknownValueprotected boofcv.struct.distort.Point2Transform2Model_F32<MotionModel extends georegression.struct.InvertibleTransform<MotionModel>> transform
protected MotionModel extends georegression.struct.InvertibleTransform<MotionModel> homeToWorld
protected MotionModel extends georegression.struct.InvertibleTransform<MotionModel> worldToHome
protected MotionModel extends georegression.struct.InvertibleTransform<MotionModel> currentToWorld
protected MotionModel extends georegression.struct.InvertibleTransform<MotionModel> worldToCurrent
protected int backgroundWidth
protected int backgroundHeight
protected georegression.struct.point.Point2D_F32[] corners
protected georegression.struct.point.Point2D_F32 work
public BackgroundModelMoving(boofcv.struct.distort.Point2Transform2Model_F32<MotionModel> transform, boofcv.struct.image.ImageType<T> imageType)
transform - Point transform which can be used to apply the motion modelimageType - Type of input imagepublic abstract void initialize(int backgroundWidth,
int backgroundHeight,
MotionModel homeToWorld)
backgroundWidth - Width of backgroundbackgroundHeight - Height of backgroundhomeToWorld - Transform from home to world.public void updateBackground(MotionModel homeToCurrent, T frame)
homeToCurrent - Transform from home image to the current imageframe - The current image in the sequenceprotected abstract void updateBackground(int x0,
int y0,
int x1,
int y1,
T frame)
public void segment(MotionModel homeToCurrent, T frame, boofcv.struct.image.GrayU8 segmented)
homeToCurrent - Transform from home image to the current imageframe - current imagesegmented - Segmented image. 0 = background, 1 = foreground/movingprotected abstract void _segment(MotionModel currentToWorld, T frame, boofcv.struct.image.GrayU8 segmented)