![]() |
VOOZH | about |
In this article, we will be going to implement Python OpenCV - BFMatcher() Function.
Prerequisites: OpenCV, matplotlib
BFMatcher() function is used in feature matching and used to match features in one image with other image. BFMatcher refers to a Brute-force matcher that is nothing, but a distance computation used to match the descriptor of one feature from the first set with each of the other features in the second set. The nearest is then returned. For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches of descriptor sets. So in order to implement the function, our aim is to find the closest descriptor from the set of features of one image to the set of features of another image.
Sample input images:
To install prerequisite modules, run the following commands in command prompt or terminal.
pip install opencv-python==3.4.2.16 pip install opencv-contrib-python==3.4.2.16 pip install matplotlib
Code Implementation:
Explanation:
You can see the output. In the below output overall matches are 5. Whether the good features with our logic are 4.
Output:
We will see the output image that is plotted or shown by the program: