c++ - Are there standard patterns for implementing a class to dynamically load images? -


i've been tasked creating application works thousands of images, far many load ram @ once. guess it's analogous photo viewer picassa, in @ given moment application needs pixel data handful of total cataloged images. application must handle extremely large images, small subset of pixel data required @ given time image analysis or display, which, suppose, analogous google earth. in short, application must dynamically load portion of pixel data required @ given time.

having dealt static image loading typical of image libraries opencv, cimg, or magick++, i'm @ bit of loss how might best approach problem. question is: there standard design patterns requirement, or approaches solving (or similar) problem?

btw, small images, realize delay loading of image until needed, there 2 key problems spring mind approach. (1) doesn't solve large image problem. (2) since unloading image after used inefficient, need type of memory management handler in application unloads images when new images loaded , memory threshold has been passed. similar memory management issue remains portions of larger image loaded memory. plainly admit such tool beyond knowledge , experience, if prevailing answer question, have supplemental question. recommended basic tutorials on memory management?

thank help!

update: curious, thought i'd share approach took. image class created lazy loads image data. solve problem loading thousands of images, created class keep track of file handles (windows has limit - see _getmaxstdio), , amount of image memory loaded, unloading necessary. handle large images, used vxl image library back-end, able load subsection of large image. granted isn't efficient images (compressed images especially), since i'm working tiled tiff images, works well.

if larger images large, such not fit onto screen, may reasonable split them smaller pieces.

if have display images reduced (zoomed out) can ease work creating , storing reduced versions of larger images. whole cascade of reduced images sides x 0.707, x 0.5 etc takes maximally lot of storage original image.

for lazy unloading can load images (or fragments, or reduced versions) , remember time when these latest displayed , lot of memory take. once hit threshold need load more images can unload starting oldest free space.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -