pub struct GrayCodePattern { /* private fields */ }
Expand 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.

Implementations§

source§

impl GrayCodePattern

source

pub fn create( parameters: &GrayCodePattern_Params ) -> Result<Ptr<GrayCodePattern>>

Constructor

Parameters
  • parameters: GrayCodePattern parameters GrayCodePattern::Params: the width and the height of the projector.
C++ default parameters
  • parameters: GrayCodePattern::Params()
source

pub fn create_1(width: i32, height: i32) -> Result<Ptr<GrayCodePattern>>

Trait Implementations§

source§

impl AlgorithmTrait for GrayCodePattern

source§

fn as_raw_mut_Algorithm(&mut self) -> *mut c_void

source§

fn clear(&mut self) -> Result<()>

Clears the algorithm state
source§

fn read(&mut self, fn_: &FileNode) -> Result<()>

Reads algorithm parameters from a file storage
source§

impl AlgorithmTraitConst for GrayCodePattern

source§

fn as_raw_Algorithm(&self) -> *const c_void

source§

fn write(&self, fs: &mut FileStorage) -> Result<()>

Stores algorithm parameters in a file storage
source§

fn write_1(&self, fs: &mut FileStorage, name: &str) -> Result<()>

Stores algorithm parameters in a file storage Read more
source§

fn write_with_name(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>

@deprecated Read more
source§

fn empty(&self) -> Result<bool>

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

fn save(&self, filename: &str) -> Result<()>

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

fn get_default_name(&self) -> Result<String>

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.
source§

impl Boxed for GrayCodePattern

source§

unsafe fn from_raw(ptr: *mut c_void) -> Self

Wrap the specified raw pointer Read more
source§

fn into_raw(self) -> *mut c_void

Return an the underlying raw pointer while consuming this wrapper. Read more
source§

fn as_raw(&self) -> *const c_void

Return the underlying raw pointer. Read more
source§

fn as_raw_mut(&mut self) -> *mut c_void

Return the underlying mutable raw pointer Read more
source§

impl Debug for GrayCodePattern

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for GrayCodePattern

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl From<GrayCodePattern> for Algorithm

source§

fn from(s: GrayCodePattern) -> Self

Converts to this type from the input type.
source§

impl From<GrayCodePattern> for StructuredLightPattern

source§

fn from(s: GrayCodePattern) -> Self

Converts to this type from the input type.
source§

impl GrayCodePatternTrait for GrayCodePattern

source§

fn as_raw_mut_GrayCodePattern(&mut self) -> *mut c_void

source§

fn set_white_threshold(&mut self, value: size_t) -> Result<()>

Sets the value for white threshold, needed for decoding. Read more
source§

fn set_black_threshold(&mut self, value: size_t) -> Result<()>

Sets the value for black threshold, needed for decoding (shadowsmasks computation). Read more
source§

impl GrayCodePatternTraitConst for GrayCodePattern

source§

fn as_raw_GrayCodePattern(&self) -> *const c_void

source§

fn get_number_of_pattern_images(&self) -> Result<size_t>

Get the number of pattern images needed for the graycode pattern. Read more
source§

fn get_images_for_shadow_masks( &self, black_image: &mut impl ToInputOutputArray, white_image: &mut impl ToInputOutputArray ) -> Result<()>

Generates the all-black and all-white images needed for shadowMasks computation. Read more
source§

fn get_proj_pixel( &self, pattern_images: &impl ToInputArray, x: i32, y: i32, proj_pix: &mut Point ) -> Result<bool>

For a (x,y) pixel of a camera returns the corresponding projector pixel. Read more
source§

impl StructuredLightPatternTrait for GrayCodePattern

source§

fn as_raw_mut_StructuredLightPattern(&mut self) -> *mut c_void

source§

fn generate(&mut self, pattern_images: &mut impl ToOutputArray) -> Result<bool>

Generates the structured light pattern to project. Read more
source§

impl StructuredLightPatternTraitConst for GrayCodePattern

source§

fn as_raw_StructuredLightPattern(&self) -> *const c_void

source§

fn decode( &self, pattern_images: &Vector<Vector<Mat>>, disparity_map: &mut impl ToOutputArray, black_images: &impl ToInputArray, white_images: &impl ToInputArray, flags: i32 ) -> Result<bool>

Decodes the structured light pattern, generating a disparity map Read more
source§

impl TryFrom<StructuredLightPattern> for GrayCodePattern

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(s: StructuredLightPattern) -> Result<Self>

Performs the conversion.
source§

impl Send for GrayCodePattern

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.