Create a vector of Mat from a three dimensional vector
Hello,
I have a vector of the type
std::vector< std::vector< std::vector <uint16_t> > >
and data is stored in the following order: vector[col][channel][row]
.
I would like to create a vector of the type std::vector<cv::Mat>
in which a grayscale image of each channel is stored.
Also, the Mat vector should point to the original data.
The original vector changes dynamically as new columns are appended and so the Mat vector should grow as well.
What is the best way to create, fill and extend the Mat vector?
Thank you very much!
"the Mat vector should point to the original data." -- this will not be possible.
vector[col][channel][row]
-- this really looks weird. what kind of data would be stored in this way ?This is a hyperspectral cube coming from BIL format (http://desktop.arcgis.com/en/arcmap/1...) and a line scan. So a buffer always delivers new lines. I could store it in any other way as well. It should just be possible to easily access every data point, so all three dimensions. The current way of storage is in the way the data is created. Any other good suggestions? Thanks
so, it is the 1st of the 3 described formats there ?
Yes and I always get a buffer with one image line.
ok, however, can it be, you're confusing rows and cols ?
this would mean, rows are appended, not columns. it also would mean, your format is:
right ? (you append to the last / inner index)
Sorry, I was not clear enough. The original format is
uchar* buffer
for eyery image line. From this buffer I need to cast two uchar to a 16 bit variable using shift operators. The vector was introduced by me for easier data access. Whether rows or cols are appended is at matter of the definition of the image direction.yea, just a matter of indexing, then.