jude jude - 4 months ago 50
Python Question

Is sift algorithm invariant in color?

I will use sift in identifying a certain type of object what if that object change in color can it recognize it? i will use opencv library for sift



What have you tried so far? You could verify this with an experiment such as..

import cv2
img = cv2.imread('0.jpg',1) # 1 = read image as color
sift = cv2.xfeatures2d.SIFT_create()
kp = sift.detect(img,None)
img2 = cv2.drawKeypoints(img,kp,None)

Then you can run the code again with the same image and do

import cv2
img = cv2.imread('0.jpg',0) # 0 = read image as gray
sift= cv2.xfeatures2d.SIFT_create()
kp = sift.detect(img,None)
img2 = cv2.drawKeypoints(img,kp,None)

Now you will have two images saved, one in color with keypoints drawn and another in gray with keypoints drawn. What do you see? I tried the above code with


Check my images below. This may not be as fined-grained as you want but it's a start. Most image processing applications tend to use grayscale because it is much less data to crunch than a full color image.

For a reference check these tutorials:

  1. why we should use gray scale for image processing
  2. http://docs.opencv.org/3.1.0/da/df5/tutorial_py_sift_intro.html
  3. http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_image_display/py_image_display.html

Color KP

Gray KP