Beispiel #1
0
# mostly to just have something to cycle waitKey (w/o a window, waitKey doesn't work?)
intro = DrawWindow(400, 80, 'Webcam Tool Instructions')
intro.drawText((10, 10), 'f=get webcam frame')
intro.drawText((10, 20), 'F=get ave of 10 webcam frames')
intro.drawText((10, 30), 'm=get mapped webcam frame')
intro.drawText((10, 40), 'c=calibrate webcam(1-4,arrows,s=save,esc=done)')
intro.drawText((10, 50), 's=save mapping data')
intro.drawText((10, 60), 'l=load mapping data')
intro.show()

width = 300
height = 400

W = Webcam()
W.setMapSize(width, height)

DW = DrawWindow(width, height, 'Desired Painting')

DW.setPenColor([0, 0, 0])
DW.drawRectangle2(.4 * width, .2 * height, .65 * width, .9 * height, True)
DW.drawRectangle2(.2 * width, .5 * height, .8 * width, .7 * height, True)
DW.moveWindow(20, 150)
DW.show()

EW = DrawWindow(width, height, 'Error Window')
EW.moveWindow(2 * (width + 5) + 20, 150)

map_window = 'Mapped Webcam'
cv2.namedWindow(map_window, cv2.WINDOW_AUTOSIZE)