Archive for the 'de.je2050.*' Category

Some updates

I added two the Imageprocessing Library some new blurs. RadialBlur, ZoomBlur and GeometricDisplacedBlur. The GeometricDisplacedBlur is very nice, because you can use any GeometricMap with this filter.

I also added a RedEyeRemoval and made some updates to the Color class. Some other filters have been updated as well. I will focus now on some examples and more GeometricMap objects. I am also thinking about filters for HSV color correction and this stuff. But that is not very hard since it is only the ColorMatrix that has to be extended. I am also trying to find good ways for texture synthesis (that will not freeze Flash for 10 seconds).

If someone has any idea for filters that are missing just post it here please.

Render, noise and morphological filters

Dilation

I had a lot of stuff on my mind the last days (besides the Wiimote). Check the documentation for nice pre-views. Here are the resuts:

de.popforge.imageprocessing.filters.*

  • Closing
  • Dilation
  • Erosion
  • Opening
  • Outline
  • TopHat
  • Curves
  • Blobs
  • CellGenerator
  • Corona
  • FractalPlasma
  • MakeTileable
  • Mandelbrot
  • OldschoolPlasma
  • Tile
  • AverageCut
  • MedianCut

de.popforge.imageprocessing.geom.*

  • Curve
  • StructuringFunction

Curves

CurvesI think that I would sell this if I were an artist. Unfortunately I am not. What you see here is a fractal plasma with applied Curves filter. The UI in this example is of course not tweaked. But you can add and remove points from the curve. Also there are some other options like changing the interpolation etc.

Let’s do some serious art!

It is also nice that I have no lags in the stand-alone player even if I use live mode.

Library updates

Just after the last release I have a couple of updates ready to use. Here is a list of new stuff:

  • QuickNormalMap (thanks to Ralph Hauwert)
  • DisplacementMap
  • GeometricDisplacementMap
  • QuickBumpMap (thanks to Ralph Hauwert)
  • Ripple
  • Spherize
  • Twirl
  • InterpolatedPlasma (thanks to toxie^ainc. and Hopper)
  • SinePlasma (thaks to tocie^ainc. and Hopper)
  • Interpolation (bicubic, bilinear, nearest neighbour)
  • Set of mathematical described displacement maps (RippleMap, SphereMap, TwirlMap)

As you can see it is growing. I am also happy about the nice help I got. There is a lot more to implement since I got the ok to use some rendering filters that theese demo-scene people use to create textures at runtime.

New ImageProcessing Library Version


There is a new release of the ImageProcessing Library out for you people. I do not have that much time to spend but I hope that this is a helpful library and will even grow a lot.

Here is a small changelog:

  • Publish class util to send images in an easy way to sockets or websites
  • Format exporter (PNG, JPEG)
  • New core class for multiple layers
  • ToneMapping filter
  • Noise filters (GaussianNoise, UniformNoise, PerlinNoise)
  • Drawing util

I guess that there are a lot of small changes here and there but nothing special. I also want to implement some more filters later maybe. Right now the next thing I really would like to have is an online playground where you can load pictures from flickr or take snapshots from your webcam, mix them together and save them. The only problem is that this needs some sort of GUI and this is where the problems begin and my timescale shrinks. So you will have to wait for that. I am also looking for contributors. If somebody wants to share his filters or effects just send me an e-mail (address is on je2050.de).

Here is also a code sample. I will come up with more stuff and update the zip-archive aswell. This little piece of code generates the image you see on top of the post.
[as]var backGround: Image = new Image( 700, 200, ImageFormat.RGB );
var text: Image = new Image( 700, 200, ImageFormat.RGB );
var textGlow: Image;

Drawing.drawText( text, 0xffee3399, 120, 20, ‘ImageProcessing Library’, ‘verdana’, 32, true );

textGlow = text.clone();

