Arkan

Arkan is designed to convert border of a raster mask (selection of an object in scene) or any closed polyline into B-spline (piecewise cubic Bezier curve) representation spread widely in vector graphics packages. Arkan chooses the best position both for node points (junctions of adjacent Bezier polynomial pieces) and for control points, which don’t lie on the curve but only affect its shape. Minimum description length approach powers the program. In addition to its unique outlining capabilities Arkan features nice and friendly user interface (see screenshot).

It’s typical task in computer graphics to describe contour of raster masks in terms of a set of cubic Bezier curves. For example, to allow changing (interpolation) of the mask during the time in a compositing environment, such as Adobe After Effects. Currently this task is performed manually for many frames and it’s really painful even for a skilled computer designer.

Arkan screenshot

Arkan can operate in one of two modes:

Features & Benefits

Tutorial

In this tutorial you will know how to use Arkan in semi-automatic mode. No tutorial for automatic contour outlining is provided since it’s too trivial.

Follow the steps to reconstruct curve for given bitmap.

1. Launch Arkan and open this mask through File|Open… menu command. (To save the mask in whatever folder you wish just press right mouse button in your browser and choose ‘Save Picture As…’). Arkan can load only bitmaps in BMP format with 1 bit per pixel.

It is very simple to make 1bpp BMP if you have not it yet. Open your image in standard picture editor Paint, that is coming with every version of Windows and can be found in Accessories folder of Start menu. Then save it as 'Monochrome bitmap'. That's all! The same result can be archived with Adobe Photoshop or most other image packages.

2. Select Pin Tool (press P key) and make two clicks with right mouse button at the corners of the polyline. Appeared blue circles symbolize that junction with a sharp bend is allowd in each of them.

3. Press PolyBezier|Build

4. To increase the quality of fitting permit the program to insert one more Bezier piece. Now click left mouse button to allow only smooth junction.

5. Press again PolyBezier|Build

Adobe After Effects plug-in

The plug-in is installed together with Arkan. When you run After Effects next time the new item is inserted in Edit menu: “Paste Mask”.

To copy built mask

The plug-in was tested with AE 5.5, AE 6.0, AE 6.5.

Reference

Tools

Arkan has several tools that you can operate inside the View window.

Hand

The Hand tool is intended for panning the image in the View window.

When the Hand tool is active, use the keys , , , to move the image.

When any other tool is active, press CTRL to switch temporarily to the Hand tool.

Zoom

The Zoom tool is intended for scaling the image in the View window. When the Zoom tool is active:

When any other tool is active, press CTRL+ALT to switch temporarily to the Zoom tool.

Pin Junctions

The Pin tool is intended for setting round areas where junction between two Bezier pieces should be located. Pinning the first area switch the program to semi-automatic mode. When Pin tool is active:

Menu

Item Description
Save what you see in a vector graphics file
Copy control points of computed Bezier spline in the Clipboard. This can be used to pass the spline into After Effects, details.
Erase computed Bezier spline
Computes the best Bezier spline that approximates the current polyline, this may take long time
Save built Bezier spline in a monochrome bitmap file
Remove all the pins
Copy position, size and type of the pins in the Clipboard
Paste new areas from the Clipboard in addition to existing pins
Show poly Bezier spline as it was assembled from estimations before rendering
Show poly Bezier spline as it was finally rendered
Emphasize points where two nearby Bezier pieces meet together
Show tangents (and hidden control points) at junctions of Bezier polynomials
Fill interiors of the polyline and splines if they are visible
Show discrete contour to be approximated by several Bezier pieces
Show user-defined areas, in each of which single junction point should be placed during next Build operation

Parameters

Name Meaning
Estimation Estimation of various possible bezier locations is almost requied if you don't define any areas, and desired if search areas are large enough. If you decided to turn off the estimation, then it's arguably a good idea to boost Rendering|Max Iterations parameter.
Max Iterations Limit for the iteration number, no more iterations can be made even if the curve does not fit the points.
Oversample Factor Oversample factor is multiplied on the number of nodes in a piece of approximated polyline to obtain the number of points, lying on the curve, each of which is pulled to the nearest place on the polyline. The more the oversample factor, the more fitted curve resembles the polyline, but more iterations are required and each iteration takes more time.
Stop Mean Discrepancy Iterations are stopped after mean discrepancy (per polyline's node) reaches that value.
Assembling Assembling phase goes after all possible subcontours were estimated, best Bezier curves for them are known.
Min Junctions The minimum permitted number of polynomial pieces in optimal spline. If no spline is possible to create using such big number of Bezier polynomials, then this number is automatically decreased.
Max Junctions The maximum permitted number of polynomial pieces in optimal spline. If no spline is possible to create using such small number of Bezier polynomials, then this number is automatically increased.
Penalty for a Junction Discrepancy of fitted curve is increased by this amount with each additional junction on it.
Penalty for a Sharp Bend Specifies maximum penalty per junction for the loss of continuity. The penalty in each case depends on the measure of discontinuity.
Rendering Rendering takes place after the positions of junctions on the polyline is determined, typically during estimation. Rendering is aimed to dispose finally Bezier control points with high precision (higher than it was made during estimation).
Fit Whole PolyBezier During estimation the fitting is made on the per piece basis. It sometimes leads to bad suiting of adjacent Bezier pieces and to the necessity of junctions to coincide with nodes of polyline. Fitting curve as a whole means that all controls points are matched in coordination and it allows overcoming of the mentioned shortcomings.
Estimated Discrepancy Discrepancy of the best Bezier polynomial found during estimation from the polyline plus the penalties.
Junction Count This is the number of polynomial Bezier pieces and in the same time the number of the points where they meet.
Assembled Junctions All splines containing up to this number of Bezier polynomial pieces (and junctions between them) were inspected.
Total Length This number is the length of the polyline in sizes of bitmap's pixels.

Examples

3 Balls

Bitmap

Chieftain

Bitmap

Letter "m"

Bitmap

Awards

5 stars rating 5 stars ratingEditor's Choice Softpedia Pick 5/5100% Free, Softpedia certified4,5 stars rating 5 stars rating

Free Download

Arkan.exe (installer, 1.4 Mb) for Windows NT/2000/XP/2003

Arkan Versions History

http://PatchMaker.net/Arkan/
mailto:Arkan1 (at) PatchMaker.net

© Pixmart LLC 2004. All rights reserved