From 043c14339f5124918138eee76d33eaea7dc90477 Mon Sep 17 00:00:00 2001 From: "Dr. Simon Levy" Date: Wed, 10 Aug 2016 16:30:36 -0400 Subject: [PATCH] Displaying empty pyplot --- examples/pltslamshow.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/examples/pltslamshow.py b/examples/pltslamshow.py index de4096f..72a1d2f 100644 --- a/examples/pltslamshow.py +++ b/examples/pltslamshow.py @@ -152,8 +152,21 @@ class SlamShow(object): TRAJECTORY_COLOR_BGR) def refresh(self): - - # Rotate image 270 degrees + + # If we have a new figure, something went wrong (closing figure failed) + if self.figid != id(plt.gcf()): + return False + + # Redraw current objects without blocking + plt.draw() + + # Refresh display, setting flag on window close or keyboard interrupt + try: + plt.pause(.01) + except: + return False + + # Rotate image 270 degrees #wid,hgt = cv.GetSize(self.image) #mapMatrix = cv2.getRotationMatrix2D((wid/2,hgt/2), 270, 1.0) #cv.WarpAffine(self.image, self.image, cv.fromarray(mapMatrix)) @@ -164,7 +177,6 @@ class SlamShow(object): # Force image display, returning any key hit key = cvdisplay() return key if key > -1 else None - def waitkey(self, action):