George Profenza George Profenza - 3 months ago 60
C++ Question

How to process large images?

I need to process(export subsections) of a large image(33600x19200) and I'm not sure how to start.

I've tried simply allocating an image using openframeworks but I got this error:

terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc

I'm not experienced with with processing images this large. Where should I start ?


std::bad_alloc occurs, because you dont have enough memory available to hold the whole image.

In order to work with such big things, one has to split them, e.g threat the picture as a set of subsections / subpictures with a well defined size (e.g 1000x1000) and process them one by one.

The other solution is simply to throw as much memory into your system as you can. If you have the money and the program should only run on one specific machine, its surely an option, but I think its clear which of the both solutions is the better one ;)