Classic Computer Magazine Archive ANTIC VOL. 4, NO. 2 / JUNE 1985

Pixel Scanner


Pixel Scanner (Bird)

This BASIC program introduces you to pixel averaging-an advanced graphics technique similar to the method NASA uses few enhancing satellite photo details. Pixel Scanner works on all Atari computers of any memory size. Disk or cassette.

The Atari's graphics capabilities are the best you can get for anywhere near the price. The problem most of us run into is that our pictures LOOK as if we did them ourselves.
   This doesn't need to be the case, however. Pixel Scanner will perform automatic computer enhancement of a picture by using a process called pixel averaging, which gives a depth and fullness to an otherwise flat picture.
   And that isn't all. By tinkering with this program a little, you can simulate the sophisticated computer enhancements used by NASA to bring out small details in satellite photos.
   To get started, type in Listing 1, check it with TYPO II, and SAVE a copy.
   The program includes a demonstration picture of a stick figure bird in Graphics 9 (lines 200-270), and the pixel averaging routine (lines 100-161). The picture was made using simple PLOT and DRAWTO commands; if you're enterprising, you can create your own picture by changing these commands in the demonstration picture.
   The stick figure is drawn at the top half of the screen, leaving room for the enhanced version at the bottom.

After the picture is drawn, the program looks at each pixel and its surrounding pixels, then places their values into variables. This is done in lines 121-129 by means of the LOCATE command, which positions the cursor at a specified x,y coordinate on the screen and assigns the value of the byte for that data to a specified variable.

    The format for a LOCATE command is:
    LOCATE (x-coord),(y-coord), (variable)

   The program then adds the values of all the variables together, and divides by the number of pixels sampled (line 131). Using that average value, it then re-colors the center pixel, to make it blend more smoothly with its surroundings (line 141).

The word 'pixel" is computer jargon for "picture element" It stands for the smallest controllable element of a screen display.
   Naturally, pixel size is determined by computer and video resolution limits, as well as by graphics mode selection. In Atari Graphics 8 mode, for example, a pixel is one scan line high by one-half color clock wide- which essentially matches the resolution of a home television receiver.

The Pixel Scanner demo program blends pixels. It could just as easily widen the difference between pixels-as is done in satellite photos to distinguish between extremely small variations.
   To do this, change the way the value of K is figured. In line 131, K is figured as the average of all the variables. It would be just as easy to make K vary by, say, 4 times the average, if you change the command COLOR K (line 141) into COLOR K*4.
   With a little experimentation, you will begin to find a wide variety of things to do with this routine. Other effects can be achieved by sampling only certain adjacent pixels and not others.
   You might also try changing to Graphics 11 (line 201). You'll be surprised at the beautiful blends of colors which are produced.

Lyn Buchanan is a civilian programmer at Fort Meade, Maryland. He is also a programming and systems analysis instructor.

Listing 1    BIRD.BAS Download