Automatic Shockwave Identification
- February 24th, 2010
- Write comment
The following project spawned from a simple homework assignment. The purpose of the assignment was to identify the angle of the shock-wave formed on an object. Provided were photographs from the schlieren visualization lab that we had done the previous week. What I have written is a matlab script that finds the finds the shock-wave and draws a line on it. From the beginning and ending points the angle can easily be discerned. What follows is the progression of images produced as the various processes and filters are applied to the image.
The image is first converted to grayscale. The contrast is then increased.
The increased contrast has also made the image more grainy. The image is smoothed using and adaptive filter to reduce the number of fake lines that will be detected in the next step.
An edge finding algorithm is applied which looks for sharp changes in the color of the image. This creates a binary image (black and white) where only the edges are shown.
In this step we want to retain the object which created the shock-waves as well as the shock-waves. The object has an unbroken outline making it the largest contiguous object in the image. We also know that the shock-wave will be mostly contiguous and will importantly come very close to the object. A region closing algorithm is applied to the image which causes the regions to expand and merge together.
Now the largest contiguous region can be selected from the image.
This is used as a filter against the image from step 3.
At this point a hough transform is applied to the image. From this the “houghlines” function extracts end-points for lines. Finally this data is over-layed on to the original image. There is also a bit of code at the end for collating multiple lines along the same feature into a single item on a list. The plan was to use this list to find shock-waves and their angles.
There are a number of areas where this experiment could be expanded. Importantly, the algorithm needs to run against other images to in order to tune out oddities that are likely to occur. The code itself could be generalized so that it is easier to hand it new information. The data generated could also be processed better to amalgamate discontinuous lines. This was started, but never completed. There is also the possibility of adding a method to cut-out the object that generated the shockwaves from the images. This could be useful for reducing the irrelevant lines that are generated.
I have appended the original code I used for this below. Be advised that the code is very rough in spots and has no comments. This code will not work without matlab’s image processing libraries.