View Source Evision.StructuredLight.GrayCodePattern (Evision v0.2.9)

Summary

Types

t()

Type that represents an StructuredLight.GrayCodePattern struct.

Functions

Clears the algorithm state

Constructor

Decodes the structured light pattern, generating a disparity map

Decodes the structured light pattern, generating a disparity map

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read

Generates the structured light pattern to project.

Generates the structured light pattern to project.

Generates the all-black and all-white images needed for shadowMasks computation.

Get the number of pattern images needed for the graycode pattern.

For a (x,y) pixel of a camera returns the corresponding projector pixel.

Reads algorithm parameters from a file storage

Sets the value for black threshold, needed for decoding (shadowsmasks computation).

Sets the value for white threshold, needed for decoding.

Stores algorithm parameters in a file storage

Types

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

Type that represents an StructuredLight.GrayCodePattern struct.

  • ref. reference()

    The underlying erlang resource variable.

Functions

@spec clear(Keyword.t()) :: any() | {:error, String.t()}
@spec clear(t()) :: t() | {:error, String.t()}

Clears the algorithm state

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()

Python prototype (for reference only):

clear() -> None
@spec create(Keyword.t()) :: any() | {:error, String.t()}
@spec create(integer(), integer()) :: t() | {:error, String.t()}

Constructor

Positional Arguments
  • width: integer()
  • height: integer()
Return
  • retval: Evision.StructuredLight.GrayCodePattern.t()

Python prototype (for reference only):

