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

Using strided external array as cv::Mat

$
0
0
I have an array in memory that represents a matrix. However, I have a stride value for both rows and individual elements. That is, the step from one element in a row to the next is *NOT* the size associated with its type (e.g. 8 for doubles). Is there any way to construct a `cv::Mat` object that maps to this chunk of memory? P.S. The constructor of cv::Mat with step-size does not seem to do the trick, since I cannot specify the step size between elements in a row. Update - data layout - Let's say I have an LxMxN array. It is organized in L-N-M storage order. The following example demonstrates the data layout of a 3x2x2 array in `i:(n,m,l)` format where `i` is the actual index in the memory chunk and `(n,m,l)` is the corresponding index in the 3D array: 0:(0,0,0) 1:(1,0,0) 2:(2,0,0), 3:(0,1,0) 4:(1,1,0) 5:(2,1,0), 6:(0,0,1) 7:(1,0,1) 8:(2,0,1), 9:(0,1,1) 10:(1,1,1) 11:(2,1,1) Given such a chunk in memory representing the array `A`, I would like to construct a `cv::Mat` object representing, in MATLAB notation, the array `A(i,:,:)` for a given `i`.

Viewing all articles
Browse latest Browse all 41027

Trending Articles



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