Skip to content

Commit d22f274

Browse files
committed
Update docs & changelog
1 parent 760f582 commit d22f274

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3900
-5738
lines changed

CHANGES.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
* 0.96.0
2+
* Introduce `OPENCV_CMAKE_TOOLCHAIN_FILE` and `OPENCV_CMAKE_ARGS` environment variables (fixes https://github.com/twistedfall/opencv-rust/issues/683).
3+
* Enums that represent bitfields now generate the special `struct`s that allow flag combinations, see `OpenCVBitfieldEnum` trait
4+
for details (fixes https://github.com/twistedfall/opencv-rust/issues/675).
5+
* `Mat::at` no longer allows addressing matrices with more than 2 dimensions. OpenCV explicitly forbids this, and it was
6+
previously allowed by accident.
7+
* `Mat::from_exact_iter` now creates a 1-row matrix instead of 1-column matrix. Previous behavior was inconsistent with OpenCV.
8+
* `MatStep` indexing operator is now unsafe as it allowed out-of-bounds access.
9+
* "video" feature now depends on "dnn" (fixes https://github.com/twistedfall/opencv-rust/issues/686).
10+
* Fix building with clang-21 on Windows (fixes https://github.com/twistedfall/opencv-rust/issues/693).
11+
* Documentation generation improvements for overloaded functions.
12+
* Bump Rust MSRV to 1.81.0.
13+
114
* 0.95.1
215
* Add `Deref` for `MatSize`.
316
* Fix assertion error with `Mat::at` addressing on OpenCV 4.12.

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ The following variables are rarely used, but you might need them under some circ
9898
Allows selecting the CRT library when building with MSVC for Windows. Allowed values are `"static"` for `/MT`
9999
and `"dynamic"` for `/MD`.
100100

101+
* `OPENCV_CMAKE_TOOLCHAIN_FILE`
102+
Path to a cmake toolchain file to be used during OpenCV discovery. Useful when cross-compiling. This will
103+
pass `-DCMAKE_TOOLCHAIN_FILE=<value>` to cmake command line.
104+
105+
* `OPENCV_CMAKE_ARGS`
106+
Additional arguments to be passed to cmake during OpenCV discovery. This will be parsed according to the POSIX
107+
command line rules (e.g. quotes are supported) and passed as is to `cmake`.
108+
101109
The following variables affect the building the of the `opencv` crate, but belong to external components:
102110

103111
* `PKG_CONFIG_PATH`

docs/aruco.rs

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub mod aruco {
3434
/// ## See also
3535
/// estimatePoseSingleMarkers()
3636
#[deprecated = "Use Board::matchImagePoints and cv::solvePnP"]
37-
#[repr(C)]
37+
#[repr(i32)]
3838
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
3939
pub enum PatternPositionType {
4040
/// The marker coordinate system is centered on the middle of the marker.
@@ -53,21 +53,48 @@ pub mod aruco {
5353
ARUCO_CW_TOP_LEFT_CORNER = 1,
5454
}
5555

56-
impl TryFrom<i32> for PatternPositionType {
57-
type Error = crate::Error;
56+
opencv_type_enum! { crate::aruco::PatternPositionType { ARUCO_CCW_CENTER, ARUCO_CW_TOP_LEFT_CORNER } }
5857

59-
fn try_from(value: i32) -> Result<Self, Self::Error> {
60-
match value {
61-
0 => Ok(Self::ARUCO_CCW_CENTER),
62-
1 => Ok(Self::ARUCO_CW_TOP_LEFT_CORNER),
63-
_ => Err(crate::Error::new(crate::core::StsBadArg, format!("Value: {value} is not valid for enum: crate::aruco::PatternPositionType"))),
64-
}
65-
}
66-
}
67-
68-
opencv_type_enum! { crate::aruco::PatternPositionType }
69-
70-
/// @overload
58+
/// Calibrate a camera using aruco markers
59+
///
60+
/// ## Parameters
61+
/// * corners: vector of detected marker corners in all frames.
62+
/// The corners should have the same format returned by detectMarkers (see #detectMarkers).
63+
/// * ids: list of identifiers for each marker in corners
64+
/// * counter: number of markers in each frame so that corners and ids can be split
65+
/// * board: Marker Board layout
66+
/// * imageSize: Size of the image used only to initialize the intrinsic camera matrix.
67+
/// * cameraMatrix: Output 3x3 floating-point camera matrix
68+
/// ![inline formula](https://latex.codecogs.com/png.latex?A%20%3D%20%5Cbegin%7Bbmatrix%7D%20f%5Fx%20%26%200%20%26%20c%5Fx%5C%5C%200%20%26%20f%5Fy%20%26%20c%5Fy%5C%5C%200%20%26%200%20%26%201%20%5Cend%7Bbmatrix%7D) . If CV\_CALIB\_USE\_INTRINSIC\_GUESS
69+
/// and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be
70+
/// initialized before calling the function.
71+
/// * distCoeffs: Output vector of distortion coefficients
72+
/// ![inline formula](https://latex.codecogs.com/png.latex?%28k%5F1%2C%20k%5F2%2C%20p%5F1%2C%20p%5F2%5B%2C%20k%5F3%5B%2C%20k%5F4%2C%20k%5F5%2C%20k%5F6%5D%2C%5Bs%5F1%2C%20s%5F2%2C%20s%5F3%2C%20s%5F4%5D%5D%29) of 4, 5, 8 or 12 elements
73+
/// * rvecs: Output vector of rotation vectors (see Rodrigues ) estimated for each board view
74+
/// (e.g. std::vector<cv::Mat>>). That is, each k-th rotation vector together with the corresponding
75+
/// k-th translation vector (see the next output parameter description) brings the board pattern
76+
/// from the model coordinate space (in which object points are specified) to the world coordinate
77+
/// space, that is, a real position of the board pattern in the k-th pattern view (k=0.. *M* -1).
78+
/// * tvecs: Output vector of translation vectors estimated for each pattern view.
79+
/// * stdDeviationsIntrinsics: Output vector of standard deviations estimated for intrinsic parameters.
80+
/// Order of deviations values:
81+
/// ![inline formula](https://latex.codecogs.com/png.latex?%28f%5Fx%2C%20f%5Fy%2C%20c%5Fx%2C%20c%5Fy%2C%20k%5F1%2C%20k%5F2%2C%20p%5F1%2C%20p%5F2%2C%20k%5F3%2C%20k%5F4%2C%20k%5F5%2C%20k%5F6%20%2C%20s%5F1%2C%20s%5F2%2C%20s%5F3%2C%0As%5F4%2C%20%5Ctau%5Fx%2C%20%5Ctau%5Fy%29) If one of parameters is not estimated, it's deviation is equals to zero.
82+
/// * stdDeviationsExtrinsics: Output vector of standard deviations estimated for extrinsic parameters.
83+
/// Order of deviations values: ![inline formula](https://latex.codecogs.com/png.latex?%28R%5F1%2C%20T%5F1%2C%20%5Cdotsc%20%2C%20R%5FM%2C%20T%5FM%29) where M is number of pattern views,
84+
/// ![inline formula](https://latex.codecogs.com/png.latex?R%5Fi%2C%20T%5Fi) are concatenated 1x3 vectors.
85+
/// * perViewErrors: Output vector of average re-projection errors estimated for each pattern view.
86+
/// * flags: flags Different flags for the calibration process (see [calibrate_camera] for details).
87+
/// * criteria: Termination criteria for the iterative optimization algorithm.
88+
///
89+
/// This function calibrates a camera using an Aruco Board. The function receives a list of
90+
/// detected markers from several views of the Board. The process is similar to the chessboard
91+
/// calibration in calibrateCamera(). The function returns the final re-projection error.
92+
///
93+
///
94+
/// **Deprecated**: Use Board::matchImagePoints and cv::solvePnP
95+
///
96+
/// ## Overloaded parameters
97+
///
7198
/// It's the same function as [calibrate_camera_aruco] but without calibration error estimation.
7299
///
73100
/// **Deprecated**: Use Board::matchImagePoints and cv::solvePnP

docs/bgsegm.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,14 @@ pub mod bgsegm {
88

99
pub const LSBP_CAMERA_MOTION_COMPENSATION_LK: i32 = 1;
1010
pub const LSBP_CAMERA_MOTION_COMPENSATION_NONE: i32 = 0;
11-
#[repr(C)]
11+
#[repr(i32)]
1212
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
1313
pub enum LSBPCameraMotionCompensation {
1414
LSBP_CAMERA_MOTION_COMPENSATION_NONE = 0,
1515
LSBP_CAMERA_MOTION_COMPENSATION_LK = 1,
1616
}
1717

18-
impl TryFrom<i32> for LSBPCameraMotionCompensation {
19-
type Error = crate::Error;
20-
21-
fn try_from(value: i32) -> Result<Self, Self::Error> {
22-
match value {
23-
0 => Ok(Self::LSBP_CAMERA_MOTION_COMPENSATION_NONE),
24-
1 => Ok(Self::LSBP_CAMERA_MOTION_COMPENSATION_LK),
25-
_ => Err(crate::Error::new(crate::core::StsBadArg, format!("Value: {value} is not valid for enum: crate::bgsegm::LSBPCameraMotionCompensation"))),
26-
}
27-
}
28-
}
29-
30-
opencv_type_enum! { crate::bgsegm::LSBPCameraMotionCompensation }
18+
opencv_type_enum! { crate::bgsegm::LSBPCameraMotionCompensation { LSBP_CAMERA_MOTION_COMPENSATION_NONE, LSBP_CAMERA_MOTION_COMPENSATION_LK } }
3119

3220
/// Creates a CNT Background Subtractor
3321
///

docs/bioinspired.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,19 @@ pub mod bioinspired {
319319
Ok(ret)
320320
}
321321

322-
/// @overload
322+
/// Try to open an XML retina parameters file to adjust current retina instance setup
323+
///
324+
/// - if the xml file does not exist, then default setup is applied
325+
/// - warning, Exceptions are thrown if read XML file is not valid
323326
/// ## Parameters
327+
/// * retinaParameterFile: the parameters filename
328+
/// * applyDefaultSetupOnFailure: set to true if an error must be thrown on error
329+
///
330+
/// You can retrieve the current parameters structure using the method Retina::getParameters and update
331+
/// it before running method Retina::setup.
332+
///
333+
/// ## Overloaded parameters
334+
///
324335
/// * fs: the open Filestorage which contains retina parameters
325336
/// * applyDefaultSetupOnFailure: set to true if an error must be thrown on error
326337
///

0 commit comments

Comments
 (0)