I have a tuple (Keypoints, Descriptors) extracted from img1
using the method:
(kp, des) = sift.detectAndCompute(img1,None)
kp
is a list containing cv2.KeyPoint
objects, and
des
is a numpy.array
containing their 128 dimensional descriptors
I want to retrieve for each keypoint a pixel value taken from another image img2
of the same size and store them in the tuple (kp, des)
to have in the end a tuple like (kp, des, pixel_values)
Thank you very much in advance.
You can access pixel coordinates from kp. Like below:
kp[0].pt
and i think following code does what you want:
(kp[i], des[i], img2[kp[i].pt] for i in range(len(kp)))