In the last post, I described how to create an image with random B&W patterns by using random noise and bandpass filtering. This time I will show an even simpler trick with ImageJ, the creation of an image with random bubbles.

Start as before by opening ImageJ and making a new image.

bubble1.jpg

Fill the originally black image with specified random noise of standard deviation 3.0 (Process > Noise > Add Specified Noise ).

bubble2.jpg

Next, choose Process > Filters > Minimum and set the “radius” to 20 pixels. This will replace the brightness value of every pixel in the original image with the smallest brightness value that can be found in its circular neighborhood of that radius.

bubble3.jpg

Next do an edge detection, from the menu Process > Find Edges. The resulting image looks like this.

bubble4.jpg

Finally, modify the brightness of the image and add contrast (both done in Image > Adjust > Brightness/Contrast).

bubble5

Now we have a quite good bubbles image, but it has a rather poor resolution, as can be seen by zooming in:

 

The solution to this is to use the Inkscape vector graphics program to “trace” the bitmap and then export it in a PNG file of a larger resolution. Choose Path > Trace Bitmap from the Inkscape menu and use the “Brightness Cutoff” to do this.

Screenshot from 2017-07-29 13-48-06

If this is done by producing a 2-color vector image (not by multiple brightness steps), the result and the zoom look like this:

bubble-vector.jpg

bubble-vector-zoom.jpg

So, no more pixelization or blurring. The Inkscape program is easy to use and shouldn’t cause trouble. Another way to do the same thing is to use some online image vectorization service.

More image processing stuff coming soon, have fun!

Save

Advertisements