Digitising Geometry from Line Art Raster Images

Hull Definition is not always about Design

While we like to think about all the beautiful yachts we might design the majority of a Naval Architect's work is often with existing vessels in the management and maintenance of a vessel's life. Frequently we'll need to perform analysis and propose changes. To support these processes we'll often have to analyse something dependent on the hull and often the definition is only available as a plan or as offsets. It's tedious to measure a hull definition from a 2D plan but PolyCAD offers an alternative, the ability to insert a scanned image into the design environment to allow tracing of geometry over the top.

Modellers too will find this capability useful allowing them to turn 2D source information into a 3D surface.

Hard Copy!

Two dimensional plans and paper hard copy has been the primary means of capturing design and construction information for over four hundred years. However, in the last decades the means to capture information digitally has become routine and the need to maintain a digital representation of design and engineering information is superseding the paper equivalent. That said, hard copy is resilient and robust. A considerable amount of 2D geometry has been authored in the last century, first by hand and then using Computer Aided Design tools where the information was either printed or plotted. It is relatively easy to convert a 3D object into a 2D representation by projecting and sectioning but reversing the process is a challenge. There is a need to interpret the lines and styles particularly in the case of a Lines Plan. This isn't something computers are good at, well, not just yet.

Measuring Lines

Use of the Engineer's scale to capture offsets from a Lines Plan remains the primary means of capturing the geometry of a hull form from a 2D plan. Offsets are captured by measuring with a particular pattern across the plan in the form of coordinates, usually to a fairly uncontrollable degree of accuracy. These coordinates are the typed into the CAD software as curves or a mesh of points. If the points capture a region of the surface poorly it's necessary to return back to the plan and measure. Given the size of Lines Plans and the amount of space available on the modern office desk it's likely that this may involve walking to another part of the room. It is a tedious activity that requires patience.

Measuring Lines Plans using an Engineer's scale is tedious and inefficient.

From a software developer's perspective, it's difficult to improve this process because the act of measuring and moving about the plan dominates the amount of time it takes to perform this activity.

Optimising the Measurement Process

Electronic digitizers improve this process by removing the need to interpret the Engineers' Scale, write down coordinates and type the data into the software. The improvement is achieved through specialised hardware and specifically designed software applications. But the challenges have started to appear with this approach. Firstly, the large format digitisers required for capturing plans, which may be a couple of metres long, are expensive because there isn't a large market for them. They tended to connect to computer using Serial interfaces and were slow to adopt USB connections. Given the pace that computer technology advances the useful life span of a digitiser may only be a couple of years because of Operating System changes and the need to have up to date drivers. Furthermore, Digitisers tend to be quite fragile and can break even with careful treatment. The biggest challenge is cost and it's unlikely that no-one other than a large Engineering office can afford these types of equipment.

Digitisers make the capture process easier but the hardware is expensive and not always supported when operating systems are upgraded.

Scanning: Bring the Paper inside the CAD Environment

While Digitiser technology has remained specialised, image scanning technology has penetrated all parts of the peripheral market. From the free combined printer/scanners included in a new computer purchase to the large format scanners used to convert paper drawings to their electronic equivalent in Engineering offices and copy shops. Plans can be captured as Line Art images and then viewed and processed inside software. The leap to proving capability to extract geometry from images is then only a small one and it doesn't have to involve any specialist high-cost hardware.

A matter of Interpretation: Electronically Digitising Lines Plans

Features to convert images to vector geometry can be found in many graphics software from Open Source tools like Inkscape to serious CAD Systems like AutoCAD. In general, these processes are dependent on algorithms like Canny Edge and Thinning techniques. The algorithm selection is quite important as techniques like Canny Edge capture contour of the line edges as they transition from white to black and then from black to white. Consequently, each drawn line may be captured by multiple geometric elements. Thinning, on the other hand, aims to identify the centre or median of the draw line but as an erosion process is used to reduce line thickness to the minimum it can means that detail is lost.

In most cases, these conversion tools will aim to make a vector equivalent of the raster image. This isn't of interest when rebuilding a hull surface from a Lines Plan. It's more important to understand how the original author translated the 3D Design into a 2D representation so that the important features can be extracted. The Tracing approaches above may be helpful but often too much geometry is generated especially considering that it's possible to regenerate a surface from a select set of offsets measured manually. The simpler solution can be to allow the software user to trace from the image as and when they need. Rather than try to create a complex algorithm to recreate the surface which is unlikely to be robust, we eliminate the need for desk space, the Engineer's Scale, writing down numbers, typing in and walking between workstations. The Plan Views can be visualised, calibrated in 3D to the correct dimensions and geometry traced over the top. It's the simplest solution possible.

Using Images in PolyCAD

Importing an Image into PolyCAD is straight forward. Once in 3D, the image can positioned and calibrated to make it ready for tracing. Presently jpg, gif, png, tiff and Windows bmp formats are supported and if the image contains different projections or view directions of the geometry it will be necessary to split out each view into separate images. Splitting views and orientating images so that they form an accurate orthogonal view can be acheived in the Image Editor.

Importing

The first step is to select the Image Plane tool button from the Curve page on the Tab Menu. Then, in the correct view orientation, drag a rectangle using the mouse. The Open File Form will now appear to select the Image file. Subsequently, the image will be imported and processed into the correct size.

Assembling

Once the image is loaded and selected the projection plane and position offset can be set. The boundary dimensions of the image can be set numerically. If the image is Edited, by pressing F2, the extents of the image can be set interactively using the mouse.

Images can be assembled in 3D to aid the regeneration of a hull surface.

If multiple views of the artefact are available, each view may be loaded in and assembled in the correct position. Typically a Lines Plan can be assembled into 3 different planes corresponding to the profile, waterlines and body plans.

Calibrating

The image now needs to be calibrated in the design environment to allow the tracing of accurately dimensioned geometry. In most situations the external dimensions of the image will be arbitrary sized and positioned as consequence of the scan dimensions or any image edits. These measurements cannot be used for calibration. However, there is often some reference information or a grid pattern in the image with known dimensions that can be used for calibration. When importing a Lines Plan obvious reference mark positions are base lines, center lines, design waterline etc.

Image can be calibrated to size using reference positions.

The calibration is performed by first interactively positioning a scaling rectangle so that its limits line up with the reference positions. Then press the Rescale to Window Dimensions button to display the calibration form. This has 4 boxes corresponding to each side of the scaling rectangle. Type the numerical dimensions corresponding to each edge as represented on the form and press ok to Rescale. If the scaling rectangle has been reversed or the image viewed from reverse the calibrated image may be correspondingly reversed. Perform the calibration again and it should return to the correct orientation.

Tracing

Once the image has been correctly positioned geometry can be digitised over the image. In general, the recommendation is to capture the lines of the image as Polylines rather than trace more complex curve types or surfaces. Once the Image has been capture as Polylines it will be easier to manipulate the more complex geometry types into position. Remember that the traced Polylines only have to capture as much detail as you need. If you trace too much detail then you could be spending more time on this than you need.

Once the image is calibrated geometry can be traced on top

When tracing a Lines plan, it is recommended to trace all the 2D image contours first and then update position of each curve in the 3rd coordinate subsequently.

When tracing geometry you may experience certain situations that hinder the process. For example, if the image is in front of the working plane the geometry may disappear behind the image. In this case, reposition the image plane slightly behind the geometry. When working on principle plane positions this may mean setting the plane position to -0.01. Depending on the colour of the design environment background, line colour and general image colour traced geometry may blend into the image. In this situation the colour of the image can be reversed, using the Negative Image Colour button.

Image Editor

An integrated Image Editor is now introduced into the application allow preparation and processing of images without the need to separate image processing software. The Image Editor provides a range of functions dedicated towards to the processing of line art images such as Lines Plans that may be imperfectly scanned or source image poor quality, such as from a photocopy.

Performing a crop operation in the Image Editor

A range of typical processing facilities allow images to be cropped, resized and new images created from a selection rectangle, which allows images to be imported and the extents adjusted before the image is projected into the 3D model. Image colours can be inverted, brightness or contrast adjusted, converted to grey scale, or black and white through a threshold filter.

Two lines drawn on a deformed image can be used to reorient it
ready for digitisation using rotation and skew transformations.

To resolve misalignment, images may be rotated or straightened to produce an accurate orthogonal view. Image rotation is achieved through angular adjustment to fractions of a degree. Alternatively, the image may be straightened by digitising a single orientation line that will rotate the image to the horizontal or vertical. Two orientation lines can be used to correct more complex distortion applying both rotation and skew to the image, making the draw lines horizontal and vertical respectively. Any grid lines within the image can been traced with these orientation lines to apply the corrections. Orthogonal grid lines can be overlaid onto the image by clicking on the rulers and dragging into the image content.

Cleaning up an image using the Despeckle filter

Image quality during tracing can be improved by applying a Despeckle filter which will remove isolated clusters of pixels and the thickness of image lines can be reduced to a single pixel by applying a thinning filter.

Reducing lines to a single pixel using the Thinning filter

X-Topology

Images are an excellent source of information for X-Topology surfaces and curve networks. Extending the best-practice approach to Image tracing it follows that, as mentioned above, the image should be traced with Polylines first, then assembled correctly in 3D. Usually, as its best to define the Primary Shape curves longitudinally, a trace of the sections of the body plan is all that should be necessary to capture surface shape. The X-Topology curves can then be fitted to the sections using intersection and either Spline or Least Squares fitting. Any boundary and feature curves will need to be extracted from the most appropriate views beforehand.

Detailed surfaces can be assembled using traced geometry