Processing of the raw image
In this step, the raw image is read and initial adjustments are made to obtain the following steps:
- Image 2: A slight Gaussian blur of 5 pixels is added to reduce unwanted artefacts such as paper artifacts or drop shadows on the original image
- Image 3: Next, a canny edge detection algorithm is applied using the OpenCV Python toolbox to detect the edge. First, the intensity gradient is found for all pixels in the image. The maximum peak in gradient is found for all pixels by comparing neighbouring pixels. This step is essential if the original image is drawn with a soft sharp. Next, true edges are found. The gradient of those pixels are above a certain threshold value or directly connected to pixels which are. Minimum and maximum thresholds of 10 and 200 are used respectively, which have proven to robust choices for a wide range of drawings.
- Image 4: Last, the image is inverted and a clean image of the airfoil is obtained.
Finding the concave hull and extract surface coordinates
In this step image 4 shown above is converted to an actual object with x–y coordinates from the surface are extracted. One common approach is the convex hull, which is smallest set of points that surround an object. For this airfoil, the set of points for the convex hull is shown below:
This is obviously not the best representation of the object as the lower is cut off. Instead, the concave hull algorithm by Andre Lister is used. In contrast to the convex hull, the concave hull is not unique and depending on a user-specified value, the set of points will look like:
With a tolerance of 0 the airfoil is cut on several places as points on the opposite side are detected. For a tolerance of 200 or infinite, the airfoil shape is not represented with sufficient accuracy. Here a tolerance of 40 is chosen as a compromise.
Detecting the airfoil cord and make adjustments
In this step the cord is detected and the airfoil is rotated. First, a distance matrix between all points is computed. The longest distance is assumed to form the chord of the airfoil. All points are rotated accordingly so that its angle with horizontal is 0. Next, the coordinates are scaled so that the chord length is 1. Then, the coordinate set are rotated according to the user-specified angle of attack.
Creating the surface file (.stl)
In this step an actual 3D surface shape is created. The coordinate set is extruded in the third dimension and triangulation algorithm provided in the matplotlib library is used to form triangles. Next, the triangles along with vertices (points) are saved to form the .stl file.