OpenCV for Unity 2.6.4
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.Structured_lightModule.GrayCodePattern Class Reference

Class implementing the Gray-code pattern, based on [UNDERWORLD]. More...

Public Member Functions

void getImagesForShadowMasks (Mat blackImage, Mat whiteImage)
 Generates the all-black and all-white images needed for shadowMasks computation.
 
long getNumberOfPatternImages ()
 Get the number of pattern images needed for the graycode pattern.
 
bool getProjPixel (List< Mat > patternImages, int x, int y, out Vec2d projPix)
 For a (x,y) pixel of a camera returns the corresponding projector pixel.
 
bool getProjPixel (List< Mat > patternImages, int x, int y, out(double x, double y) projPix)
 For a (x,y) pixel of a camera returns the corresponding projector pixel.
 
bool getProjPixel (List< Mat > patternImages, int x, int y, Point projPix)
 For a (x,y) pixel of a camera returns the corresponding projector pixel.
 
void setBlackThreshold (long value)
 Sets the value for black threshold, needed for decoding (shadowsmasks computation).
 
void setWhiteThreshold (long value)
 Sets the value for white threshold, needed for decoding.
 
- Public Member Functions inherited from OpenCVForUnity.Structured_lightModule.StructuredLightPattern
bool generate (List< Mat > patternImages)
 Generates the structured light pattern to project.
 
- Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
virtual void clear ()
 Clears the algorithm state.
 
virtual bool empty ()
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
 
virtual string getDefaultName ()
 
IntPtr getNativeObjAddr ()
 
void save (string filename)
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static new GrayCodePattern __fromPtr__ (IntPtr addr)
 
static GrayCodePattern create (int width, int height)
 Constructor.
 
- Static Public Member Functions inherited from OpenCVForUnity.Structured_lightModule.StructuredLightPattern
static new StructuredLightPattern __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
static Algorithm __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.Structured_lightModule.StructuredLightPattern
override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Package Functions inherited from OpenCVForUnity.Structured_lightModule.StructuredLightPattern
- Package Functions inherited from OpenCVForUnity.CoreModule.Algorithm
- Package Attributes inherited from OpenCVForUnity.DisposableOpenCVObject
- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Detailed Description

Class implementing the Gray-code pattern, based on [UNDERWORLD].

The generation of the pattern images is performed with Gray encoding using the traditional white and black colors.

The information about the two image axes x, y is encoded separately into two different pattern sequences. A projector P with resolution (P_res_x, P_res_y) will result in Ncols = log 2 (P_res_x) encoded pattern images representing the columns, and in Nrows = log 2 (P_res_y) encoded pattern images representing the rows. For example a projector with resolution 1024x768 will result in Ncols = 10 and Nrows = 10.

However, the generated pattern sequence consists of both regular color and color-inverted images: inverted pattern images are images with the same structure as the original but with inverted colors. This provides an effective method for easily determining the intensity value of each pixel when it is lit (highest value) and when it is not lit (lowest value). So for a a projector with resolution 1024x768, the number of pattern images will be Ncols * 2 + Nrows * 2 = 40.

Member Function Documentation

◆ __fromPtr__()

static new GrayCodePattern OpenCVForUnity.Structured_lightModule.GrayCodePattern.__fromPtr__ ( IntPtr addr)
static

◆ create()

static GrayCodePattern OpenCVForUnity.Structured_lightModule.GrayCodePattern.create ( int width,
int height )
static

Constructor.

Parameters
parametersGrayCodePattern parameters GrayCodePattern::Params: the width and the height of the projector.

◆ Dispose()

override void OpenCVForUnity.Structured_lightModule.GrayCodePattern.Dispose ( bool disposing)
protectedvirtual

◆ getImagesForShadowMasks()

void OpenCVForUnity.Structured_lightModule.GrayCodePattern.getImagesForShadowMasks ( Mat blackImage,
Mat whiteImage )

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

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.

Parameters
blackImageThe generated all-black CV_8U image, at projector's resolution.
whiteImageThe generated all-white CV_8U image, at projector's resolution.

◆ getNumberOfPatternImages()

long OpenCVForUnity.Structured_lightModule.GrayCodePattern.getNumberOfPatternImages ( )

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

Returns
The number of pattern images needed for the graycode pattern.

◆ getProjPixel() [1/3]

bool OpenCVForUnity.Structured_lightModule.GrayCodePattern.getProjPixel ( List< Mat > patternImages,
int x,
int y,
out Vec2d projPix )

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

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.

Parameters
patternImagesThe pattern images acquired by the camera, stored in a grayscale vector < Mat >.
xx coordinate of the image pixel.
yy coordinate of the image pixel.
projPixProjector'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.

◆ getProjPixel() [2/3]

bool OpenCVForUnity.Structured_lightModule.GrayCodePattern.getProjPixel ( List< Mat > patternImages,
int x,
int y,
out(double x, double y) projPix )

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

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.

Parameters
patternImagesThe pattern images acquired by the camera, stored in a grayscale vector < Mat >.
xx coordinate of the image pixel.
yy coordinate of the image pixel.
projPixProjector'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.

◆ getProjPixel() [3/3]

bool OpenCVForUnity.Structured_lightModule.GrayCodePattern.getProjPixel ( List< Mat > patternImages,
int x,
int y,
Point projPix )

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

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.

Parameters
patternImagesThe pattern images acquired by the camera, stored in a grayscale vector < Mat >.
xx coordinate of the image pixel.
yy coordinate of the image pixel.
projPixProjector'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.

◆ setBlackThreshold()

void OpenCVForUnity.Structured_lightModule.GrayCodePattern.setBlackThreshold ( long value)

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

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.

Parameters
valueThe desired black threshold value.

◆ setWhiteThreshold()

void OpenCVForUnity.Structured_lightModule.GrayCodePattern.setWhiteThreshold ( long value)

Sets the value for white threshold, needed for decoding.

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.

Parameters
valueThe desired white threshold value.

The documentation for this class was generated from the following files: