Ask Your Question

Revision history [back]

Vocabulary Tree Algorithm

Hi everyone,

I am trying to implement Vocabulary Tree Algorithm by Nister and Stewenius. Part of their work says

For each image in the database, extract MSER regions and calculate a set of feature point descriptors (e.g. 128 SIFT).

and

For feature extraction, we use our own implementation of Maximally Stable Extremal Regions (MSERs) [10]. They have been found to perform well in thorough performance evaluation [13, 4]. We warp an elliptical patch around each MSER region into a circular patch. The remaining portion of our feature extraction is then implemented according to the SIFT feature extraction pipeline by Lowe

What I am not sure about is, how to do this in OpenCV 3.x and Python 3.x, and also am not sure if I understood it correctly.

Am I supposed to put MSER keypoints to SIFT? And if so, how do I do it in Python OpenCV? I saw something similar but it was in C++

So far I have this code

import cv2
import numpy as np

img = cv2.imread('test_image.jpg', cv2.IMREAD_COLOR);

height, width,channels = img.shape

blank_image = np.zeros((height,width,3), np.uint8)

mser = cv2.MSER_create()
mser_areas = mser.detect(img)

sift = cv2.xfeatures2d.SIFT_create()

Vocabulary Tree Algorithm

Hi everyone,

I am trying to implement Vocabulary Tree Algorithm by Nister and Stewenius. Part of their work says

For each image in the database, extract MSER regions and calculate a set of feature point descriptors (e.g. 128 SIFT).

and

For feature extraction, we use our own implementation of Maximally Stable Extremal Regions (MSERs) [10]. They have been found to perform well in thorough performance evaluation [13, 4]. We warp an elliptical patch around each MSER region into a circular patch. The remaining portion of our feature extraction is then implemented according to the SIFT feature extraction pipeline by Lowe

What I am not sure about is, how to do this in OpenCV 3.x and Python 3.x, and also am not sure if I understood it correctly.

Am I supposed to put MSER keypoints to SIFT? And if so, how do I do it in Python OpenCV? I saw something similar but it was in C++

So far I have this codecode: EDIT - I Think I managed to put MSER keypoints to SIFT so SIFT gave me descriptors- can someone confirm that this code is correct? It does not show any errors but I am unsure anyway

import cv2
import numpy as np

img = cv2.imread('test_image.jpg', cv2.IMREAD_COLOR);

# channels for color image
height, width,channels width, channels = img.shape

blank_image # blank image, will contain image and detected keypoints, just to show it works
#blank_image = np.zeros((height,width,3), np.uint8)

 mser = cv2.MSER_create()
# detecting keypoints
mser_areas = mser.detect(img)

#creating sift to compute descriptors
sift = cv2.xfeatures2d.SIFT_create()
# descriptors created from MSER keypoints (Is this correct?)
descs = sift.compute(img, mser_areas)

print(descs)

Vocabulary Tree Algorithm

Hi everyone,

I am trying to implement Vocabulary Tree Algorithm by Nister and Stewenius. Part of their work says

For each image in the database, extract MSER regions and calculate a set of feature point descriptors (e.g. 128 SIFT).

and

For feature extraction, we use our own implementation of Maximally Stable Extremal Regions (MSERs) [10]. They have been found to perform well in thorough performance evaluation [13, 4]. We warp an elliptical patch around each MSER region into a circular patch. The remaining portion of our feature extraction is then implemented according to the SIFT feature extraction pipeline by Lowe

What I am not sure about is, how to do this in OpenCV 3.x and Python 3.x, and also am not sure if I understood it correctly.

Question #1 Also - English is not my first language but I understood it this way: They get MSER Regions (small parts of image) and in THAT small regions they detect keypoints with SIFT?

Question #2 Am I supposed to put MSER keypoints to SIFT? And if so, how do I do it in Python OpenCV? I saw something similar but it was in C++

So far I have this code: EDIT - I Think I managed to put MSER keypoints to SIFT so SIFT gave me descriptors- can someone confirm that this code is correct? It does not show any errors but I am unsure anyway

import cv2
import numpy as np

img = cv2.imread('test_image.jpg', cv2.IMREAD_COLOR);

# channels for color image
height, width, channels = img.shape

# blank image, will contain image and detected keypoints, just to show it works
#blank_image = np.zeros((height,width,3), np.uint8)



mser = cv2.MSER_create()
# detecting keypoints
mser_areas = mser.detect(img)

#creating sift to compute descriptors
sift = cv2.xfeatures2d.SIFT_create()
# descriptors created from MSER keypoints (Is this correct?)
descs = sift.compute(img, mser_areas)

print(descs)