Function opencv::core::set_identity
source · [−]pub fn set_identity(mtx: &mut dyn ToInputOutputArray, s: Scalar) -> Result<()>
Expand description
Initializes a scaled identity matrix.
The function cv::setIdentity initializes a scaled identity matrix:
The function can also be emulated using the matrix initializers and the matrix expressions:
ⓘ
Mat A = Mat::eye(4, 3, CV_32F)*5;
// A will be set to [[5, 0, 0], [0, 5, 0], [0, 0, 5], [0, 0, 0]]
Parameters
- mtx: matrix to initialize (not necessarily square).
- s: value to assign to diagonal elements.
See also
Mat::zeros, Mat::ones, Mat::setTo, Mat::operator=
C++ default parameters
- s: Scalar(1)