new PerlinNoise( 700, 200, 8, 0xABC, false, false, PerlinNoise.CHANNEL_RED | PerlinNoise.CHANNEL_GREEN | PerlinNoise.CHANNEL_BLUE ).apply( backGround );
new Blur( 8, 8, 3 ).apply( textGlow );

var layerManager: LayerManager = LayerManager.fromImage( backGround );

for ( var x: Number = -240; x < layerManager.width; x += layerManager.width / 100 )
Drawing.drawLine( layerManager.backgroundImage, 0×80008888, x, 0, x + 240, 200, true );

for ( var y: Number = -240; y < layerManager.height; y += layerManager.height / 50 )
Drawing.drawLine( layerManager.backgroundImage, 0×80888800, 0, y, 700, y + 240, true );

new GaussianNoise( .16, true ).apply( backGround );

layerManager.addLayer( new Layer( text, 1, BlendMode.ADD ) );
layerManager.addLayer( new Layer( textGlow, 1, BlendMode.ADD, -5, -5 ) );
layerManager.addLayer( new Layer( textGlow, 1, BlendMode.ADD, 5, 5 ) );

var pixelate: Pixelate = new Pixelate( 3 );
pixelate.apply( text );
pixelate.apply( textGlow );

layerManager.merge();
textGlow.dispose();
text.dispose();

layerManager.backgroundImage.updateHistogram();

var histoGram: Image = Image.fromBitmapData( layerManager.backgroundImage.histogram.getBitmapData( 700, 400 ), ImageFormat.RGB );

layerManager.addLayer( new Layer( histoGram, 1, BlendMode.ADD, 0, -200 ) );

layerManager.merge();

histoGram.dispose();

new ContrastCorrection( 1.4 ).apply( layerManager.backgroundImage );
new LevelsCorrection().apply( layerManager.backgroundImage );

addChild( new Bitmap( layerManager.bitmapData ) );[/as]

Upcomming Imageprocessing Library Release

I am sorry that I do not have much time theese days but I am planning to release a brandnew version of the imageprocessing library. This time I hope some of you already used it and have some ideas about improvements.

Here is the plan for the new features:

  • JPEG encoding (complete, using modified version of Tinic Uro’s encoder)
  • PNG encoding (complete, using modified version of Tinic Uro’s encoder)
  • Experiments on very fast mean values (using a Matrix approach orginally comming from Mario Klingemann)
  • Implementation of a fast interpolated/non-interpolated warp filter (using tesselation technique by AndrĂ© Michelle)
  • Interpolated levels correction
  • Simple drawing API (anti-aliased and normal lines complete, text and other primitives missing)
  • New core class for a layered image (supporting also blend-modes on layers)
  • Full alpha-channel support

As you can see some of the stuff is already complete. Other stuff is missing. The warp filter for instance has never been tested by me before but I have a lot of code here to implement that beast on a fast way. I could also think of two resolutions like I have done it with the sepia filter (QuickSepia and Sepia classes). Beacuse creating a simple warp filter using bilinear interpolation is not that hard. The only problem is, that it will be slow. The other technique uses the Flash drawing API to warp the image (and also for interpolation) but it is not 100% correct.

Another problem is that I lost the batch file for the ASDoc generation. But this is of course a minor issue. Stay tuned!

ImageProcessing Library (beta)

A first beta release of the imageprocessing library can be downloaded right now. I like to experiment with my webcam and images. This is a fast library with a couple of implemented algorithms. Have a try and tell me what you think about it.

ImageProcessing Library
ImageProcessing Library Documentation

Updates:

  • Added QuickSepia filter which is using a ColroMatrixFilter instead of YIQ transformations (de.popforge.imageprocessing.filters.color.QuickSepia)
  • Added Color.add() and Color.substract() for easier blend-mode calculations.
  • The zip-file contains now the laboratory sources and a batch to compile them.

ImageProcessing library

LevelsCorrectionGot an idea what imageprocessing means? You always wanted to create som eyeToy like game, but it is a struggle to fight against bad lighting? You know that AS3 is fast. So what about some real-time imageprocessing?

