开发者

Integers to const c++, c

开发者 https://www.devze.com 2023-01-30 00:27 出处:网络
I have integers which I put in a matrix in order to use them in a specific function in openCV. The matrix that I created is only cvMat and I want to use this matrix in the function. I\'m getting an er

I have integers which I put in a matrix in order to use them in a specific function in openCV. The matrix that I created is only cvMat and I want to use this matrix in the function. I'm getting an error:

error: cannot convert ‘CvMat’ to ‘const CvMat*’

So how can I convert these ints to const in order to create that matrix as const CvMat i.e how to change CvM开发者_开发知识库at to const CvMat?


" error: cannot convert ‘CvMat’ to ‘const CvMat*’ "

The important thing there is the asterix at the end. That means the function you are calling wants a pointer. you can just take the address of your matrix and pass that, instead somefunction(myMatrix) it needs somefunction(&myMatrix). Don't worry about the const. A pointer can always be converted to a const pointer implicitly.

0

精彩评论

暂无评论...
验证码 换一张
取 消