I'm trying to duplicate an example for line detection from java to native code.
My Java code is as follows
int[] linesArray = new int[lines.cols() * lines.rows() * lines.channels()];
lines.get(0,0,linesArray); //the function in question. Reads Mat data into the lines array
for (int i=0; i < linesArray.length; i = i + 4)
{
//loop through the data and do stuff
}
but in C++ native code, there is no Mat::get()
function. How can I read the data from my lines
Mat into my linesArray
so far I have this for C++, mostly the same
int linesArray[lines.cols * lines.rows * lines.channels()];
lines.get(0,0,linesArray); //get is not a member of cv::Mat
lines.cols
,lines.rows
, andlines.channels()
are allconstexpr
(which I suspect is not the case), you cannot use them for stack allocated arrays. You will need to heap allocate with eithernew
or something likestd::vector
– Evan Teran