Reducing dimensionality of ORB descriptor with PCA [CLOSED]
i try to reduce dimensionality of feature that have been extracted by using ORB with PCA then draw the keypoints that processed by PCA
e1 = cv2.getTickCount()
#read image and convert to RGB
image_normal = cv2.imread(image)
image_query = cv2.cvtColor(image_normal, cv2.COLOR_BGR2RGB)
image_gray = cv2.cvtColor(image_query, cv2.COLOR_RGB2GRAY)
#ORB function
orb = cv2.ORB_create()
keypoints, descriptor = orb.detectAndCompute(image_gray, None)
# Draw the keypoints
image = cv2.drawKeypoints(image_query, keypoints,0,flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
mean, eigenvectors = cv2.PCACompute(image, np.mean(image, axis=0).reshape(1,-1))
e2 = cv2.getTickCount()
t = (e2 - e1) / cv2.getTickFrequency()
#Show Image
plt.imshow(image)
plt.title('ORB Keypoints')
plt.show()
# Print the number of keypoints detected and time
print("\nNumber of keypoints Detected: ", len(keypoints))
print('Time Cost for ORB: ', (t))
as i try i got an error that says
error: OpenCV(3.4.2) C:\projects\opencv- python\opencv\modules\core\src\pca.cpp:72: error: (-215:Assertion failed) data.channels() == 1 in function 'cv::PCA::operator ()'
but what you did instead was: draw the keypoints to an image and to take the pca from that (and that's bs)
and no, you can't apply a PCA on ORB features, which are binary, bitstrings
thank you for replying, i'm really new to computer vision,
i read in some thread about PCA SIFT,
can PCA used to reduce feature, if can would you be kind and give an example,
i'm sorry if i sound like a choosing beggar
thank you in advance sir
indeed, SIFT and SURF are float descriptors (suitable for PCA), while BRISK,BRIEF,ORB are examples for binary ones (no PCA possible)
wow thank you for that information sir, so how can PCA be used on SIFT or SURF, and besides ORB that obviously wrong, how to implement PCA my in code above?