All it started when I was watching a movie clip YouTube video from one of my favorites movies Interstellar known as the Docking scene.
Spoiler alert!! if you haven’t watched the movie I would suggest you watch this Christopher Nolan’s masterpiece and with breathtaking background score by Hans Zimmer
In the Scene when Cooper (Matthew McConaughey) tries to save the Endurance ship(which is a space station) from falling into the atmosphere of a planet and getting destroyed. He does that by trying to dock the Ranger ship(a small space ship) to the Endurance ship and pull it out from the gravitational field of the planet. So to dock the Ranger ship to Endurance the small ship needs to match the rotation speed of the endurance ship and In that scene, Cooper (Matthew McConaughey) asks the AI robot(CASE) to analyze the Endurance Rotation speed.
And at that moment as a data scientist, it popped into my head how the robot has figured out or analyzed the rpm of the Endurance ship. For that, we need a device called a Tachometer which measures the rotation speed.
Of course, there are many different ways it can be solved like using contact-based methods i.e. using physical sensors. Non-contact-based methods i.e. leaser based, optical frequency-based, electromagnetic flux-based, etc. but as I am into machine learning I thought of solving this thing using computer vision or vision-based approach.
A Tachometer is an instrument that measures the rotation speed.
Here we are trying to implement a non-contact-based method that doesn’t require installing any sensor devices on the Endurance ship.
There are two different ways to calculate the RPM
- Instantaneous measurement In this method, we are restricted to mechanical or electrical instruments that indicate instantaneous values of speed in revolution per minute.
- Average speed measurement In this method, the measurement relies on the repetition of a certain event like the crossing of an object, reflection of a laser beam, etc., and then comparing it to a time reference. In our case measuring the time difference between two frames of a video. Since the time interval between two frames is not infinitesimal so the output is average by nature.
- Frame capturing: From the video one frame is captured and store temporarily in-memory
- Time sampling: we will also collect the time stamp associated with the image or frame we have captured from the video. After images are retrieved from the temporary place and zoomed to the desired area.
- Extracting edge information: In each iteration, only an image frame with one edge is passed to the next step. That is because that the zoomed area is chosen carefully to capture the ring airlock or command module entering this area. The previous step resulted in the initialization of a counter for a number of ring airlocks or command modules passing the zoomed area. Afterward, the counter will not increment until a frame containing more than one edge is detected. The iteration in this step is stopped when the counter reaches a preset number.
- Speed calculation :
Retrieve the time stamps array from frame 1.
Retrieve the accepted frame numbers frame 2.
Taking the difference in time between the timestamps of the selected frame numbers.
Note: The image processing algorithm gives different results when lighting on the surface changes. It can be solved by advancing the image processing techniques that can distinguish between shadow, glare, and variable background.
Thanks For Reading.