def mapObjects(): sql = "SELECT X(position), Y(position), focus, bearing FROM pictures;" rows = query(sql) x = list() y = list() for row in rows: p = dbscan.Point(0, row[1], row[0], True, row[3], row[2]) P = dbscan.getObjPoint(p) x.append(P.lon) y.append(P.lat) pylab.scatter(x,y, s=100 ,marker='o') pylab.show()
def printStuff(): # test object capture bearing = 350 point = (0,1) focus = 3 p = dbscan.Point(0, 0, 1, False, bearing, focus) x = [p.lon] y = [p.lat] for bearing in range(0,360): if bearing % 20 > 10: continue p = dbscan.Point(0, 0, 1, False, bearing, focus) P = dbscan.getObjPoint(p) x.append(P.lon) y.append(P.lat) color=['g','r'] sql = "INSERT INTO pictures (position,visited,bearing,focus) VALUES (POINT(%s, %s), %s, %s, %s)" vals = [p.lat, p.lon, p.vis, bearing, focus] print 'Beginning new cluster', vals execute(sql, vals) pylab.scatter(x,y, s=100 ,marker='o', c=color) pylab.xlim(xmin=0)
def findNear(): for p in dbscan.queryUnv(): P = dbscan.getObjPoint(p) for cP in dbscan.regionQuery(P, 1): print cP