I'm trying to detect copy-move forgery through key points. I'm using this
This above image has tampered ( the number 4 is copied and moved). I got the key points (number = 891) and descriptors for each keypoint. The shape of descriptors = (891x128
). This is the image on which key points are drawn.
Now I have to cluster these descriptors right? How exactly should I do that? I referred many papers and they only show the flow chart but not how to do it and most of them are hybrid. Most of the StackOverflow questions involve multiple images (from image similarity domain).
I thought the descriptors for the key points lying on both the 4's will be the same and I tried finding duplicate values in the descriptor matrix with the following code:
import cv2
from collections import Counter
import numpy as np
img = cv2.imread('img_tamp_1.bmp')
gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
sift = cv2.xfeatures2d.SIFT_create()
kp, des = sift.detectAndCompute(gray,None)
print('number of key points:', len(kp))
kp = np.array(kp)
des = np.array(des)
u = np.unique(des, axis = 0)
print('unique:', len(u))
img=cv2.drawKeypoints(gray,kp,img)
cv2.imwrite('sift_keypoints.jpg',img)
The output is :
number of key points: 891
unique: 880
implying only 11 are duplicate key points. This confuses me.
So how shall I cluster the row vectors in order to proceed further and mark the forged region?
I will be happy if someone can explain the clustering processing intuitively with some visual output.
PS: This is my first question here. Please let me know if I'm unclear or what I asked is too broad. If anything is uncertain to you, I'll try to add more information. I'm working on this since the whole day and I'm very tired, help, please.