From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c329247dd63d7778,start X-Google-Attributes: gid103376,public From: Richard Beare Subject: 1 and 2d image representations Date: 1997/10/23 Message-ID: <344E97A8.688C@eleceng.adelaide.edu.au>#1/1 X-Deja-AN: 284811746 X-Complaints-To: usenet@hakea.adelaide.edu.au X-Trace: hakea.services.adelaide.edu.au 877565864 28473 (None) 129.127.28.122 Organization: University of Adelaide Newsgroups: comp.lang.ada Date: 1997-10-23T00:00:00+00:00 List-Id: 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