简体   繁体   中英

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?

              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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM