2016-10-13 11 views
0

画像のORB記述子をコンピュータに入力し、それらをクラスタ化しようとしています空間的にです。私はscikitにscikit-DBSCANクラスタリング(x.y)座標点でエラーが発生する

detector = cv2.ORB(500) 
orb_kp = detector.detect(gray,None) 
# compute the descriptors with ORB 
kps, descs = detector.compute(gray, orb_kp) 
img2 = cv2.drawKeypoints(gray,kps,color=(0,255,0), flags=0) 
#extract the x,y points from the list (since kp contains various other attribs) 
pts = (p.pt for p in kps) 
db = DBSCAN(eps=0.3, min_samples=5).fit(pts) 

をDBSCANを使用しようとしていたが、私はこのエラーを取得:

float() argument must be a string or a number

ので、私が試した: pts = (int(p.pt) for p in kps)pts = ([int(p.pt.x),int(p.pt.y)] for p in kps) とまだ同じエラーを取得します。

私はPythonでPTSを印刷しようとしたが、このメッセージが表示されます:

print pts None <generator object <genexpr> at 0x10fcab3c0>

私はint

答えて

0

OK投稿ANにポイントのfloatタイプを "キャスト" できるかわかりません同じ問題を持っている人のための答え:

pts = (p.pt for p in kps)

正しくありません。

は次のようになります。 pts = [p.pt for p in kps]

愚かな私!

関連する問題