View Source Evision.BackgroundSubtractorKNN (Evision v0.1.15)

Link to this section Summary

Types

t()

Type that represents an Evision.BackgroundSubtractorKNN struct.

Functions

Returns the shadow detection flag

Returns the threshold on the squared distance between the pixel and the sample

Returns the number of last frames that affect the background model

Returns the number of neighbours, the k in the kNN.

Returns the number of data samples in the background model

Returns the shadow threshold

Returns the shadow value

Enables or disables shadow detection

Sets the threshold on the squared distance

Sets the number of last frames that affect the background model

Sets the k in the kNN. How many nearest neighbours need to match.

Sets the number of data samples in the background model.

Sets the shadow threshold

Sets the shadow value

Link to this section Types

@type t() :: %Evision.BackgroundSubtractorKNN{ref: reference()}

Type that represents an Evision.BackgroundSubtractorKNN struct.

  • ref. reference()

    The underlying erlang resource variable.

Link to this section Functions

@spec getDetectShadows(t()) :: boolean() | {:error, String.t()}

Returns the shadow detection flag

Return
  • retval: bool

If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for details.

Python prototype (for reference):

getDetectShadows() -> retval
@spec getDist2Threshold(t()) :: number() | {:error, String.t()}

Returns the threshold on the squared distance between the pixel and the sample

Return
  • retval: double

The threshold on the squared distance between the pixel and the sample to decide whether a pixel is close to a data sample.

Python prototype (for reference):

getDist2Threshold() -> retval
@spec getHistory(t()) :: integer() | {:error, String.t()}

Returns the number of last frames that affect the background model

Return
  • retval: int

Python prototype (for reference):

getHistory() -> retval
@spec getkNNSamples(t()) :: integer() | {:error, String.t()}

Returns the number of neighbours, the k in the kNN.

Return
  • retval: int

K is the number of samples that need to be within dist2Threshold in order to decide that that pixel is matching the kNN background model.

Python prototype (for reference):

getkNNSamples() -> retval
@spec getNSamples(t()) :: integer() | {:error, String.t()}

Returns the number of data samples in the background model

Return
  • retval: int

Python prototype (for reference):

getNSamples() -> retval
Link to this function

getShadowThreshold(self)

View Source
@spec getShadowThreshold(t()) :: number() | {:error, String.t()}

Returns the shadow threshold

Return
  • retval: double

A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara, Detecting Moving Shadows...*, IEEE PAMI,2003.

Python prototype (for reference):

getShadowThreshold() -> retval
@spec getShadowValue(t()) :: integer() | {:error, String.t()}

Returns the shadow value

Return
  • retval: int

Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0 in the mask always means background, 255 means foreground.

Python prototype (for reference):

getShadowValue() -> retval
Link to this function

setDetectShadows(self, detectShadows)

View Source
@spec setDetectShadows(t(), boolean()) :: :ok | {:error, String.t()}

Enables or disables shadow detection

Positional Arguments
  • detectShadows: bool

Python prototype (for reference):

setDetectShadows(detectShadows) -> None
Link to this function

setDist2Threshold(self, dist2Threshold)

View Source
@spec setDist2Threshold(t(), number()) :: :ok | {:error, String.t()}

Sets the threshold on the squared distance

Positional Arguments
  • dist2Threshold: double

Python prototype (for reference):

setDist2Threshold(_dist2Threshold) -> None
Link to this function

setHistory(self, history)

View Source
@spec setHistory(t(), integer()) :: :ok | {:error, String.t()}

Sets the number of last frames that affect the background model

Positional Arguments
  • history: int

Python prototype (for reference):

setHistory(history) -> None
Link to this function

setkNNSamples(self, nkNN)

View Source
@spec setkNNSamples(t(), integer()) :: :ok | {:error, String.t()}

Sets the k in the kNN. How many nearest neighbours need to match.

Positional Arguments
  • nkNN: int

Python prototype (for reference):

setkNNSamples(_nkNN) -> None
@spec setNSamples(t(), integer()) :: :ok | {:error, String.t()}

Sets the number of data samples in the background model.

Positional Arguments
  • nN: int

The model needs to be reinitalized to reserve memory.

Python prototype (for reference):

setNSamples(_nN) -> None
Link to this function

setShadowThreshold(self, threshold)

View Source
@spec setShadowThreshold(t(), number()) :: :ok | {:error, String.t()}

Sets the shadow threshold

Positional Arguments
  • threshold: double

Python prototype (for reference):

setShadowThreshold(threshold) -> None
Link to this function

setShadowValue(self, value)

View Source
@spec setShadowValue(t(), integer()) :: :ok | {:error, String.t()}

Sets the shadow value

Positional Arguments
  • value: int

Python prototype (for reference):

setShadowValue(value) -> None