Features¶
We support different types of visual features, which can be used to create the Bag of Features databases.
SIFT¶
-
vsearch.sift.
calculate_sift
(image, roi=None, only_keypoints=False)¶ Calculate SIFT descriptors and/or keypoints
Parameters: - image (array_like) – The input image array
- roi (array_like) – An optional region of interest encoded as (x, y, width, height) If None, then the whole image is used
- only_keypoints (bool) – If True then only keypoints will be computed
Returns: - descriptors (array_like) – NxD array containing the N D-dimensional descriptor vectors
- keypoints (list) – List of N cv2.Keypoint objects
-
vsearch.sift.
sift_file_for_image
(path)¶ Return SIFT descriptor filename corresponding to an image path
Color names¶
-
vsearch.colornames.
calculate_colornames
(image, roi=None, keypoints=None)¶ Calculate colornames descriptors and/or keypoints
For color names we still use SIFT to detect keypoints. For each keypoint we use a radius that is twice that of the corresponding SIFT feature, and calculate a histogram of color name probabilities within this region. The histogram is then normalized to not depend on the chosen radius.
Parameters: - image (array_like) – The input image array
- roi (array_like) – An optional region of interest encoded as (x, y, width, height) If None, then the whole image is used
- keypoints (list) – List of keypoints for which to compute the color names descriptors. If None, then SIFT keypoints for the image will be computed.
Returns: - descriptors (array_like) – NxD array containing the N D-dimensional descriptor vectors
- keypoints (list) – List of N cv2.Keypoint objects
-
vsearch.colornames.
cname_file_for_image
(path)¶ Return color names descriptor filename corresponding to an image path
-
vsearch.colornames.
colornames_image
(image, mode='index')¶ Apply color names to an image
Parameters: - image (array_like) – The input image array (RxC)
- mode (str) – If ‘index’ then it returns an image where each element is the corresponding color name label. If ‘probability’, then the returned image has size RxCx11 where the last dimension are the probabilities for each color label. The corresponding human readable name of each label is found in the COLOR_NAMES list.
Returns: Return type: Color names encoded image, as explained by the mode parameter.