Hana
Hana

Reputation: 9

How do I find key points of low-contrast noisy image in OpenCV?

I am trying to use SIFT (with OpenCV and Python) to detect key features in two images: image 1 and image 2.

I need to highlight the key features on both images to then further stitch them together. Looking at the image visually, there are multiple key features that are visibly repeated between the two images (e.g. all the wires in the back).
However, due to the extremely bright line down the center of the images and the similar contrast between the background and the features, I have not been able to correctly detect the key features and then stitch the images together.

  1. My first pass gave this output: first try. I barely got any keypoints and almost all of them were centered along the light patches.
    My base code here was just:
sift = cv.SIFT_create()

(kps, features) = sift.detectAndCompute(img, None)
imgKPS = cv.drawKeypoints(img, kps, None)
  1. I first played around with the contrast threshold, with gave me a much larger amount of points. However, most key points on the wires were still missed and instead clustered along the light patches.
    (see this image).
    For change to the code was this:
sift = cv.SIFT_create(contrastThreshold = 0.02)
  1. I then tried to use the equalizeHist function in OpenCV to darken the wires in the background of the image, however the output was horrible: third try. The noise was so bad on this image that the SIFT algorithm was unable to differentiate useful data from the noise. The change to the code was:
tempImage = cv.equalizeHist(tempImage)

when inputting the images. 4) I have now tried using a GaussianBlur and threshold, skimage's exposure function and threshold_yen. Each continues to make my problem worse and I am stuck.

If anyone could help, I would really appreciate it.


TLDR: Need to highlight find key points in the background of my low-contrast image.




Code for the SIFT Algorithm:

def SIFTAlgo(img):
    # SIFT Algorithm
    sift = cv.SIFT_create()

    (kps, features) = sift.detectAndCompute(img, None)
    imgKPS = cv.drawKeypoints(img, kps, None)
    print("Number of keypoints", len(kps))
    
    printF(imgKPS)
    return (kps, features, imgKPS)




My ideal output image would have points in these locations (obviously, to a much greater extent):

ideal

Upvotes: 0

Views: 152

Answers (0)

Related Questions