Jump to content
IGNORED

gr9Lab - image processing on Atari 8-bit computer


amarok

Recommended Posts

I would like to present my first program which I wrote using MadPascal.

 

gr9Lab is an application designed for image processing on 8-bit Atari computer.
The program is still under development but it contains almost all functionalities planned so far.
I tested the application under Altirra and I cannot guarantee that it works on a real hardware.
The current version should properly work with 64kB of memory.

 

Below you can find the link to the YouTube video.

 

 

It is possible to work with two images in GR9 mode with resolution of 80x192 pixels at the same time.
The program has ability to process the whole images or within a selected rectangular area of interest (ROI).


The program can be controlled by joystick or the keyboard:

  • by pressing 1 and 2 keys you can switch the view between two images.
  • by pressing Tab/Shift Tab keys you can go to the next/previous menu item or other GUI control.
  • by pressing Return key you can activate highlighted menu item or other GUI control.
  • by pressing Esc key you can go to the main menu.

 

The list of features available in the current version contains as follows.

 

gr9Lab menu

  • New - clears content of the image.
  • Load - loads image from a file in GR9 format (80x192 pixels).
  • Save - saves image to file in GR9 format (80x192 pixels).
  • Exit - closes the application.
  • Copy - copies image content from the other one.
  • Show/Hide selection - turns on/off selection (ROI).

 

Process menu

  • Flip horizontal - performs mirror of the image in horizontal direction.
  • Flip vertical - performs mirror of the image in vertical direction.
  • Rotate 180 - rotates the image by 180 degrees.
  • Brightness/Contrast - adjusts brightness and contrast of the image.
  • Histogram - calculates and shows a histogram of the image.
  • Histogram equalize - performs histogram equalizaion on the image.
  • Inverse - applies inversion of pixels intensity.
  • Threshold - performs thresholding operation, pixels replaced by black if are darker than parameter or replaced by white otherwise.
  • Add noise - applies random modification of pixels intensity.

 

Filter menu

  • Box filter - applies average filter of 3x3 pixels on the image.
  • Gaussian blur - applies Gaussian blur filter of 3x3 pixels on the image.
  • Sharpen - performes sharpening operation using filter of 3x3 pixels.
  • Laplace edges - enhances edges on the image by Laplace filter of 3x3 pixels.
  • Emboss - generates relief effect on the image by using filter of 3x3 pixels.
  • Dilate filter - applies morphological dilate filter of 3x3 pixels on the image.
  • Erode filter - applies morphological erode filter of 3x3 pixels on the image.
  • Opening filter - applies morphological opening filter of 3x3 pixels on the image.
  • Closing filter - applies morphological closing filter of 3x3 pixels on the image.

 

Math menu

  • Set - fill the image by a selected intensity.
  • Add - increases pixels intensity by selected value.
  • Subtract - decrease pixels intensity by selected value.
  • Difference - calculates absolute difference between pixels intensity and selected value.
  • Multiply - multiplies pixels intensity by selected value.
  • Divide - divides pixels intensity by selected value.
  • Log - calculates logarithm values from pixels intensity.
  • Exp - calculates exponent values from pixels intensity.
  • Sqr - calculates power of 2 from pixels intensity.
  • Sqrt - calculates square root from pixels intensity.
  • Not - calculates bitwise negation of pixels intensity.
  • Or - calculates bitwise sum of pixels intensity and selected value.
  • And - calculates bitwise product of pixels intensity and selected value.
  • Xor - calculates bitwise exclusive disjunction of pixels intensity and selected value.
  • Minimum - calulates minimum value from pixels intensity and selected value.
  • Maximum - calulates maximum value from pixels intensity and selected value.

 

Blender menu

  • Add - calculates addition between corresponding pixels of two images.
  • Subtract - calculates subraction between corresponding pixels of two images.
  • Difference - calculates absolute difference between corresponding pixels of two images.
  • Multiply - calculates multiplication between corresponding pixels of two images.
  • Divide - calculates division between corresponding pixels of two images.
  • Average - calculates average value between corresponding pixels of two images.
  • Or - calculates bitwise sum between corresponding pixels of two images.
  • And - calculates bitwise product between corresponding pixels of two images.
  • Xor - calculates bitwise exclusive disjunction between corresponding pixels of two images.
  • Minimum - calculates minimum from corresponding pixels of two images.
  • Maximum - calculates maximum from corresponding pixels of two images.

 

 

My plan for further improvements of the program contains at least the following items:

  • using extended memory for storing more than 2 images.
  • introduction of undo operation.
  • improvements of load/save operations - better error handling, introduction of file explorer.
  • showing the name of visible image and information if the image has been modified and is unsaved.
  • introduction the screen with help and settings (I have some ideas for settings).
  • support of Atari 800 (currently I have problem with proper keyboard handling by ReadKey function).
  • solve a problem with computer crash after aplication is closed.

 

 

You can download the disc image or standalone executable and play with the application freely.
I would be grateful for your comments.

 

gr9Lab_WIP1.atr gr9Lab_WIP1.xex

  • Like 31
  • Thanks 11
Link to comment
Share on other sites

Very nice this "Photoshop" as a retouching program. Several good features included.

 

I think, however, that the most crucial and the very first step, which is to convert any high-res jpg to a good pixelated image suitable for 8-bits, from a squared pixel to a rectangular-horizontal pixel for Atari, with a good contrast, and likely by a Windows program due to hardware requirements, it's still missing in some way. It's very difficult and also an "entry barrier" to generate a starting point for Atari with rectangular pixels, for then do the retouching.

 

image.png.1b2fea2e664daf45369104de2850f4f6.png

 

Edited by tane
  • Thanks 1
Link to comment
Share on other sites

Thank you very much for your comments. I am glad you like it.

 

In the link below you can find source codes of the project. Nothing special, but maybe for someone will be inspiring...

https://gitlab.com/amarok8bit/gr9Lab

 

There you can find also a python script which I am using for conversion from png to gr9 image format.

  • Like 5
  • Thanks 2
Link to comment
Share on other sites

35 minutes ago, amarok said:

Thank you very much for your comments. I am glad you like it.

 

In the link below you can find source codes of the project. Nothing special, but maybe for someone will be inspiring...

https://gitlab.com/amarok8bit/gr9Lab

 

There you can find also a python script which I am using for conversion from png to gr9 image format.

Thanks for sharing!

Link to comment
Share on other sites

4 hours ago, amarok said:

There you can find also a python script which I am using for conversion from png to gr9 image format.

"Atari Graphics Studio" which you can find here:

http://madteam.atari8.info/index.php?prod=uzytki

is also able to produce this format, has a broader support of input file formats and some nice conversion options.

(Which only partly contradicts the native processing of "gr9Lab"... ;) (nice job, BTW) )

 

Edited by Irgendwer
  • Thanks 1
Link to comment
Share on other sites

"Atari Graphics Studio" is indeed a quite powerfull application. Thanks for the recommendation.

 

In the meantime I prepared WIP demo 2 of gr9Lab. In this version there are following changes:

  • Added settings menu.
  • Added support for Atari ST mouse and Amiga mouse.
  • Added shortcuts for menu items.
  • Added option for faster image processing by turn the display off.

You can check how Atari ST mouse works in the application on the video below:

 

 

I attached the latest disc image and executable.

gr9Lab_WIP2.atr gr9Lab_WIP2.xex

  • Like 10
  • Thanks 2
Link to comment
Share on other sites

41 minutes ago, amarok said:

"Atari Graphics Studio" is indeed a quite powerfull application. Thanks for the recommendation.

 

In the meantime I prepared WIP demo 2 of gr9Lab. In this version there are following changes:

  • Added settings menu.
  • Added support for Atari ST mouse and Amiga mouse.
  • Added shortcuts for menu items.
  • Added option for faster image processing by turn the display off.

You can check how Atari ST mouse works in the application on the video below:

 

 

I attached the latest disc image and executable.

gr9Lab_WIP2.atr 90.02 kB · 1 download gr9Lab_WIP2.xex 34.22 kB · 1 download

Was it difficult to add mouse support?

Link to comment
Share on other sites

@Stephen, mouse support seems to be relatively easy task.

It is required to check a specific sequence of signals on particular pins of joystick port.

I used the following documentation (unfortunately it is written in Polish):

You can also check my implementation in procedure MoveMouseCursor located in the following source file:

https://gitlab.com/amarok8bit/gr9Lab/-/blob/master/source/cursor.pas#L216

 

In the meantime I prepared a short video containing results of image processing time.

This simple benchmark compares PAL and NTSC systems in normal and fast mode when display is turn on and off respectively.

 

 

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

This is a fantastic piece of software!!!  Now regarding ponting device support, Missile Command trackball mode (which I use with both CX22 and CX80) also supports Atari ST Mouse. So that make me wonder that adding trackball support (in the missile command way) will make the application to support Atari ST mouse as well.

 

  • Like 1
Link to comment
Share on other sites

@manterola, it is very good idea to support trakball.

 

I've just implemented this functionality and roughly checked in Altirra. But could you please test it on the real hardware?

https://gitlab.com/amarok8bit/gr9Lab/-/blob/master/gr9Lab.atr

https://gitlab.com/amarok8bit/gr9Lab/-/blob/master/gr9Lab.xex

 

To activate the trakball support you have to change Controller to Trakball in the Settings menu.

 

Thank you very much for your help. ?

 

Edited by amarok
  • Like 6
Link to comment
Share on other sites

  • 3 weeks later...
On 9/9/2020 at 12:29 PM, amarok said:

@manterola, it is very good idea to support trakball.

 

I've just implemented this functionality and roughly checked in Altirra. But could you please test it on the real hardware?

https://gitlab.com/amarok8bit/gr9Lab/-/blob/master/gr9Lab.atr

https://gitlab.com/amarok8bit/gr9Lab/-/blob/master/gr9Lab.xex

 

To activate the trakball support you have to change Controller to Trakball in the Settings menu.

 

Thank you very much for your help. ?

 

Hi @amarok,

I was finally able to spend a bit of time with your great program.  The Trackball works, but i have some observations:

- I could not change the controller in the setup,using only the keys. I tried that since I already had the trackball plugged. Finally i plugged a joystick and change the controller selection by using that joystick, the  I replugged the trackball

- Once you change controller, the setting are activated immediately,so the pointer started jumping around. It should apply the changes after the OK. 

- Finally, the trackball works pretty "slow",I guess you need to apply a "factor" to compensate for the low resolution of the trackball.

 

Thanks for this great piece of software.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

I've prepared a small upgrade of the gr9Lab. In WIP 3 demo version there are following changes:

  • support for Atari Trakball,
  • possibility for changing controller port (available in Settings menu),
  • support for Atari 800 keyboard,
  • settings are changed after closing the Settings menu by selecting OK button.

 

@manterola I'd like to thank you for checking gr9Lab with the real trackball. Your feedback was very helpful.

Quote

Finally, the trackball works pretty "slow",I guess you need to apply a "factor" to compensate for the low resolution of the trackball.

I think that the trackball has enough good "resolution" and there was a completely different problem. I used STICK0 $0278 (the shadow register) for checking the trackball status instead of PORTA $D300 (the hardware register). It is obvious that state of the shadow register is updated 50 or 60 times per second for PAL or NTSC respectivelly during vertical blank. And this is to slow for handling the trackball. So that was the actual reason of the poor response of the software for trackball movements.

 

Regarding the keyboard and Atari 800: gr9Lab is written in MadPascal and I use ReadKey function for checking which key on the keyboard is pressed. This function uses a convertion table located in ROM for translation of the keyboard code into ATASCII. Unfortunately in Atari 800 this table is missing (or at least I couldn't find it in ROM), therefore I had to provide it directly within the software. Finally gr9Lab should properly handle the keyboard of Atari 800. I would be grateful if someone could confirm it on the real hardware.

 

gr9Lab_WIP3.atr gr9Lab_WIP3.xex

  • Like 5
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...