display = Display((img.width, img.height)) mouse_down = False while not display.isDone(): img = cam.getImage() img = img.scale(160, 120) dl = DrawingLayer((img.width, img.height)) mystring = "( " + str(display.mouseX) + " , " + str(display.mouseY) + " )" #print((display.mouseX,display.mouseY)) if SegmentMode: segmentation.addImage(img) if (segmentation.isReady()): img = segmentation.getSegmentedImage() img = img.erode(iterations=2).dilate().invert() img.dl().ezViewText(mystring, (30, 30)) img = img.applyLayers() display.writeFrame(img) if (display.mouseLeft): SegmentMode = False segmentation.reset() display.mouseLeft = False else: if (display.mouseLeft and not mouse_down): #print( (display.mouseX,display.mouseY)) x0 = display.mouseX y0 = display.mouseY mouse_down = True elif (display.mouseLeft and mouse_down): dl.circle((x0, y0), radius=10, color=Color.RED) dl.rectangle2pts((display.mouseX, display.mouseY), (x0, y0), color=Color.RED) dl.circle((display.mouseX, display.mouseY),
display = Display((img.width,img.height)) mouse_down = False while not display.isDone(): img = cam.getImage() img = img.scale(160,120) dl = DrawingLayer((img.width,img.height)) mystring = "( " +str(display.mouseX)+" , "+str(display.mouseY)+" )" #print((display.mouseX,display.mouseY)) if SegmentMode: segmentation.addImage(img) if(segmentation.isReady()): img = segmentation.getSegmentedImage() img = img.erode(iterations = 2).dilate().invert() img.dl().ezViewText(mystring, (30,30)) img = img.applyLayers() display.writeFrame(img) if(display.mouseLeft): SegmentMode = False segmentation.reset() display.mouseLeft = False else: if(display.mouseLeft and not mouse_down): #print( (display.mouseX,display.mouseY)) x0 = display.mouseX y0 = display.mouseY mouse_down = True elif( display.mouseLeft and mouse_down ): dl.circle((x0,y0),radius=10,color=Color.RED) dl.rectangle2pts( (display.mouseX,display.mouseY),(x0,y0),color=Color.RED) dl.circle((display.mouseX,display.mouseY),radius=10,color=Color.RED) elif(mouse_down):
t=1 display = Display(resolution = (w,h)) #create a new display to draw images on img = Image('../sampleimages/aerospace.jpg') img = img.scale(800,600) img2 = img.scale(w,h) smallWbigH = img.scale(100,400) smallHbigW = img2.scale(500,100) smallW = img2.scale(100,h) smallH = img2.scale(w,100) small = img2.scale(99,23) big = img2.scale(555,432) foo = "Image:"+str((img.width,img.height)) print(foo) print('Image should scale clean') display.writeFrame(img) time.sleep(t) foo = "Image:"+str((img2.width,img2.height)) print(foo) print('Image should scale clean') display.writeFrame(img2) time.sleep(t) foo = "Image:"+str((smallWbigH.width,smallWbigH.height)) print(foo) display.writeFrame(smallWbigH) time.sleep(t) foo = "Image:"+str((smallHbigW.width,smallHbigW.height)) print(foo)