TAMS / Java / Hades / applets: contents | previous | next | ||||
Hades Applets contents visual index introduction std_logic_1164 gatelevel circuits delay models flipflops adders and arithm... counters LFSR and selftest memories programmable logic state-machine editor misc. demos I/O and displays DCF-77 clock relays (switch-le... CMOS circuits (sw... RTLIB logic RTLIB registers Prima processor D*CORE MicroJava Pic16 cosimulation Mips R3000 cosimu... Intel MCS4 (i4004) image processing ... color channels JPEG compres... Sobel filter Gauss filter resize rotate chessboard gamma correc... saturation chroma-keying chroma-keying purple fringing red-eye [Sch04] Codeumsetzer [Sch04] Addierer [Sch04] Flipflops [Sch04] Schaltwerke [Sch04] RALU, Min... [Fer05] State-Mac... [Fer05] PIC16F84/... [Fer05] Miscellan... [Fer05] Femtojava FreeTTS | RGB color model
Circuit Description
The applets in this chapter demonstrate how to use Hades
for a few simple image processing tasks.
They should be fun to watch, and showcase that event-based simulation
is not limited to the modelling of digital circuits.
The basic idea is to use a class-hierarchy of simulation objects
that operate on image data.
A corresponding signal class is used to connect the image operators.
Instead of logical values, the signals carry references to image objects
as their payload.
You can instantiate any number of image filters and simply connect
them via this new signal type.
The standard simulation engine is used to keep track of image changes
and notifies the next image filters in the filter chain or filter graph.
At the moment, all classes related to the image processing demonstrations
are kept in the The ImageSource simulation object is used to load images from a file or URL. Just click on the ImageSource symbol to open a file-dialog and select an image file (supported image formats are GIF, JPEG, PNG). Once the image is loaded, the ImageSource model creates an event on the signal connected to its output port.
Please remember that the applet security mechanism denies file access
to applets unless you explicitly allows this via settings in the
Java configuration file.
Please see the Usage file
for details about how to grant applets file access,
if you want to open and experiment with your own image files.
If the applet detects that file access is denied,
it will open a dialog window that allows you to select one of a few
demo images, including famous image processing examples like
The ImageViewer component is used to show an image in an external window. Simply click on the ImageViewer component to open the corresponding image viewer window. A normal left-click will close the viewer window, while a right-click will change the window size to match the image size. Note that the viewer also displays the alpha, red, green, blue values of the pixel corresponding to the mouse position in its status line. The filter graph used in this applet demonstrates the RGB (red/green/blue) color model used by most image processing algorithms. The input image is propagated to four image filters, which separate the red, green, and blue components of the input image. The gray filter uses the standard formula to convert the color input image into a grayscale image. The output of each image filter is propagated via a cascade of image multiplexers to a single image viewer. Note that standard digital simulation models, as demonstrated by the two clock-generators, can be used together with the image filters.
Disclaimer: Naturally, the simple image filters used in this and the following applets do not provide a professional quality image-processing framework. Some of the obvious limitations are:
Tip:
The image filters from the setenv CLASSPATH hades.jar:jython.jar jython imagedemo.py
where from hades.models.imaging import * i = ImageSource().loadImage( 'purple-fringing.jpg' ) # load source image j = GrayFilter().filter( i ) # grayscale k = SobelXFilter().filter( j ) # x gradient l = SobelYFilter().filter( j ) # y gradient m = AddFilter().filter( k, l ) # add gradients c = ImageViewer() # show result image c.updateImage( i ) c.showImage() For parametrized filters, you can use the following idiom: from hades.models.imaging import * # step one: initialize and configure all filters # pf = PurpleDetectionFilter() pf.setP0( 30 ) # blue-red and blue-green difference threshold cf = ConstantColorFilter() cf.setP0( 0 ) # red cf.setP1( 0 ) # green cf.setP2( 50 ) # blue mf = MultFilter() sf = SubFilter() # step two: load image and run filter graph # i = ImageSource().loadImage( 'purple-fringing.jpg' ) m = sf.filter( i, mf.filter( cf.filter(i), pf.filter(i) )) # step three: show result image # e = ImageViewer() e.updateImage( m ) e.showImage() from javax.image import * ImageIO.write( m, 'JPG', 'result.jpg' ) | |||
Print version | Run this demo in the Hades editor (via Java WebStart) | ||||
Usage | FAQ | About | License | Feedback | Tutorial (PDF) | Referenzkarte (PDF, in German) | ||||
Impressum | http://tams.informatik.uni-hamburg.de/applets/hades/webdemos/00-intro/02-imageprocessing/colors.html |