comp.lang.ada
 help / color / mirror / Atom feed
From: Richard Beare <rbeare@eleceng.adelaide.edu.au>
Subject: 1 and 2d image representations
Date: 1997/10/23
Date: 1997-10-23T00:00:00+00:00	[thread overview]
Message-ID: <344E97A8.688C@eleceng.adelaide.edu.au> (raw)


Hi all,

I'm writing some image processing software and I'm concerned about my
use of arrays. Obviously there are a number of options. My images are
not all the same size, but they don't change size, so I can use
something like

type Image is array (Postive range <>, Positive range <>) of Pixel;

however this doesn't allow me to take slices, which can be useful.

An array of array accesses makes this possible (obviously in one
direction only).

type Row is array (Positive range <>) of Pixel;
type H_Row is access Row;

type Image is array (Positive range <>) of H_Row;


Alternatively it is possible to represent an image as a linear array
and provide functions to perform the mapping between 1 and 2
dimensions.

Is there a sensible way to provide both the 1 and 2 dimensional
views of the image. The linear array can be useful if interfacing
to C code. It also allows every pixel to be checked using a single
loop, rather than nested loops. The other structures are convenient
because they describe an image in a more natural way. Preserving Ada's
range checks on rows would also be an advantage.

Can anyone comment on the overhead of using a linear array and
functions to map from two dimensions to one (and vice versa).

Any advice appreciated.

-- 

Richard Beare
rbeare@eleceng.adelaide.edu.au




             reply	other threads:[~1997-10-23  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-23  0:00 Richard Beare [this message]
1997-10-27  0:00 ` 1 and 2d image representations Alan E & Carmel J Brain
1997-10-28  0:00   ` Samuel T. Harris
1997-11-01  0:00   ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox