Class BackgroundModelMoving<T extends ImageBase<T>,MotionModel extends InvertibleTransform<MotionModel>>

Direct Known Subclasses:
BackgroundMovingBasic, BackgroundMovingGaussian, BackgroundMovingGmm

public abstract class BackgroundModelMoving<T extends ImageBase<T>,MotionModel extends 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.
  1. World is the background model's coordinate system.
  2. Home is the image which all the camera motion is relative to
  3. 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 Details

  • Constructor Details

    • BackgroundModelMoving

      protected BackgroundModelMoving(Point2Transform2Model_F32<MotionModel> transform, ImageType<T> imageType)
      Constructor which provides the motion model and image type
      transform - Point transform which can be used to apply the motion model
      imageType - Type of input image
  • Method Details

    • initialize

      public abstract void initialize(int backgroundWidth, int backgroundHeight, MotionModel homeToWorld)
      Initializes background model. Specifies the size of the background image and transform from the "home" image to the background "world"
      backgroundWidth - Width of background
      backgroundHeight - Height of background
      homeToWorld - Transform from home to world.
    • updateBackground

      public void updateBackground(MotionModel homeToCurrent, T frame)
      Updates the background with new image information.
      homeToCurrent - Transform from home image to the current image
      frame - The current image in the sequence
    • updateBackground

      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. Implementing class needs to make sure the rectangle is inside the background.
    • segment

      public void segment(MotionModel homeToCurrent, T frame, GrayU8 segmented)
      Invoke to use the background image to segment the current frame into background and foreground pixels
      homeToCurrent - Transform from home image to the current image
      frame - current image
      segmented - Segmented image. 0 = background, 1 = foreground/moving
    • _segment

      protected abstract void _segment(MotionModel currentToWorld, T frame, GrayU8 segmented)