# Tracking Sensor Location by Video Analysis in Double-Shell Tank Inspections
## 2 Materials and Methods
### Tracking Sensor Location by Video Analysis  
The method described above for predicting sensor movement from video acquired by cameras on the crawlers pulling the ultrasonic sensor through air slots is not practical over large distances without automated target selection and matching in a later frame. Automation was achieved by application of Scale Invariant Feature Transform (SIFT) [15] and Fast Library for Approximate Nearest Neighbors (FLANN) [16] in Python's OpenCV Library [17]. SIFT extracts keypoints and computes their descriptors (invariant feature transforms), which FLANN uses to find matches of those keypoints in later frames. Links in [15; 16] provide additional information about these algorithms. Figure 6 shows the location of a keypoint in frame 4100 of the video taken during inspection of air slot 31-1 in DST AP-107 [12], which we call the \"start\" frame, matched to the same keypoint in frame 4117, which we call the search frame. Coordinates of keypoints are written to an output file for later calculation of how far the sensor moved in the time between the frames. The frame count between start and search frames is mainly determined by the illumination of the channel by lights on the front and rear crawlers because large changes in brightness between start and search frames increase mismatches. After a successful match, the search frame becomes a new start frame to match keypoints with a new search frame separated by the same frame count as before. If a search for matching keypoints fails, the frame count is decreased by one successively until a successful match is found  
Figure 5: View from rear camera showing graph-paper-lined channel marked with points that are 50 mm apart on the top edges. Spot where the beam from a laser pointer attached to the camera hits the graph paper covering the channel entrance, which shows that the camera is off center toward the right-hand wall of the channel. or the count between start and search frames is less than a threshold. In the latter case, a gap equal to the desired constant frame count is entered into the output table, and a new start-search sequence is initiated. These gaps are filled later by manual target matching in the frames that border the gap. After gap filling, the coordinates of matched keypoints in each pair of start-search frames are used to calculate how far the sensor has moved in the time between frames. The absolute location of the sensor is the accumulation of many short measurements of size determined by the optimum count between start and search frames. The robot is expected to move at approximately constant speed between sites of data collection; consequently, accumulated measurements as a function of frame number are approximately linear. Fitting a line to these data reduces noise in the absolute location and may reveal large errors in distance measurements that require correction by reexamining the video. The method of tracking sensor location described above cannot be implemented while the crawler carrying the camera is negotiating a turn in the air slot because mismatches increase, and the slope of the edge that contains a target cannot be accurately determined. Consequently, when the front camera comes within 6 inches of a turn, the video for tracking sensor location is switched to the camera on the back crawler. The same method of measuring distance moved applies to the rear camera based on the reduction in the apparent width of the channel as the RAVIS moves away from a target selected in an earlier frame. When the front crawler has completed the turn, video is returned to the front camera. Additional video to test our method of sensor tracking was obtained using a section of air slot in our laboratory, donated by the Pacific Northwest National Laboratory (PNNL), that contains 2 turns of the bifurcated air slot network shown in Figure 1. A 3-car mockup of the RAVIS, shown in Figure 3, was constructed based on dimensions of the crawlers and sensor, which was also provided by PNNL.