Skip to content

TrumThuyLoi/SFND_2D_Feature_Tracking

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SFND 2D Feature Tracking

The idea of the camera course is to build a collision detection system - that's the overall goal for the Final Project. As a preparation for this, you will now build the feature tracking part and test various detector / descriptor combinations to see which ones perform best. This mid-term project consists of four parts:

  • First, you will focus on loading images, setting up data structures and putting everything into a ring buffer to optimize memory load.
  • Then, you will integrate several keypoint detectors such as HARRIS, FAST, BRISK and SIFT and compare them with regard to number of keypoints and speed.
  • In the next part, you will then focus on descriptor extraction and matching using brute force and also the FLANN approach we discussed in the previous lesson.
  • In the last part, once the code framework is complete, you will test the various algorithms in different combinations and compare them with regard to some performance measures.

See the classroom instruction and code comments for more details on each of these parts. Once you are finished with this project, the keypoint matching part will be set up and you can proceed to the next lesson, where the focus is on integrating Lidar points and on object detection using deep-learning.

Dependencies for Running Locally

  1. cmake >= 2.8
  1. make >= 4.1 (Linux, Mac), 3.81 (Windows)
  1. OpenCV >= 4.1
  • All OSes: refer to the official instructions
  • This must be compiled from source using the -D OPENCV_ENABLE_NONFREE=ON cmake flag for testing the SIFT and SURF detectors. If using homebrew: $> brew install --build-from-source opencv will install required dependencies and compile opencv with the opencv_contrib module by default (no need to set -DOPENCV_ENABLE_NONFREE=ON manually).
  • The OpenCV 4.1.0 source code can be found here
  1. gcc/g++ >= 5.4
  • Linux: gcc / g++ is installed by default on most Linux distros
  • Mac: same deal as make - install Xcode command line tools
  • Windows: recommend using either MinGW-w64 or Microsoft's VCPKG, a C++ package manager. VCPKG maintains its own binary distributions of OpenCV and many other packages. To see what packages are available, type vcpkg search at the command prompt. For example, once you've VCPKG installed, you can install OpenCV 4.1 with the command:
c:\vcpkg> vcpkg install opencv4[nonfree,contrib]:x64-windows

Then, add C:\vcpkg\installed\x64-windows\bin and C:\vcpkg\installed\x64-windows\debug\bin to your user's PATH variable. Also, set the CMake Toolchain File to c:\vcpkg\scripts\buildsystems\vcpkg.cmake.

Basic Build Instructions

  1. Clone this repo.
  2. Make a build directory in the top level directory: mkdir build && cd build
  3. Compile: cmake .. && make
  4. Run it: ./2D_feature_tracking.

How I Addressed Each Rubric Point

MP.1 Data Buffer Optimization:

  • I use the deque data structure to wrap the DataFrame struct. When the size of the deque equal to dataBufferSize I simply remove the first element and push next element on the back of the deque.

MP.2 Keypoint Detection:

  • I implement detectors HARRIS, FAST, BRISK, ORB, AKAZE, and SIFT with default parameter of the OpenCV library.

MP.3 Keypoint Removal

  • I create new std::vector to store all keypoints inside of the pre-defined rectangle. Then I loop through all keypoints and check inside rectangle condition and push them into the new std::vector if they are in.

MP.4 Keypoint Descriptors

  • I implement descriptors BRIEF, ORB, FREAK, AKAZE and SIFT with default parameter of the OpenCV library.

MP.5 Descriptor Matching

  • For the FLANN matching, I need to convert data type of the descSource, descRef to CV_32F before execute the match() function, and set k=2 for k-nearest neighbor selection.

MP.6 Descriptor Distance Ratio

  • If the distance of the best match < 0.8*(the distance of the second best match) then I choose that best match.

MP.7 Performance Evaluation 1

  • I log the number of keypoints on the preceding vehicle into ./results/sheet_keypoints_inside_rect.csv for all detectors-descriptor combination and all step of the main loop.

MP.8 Performance Evaluation 2

  • If the distance of the best match < 0.8*(the distance of the second best match) then I choose that best match. Then I log the number of matched keypoints into ./results/sheet_matched_keypoints.csv for all detectors-descriptor combination and all step of the main loop.

MP.9 Performance Evaluation 3

  • I log the time it take to process all 10 images for each detectors-descriptor combination into ./results/sheet_time.csv.
  • Top 3 detectors-descriptor combination I recommend are FAST + SIFT, SHITOMASI + SIFT, HARRIS + SIFT.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.2%
  • CMake 1.8%