This is a personal point of interest and I had a lot of fun creating this library. It is currently in an early state but it is very difficult to create acceptable results. This library is not very scientific but the output is nearly the same. For some reasons I had to speed up some processes of real imageprocessing. I will continue the fun and add some filters. I do not know from which categorie, maybe morphologic or some more basic binary stuff like Erosion or Dilation (and therefore Closing).

Have a small preview here. I will post either the sources (after having another look) or a compiled SWC. But Flex Builder 2 is some sort of annoying. If I compile the SWC with the compc it works fine until I want to include the SWC into a project. The project also compiles but there is no auto-completion in Flex Builder.

ImageProcessing Library Documentation

AS3 WebCam LevelsCorrection (updated)

The labThe imageprocessing-lab yields fruits. What you can see here is automatic levelscorrection applied on a 160×120 image. The fps decrease a little bit because I have to calculate the histogram three times. Two times for the histogram images and one time for the levels filter. So there would be another speed boost if the histograms are not shown.

My webcam is doing the auto-levels correction already. This is shit, because it is hard to correct corrected levels. And you will not see a big difference. Maybe your webcam is not doing this and you will achieve the grateness of this filter.

After a lot of tests I have got my favorite image format now. It is fast and easy to create new filters. Basically the image consists of an array which holds a BitmapData for each channel. The BrightnessCorrection filter works for example like this:
- Create a look-up table for new brightness values. This is for every channel the same.
- Apply paletteMap to every channel of the image

Easy, huh? And fast. paletteMap is one of the fastest native functions. It is even faster to use BitmapData.paletteMap instead of BitmapData.threshold. The basic function to binarize a picture is done by applying paletteMap with a palette of 0 and 1. This is faster then using threshold!

One last thing. The histogram is way to slow in my eyes. I am still searching for a solution to speed this up. Currently I read the value of each pixel using getPixel. This makes width * height iterations. Then I tested BitmapData.threshold with the == operator. Of course only 256 (non native) iterations but totally 256 * width * height. It was very slow. Another test was using a combination of BitmapData.fillRect and BitmapData.compare. Also slower than reading every pixel.

Maybe another good solution? The comments function is working. I am waiting for your suggestions :-)

If you can not see any difference in the two pictures. Try holding your hand in front of the webcam. This will result in very dark input and you see the levels-correction working.

Update:
Compiled using Flex Builder 2.0 Beta 3 which Adobe released a few hours ago. Now there is a big performance boost in the whole ImageProcessing. I do not really know where it comes from. setPixel seems to be slower than in Beta 2 but since I do not use setPixel at all in the whole package everything is faster. I think that some native functions (also filters) work faster.

The example is doing the following:
- Webcam whith (some sort of) double framebuffer
- Convert BitmapData to Image class with grayscale conversion (using BT709 algorithm)
- Render original Image
- Calculate and draw(!) original histogram
- Apply automatic levels correction
- Apply sharpening
- Render filtered image
- Calculate and draw histogram of new image

This runs at ~20fps for me in the browser. Disabling both unneeded histograms increases fps in standalone player to ~50.

AS3 Imageprocessing library

Various filters

Continuing with my work on some “research” releated to webcam and object recognitionI got a little bit addicted to imageprocessing. You can see some of a lot of working filters here. The latest beauty is the automatic levels correction by stretching the histogram. The auto-levels takes 250ms for a 640×480 px image which is not bad. Most filters are look-up based.

Thr problem is that I can never decide what seems to be the best and fastest method. An image is of course built from a BitmapData input. First I started with a BitmapData for every color-channel (4 bitmaps for a RGBA image). I am currently using an Array for every channel, because looping through the whole image is faster and I get rid of the get-/setPixel method.

But some new ideas using native methods could speed up everything again. I am not sure, but palletteMap has the potential to make all look-up-table based filters incredible fast. I will give it a try…tomorrow maybe.




Close
E-mail It