Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Computer vision ORB后用PCA降维_Computer Vision - Fatal编程技术网

Computer vision ORB后用PCA降维

Computer vision ORB后用PCA降维,computer-vision,Computer Vision,我尝试使用ORB和PCA对提取的特征进行降维,然后提取PCA处理过的关键点 plt.rcParams['figure.figsize'] = [14.0, 7.0] 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.

我尝试使用ORB和PCA对提取的特征进行降维,然后提取PCA处理过的关键点

plt.rcParams['figure.figsize'] = [14.0, 7.0]

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))
当我尝试时,我得到了一个错误 错误:OpenCV(3.4.2)C:\projects\OpenCV- python\opencv\modules\core\src\pca.cpp:72:错误:(-215:断言失败)
函数“cv::PCA::operator()”中的data.channels()==1

看起来您试图在绘制关键点的图像上计算PCA,而不是在计算的描述符上。感谢您的回复,如何使用PCA计算descrptor,我对opencv非常陌生。看起来你试图在绘制关键点的图像上计算PCA,而不是在计算描述符上。谢谢你的回答,如何使用PCA计算descrptor,我对opencv非常陌生