Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

:RESIZE-IMAGE

source files: xzum.[ch]

SYNTAX

(require "xg.3d.imageops-xzum")

(send <dst-grl> :RESIZE-IMAGE <src-grl>
    [ :X-SRC-LOC <fix:x-src-loc> ]
    [ :Y-SRC-LOC <fix:y-src-loc> ]
    [ :X-SRC-SIZ <fix:x-src-siz> ]
    [ :Y-SRC-SIZ <fix:y-src-siz> ]

    [ :X-DST-LOC <fix:x-dst-loc> ]
    [ :Y-DST-LOC <fix:y-dst-loc> ]
    [ :X-DST-SIZ <fix:x-dst-siz> ]
    [ :Y-DST-SIZ <fix:y-dst-siz> ]

    [ :FILTER-SHAPE { :IMPULSE | :BOX | :TRIANGLE | :QUADRATIC | :MITCHELL } ]
    [ :BLUR-FACTOR <flo:blur-factor> ]
)

DESCRIPTION

This call is kept for compatability: :RESIZE-RELATION is more general and likely should be used in new code. The :RESIZE-IMAGE call's main advantage is that it allows mismatches between input and output in terms of the color planes present: An RGB image can be scaled into a grey-scale image (one containing only a green plane) or vice versa, for example.

This call copies a two-dimensional rectangle from <src-grl> to <dst-grl>. Both relations should have two-dimensional CLASS-UNIT-FLOAT-ARRAY arrays :PIXEL-RED, :PIXEL-GREEN and :PIXEL-BLUE. (The :PIXEL-RED and :PIXEL-BLUE arrays (by convention) may be omitted for grayscale images.) The code used is fairly heavily optimized for speed.

In general, the source and destination rectangles will be different sizes, since the main design purpose of this message is to resize an image.

Currently, the source and destination relations must be distinct.

By default, the complete src image is resized to exactly fit the dst relation, but the {X|Y}-{SRC|DST@}-{LOC|SIZ@} keywords may be used to copy any subrectangle of the src to any subrectangle of the dst. The *LOC* keywords specify the lower-left corner of the subrectangle, and the *SIZ* keywords the x and y dimensions in pixels of the subrectangles.

The :FILTER-SHAPE governs the sort of interpolation/convolution used to select the value for each output pixel, and defaults to :TRIANGLE.

The filters are listed roughly in order of increasing quality and computation time.

The :IMPULSE 'filter' simply copies the geometrically closest input pixel to output, which produces severe pixellation effect ('jaggies') when magnifying an image, but which *does* have the virtue of being about ten times faster than the remaining filters.

The :BOX filter samples a neighborhood of the input image using a (2-D) square-wave weighting function, while the :TRIANGLE filter uses a triangular-peaked weighting function.

The :QUADRATIC and :MITCHELL filters provide still better approximations to the ideal (?) Gaussian weighting function, at the cost of about twice the computation time of the :BOX and :TRIANGLE filters.

The :MITCHELL filter is based on Mitchell&Netravali, "Reconstruction Filters in Computer Graphics", SIGGRAPH 88.

The :BLUR-FACTOR defaults to 1.0. It allows the user explicit control of the neighborhood size used to compute each output pixel: setting this parameter larger will produce a steadily blurrier image. The default :blur-factor 1.0 neighborhoods include the nearest neighbor pixels for :BOX and :TRIANGLE, and extend twice as far for :QUADRATIC and :MITCHELL.


Go to the first, previous, next, last section, table of contents.