MATLAB Code For Object Detection in a Cluttered Scene Based Point Feature Matching

by admin in , , on July 26, 2020

This code shows how to detect a particular object in a cluttered scene, given a reference image of the object. This code uses an imbedded pictures in Matlab that you can change it any time.


This code presents an algorithm for detecting a specific object based on finding point correspondences between the reference and the target image. It can detect objects despite a scale change or in-plane rotation. It is also robust to small amount of out-of-plane rotation and occlusion.

This method of object detection works best for objects that exhibit non-repeating texture patterns, which give rise to unique feature matches. This technique is not likely to work well for uniformly-colored objects, or for objects containing repeating patterns. Note that this algorithm is designed for detecting a specific object, for example, the elephant in the reference image, rather than any elephant. For detecting objects of a particular category, such as people or faces, see vision.PeopleDetector and vision.CascadeObjectDetector.

Step 1: Read Images:

Read the reference image containing the object of interest.

Read the target image containing a cluttered scene.

Step 2: Detect Feature Points:

Detect feature points in both images.

Visualize the strongest feature points found in the reference image.

Visualize the strongest feature points found in the target image.

Step 3: Extract Feature Descriptors:

Extract feature descriptors at the interest points in both images.

Step 4: Find Putative Point Matches:

Match the features using their descriptors.

Display putatively matched features.

Step 5: Locate the Object in the Scene Using Putative Matches:

estimateGeometricTransform calculates the transformation relating the matched points, while eliminating outliers. This transformation allows us to localize the object in the scene.

Display the matching point pairs with the outliers removed

Get the bounding polygon of the reference image.

Transform the polygon into the coordinate system of the target image. The transformed polygon indicates the location of the object in the scene.

Display the detected object.

Step 7: Detect Another Object:

Detect a second object by using the same steps as before.

Read an image containing the second object of interest.

Detect and visualize feature points.

Extract feature descriptors. Then Match Features. Display putatively matched features.

Estimate Geometric Transformation and Eliminate Outliers

Display Both Objects

See the Video:

Click here.

Recommended For You:

Codes and Articles:

2 Sales

Share Now!

Release Information

  • Price


  • Released

    July 26, 2020

  • Last Updated

    July 26, 2020

  • File Included

    MATLAB Code Only.

  • File Size

    0.02 Mb

  • Compatible With

    Matlab R19

Share Your Valuable Opinions