[ptx] Re: Enblend suggestion: focus score weighting

Andrew C Mihal mihal at eecs.berkeley.edu
Thu Jun 17 22:43:34 BST 2004


On Thu, 17 Jun 2004, Pablo d'Angelo wrote:

> A completely disk based image might be needed for really big images.
> In the meantime we might get away with mmap'ing a temp file, and use that
> with vigra::BasicImageView. However I have no idea well the kernel responds
> to the typical traversals how they accur in image processing.

Enblend looks at data in files one scanline at a time, in sequential
order. For all of the pyramid functions I work from memory. Then I dump
them back to disk to keep the max memory cross-section down. This was a
very intuitive place to make the split between disk/memory and it seems to
be ok. Maybe others can relate their memory usage requirements for enblend
projects. Is anyone still having out-of-memory problems? What's the
biggest project you've done?

> Where would boost::variant come into play?

Since I keep dumping data to disk and loading it back again in random
places, I was looking for a way to modularize between loading images and
doing image processing.

I want to avoid this:

if binary {
	make bimage
	get bimage iterators/accessors
	call image processing routine 1
	dump to disk
	reload
        call image processing routine 2
	...
} else if float {
	make fimage
	get fimage iterators/accessors
	call image processing routine 1
	dump to disk
        reload
        call image processing routine 2
        ...
}        
...

Because that copies the blending loop code N times.
With a variant I could do:

for each input image {
	variant = load image
	visit variant
}

Where the variant is over BImage, FImage, IImage, etc.
And the visitor looks like:

template <over each type in the variant> visitor(image) {
     get accessors/iterators for image
     call image processing routine 1
     dump to disk
     reload
     call image processing routine 2
     ...
}

Of course, I'm getting a crash course in vigra and templates here, so I 
could be totally off the mark.

Andrew

---------------------------------
Andrew Mihal
www-cad.eecs.berkeley.edu/~mihal
mihal at eecs.berkeley.edu



More information about the ptX mailing list