scikit- DBSCAN giving error on clustering (x.y) co-ordinate points
<p>I am trying to computer ORB descriptors for an image and cluster them <em>spatially</em>. I was trying to use DBSCAN in scikit</p>

<pre><code>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)
</code></pre>

<p>but I get this error:</p>

<p><code>float() argument must be a string or a number</code></p>

<p>so I tried : 
 <code>pts = (int(p.pt) for p in kps)</code>
and 
<code>pts = ([int(p.pt.x),int(p.pt.y)] for p in kps)</code>
and still get the same error.</p>

<p>I tried printing the pts in python but get this message:</p>

<p><code>print pts
None
&lt;generator object &lt;genexpr&gt; at 0x10fcab3c0&gt;</code></p>

<p>I am not sure how I can "cast" the <code>float</code> type for points into an <code>int</code></p>

<p>OK posting an answer for anyone who has the same issue:</p>

<p><code>pts = (p.pt for p in kps)</code> is incorrect</p>

<p>it should be:
<code>pts = [p.pt for p in kps]</code></p>

<p>Silly me!</p>

python scikit-learn