我正在尝试使用ORB功能为图像训练SVM。每个ORB点有32个整数值,显示关键点的强度。关键点的数量是可变的,所以我正在考虑使用特征哈希。
img = cv2.imread(img_name,cv2.IMREAD_GRAYSCALE)
if img is None: continue
gray = cv2.resize(img,(256,256))
smooth = cv2.GaussianBlur(gray,(3,3),0)
kps = orb.detect(smooth,None)
kp, descs = orb.compute(smooth, kps)
#print des.shape
desc_dict = {}
for i,desc in enumerate(descs):
desc_dict[i] = desc
这里是desc_dict的样子
{0: array([ 88, 143, 234, 183, 23, 248, 107, 50, 113, 205, 78, 2, 111,
227, 146, 116, 48, 230, 189, 203, 8, 216, 173, 109, 247, 103,
232, 129, 39, 231, 86, 110], dtype=uint8),
1: array([ 71, 246, 250, 192, 114, 152, 191, 31, 43, 199, 90, 239, 221,
206, 222, 16, 55, 253, 53, 21, 195, 148, 182, 194, 62, 30,
47, 236, 140, 178, 131, 245], dtype=uint8),
2: array([190, 205, 100, 238, 221, 82, 222, 230, 1, 6, 248, 131, 105,
125, 61, 128, 223, 243, 151, 227, 108, 170, 72, 239, 115, 127,
142, 147, 119, 255, 252, 14], dtype=uint8),
:
:
<n>
我对如何将其传递给FeatureHasher
感到困惑。我应该将数组转换为链接字符串吗?对不起,我是这个的新手,可以使用一些指导。