But presence of an orb would often match up to feelings of disquiet or emotional intensity. This naturally led to speculation that the photographs might be evidence of some form of ghostly activity. Other people maintain that orbs are a trick of the environment. The rotation ones will probably match fine but the scale ones won't (i think decreasing scale is the worst). I also advise you to try the opencv version from the trunk (see opencv's site for compile instructions), ORB as been updated since 2.3.1 and performs a little better but still has those scale problems.
Goal¶
- We will see how to match features in one image with others.
- We will use the Brute-Force matcher and FLANN Matcher in OpenCV
Basics of Brute-Force Matcher¶
Brute-Force matcher is simple. It takes the descriptor of one feature in first set and is matched with all other features in second set using some distance calculation. And the closest one is returned.
For BF matcher, first we have to create the BFMatcher object using cv2.BFMatcher(). It takes two optional params. First one is normType
. It specifies the distance measurement to be used. By default, it is cv2.NORM_L2
. It is good for SIFT, SURF etc (cv2.NORM_L1
is also there). For binary string based descriptors like ORB, BRIEF, BRISK etc, cv2.NORM_HAMMING
should be used, which used Hamming distance as measurement. If ORB is using VTA_K3or4
, cv2.NORM_HAMMING2
should be used.
Second param is boolean variable, crossCheck
which is false by default. Ik multimedia ampeg svx v1.1.3 vst..rtas incl keygen dynamics. If it is true, Matcher returns only those matches with value (i,j) such that i-th descriptor in set A has j-th descriptor in set B as the best match and vice-versa. That is, the two features in both sets should match each other. It provides consistant result, and is a good alternative to ratio test proposed by D.Lowe in SIFT paper.
Once it is created, two important methods are BFMatcher.match() and BFMatcher.knnMatch(). First one returns the best match. Second method returns k best matches where k is specified by the user. It may be useful when we need to do additional work on that.
Like we used cv2.drawKeypoints() to draw keypoints, cv2.drawMatches() helps us to draw the matches. It stacks two images horizontally and draw lines from first image to second image showing best matches. There is also cv2.drawMatchesKnn which draws all the k best matches. If k=2, it will draw two match-lines for each keypoint. So we have to pass a mask if we want to selectively draw it.
Let’s see one example for each of SURF and ORB (Both use different distance measurements).
Brute-Force Matching with ORB Descriptors¶
Here, we will see a simple example on how to match features between two images. In this case, I have a queryImage and a trainImage. We will try to find the queryImage in trainImage using feature matching. ( The images are /samples/c/box.png
and /samples/c/box_in_scene.png
)
We are using SIFT descriptors to match features. So let’s start with loading images, finding descriptors etc.
Next we create a BFMatcher object with distance measurement cv2.NORM_HAMMING
(since we are using ORB) and crossCheck
is switched on for better results. Then we use Matcher.match() method to get the best matches in two images. We sort them in ascending order of their distances so that best matches (with low distance) come to front. Then we draw only first 10 matches (Just for sake of visibility. You can increase it as you like)
Below is the result I got:
What is this Matcher Object?¶
The result of matches=bf.match(des1,des2)
line is a list of DMatch objects. This DMatch object has following attributes:
DMatch.distance
- Distance between descriptors. The lower, the better it is.DMatch.trainIdx
- Index of the descriptor in train descriptorsDMatch.queryIdx
- Index of the descriptor in query descriptorsDMatch.imgIdx
- Index of the train image.
Brute-Force Matching with SIFT Descriptors and Ratio Test¶
This time, we will use BFMatcher.knnMatch()
to get k best matches. In this example, we will take k=2 so that we can apply ratio test explained by D.Lowe in his paper.
See the result below:
FLANN based Matcher¶
FLANN stands for Fast Library for Approximate Nearest Neighbors. It contains a collection of algorithms optimized for fast nearest neighbor search in large datasets and for high dimensional features. It works more faster than BFMatcher for large datasets. We will see the second example with FLANN based matcher.
For FLANN based matcher, we need to pass two dictionaries which specifies the algorithm to be used, its related parameters etc. First one is IndexParams. For various algorithms, the information to be passed is explained in FLANN docs. As a summary, for algorithms like SIFT, SURF etc. you can pass following:
While using ORB, you can pass the following. The commented values are recommended as per the docs, but it didn’t provide required results in some cases. Other values worked fine.:
Second dictionary is the SearchParams. It specifies the number of times the trees in the index should be recursively traversed. Higher values gives better precision, but also takes more time. If you want to change the value, pass search_params=dict(checks=100)
.
With these informations, we are good to go.
See the result below:
Exercises¶
Follow us! | Check our CAD apps |
Creepy Dungeons Step into the dark dungeons of legendary monsters as the bravest hero ever known. Pick your favorite hero, equip with weapons, magic potions, legendary items and explore the hidden secrets more. |
Orbs Match Fun addictive game for match-3 lovers!, playing it is very easy: just move the orbs to make matches of 3 or more before the orbs overflow or time runs out. more. |
Gem Twyx A twist for the puzzle and match-3 genere!, rotate gems to make matches, do lot of combos, collect special magic stones and bombs, play along many levels and game modes. more. |
Marble Craft A fun and addictive puzzle game, to play just move the marbles to connect 4 or more marbles of the same type, avoid the board getting full and keep an eye on the clock! more. |
Fruity Paths Play as Pip, who must fly his spaceship to different levels to collect fruit that is moving along paths. However, enemies are also moving along the paths, and will try to destroy Pip's spaceship! more. |
Golf Solitaire 4 in 1 Four classic solitaire card games in one app: Golf, TriPeaks, Pyramid and Black Hole. All of them very easy to play and highly addictive! more. |
Seasons Pairs A fun and gorgeous pairs matching memory game, featuring Christmas, Halloween, St. Valentine, Easter and Summer themes, a perfect game for kids and great for all ages! more. |
Jewel Match An addictive match 3 puzzle game, to play move the jewels to connect 3 or more of the same type. more. |
Minesweeper & Break the Code Two classic logic games of all times in one app: Minesweeper & Break the Code. Both very easy to play, highly addictive, and with several difficulty options. more. |
Tactical Poker A unique variation of the classical five-card draw Poker game, where a normal deck of 52 cards is played consecutively in 5 rounds of poker hands, you can see which cards have been played after each round, helping you to figure out the odds for the next cards to come. more. |
Ball Rows An addictive strategic puzzle game, to play move the balls to connect 5 or more balls of the same color. more. |
Dog Pairs A fun matching pairs memory game featuring dogs of many races, perfect for kids and great for all ages! more. |
Creatures Match 3 Creatures is a strategic match 3 puzzle game, to play move the creatures to connect 3 or more of the same type. more. |
Splashy Sharky Swim with the devouring sharky, avoid the mines, and eat as much fish as you can! more. |
Aquarium Pairs A fun and gorgeous pairs matching memory game featuring aquatic creatures, perfect for kids and great for all ages! more. |
Orbs Match Game
Gummy Match A gorgeous addictive match 3 puzzle game, to play move the gummies to connect 3 or more of the same type. more. |
Diamond Stacks Fun & challenging match-3 game, to play just move the gems to make matches of 3 or more before the gems overflow or time runs out. more. |
Orbs Match 3
Happy Aviary Fly with your favorite bird and take the challenge: pass inside tunnels, pipes and earn as much money as you can! more. |
Cake Match A beautiful & fun match 3 game, just swipe the cakes to connect 3 or more of the same type before time runs out. more. |
Frenzy Fruits Match juicy combinations of fruits before they overflow in your new match-3 adventure: Frenzy Fruits! more. |
Orbs Match Christmas Fun match-3 game featuring a lovely christmas theme!, playing it is super easy: just move the orbs to make matches of 3 or more before the orbs overflow or time runs out. more. |
Golf Solitaire Deluxe Four classic solitaire card games in one app: Golf, TriPeaks, Pyramid & Black Hole. more. |
Follow us |Terms of Use |Privacy Policy|Contact Us |
Orbs Match 4
© BovioSoft, 2020