'Python Opencv how to improve SIFT output?

        train_image = 'train_image location'
        sift = cv2.SIFT_create() 
        gray = cv2.cvtColor(train_image, cv2.COLOR_BGR2GRAY)
        (kp, descs) = sift.detectAndCompute(gray, None)
      

I have a dataset of 39,209 traffic sign pictures for my train model. When i try to get SIFT features from them 3131 of the pictures were unable to create descs.After that i tried resize the images that had problems with this code

resized = cv2.resize(train_image,(256,256))

The number went from 3131 down to 2613. What can i else do to make the SIFT better ?



Solution 1:[1]

              resized = cv2.resize(roi_image,(256,256))
              alpha = 2.5 # Contrast control (1.0-3.0)
              beta = 50 # Brightness control (0-100)
              adjusted = cv2.convertScaleAbs(resized, alpha=alpha, beta=beta)
              sift = cv2.SIFT_create() 
              gray = cv2.cvtColor(adjusted, cv2.COLOR_BGR2GRAY)
              (kp, descs) = sift.detectAndCompute(gray, None)

I found out that changing the brightness and contrast could help.It made the troublesome data go down from 2613 to araound 300.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mustafa Ya??z Özduygun