Class ImagePyramidBase<T extends ImageBase<T>>

java.lang.Object
boofcv.struct.pyramid.ImagePyramidBase<T>
All Implemented Interfaces:
ImagePyramid<T>
Direct Known Subclasses:
PyramidDiscrete, PyramidFloat

public abstract class ImagePyramidBase<T extends ImageBase<T>>
extends Object
implements ImagePyramid<T>

Base class for image pyramids. Provides common functionality and data structures. The scale is defined in its children PyramidDiscrete and PyramidFloat. This allows it to be either integer or floating point and strongly typed.

When updating the pyramid, if the top most layer is at the same resolution as the original image then a reference can optionally be saved, avoiding an unnecessary image copy. This is done by setting the saveOriginalReference to true.

  • Field Details

    • bottomWidth

      protected int bottomWidth
    • bottomHeight

      protected int bottomHeight
    • layers

      public T extends ImageBase<T>[] layers
    • saveOriginalReference

      protected boolean saveOriginalReference
  • Constructor Details

    • ImagePyramidBase

      protected ImagePyramidBase​(ImageType<T> imageType, boolean saveOriginalReference)
      Specifies input image size and behavior of top most layer.
      Parameters:
      imageType - Type of image which is processed
      saveOriginalReference - If a reference to the full resolution image should be saved instead of copied.
    • ImagePyramidBase

      protected ImagePyramidBase​(ImagePyramidBase<T> orig)
  • Method Details

    • initialize

      public void initialize​(int width, int height)
      Initializes internal data structures based on the input image's size. Should be called each time a new image is processed.
      Specified by:
      initialize in interface ImagePyramid<T extends ImageBase<T>>
      Parameters:
      width - Image width
      height - Image height
    • isInitialized

      public boolean isInitialized()
      Description copied from interface: ImagePyramid
      Checks to see if the pyramid has been initialized or not
      Specified by:
      isInitialized in interface ImagePyramid<T extends ImageBase<T>>
    • checkScales

      protected void checkScales()
      Used to internally check that the provided scales are valid.
    • setTo

      public void setTo​(ImagePyramid<T> input)
      Description copied from interface: ImagePyramid
      Set's this pyramid to be the same as input. The two pyramids must have the same structure or else an exception will be thrown.
      Specified by:
      setTo in interface ImagePyramid<T extends ImageBase<T>>
      Parameters:
      input - Input pyramid. Not modified.
    • getLayer

      public T getLayer​(int layerNum)
      Description copied from interface: ImagePyramid
      Returns a layer in the pyramid.
      Specified by:
      getLayer in interface ImagePyramid<T extends ImageBase<T>>
      Parameters:
      layerNum - which image is to be returned.
      Returns:
      The image in the pyramid.
    • setFirstLayer

      public void setFirstLayer​(T image)
    • getWidth

      public int getWidth​(int layer)
      Description copied from interface: ImagePyramid
      Returns the width of an image at ths specified layer.
      Specified by:
      getWidth in interface ImagePyramid<T extends ImageBase<T>>
      Parameters:
      layer - The layer being requested.
      Returns:
      The layer's width.
    • getHeight

      public int getHeight​(int layer)
      Description copied from interface: ImagePyramid
      Returns the height of an image at ths specified layer.
      Specified by:
      getHeight in interface ImagePyramid<T extends ImageBase<T>>
      Parameters:
      layer - The layer being requested.
      Returns:
      The layer's height.
    • getImageType

      public ImageType<T> getImageType()
      Description copied from interface: ImagePyramid
      The type of image.
      Specified by:
      getImageType in interface ImagePyramid<T extends ImageBase<T>>
      Returns:
      Image type.
    • getInputWidth

      public int getInputWidth()
      Description copied from interface: ImagePyramid
      Width of input image.
      Specified by:
      getInputWidth in interface ImagePyramid<T extends ImageBase<T>>
    • getInputHeight

      public int getInputHeight()
      Description copied from interface: ImagePyramid
      Height of input image.
      Specified by:
      getInputHeight in interface ImagePyramid<T extends ImageBase<T>>
    • isSaveOriginalReference

      public boolean isSaveOriginalReference()
    • setSaveOriginalReference

      public void setSaveOriginalReference​(boolean save)