The Bill's Delaunay Portraits program

About the Program

The program was written by me from scratch in Visual Basic 2010 (it's a FREE download, thank you so much Microsoft!). It took about a week of evenings to complete to the point where I was happy to sit and use it to create the Delaunay portraits rather than fuss with the coding.

It was designed to be as simple as possible while still being intuitive (well to me anyway), with editing features and obvious context menu functionality. I wanted an end product that would do what I wanted quickly and without too much messing about. For example, the Marilyn image in the Gallery was created in about 10 minutes, which is about my attention span for something like this.
 

The Interface

<- This is the tool on opening.

The File menu does all the obvious stuff, it lets you :

  • Choose a new picture to start working with
  • Save or read the entered point data to or from a file
  • Save the Delaunay Portrait to file in BMP, JPG, GIF or PNG format
  • Copy the image to the clipboard.

The options which are used while creating the portrait are in the tool bar to the left.

There is a progress bar and point and triangle status information on the status strip along the bottom.

On loading the input picture, the drawing area resizes to accommodate the image. there are no resizing routines in the program, although it would be fairly trivial to add them. I simply resize the image I want to work with to somewhere from 400 to 800 pixels wide/high before I load it.

 

Using the tool

I would typically start by just adding points to the main and obvious outline locations as shown here.
  • Points are added by left mouse click
  • Left mouse click on an existing point, hold and drag moves the point
  • Right mouse click on a point automatically deletes it

 

It is easier at first to just see the points as they are added, although you can check the "Lines" option and increase the "Opacity" to see the Delaunay calculation in real time as you add the points.

 

 

Right mouse down on an open area and drag creates a marquee, which on right mouse release selects all of the points inside the marquee (and turns them red on the screen) and opens a small context menu.

The context menu allows you to delete all of the points that have been selected

More usefully it allows you to automatically generate points within that area. The routine that does this uses the 2 parameters "color block size" and "Allowable proximity" to calculate where the new points will go. The smaller each of these is, the more points are generated.

This screenshot shows the points that are automatically generated after I selected the area around each eye and the nose, and am about to do the same for the mouth area.

The "Optimize spots" action just goes through all of the points in the array and eliminates any that are close in color to the surrounding triangles - or in other words are sort of redundant. The "Optimize" parameter lets the code know how close in color the point has to be to the triangles color to qualify for deletion. This helps speed up the calculation and plotting.

With the code as it is right now, I get fed up waiting for real time refresh of the Delaunay calculation if there are more than 400 or so points so I either delete points using the "Optimize" function or turn off the "Auto update" feature. Turning that back on redraws the picture.

And here is the result of about 2 minutes work.

Yes, pretty grim, but it is a good place to start from before you get going with the detailed point placement. This is a purely aesthetic judgment at this stage and you would just use the opacity and turn on and off the point and line display as needed to get the results you want.

5 minutes later, a few points added, a few deleted and here you go.

                 

 

Ps. I am not a programmer, I code for fun and the occasional intellectual challenge. I also have a full time day job doing something completely different. As I mentioned elsewhere, I have no intention right now of releasing either the code or the executable for this tool.