From: Mandrak
Subject: Image processing
Date: 
Message-ID: <36d6bd75.0@news.interlinx.qc.ca>
Yet another question about optimisation.

I use DrScheme and MITScheme. My school project is to write a shell for
photo-interpretation of satellite images using the A* algorythm. This means
that I'll have to manipulate image regions (by using masks and logical
operators.)

If a 24-bit image is represented as a string (of characters), it can
(read-string!) really fast. But I don't believe that the arithmetic
operations required by image processing are implanted for
strings/characters.
Is there a time-efficient way to code these operation?

If a 24-bit image is represented by a vector of numbers, arithmetic
operations are possible. But a lot of time is wasted doing
(char->integer), and 66% of the storage space is unused (a fixnum is 24,
26 or 30-bit). Of course, it would be possible to use the numbers to
represent red-green-blue triplets, using all the storage space.

Is this possible without doing three (char->integer)?

Considering the forementioned issues, what is the best representation for
a 24-bit image?

TIA,
-Kami

From: Christopher J. Vogt
Subject: Re: Image processing
Date: 
Message-ID: <36D7120F.7D6D0FA2@computer.org>
Mandrak wrote:
> 
> Yet another question about optimisation.
> 
> I use DrScheme and MITScheme. My school project is to write a shell for
> photo-interpretation of satellite images using the A* algorythm. This means
> that I'll have to manipulate image regions (by using masks and logical
> operators.)
> 
> If a 24-bit image is represented as a string (of characters), it can
> (read-string!) really fast. But I don't believe that the arithmetic
> operations required by image processing are implanted for
> strings/characters.
> Is there a time-efficient way to code these operation?

I don't know scheme, but in CL I'd use a byte-stream, not characters, then there isn't any conversion.
From: cdm
Subject: Re: Image processing
Date: 
Message-ID: <920064653.941.50@news.remarQ.com>
You might want to think about writing some image
manipulation primitives in C and linking them in to Scheme.
(MzScheme can do this pretty easily, with MITScheme, it
will depend on the platform).

~jrm

Mandrak <····@bozo.net> wrote in message
···············@news.interlinx.qc.ca...
>Yet another question about optimisation.
>
>I use DrScheme and MITScheme. My school project is to write a shell for
>photo-interpretation of satellite images using the A* algorythm. This means
>that I'll have to manipulate image regions (by using masks and logical
>operators.)
>
>If a 24-bit image is represented as a string (of characters), it can
>(read-string!) really fast. But I don't believe that the arithmetic
>operations required by image processing are implanted for
>strings/characters.
>Is there a time-efficient way to code these operation?
>
>If a 24-bit image is represented by a vector of numbers, arithmetic
>operations are possible. But a lot of time is wasted doing
>(char->integer), and 66% of the storage space is unused (a fixnum is 24,
>26 or 30-bit). Of course, it would be possible to use the numbers to
>represent red-green-blue triplets, using all the storage space.
>
>Is this possible without doing three (char->integer)?
>
>Considering the forementioned issues, what is the best representation for
>a 24-bit image?
>
>TIA,
>-Kami
>
>
>
From: Patric Jonsson
Subject: Re: Image processing
Date: 
Message-ID: <7ba1qc$nk5@mumrik.nada.kth.se>
In article <··········@news.interlinx.qc.ca> "Mandrak" <····@bozo.net> writes:
[...]
>Considering the forementioned issues, what is the best representation for
>a 24-bit image?

;;; I vote for a string based solution.

(declare (usual-integrations))

;;; You can represent an RGB-TRIPPLE as three consecutive
;;; characters and convert it to an unsigned integer with:

(define-integrable (rgb-tripple->unsigned-integer rgb-tripple)
  (convert-24-bit-unsigned-integer rgb-tripple 0))

(define (convert-24-bit-unsigned-integer string index)
  ;; This is safe because the MOST-POSITIVE-FIXNUM in MIT-Scheme
  ;; is 2^25-1. (Note: it's also byte-order sensitive)
  (fix:+ (vector-8b-ref string index)
	 (fix:* 256
		(fix:+ (vector-8b-ref string (fix:+ index 1))
		       (fix:* 256 
			      (vector-8b-ref string (fix:+ index 2)))))))

;;; Examples of RGB-TRIPPLE->UNSIGNED-INTEGER

(fluid-let ((*unparser-radix* 16))
  (pp (rgb-tripple->unsigned-integer "\377\377\377"))
  (pp (rgb-tripple->unsigned-integer "\377\000\000"))
  (pp (rgb-tripple->unsigned-integer "\000\377\000"))
  (pp (rgb-tripple->unsigned-integer "\000\000\377")))

;;; Fine-Tuning Aids. (put'em in your ~/.scheme.init file)

(define (pretty-print-bin-file file)
  ;; Pretty-Print the `.bin' file produced by SF.
  (with-output-to-file (pathname-new-type file "pp")
    (lambda () 
      (pp (fasload (pathname-default-type file "bin"))))))

(define (cf-s input . rest)
  ;; Make compiler dump LAP and RTL files.
  (fluid-let ((compiler:generate-lap-files? #t)
	      (compiler:generate-rtl-files? #t)
	      (compiler:intersperse-rtl-in-lap? #f))
    (apply cf input rest)))

-- 
Patric Jonsson,·······@nada.kth.se;Joy, Happiness, and Banana Mochas all round.
From: see.signature
Subject: Re: Image processing
Date: 
Message-ID: <slrn7diegk.6n.anyone@Flex111.dNWL.WAU.NL>
On 28 Feb 1999 01:15:08 +0100, Patric Jonsson <·······@mumrik.nada.kth.se>
wrote:

Please have a look at the envision environment written partly in scheme and
c: http://www.cs.hmc.edu/~fleck/envision/envision.html



-- 
------------------------------------------------------------------------------
email: marc dot hoffmann at users dot whh dot wau dot nl
------------------------------------------------------------------------------