Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Succinct way to assign values to Mat

$
0
0
I want to assign values to a 4x3 `Mat` in C++. Right now, I'm doing it like this: Mat P = Mat(Size(4, 3), CV_64F); //Create matrix with four corners of output image P.at(0,0)=0; P.at(0,1)=inputImage.cols; P.at(0,2)=inputImage.cols; P.at(0,3)=0; P.at(1,0)=0; P.at(1,1)=0; P.at(1,2)=inputImage.rows; P.at(1,3)=inputImage.rows; P.at(2,0)=1; P.at(2,1)=1; P.at(2,2)=1; P.at(2,3)=1; Is there a more succinct way like there is in other languages more like this? P = [0, inputImage.cols, inputImage.cols, 0; 0, 0, inputImage.rows, inputImage.rows; 1, 1, 1, 1]

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>