create(width, height) -> retval
@spec decode(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

decode(self, patternImages)

View Source
@spec decode(t(), [[Evision.Mat.maybe_mat_in()]]) ::
  Evision.Mat.t() | false | {:error, String.t()}

Decodes the structured light pattern, generating a disparity map

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()

  • patternImages: [[Evision.Mat]].

    The acquired pattern images to decode (vector<vector<Mat>>), loaded as grayscale and previously rectified.

Keyword Arguments
  • blackImages: [Evision.Mat].

    The all-black images needed for shadowMasks computation.

  • whiteImages: [Evision.Mat].

    The all-white images needed for shadowMasks computation.

  • flags: integer().

    Flags setting decoding algorithms. Default: DECODE_3D_UNDERWORLD.

Return
  • retval: bool

  • disparityMap: Evision.Mat.t().

    The decoding result: a CV_64F Mat at image resolution, storing the computed disparity map.

Note: All the images must be at the same resolution.

Python prototype (for reference only):

decode(patternImages[, disparityMap[, blackImages[, whiteImages[, flags]]]]) -> retval, disparityMap
Link to this function

decode(self, patternImages, opts)

View Source
@spec decode(
  t(),
  [[Evision.Mat.maybe_mat_in()]],
  [blackImages: term(), flags: term(), whiteImages: term()] | nil
) :: Evision.Mat.t() | false | {:error, String.t()}

Decodes the structured light pattern, generating a disparity map

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()

  • patternImages: [[Evision.Mat]].

    The acquired pattern images to decode (vector<vector<Mat>>), loaded as grayscale and previously rectified.

Keyword Arguments
  • blackImages: [Evision.Mat].

    The all-black images needed for shadowMasks computation.

  • whiteImages: [Evision.Mat].

    The all-white images needed for shadowMasks computation.

  • flags: integer().

    Flags setting decoding algorithms. Default: DECODE_3D_UNDERWORLD.

Return
  • retval: bool

  • disparityMap: Evision.Mat.t().

    The decoding result: a CV_64F Mat at image resolution, storing the computed disparity map.

Note: All the images must be at the same resolution.

Python prototype (for reference only):

decode(patternImages[, disparityMap[, blackImages[, whiteImages[, flags]]]]) -> retval, disparityMap
@spec empty(Keyword.t()) :: any() | {:error, String.t()}
@spec empty(t()) :: boolean() | {:error, String.t()}

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()
Return
  • retval: bool

Python prototype (for reference only):

empty() -> retval
@spec generate(Keyword.t()) :: any() | {:error, String.t()}
@spec generate(t()) :: [Evision.Mat.t()] | false | {:error, String.t()}

Generates the structured light pattern to project.

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()
Return
  • retval: bool

  • patternImages: [Evision.Mat].

    The generated pattern: a vector<Mat>, in which each image is a CV_8U Mat at projector's resolution.

Python prototype (for reference only):

generate([, patternImages]) -> retval, patternImages
@spec generate(t(), [{atom(), term()}, ...] | nil) ::
  [Evision.Mat.t()] | false | {:error, String.t()}

Generates the structured light pattern to project.

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()
Return
  • retval: bool

  • patternImages: [Evision.Mat].

    The generated pattern: a vector<Mat>, in which each image is a CV_8U Mat at projector's resolution.

Python prototype (for reference only):

generate([, patternImages]) -> retval, patternImages
Link to this function

getDefaultName(named_args)

View Source
@spec getDefaultName(Keyword.t()) :: any() | {:error, String.t()}
@spec getDefaultName(t()) :: binary() | {:error, String.t()}

getDefaultName

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()
Return

Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.

Python prototype (for reference only):

getDefaultName() -> retval
Link to this function

getImagesForShadowMasks(named_args)

View Source
@spec getImagesForShadowMasks(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

getImagesForShadowMasks(self, blackImage, whiteImage)

View Source
@spec getImagesForShadowMasks(
  t(),
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in()
) ::
  {Evision.Mat.t(), Evision.Mat.t()} | {:error, String.t()}

Generates the all-black and all-white images needed for shadowMasks computation.

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()
Return
  • blackImage: Evision.Mat.t().

    The generated all-black CV_8U image, at projector's resolution.

  • whiteImage: Evision.Mat.t().

    The generated all-white CV_8U image, at projector's resolution.

    To identify shadow regions, the regions of two images where the pixels are not lit by projector's light and thus where there is not coded information, the 3DUNDERWORLD algorithm computes a shadow mask for the two cameras views, starting from a white and a black images captured by each camera. This method generates these two additional images to project.

Python prototype (for reference only):

getImagesForShadowMasks(blackImage, whiteImage) -> blackImage, whiteImage
Link to this function

getNumberOfPatternImages(named_args)

View Source
@spec getNumberOfPatternImages(Keyword.t()) :: any() | {:error, String.t()}
@spec getNumberOfPatternImages(t()) :: integer() | {:error, String.t()}

Get the number of pattern images needed for the graycode pattern.

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()
Return
  • retval: size_t

@return The number of pattern images needed for the graycode pattern.

Python prototype (for reference only):

getNumberOfPatternImages() -> retval
Link to this function

getProjPixel(named_args)

View Source
@spec getProjPixel(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

getProjPixel(self, patternImages, x, y)

View Source
@spec getProjPixel(t(), [Evision.Mat.maybe_mat_in()], integer(), integer()) ::
  {number(), number()} | false | {:error, String.t()}

For a (x,y) pixel of a camera returns the corresponding projector pixel.

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()

  • patternImages: [Evision.Mat].

    The pattern images acquired by the camera, stored in a grayscale vector < Mat >.

  • x: integer().

    x coordinate of the image pixel.

  • y: integer().

    y coordinate of the image pixel.

Return
  • retval: bool

  • projPix: Point.

    Projector's pixel corresponding to the camera's pixel: projPix.x and projPix.y are the image coordinates of the projector's pixel corresponding to the pixel being decoded in a camera.

    The function decodes each pixel in the pattern images acquired by a camera into their corresponding decimal numbers representing the projector's column and row, providing a mapping between camera's and projector's pixel.

Python prototype (for reference only):

getProjPixel(patternImages, x, y) -> retval, projPix
@spec read(Keyword.t()) :: any() | {:error, String.t()}
@spec read(t(), Evision.FileNode.t()) :: t() | {:error, String.t()}

Reads algorithm parameters from a file storage

Positional Arguments

Python prototype (for reference only):

read(fn) -> None
@spec save(Keyword.t()) :: any() | {:error, String.t()}
@spec save(t(), binary()) :: t() | {:error, String.t()}

save

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()
  • filename: String

Saves the algorithm to a file. In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).

Python prototype (for reference only):

save(filename) -> None
Link to this function

setBlackThreshold(named_args)

View Source
@spec setBlackThreshold(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setBlackThreshold(self, value)

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

Sets the value for black threshold, needed for decoding (shadowsmasks computation).

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()

  • value: size_t.

    The desired black threshold value.

    Black threshold is a number between 0-255 that represents the minimum brightness difference required for valid pixels, between the fully illuminated (white) and the not illuminated images (black); used in computeShadowMasks method.

Python prototype (for reference only):

setBlackThreshold(value) -> None
Link to this function

setWhiteThreshold(named_args)

View Source
@spec setWhiteThreshold(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setWhiteThreshold(self, value)

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

Sets the value for white threshold, needed for decoding.

Positional Arguments
  • self: Evision.StructuredLight.GrayCodePattern.t()

  • value: size_t.

    The desired white threshold value.

    White threshold is a number between 0-255 that represents the minimum brightness difference required for valid pixels, between the graycode pattern and its inverse images; used in getProjPixel method.

Python prototype (for reference only):

setWhiteThreshold(value) -> None
@spec write(Keyword.t()) :: any() | {:error, String.t()}
@spec write(t(), Evision.FileStorage.t()) :: t() | {:error, String.t()}

Stores algorithm parameters in a file storage

Positional Arguments

Python prototype (for reference only):

write(fs) -> None
@spec write(t(), Evision.FileStorage.t(), binary()) :: t() | {:error, String.t()}

write

Positional Arguments

Has overloading in C++

Python prototype (for reference only):

write(fs, name) -> None