+ return (G,l)
+
+
+def afficheGraph(G,l,tx,ty,sink):
+ r = 20
+ img = cv.CreateImage ((tx, ty), 32, 3)
+ cv.Rectangle(img, (0,0),(tx,ty), cv.Scalar(255,255,255), thickness=-1)
+ def px((x,y)):
+ return(int(tx*x/coteCarre),ty-int(ty*y/coteCarre))
+ for i in set(range(len(l)))-set([sink]):
+ (x,y) = l[i]
+ pix,piy = px((x,y))
+ demx = distanceEmmissionMax*tx/coteCarre
+ cv.Circle(img, (pix,piy),demx, cv.Scalar(125,125,125))
+
+ for i in set(range(len(l)))-set([sink]):
+ (x,y) = l[i]
+ pix,piy = px((x,y))
+ cv.Circle(img, (pix,piy),r, cv.Scalar(125,125,125),thickness=-1)
+
+ #sink
+ (x,y) = l[sink]
+ pix,piy = px((x,y))
+
+ cv.Rectangle(img, (pix-r/2,piy-r/2),(pix+r/2,piy+r/2), cv.Scalar(125,125,125), thickness=-1)
+
+ for i in range(len(l)):
+ for j in range(len(l)):
+
+ if np.linalg.norm(np.array(l[i])-np.array(l[j])) < distanceEmmissionMax :
+ (xi,yi) = l[i]
+ pixi,piyi = px((xi,yi))
+ (xj,yj) = l[j]
+ pixj,piyj = px((xj,yj))
+ cv.Line(img, (pixi,piyi), (pixj,piyj), cv.Scalar(125,125,125))
+
+
+ """
+ for i in range(len(l)):
+ (x,y) = l[i]
+ pix,piy = px((x,y))
+ print i
+ textColor = (0, 0, 255) # red
+ font = cv2.FONT_HERSHEY_SIMPLEX
+ imgp =
+ cv2.putText(img, str(i), (pix-r/4,piy-r/2),font, 3.0, textColor)#,thickn """
+ cv.SaveImage("SensorNetwork.png",img)