From dfaabd88fc1c6ace833d3e1c2bac0bf4d18b7e34 Mon Sep 17 00:00:00 2001 From: Gary Bradski Date: Thu, 15 Mar 2012 03:45:15 +0000 Subject: [PATCH] added cv2.destroyAllWindows() --- samples/python2/browse.py | 1 + samples/python2/calibrate.py | 1 + samples/python2/camshift.py | 1 + samples/python2/coherence.py | 1 + samples/python2/color_histogram.py | 1 + samples/python2/contours.py | 1 + samples/python2/demo.py | 1 + samples/python2/distrans.py | 1 + samples/python2/edge.py | 1 + samples/python2/facedetect.py | 1 + samples/python2/feature_homography.py | 1 + samples/python2/find_obj.py | 1 + samples/python2/floodfill.py | 1 + samples/python2/gabor_threads.py | 1 + samples/python2/gaussian_mix.py | 1 + samples/python2/hist.py | 1 + samples/python2/inpaint.py | 1 + samples/python2/letter_recog.py | 1 + samples/python2/lk_homography.py | 1 + samples/python2/lk_track.py | 1 + samples/python2/morphology.py | 1 + samples/python2/motempl.py | 1 + samples/python2/mouse_and_match.py | 1 + samples/python2/mser.py | 1 + samples/python2/opt_flow.py | 1 + samples/python2/peopledetect.py | 1 + samples/python2/squares.py | 1 + samples/python2/stereo_match.py | 3 ++- samples/python2/turing.py | 1 + samples/python2/video.py | 1 + samples/python2/watershed.py | 3 ++- 31 files changed, 33 insertions(+), 2 deletions(-) diff --git a/samples/python2/browse.py b/samples/python2/browse.py index 9ce45992b4..9234fbb977 100644 --- a/samples/python2/browse.py +++ b/samples/python2/browse.py @@ -45,3 +45,4 @@ if __name__ == '__main__': cv2.imshow('preview', small) cv2.setMouseCallback('preview', onmouse) cv2.waitKey() + cv2.destroyAllWindows() diff --git a/samples/python2/calibrate.py b/samples/python2/calibrate.py index 96ec3ad678..2155bdcca9 100644 --- a/samples/python2/calibrate.py +++ b/samples/python2/calibrate.py @@ -54,4 +54,5 @@ if __name__ == '__main__': print "RMS:", rms print "camera matrix:\n", camera_matrix print "distortion coefficients: ", dist_coefs.ravel() + cv2.destroyAllWindows() diff --git a/samples/python2/camshift.py b/samples/python2/camshift.py index ea8ac034bd..4a8b1f7748 100644 --- a/samples/python2/camshift.py +++ b/samples/python2/camshift.py @@ -106,6 +106,7 @@ class App(object): break if ch == ord('b'): self.show_backproj = not self.show_backproj + cv2.destroyAllWindows() if __name__ == '__main__': diff --git a/samples/python2/coherence.py b/samples/python2/coherence.py index 984f210efd..fdb2e89f6e 100644 --- a/samples/python2/coherence.py +++ b/samples/python2/coherence.py @@ -70,3 +70,4 @@ if __name__ == '__main__': update() if ch == 27: break + cv2.destroyAllWindows() diff --git a/samples/python2/color_histogram.py b/samples/python2/color_histogram.py index c5d0ae8663..409af4d22c 100644 --- a/samples/python2/color_histogram.py +++ b/samples/python2/color_histogram.py @@ -45,3 +45,4 @@ if __name__ == '__main__': ch = 0xFF & cv2.waitKey(1) if ch == 27: break + cv2.destroyAllWindows() diff --git a/samples/python2/contours.py b/samples/python2/contours.py index f0a5ae6343..4d90941110 100644 --- a/samples/python2/contours.py +++ b/samples/python2/contours.py @@ -46,3 +46,4 @@ if __name__ == '__main__': cv2.createTrackbar( "levels+3", "contours", 3, 7, update ) cv2.imshow('image', img) 0xFF & cv2.waitKey() + cv2.destroyAllWindows() diff --git a/samples/python2/demo.py b/samples/python2/demo.py index f9fc977200..3f75703303 100644 --- a/samples/python2/demo.py +++ b/samples/python2/demo.py @@ -149,3 +149,4 @@ class App: if __name__ == '__main__': App().run() + diff --git a/samples/python2/distrans.py b/samples/python2/distrans.py index 3301b76195..2cbca0ca20 100644 --- a/samples/python2/distrans.py +++ b/samples/python2/distrans.py @@ -53,4 +53,5 @@ if __name__ == '__main__': update() if need_update: update() + cv2.destroyAllWindows() diff --git a/samples/python2/edge.py b/samples/python2/edge.py index 4fa43d83f3..759b3c13b0 100644 --- a/samples/python2/edge.py +++ b/samples/python2/edge.py @@ -27,4 +27,5 @@ if __name__ == '__main__': ch = cv2.waitKey(5) if ch == 27: break + cv2.destroyAllWindows() diff --git a/samples/python2/facedetect.py b/samples/python2/facedetect.py index a84ab602d9..fd4cdd538f 100644 --- a/samples/python2/facedetect.py +++ b/samples/python2/facedetect.py @@ -56,4 +56,5 @@ if __name__ == '__main__': if 0xFF & cv2.waitKey(5) == 27: break + cv2.destroyAllWindows() diff --git a/samples/python2/feature_homography.py b/samples/python2/feature_homography.py index e1a74a49a6..0cabec133b 100644 --- a/samples/python2/feature_homography.py +++ b/samples/python2/feature_homography.py @@ -93,3 +93,4 @@ if __name__ == '__main__': ref_img = img.copy() if ch == 27: break + cv2.destroyAllWindows() diff --git a/samples/python2/find_obj.py b/samples/python2/find_obj.py index e34dbcc09a..4c90dae21d 100644 --- a/samples/python2/find_obj.py +++ b/samples/python2/find_obj.py @@ -100,3 +100,4 @@ if __name__ == '__main__': cv2.imshow('find_obj SURF', vis_brute) cv2.imshow('find_obj SURF flann', vis_flann) 0xFF & cv2.waitKey() + cv2.destroyAllWindows() diff --git a/samples/python2/floodfill.py b/samples/python2/floodfill.py index 11c73550bf..c2d0d70578 100644 --- a/samples/python2/floodfill.py +++ b/samples/python2/floodfill.py @@ -62,3 +62,4 @@ if __name__ == '__main__': connectivity = 12-connectivity print 'connectivity =', connectivity update() + cv2.destroyAllWindows() diff --git a/samples/python2/gabor_threads.py b/samples/python2/gabor_threads.py index bf1ee0cd13..3e102d4ff9 100644 --- a/samples/python2/gabor_threads.py +++ b/samples/python2/gabor_threads.py @@ -65,3 +65,4 @@ if __name__ == '__main__': cv2.imshow('img', img) cv2.imshow('result', res2) cv2.waitKey() + cv2.destroyAllWindows() diff --git a/samples/python2/gaussian_mix.py b/samples/python2/gaussian_mix.py index e5402aa105..c71ff3c3af 100644 --- a/samples/python2/gaussian_mix.py +++ b/samples/python2/gaussian_mix.py @@ -54,3 +54,4 @@ if __name__ == '__main__': ch = 0xFF & cv2.waitKey(0) if ch == 27: break + cv2.destroyAllWindows() diff --git a/samples/python2/hist.py b/samples/python2/hist.py index 4b03467fa7..4bd594e40b 100755 --- a/samples/python2/hist.py +++ b/samples/python2/hist.py @@ -106,4 +106,5 @@ if __name__ == '__main__': print 'ESC' cv2.destroyAllWindows() break + cv2.destroyAllWindows() diff --git a/samples/python2/inpaint.py b/samples/python2/inpaint.py index 6a10b96dc0..6a52d01627 100644 --- a/samples/python2/inpaint.py +++ b/samples/python2/inpaint.py @@ -32,4 +32,5 @@ if __name__ == '__main__': img_mark[:] = img mark[:] = 0 sketch.show() + cv2.destroyAllWindows() diff --git a/samples/python2/letter_recog.py b/samples/python2/letter_recog.py index 0d4d18f54b..5611b92247 100644 --- a/samples/python2/letter_recog.py +++ b/samples/python2/letter_recog.py @@ -154,3 +154,4 @@ if __name__ == '__main__': fn = args['--save'] print 'saving model to %s ...' % fn model.save(fn) + cv2.destroyAllWindows() diff --git a/samples/python2/lk_homography.py b/samples/python2/lk_homography.py index 5683c98a7c..616aa5e0a8 100644 --- a/samples/python2/lk_homography.py +++ b/samples/python2/lk_homography.py @@ -107,6 +107,7 @@ def main(): print __doc__ App(video_src).run() + cv2.destroyAllWindows() if __name__ == '__main__': main() diff --git a/samples/python2/lk_track.py b/samples/python2/lk_track.py index c9672450a1..d5667095c7 100644 --- a/samples/python2/lk_track.py +++ b/samples/python2/lk_track.py @@ -92,6 +92,7 @@ def main(): print __doc__ App(video_src).run() + cv2.destroyAllWindows() if __name__ == '__main__': main() diff --git a/samples/python2/morphology.py b/samples/python2/morphology.py index c104f8ca35..68b95d8622 100644 --- a/samples/python2/morphology.py +++ b/samples/python2/morphology.py @@ -56,3 +56,4 @@ if __name__ == '__main__': if ch == ord('2'): cur_str_mode = str_modes.next() update() + cv2.destroyAllWindows() diff --git a/samples/python2/motempl.py b/samples/python2/motempl.py index b2df02e45d..8b98411aae 100644 --- a/samples/python2/motempl.py +++ b/samples/python2/motempl.py @@ -78,3 +78,4 @@ if __name__ == '__main__': prev_frame = frame.copy() if 0xFF & cv2.waitKey(5) == 27: break + cv2.destroyAllWindows() diff --git a/samples/python2/mouse_and_match.py b/samples/python2/mouse_and_match.py index e011620812..5a2aa7fd79 100755 --- a/samples/python2/mouse_and_match.py +++ b/samples/python2/mouse_and_match.py @@ -69,3 +69,4 @@ if __name__ == '__main__': cv.imshow("gray",gray) if (cv.waitKey() & 255) == 27: break + cv2.destroyAllWindows() diff --git a/samples/python2/mser.py b/samples/python2/mser.py index b86ff5277a..eb6477cfa8 100644 --- a/samples/python2/mser.py +++ b/samples/python2/mser.py @@ -35,3 +35,4 @@ if __name__ == '__main__': cv2.imshow('img', vis) if 0xFF & cv2.waitKey(5) == 27: break + cv2.destroyAllWindows() diff --git a/samples/python2/opt_flow.py b/samples/python2/opt_flow.py index 98f6ff9bf9..68b245db2c 100644 --- a/samples/python2/opt_flow.py +++ b/samples/python2/opt_flow.py @@ -80,4 +80,5 @@ if __name__ == '__main__': if show_glitch: cur_glitch = img.copy() print 'glitch is', ['off', 'on'][show_glitch] + cv2.destroyAllWindows() diff --git a/samples/python2/peopledetect.py b/samples/python2/peopledetect.py index f4b876e08e..5c038bf200 100644 --- a/samples/python2/peopledetect.py +++ b/samples/python2/peopledetect.py @@ -53,3 +53,4 @@ if __name__ == '__main__': ch = 0xFF & cv2.waitKey() if ch == 27: break + cv2.destroyAllWindows() diff --git a/samples/python2/squares.py b/samples/python2/squares.py index 4099b07b36..6c6b899d83 100644 --- a/samples/python2/squares.py +++ b/samples/python2/squares.py @@ -37,3 +37,4 @@ if __name__ == '__main__': ch = 0xFF & cv2.waitKey() if ch == 27: break + cv2.destroyAllWindows() diff --git a/samples/python2/stereo_match.py b/samples/python2/stereo_match.py index 533f37d17a..0af1b6e85e 100644 --- a/samples/python2/stereo_match.py +++ b/samples/python2/stereo_match.py @@ -70,4 +70,5 @@ if __name__ == '__main__': cv2.imshow('left', imgL) cv2.imshow('disparity', (disp-min_disp)/num_disp) - cv2.waitKey() \ No newline at end of file + cv2.waitKey() + cv2.destroyAllWindows() diff --git a/samples/python2/turing.py b/samples/python2/turing.py index ad770022bc..7e30aa1c7f 100644 --- a/samples/python2/turing.py +++ b/samples/python2/turing.py @@ -62,3 +62,4 @@ if __name__ == '__main__': cv2.imshow('a', vis) if 0xFF & cv2.waitKey(5) == 27: break + cv2.destroyAllWindows() diff --git a/samples/python2/video.py b/samples/python2/video.py index 21623b3827..ab5981459e 100644 --- a/samples/python2/video.py +++ b/samples/python2/video.py @@ -165,3 +165,4 @@ if __name__ == '__main__': cv2.imwrite(fn, img) print fn, 'saved' shot_idx += 1 + cv2.destroyAllWindows() diff --git a/samples/python2/watershed.py b/samples/python2/watershed.py index 8faeb0450f..56d7ebc9e7 100644 --- a/samples/python2/watershed.py +++ b/samples/python2/watershed.py @@ -53,7 +53,8 @@ class App: self.markers[:] = 0 self.markers_vis[:] = self.img self.sketch.show() - + cv2.destroyAllWindows() + if __name__ == '__main__': import sys