Mat and a stack of images

Greetings,

Loic here, new to this forum and to OpenCV (C++) but not to Computer Vision.

I have a basic question: I wish to load a stack of color images and generate new color images from the image stack by extracting the pixels from a given column (at (Xi,Yi) coordinates) of the image stack. Each column will generate a new color image.

It seems that OpenCV offers various ways of doing this and I could use a few pointers to get started in the right direction.
I am guessing the MAT class is a good starting point, making use of the .at() function to access pixel data.
I could allocate a large 3D array, load and iterate through all the images and popûlate the array with their pixel data before extracting columns data but I’d like to hear your opinion on better alternatives

Thanks in advance
Loic

what is the context here, the purpose of it ?

it’s (y,x) here already (row major Mat’s), and making use of the .at() function to access pixel data. is the most tedious & error prone way ever. try NOT doing it this way.

Thank you @berak.
I did not want to write a lengthy post so I skipped the purpose descritpion, but am happy to explain more.
I am working on a digital hologram printer, which prints holograms pixel by pixel (actually called “hogels” in that case). The scene to be printed is obtained from a set of parallax images (the green faces on the image below).
Every hogel is a micro hologram in itself and is constructed by projecting and recording the image from an LCD onto the hologram film (to keep things simple). The images to be displayed on the LCD for every hogel are the extracted columns mentioned in my previous post, see image below.

To summarize, prior to printing a hologram, I want to load the whole stack of parallax views then generate new images from every column in the image stack. Each new generated image will be printed on film, at individual hogel locations. This represents a significant number of images so I need to implement this in an efficient manner, in terms or RAM and computational power. Any help/pointer is much appreciated.

Thanks
Loic

I don’t quite understand the data access pattern.

you could just allocate a huge file on disk, memory-map it, and load your pictures in there.

I’d recommend not bothering with C++. use Python. if you’re new to programming, you need to know that all the compute-intensive stuff in Python is actually library calls that run compiled machine code. even if you need complicated custom code, that too can be compiled with a package called “numba”.

So yes, allocating a big chunk of memory and memory-map it was my idea but before I dive into that I was asking if the Mat class has any cleaner/safer/easier way to handle this (and I am using C++ mainly because of legacy code).

So assuming I would take that route, I see here that there are three possible approaches to do the memory mapping, any recommendation on which route?
Thanks