Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Thank Alex Shishkov! Very excellent answer!

I have one comment only. For the first method of conversion, matrices C and E do not need to be initialized explicitly.So it is also OK to be like this:

const Mat A( 10, 20, CV_32FC1, Scalar::all(CV_PI) );
const Mat B( A.size(), CV_8UC1, Scalar::all(10) );
Mat C,E;
B.convertTo(E, CV_32FC1);
C = E+A;