OpenCV  5.0.0alpha
Open Source Computer Vision
Loading...
Searching...
No Matches
cv::structured_light::GrayCodePattern Class Referenceabstract

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

#include <opencv2/structured_light/graycodepattern.hpp>

Collaboration diagram for cv::structured_light::GrayCodePattern:

Classes

struct  Params
 Parameters of StructuredLightPattern constructor. More...
 

Public Member Functions

virtual void getImagesForShadowMasks (InputOutputArray blackImage, InputOutputArray whiteImage) const =0
 Generates the all-black and all-white images needed for shadowMasks computation.
 
virtual size_t getNumberOfPatternImages () const =0
 Get the number of pattern images needed for the graycode pattern.
 
virtual bool getProjPixel (InputArrayOfArrays patternImages, int x, int y, Point &projPix) const =0
 For a (x,y) pixel of a camera returns the corresponding projector pixel.
 
virtual void setBlackThreshold (size_t value)=0
 Sets the value for black threshold, needed for decoding (shadowsmasks computation).
 
virtual void setWhiteThreshold (size_t value)=0
 Sets the value for white threshold, needed for decoding.
 
- Public Member Functions inherited from cv::structured_light::StructuredLightPattern
virtual bool decode (const std::vector< std::vector< Mat > > &patternImages, OutputArray disparityMap, InputArrayOfArrays blackImages=noArray(), InputArrayOfArrays whiteImages=noArray(), int flags=DECODE_3D_UNDERWORLD) const =0
 Decodes the structured light pattern, generating a disparity map.
 
virtual bool generate (OutputArrayOfArrays patternImages)=0
 Generates the structured light pattern to project.
 
- Public Member Functions inherited from cv::Algorithm
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 Clears the algorithm state.
 
virtual bool empty () const
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 Reads algorithm parameters from a file storage.
 
virtual void save (const String &filename) const
 
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage.
 
void write (FileStorage &fs, const String &name) const
 

Static Public Member Functions

static Ptr< GrayCodePatterncreate (const GrayCodePattern::Params &parameters=GrayCodePattern::Params())
 Constructor.
 
static Ptr< GrayCodePatterncreate (int width, int height)
 
- Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tpload (const String &filename, const String &objname=String())
 Loads algorithm from the file.
 
template<typename _Tp >
static Ptr< _TploadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String.
 
template<typename _Tp >
static Ptr< _Tpread (const FileNode &fn)
 Reads algorithm from the file node.
 

Additional Inherited Members

- Protected Member Functions inherited from cv::Algorithm
void writeFormat (FileStorage &fs) const
 

Detailed Description

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

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

◆ create() [1/2]

static Ptr< GrayCodePattern > cv::structured_light::GrayCodePattern::create ( const GrayCodePattern::Params & parameters = GrayCodePattern::Params())
static
Python:
cv.structured_light.GrayCodePattern.create(width, height) -> retval
cv.structured_light.GrayCodePattern_create(width, height) -> retval

Constructor.

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

◆ create() [2/2]

static Ptr< GrayCodePattern > cv::structured_light::GrayCodePattern::create ( int width,
int height )
static
Python:
cv.structured_light.GrayCodePattern.create(width, height) -> retval
cv.structured_light.GrayCodePattern_create(width, height) -> retval

◆ getImagesForShadowMasks()

virtual void cv::structured_light::GrayCodePattern::getImagesForShadowMasks ( InputOutputArray blackImage,
InputOutputArray whiteImage ) const
pure virtual
Python:
cv.structured_light.GrayCodePattern.getImagesForShadowMasks(blackImage, whiteImage) -> blackImage, 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()

virtual size_t cv::structured_light::GrayCodePattern::getNumberOfPatternImages ( ) const
pure virtual
Python:
cv.structured_light.GrayCodePattern.getNumberOfPatternImages() -> retval

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

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

◆ getProjPixel()

virtual bool cv::structured_light::GrayCodePattern::getProjPixel ( InputArrayOfArrays patternImages,
int x,
int y,
Point & projPix ) const
pure virtual
Python:
cv.structured_light.GrayCodePattern.getProjPixel(patternImages, x, y) -> retval, 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()

virtual void cv::structured_light::GrayCodePattern::setBlackThreshold ( size_t value)
pure virtual
Python:
cv.structured_light.GrayCodePattern.setBlackThreshold(value) -> None

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()

virtual void cv::structured_light::GrayCodePattern::setWhiteThreshold ( size_t value)
pure virtual
Python:
cv.structured_light.GrayCodePattern.setWhiteThreshold(value) -> None

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 file: