OON: Re: Data/view model in image processing

From: Roland Richter (roland@flll.uni-linz.ac.at)
Date: Wed May 02 2001 - 06:17:06 EST


Dear all,

Ullrich Koethe wrote:
>
> Roland Richter wrote:
>
> > Simple example:
> > ===============
> >
> > Given an image in pixel x pixel coordinates, provide a view in "realworld
> > coordinates", for instance in millimeters x millimeters or in polar
> > coordinates, i.e. millimeters x degree.
> >
> > [...]
>
> This might be more difficult than it looks at first. If you provide an
> index that rescales the coordinates, data requests will in general *not*
> fall exactly on pixel locations. Therefore, you must interpolate gray
> levels at the requested locations. This at least changes the return type
> of operator[] to a (non-writable) value parameter. As long as you
> perform only linear interpolation, views and iterator adapters are
> equally suitable, but cubic interpolation is easier realized with a view
> plus an index object.

Yes, you are completely right on that. Sorry, I failed to tell the "whole
story". Here it is:

What we had to implement was:

 1) Provide an interpolated view (bi-linear) of the image.
 2) Provide a view of the interpolated image which is in "real world"
    coordinates, i.e. mm x mm. Due to distortions in the camera picture,
    the transformation pixel x pixel --> mm x mm was non-linear.
 3) Apply rotation and translation to this image (parameters given in
    "real world" coordinates).
 4) Convert the result back to pixel x pixel for a region of interest.

To maintain the original code, written in C, was simply a nightmare;
refactoring it using the data/view concept helped a *lot* (and caused
a significant performance increase).
 
Since I was required to produce MSVC++ 6.0 compileable code, I wrote

a) a view doing the interpolation
b) a view doing index transformations (as described in my last mail)
c) two classes representing translation and rotation

in a rather simple, straight-forward manner, and it worked.

Interpolation, of course, is a rather special need.

However, I think this might be generalized. An interpolation view

- does index transformations (for instance, rounding doubles to ints)
- acts on more than one element, typically on elements in a "neighbourhood"
- combines these elements to give the result,

I guess concepts like "neighbourhood" or views of "local data"
are not limited to image processing (examples?)

All that might be included within a rather general view, perhaps
as an extension of the current transform_view. (I still don't know a
proper name for that -- suggestions?)

Question is, how to describe a "neighbourhood"?

1) as a sliding window, similar to a window_view in VTL
2) invloving expression templates

1) is simpler, but a window only describes a linear range, not
an arbitrary, multi-dimensional neighbourhood
2) seems to be much more complicated

I guess I'll have a further look at Blitz++. There, "stencils"
seems to be something similar as neighbourhoods, and the concept
of "index placeholder" might be useable, too ...

- Roland

--------------------- Object Oriented Numerics List --------------------------
* To subscribe/unsubscribe: use the handy web form at
http://oonumerics.org/oon/
* If this doesn't work, please send a note to owner-oon-list@oonumerics.org



This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 03:20:15 EST