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 ()'