finalizing the Iterator API

Roger Larsson roger.larsson at norran.net
Fri Jul 9 02:03:20 CEST 2004


On Wednesday 07 July 2004 11.23, Casper Boemann wrote:
> > > And as Boudewijn said up,down.left,right might be nice functions,
>
> however
>
> > > they don't make sense for a PathIterator. I have had this idea myself,
>
> but
>
> > > on reflection: when would they really be used.
> >
> > Edge detection, for instance.
>
> good point, question is if we should make a special WalkerIterator for this
> or just provide those functions in general.

(Better to call "mkbitmap" and "potrace" on a temporary image...)

You might end up moving around _a lot_... (how to follow a edge? - you need
to check neighbors to know that you still are on a edge).
And for each movement you need to check that the iterator is still in
selection or in image...

It might be better to move around a AreaIterator instead...
And wouldn't that be the same as a selector?

What about providing direct pixel access within the selector?
* Iterate over all within the selector to get average.

Note:
   When the selection size increases it is better to use two selectors
    one to add new pixel values, the other to subtract old

	for fit in front_selector:
		acc += *fit;
	for eit in end_selector:
		acc = *eit;
	average = acc / size(total_selector);

	front_selector.dx(1);
	end_selector.dx(1);

/RogerL

-- 
Roger Larsson
Skellefteå
Sweden


More information about the kimageshop mailing list