pub struct Dictionary { /* private fields */ }
Expand description
Dictionary is a set of unique ArUco markers of the same size
bytesList
storing as 2-dimensions Mat with 4-th channels (CV_8UC4 type was used) and contains the marker codewords where:
- bytesList.rows is the dictionary size
- each marker is encoded using
nbytes = ceil(markerSize*markerSize/8.)
bytes - each row contains all 4 rotations of the marker, so its length is
4*nbytes
- the byte order in the bytesList[i] row:
//bytes without rotation/bytes with rotation 1/bytes with rotation 2/bytes with rotation 3//
SobytesList.ptr(i)[k*nbytes + j]
is the j-th byte of i-th marker, in its k-th rotation.
Note: Python bindings generate matrix with shape of bytesList dictionary_size x nbytes x 4
,
but it should be indexed like C++ version. Python example for j-th byte of i-th marker, in its k-th rotation:
aruco_dict.bytesList[id].ravel()[k*nbytes + j]
Implementations§
Source§impl Dictionary
impl Dictionary
pub fn default() -> Result<Dictionary>
Sourcepub fn new(
bytes_list: &impl MatTraitConst,
_marker_size: i32,
maxcorr: i32,
) -> Result<Dictionary>
pub fn new( bytes_list: &impl MatTraitConst, _marker_size: i32, maxcorr: i32, ) -> Result<Dictionary>
Sourcepub fn new_def(
bytes_list: &impl MatTraitConst,
_marker_size: i32,
) -> Result<Dictionary>
pub fn new_def( bytes_list: &impl MatTraitConst, _marker_size: i32, ) -> Result<Dictionary>
Basic ArUco dictionary constructor
§Parameters
- bytesList: bits for all ArUco markers in dictionary see memory layout in the class description
- _markerSize: ArUco marker size in units
- maxcorr: maximum number of bits that can be corrected
§Note
This alternative version of [new] function uses the following default values for its arguments:
- maxcorr: 0
Sourcepub fn get_byte_list_from_bits(bits: &impl MatTraitConst) -> Result<Mat>
pub fn get_byte_list_from_bits(bits: &impl MatTraitConst) -> Result<Mat>
Transform matrix of bits to list of bytes with 4 marker rotations
Sourcepub fn get_bits_from_byte_list(
byte_list: &impl MatTraitConst,
marker_size: i32,
) -> Result<Mat>
pub fn get_bits_from_byte_list( byte_list: &impl MatTraitConst, marker_size: i32, ) -> Result<Mat>
Transform list of bytes to matrix of bits
Trait Implementations§
Source§impl Boxed for Dictionary
impl Boxed for Dictionary
Source§unsafe fn from_raw(ptr: <Dictionary as OpenCVFromExtern>::ExternReceive) -> Self
unsafe fn from_raw(ptr: <Dictionary as OpenCVFromExtern>::ExternReceive) -> Self
Wrap the specified raw pointer Read more
Source§fn into_raw(self) -> <Dictionary as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw(self) -> <Dictionary as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying raw pointer while consuming this wrapper. Read more
Source§fn as_raw(&self) -> <Dictionary as OpenCVTypeExternContainer>::ExternSend
fn as_raw(&self) -> <Dictionary as OpenCVTypeExternContainer>::ExternSend
Return the underlying raw pointer. Read more
Source§fn as_raw_mut(
&mut self,
) -> <Dictionary as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self, ) -> <Dictionary as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying mutable raw pointer Read more
Source§impl Clone for Dictionary
impl Clone for Dictionary
Source§impl Debug for Dictionary
impl Debug for Dictionary
Source§impl DictionaryTrait for Dictionary
impl DictionaryTrait for Dictionary
fn as_raw_mut_Dictionary(&mut self) -> *mut c_void
Source§fn set_bytes_list(&mut self, val: Mat)
fn set_bytes_list(&mut self, val: Mat)
marker code information. See class description for more details
Source§fn set_marker_size(&mut self, val: i32)
fn set_marker_size(&mut self, val: i32)
number of bits per dimension
Source§fn set_max_correction_bits(&mut self, val: i32)
fn set_max_correction_bits(&mut self, val: i32)
maximum number of bits that can be corrected
Source§fn read_dictionary(&mut self, fn_: &impl FileNodeTraitConst) -> Result<bool>
fn read_dictionary(&mut self, fn_: &impl FileNodeTraitConst) -> Result<bool>
Read a new dictionary from FileNode. Read more
Source§fn write_dictionary(
&mut self,
fs: &mut impl FileStorageTrait,
name: &str,
) -> Result<()>
fn write_dictionary( &mut self, fs: &mut impl FileStorageTrait, name: &str, ) -> Result<()>
Write a dictionary to FileStorage, format is the same as in readDictionary(). Read more
Source§fn write_dictionary_def(&mut self, fs: &mut impl FileStorageTrait) -> Result<()>
fn write_dictionary_def(&mut self, fs: &mut impl FileStorageTrait) -> Result<()>
Write a dictionary to FileStorage, format is the same as in readDictionary(). Read more
Source§impl DictionaryTraitConst for Dictionary
impl DictionaryTraitConst for Dictionary
fn as_raw_Dictionary(&self) -> *const c_void
Source§fn bytes_list(&self) -> Mat
fn bytes_list(&self) -> Mat
marker code information. See class description for more details
Source§fn marker_size(&self) -> i32
fn marker_size(&self) -> i32
number of bits per dimension
Source§fn max_correction_bits(&self) -> i32
fn max_correction_bits(&self) -> i32
maximum number of bits that can be corrected
Source§fn identify(
&self,
only_bits: &impl MatTraitConst,
idx: &mut i32,
rotation: &mut i32,
max_correction_rate: f64,
) -> Result<bool>
fn identify( &self, only_bits: &impl MatTraitConst, idx: &mut i32, rotation: &mut i32, max_correction_rate: f64, ) -> Result<bool>
Given a matrix of bits. Returns whether if marker is identified or not. Read more
Source§fn get_distance_to_id(
&self,
bits: &impl ToInputArray,
id: i32,
all_rotations: bool,
) -> Result<i32>
fn get_distance_to_id( &self, bits: &impl ToInputArray, id: i32, all_rotations: bool, ) -> Result<i32>
Returns Hamming distance of the input bits to the specific id. Read more
Source§fn get_distance_to_id_def(
&self,
bits: &impl ToInputArray,
id: i32,
) -> Result<i32>
fn get_distance_to_id_def( &self, bits: &impl ToInputArray, id: i32, ) -> Result<i32>
Returns Hamming distance of the input bits to the specific id. Read more
Source§fn generate_image_marker(
&self,
id: i32,
side_pixels: i32,
_img: &mut impl ToOutputArray,
border_bits: i32,
) -> Result<()>
fn generate_image_marker( &self, id: i32, side_pixels: i32, _img: &mut impl ToOutputArray, border_bits: i32, ) -> Result<()>
Generate a canonical marker image Read more
Source§fn generate_image_marker_def(
&self,
id: i32,
side_pixels: i32,
_img: &mut impl ToOutputArray,
) -> Result<()>
fn generate_image_marker_def( &self, id: i32, side_pixels: i32, _img: &mut impl ToOutputArray, ) -> Result<()>
Generate a canonical marker image Read more
Source§impl Drop for Dictionary
impl Drop for Dictionary
impl Send for Dictionary
Auto Trait Implementations§
impl Freeze for Dictionary
impl RefUnwindSafe for Dictionary
impl !Sync for Dictionary
impl Unpin for Dictionary
impl UnwindSafe for Dictionary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
Source§unsafe fn modify_inplace<Res>(
&mut self,
f: impl FnOnce(&Mat, &mut Mat) -> Res,
) -> Res
unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res, ) -> Res
Helper function to call OpenCV functions that allow in-place modification of a
Mat
or another similar object. By passing
a mutable reference to the Mat
to this function your closure will get called with the read reference and a write references
to the same Mat
. This is unsafe in a general case as it leads to having non-exclusive mutable access to the internal data,
but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place
modification is imgproc::threshold
. Read more