util.py
Go to the documentation of this file.
00001 import roslib
00002 roslib.load_manifest('hrl_opencv')
00003 import cv
00004 
00005 def print_mat(m):
00006     for j in range(m.height):
00007         for i in range(m.width):
00008             print m[j,i], ' ',
00009         print ''
00010 
00011 
00012 ##Display a list of OpenCV images tiled across the screen
00013 #with maximum width of max_x and maximum height of max_y
00014 # @param save_images - will save the images(with timestamp) (NOT IMPLEMENTED)
00015 def display_images(image_list, max_x = 1200, max_y = 1000, save_images_flag=False):
00016     if image_list == []:
00017         return
00018     loc_x, loc_y = 0, 0
00019     wins = []
00020 #    if save_images_flag:
00021 #        save_images(image_list)
00022 
00023     for i, im in enumerate(image_list):
00024         window_name = 'image %d' % i
00025         wins.append((window_name, im))
00026         cv.NamedWindow(window_name, cv.CV_WINDOW_AUTOSIZE)
00027         cv.MoveWindow(window_name, loc_x, loc_y)
00028         loc_x = loc_x + im.width
00029         if loc_x > max_x:
00030             loc_x = 0
00031             loc_y = loc_y + im.height
00032             if loc_y > max_y:
00033                 loc_y = 0
00034     while True:
00035         for name, im in wins:
00036             cv.ShowImage(name, im)
00037         keypress = cv.WaitKey(10)
00038         if keypress & 255 == 27:
00039             break
00040 
00041 
00042 
00043 
00044 


hrl_opencv
Author(s): Hai Nguyen, Advait Jain (Healthcare Robotics Lab, Georgia Tech)
autogenerated on Wed Nov 27 2013 11:36:49