diff --git a/head_pose.py b/head_pose.py index c5b8b3b..d4459ae 100644 --- a/head_pose.py +++ b/head_pose.py @@ -231,13 +231,13 @@ if not args.hide_graph: canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) imageWindowRoot = Tk.Toplevel() -imageWindowSize = (1280,800) +imageWindowSize = tuple(metricsSize) imageWindowRoot.geometry('%dx%d+%d+%d' % (imageWindowSize[0],imageWindowSize[1],0,0)) imageWindowRoot.attributes("-fullscreen", True) # imageCanvas is where the heatmap image is drawn imageCanvas = Tk.Canvas(imageWindowRoot,width=1280,height=800) imageCanvas.pack() -imageWindowRoot.lift() + if args.output_dir: startTime = time.time() @@ -247,6 +247,10 @@ if args.queue_length: imageQueue = [] while True: + if args.hide_preview: + # if preview is hidden, we can always re-raise the image window + imageWindowRoot.lift() + t1 = time.time() _, im = c.read() size = im.shape @@ -373,9 +377,9 @@ while True: x = translation_vector[0] + rotation_vector[0] * a y = translation_vector[1] + rotation_vector[1] * a - a = - translation_vector[2] / viewDirectionVector[2] - x = translation_vector[0] + viewDirectionVector[0] * a - y = translation_vector[1] + viewDirectionVector[1] * a + # a = - translation_vector[2] / viewDirectionVector[2] + # x = translation_vector[0] + viewDirectionVector[0] * a + # y = translation_vector[1] + viewDirectionVector[1] * a point = np.array([x,y]) currentPoint = point @@ -474,7 +478,7 @@ while True: tkpi = ImageTk.PhotoImage(image) imageCanvas.delete("IMG") - imagesprite = imageCanvas.create_image(500,500,image=tkpi, tags="IMG") + imagesprite = imageCanvas.create_image(metricsSize[0]/2, metricsSize[1]/2,image=tkpi, tags="IMG") imageWindowRoot.update() tm24 = time.time() logger.debug("PIL image generated in %fs", tm24 - tm23) @@ -490,6 +494,7 @@ while True: te5 = time.time() logger.debug("Drew graph & updated window in %fs", te5-te4) + logger.warn("{}".format(image.size)) if args.output_dir: # save output to dir now = tm24 # time.time()