Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.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
Python (sendex人脸识别)cv2中的照片整形问题。将用作人脸识别的输入_Python_Opencv_Face Recognition_Cv2 - Fatal编程技术网

Python (sendex人脸识别)cv2中的照片整形问题。将用作人脸识别的输入

Python (sendex人脸识别)cv2中的照片整形问题。将用作人脸识别的输入,python,opencv,face-recognition,cv2,Python,Opencv,Face Recognition,Cv2,我正在跟踪sentdex人脸识别。我正在使用我自己的图片来训练尺寸非常大的模型,因此我在cv2.reformate()的帮助下将图片的大小更改为256x256。以下是我用于调整大小的代码。我做了10次,拍了10张照片,你可以利用这个循环 import cv2 #paste the path where you have face recognition file #for me it is '/home/Desktop/ml/face_reco' path = str(input("paste

我正在跟踪sentdex人脸识别。我正在使用我自己的图片来训练尺寸非常大的模型,因此我在
cv2.reformate()
的帮助下将图片的大小更改为256x256。以下是我用于调整大小的代码。我做了10次,拍了10张照片,你可以利用这个循环

import cv2

#paste the path where you have face recognition file
#for me it is '/home/Desktop/ml/face_reco'
path = str(input("paste you file path here: "))

IMG_SIZE = 256

# convert to array
img_array = cv2.imread(path)  

new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE)) 

#save the resized pic with some new name
cv2.imwrite('/home/Desktop/ml/face_reco/known_faces/vardhan/new.png',new_array)

当我使用这些新调整大小的图片作为模型的输入时,它会引发一个错误
列表索引超出范围
,因为sentdex第38行的
编码
数组是空的,我不知道为什么新图片的编码数组是空的,而原始图片的编码数组不是空的