Functions | Variables
util Namespace Reference

Functions

def _choose_without_replacement
def approx_equal
def bound
 Bound the value of a number to be above lower, and lower than upper.
def cart_of_pol
def cartesian_product
 cartesian product of list of lists.
def choose_without_replacement
 choose n elements from list without replacement.
def cv2np
def formatted_time
 returns current time as a string: year|month|date_hours|min|sec.
def getTime
 Returns a string that can be used as a timestamp (hours and minutes) in logfiles.
def list_mat_to_mat
 Converts a list of numpy matrices to one large matrix.
def load_pickle
 read a pickle and return the object.
def matrixrank
 compute rank of a matrix.
def norm
 Calculate L2 norm for column vectors in a matrix.
def np2cv
def np2pil
def pol_of_cart
def save_pickle
 Pickle an object.
def say
 use festival text to speech to make a soud.
def standard_rad
def unipolar_limit
def unwrap_np_array
 convert hrl's ros wrapped numpy array to a numpy array
def wrap_np_array
 wraps a numpy array into hrl's datatype for sending np arrays over ros.

Variables

dictionary cv2np_type_dict
dictionary cv2np_type_dict_invertible
tuple np2cv_type_dict

Function Documentation

def util._choose_without_replacement (   lists,
  previous_elements = [],
  ignore_count = 0 
) [private]

Definition at line 159 of file util.py.

def util.approx_equal (   a,
  b,
  epsilon = .001 
)

Definition at line 69 of file util.py.

def util.bound (   value,
  lower,
  upper 
)

Bound the value of a number to be above lower, and lower than upper.

Returns:
a number

Definition at line 102 of file util.py.

def util.cart_of_pol (   p)
Finds cartesian coordinates of polar points [r, t]' 

Definition at line 85 of file util.py.

def util.cartesian_product (   lists,
  previous_elements = [] 
)

cartesian product of list of lists.

code copied from: http://automatthias.wordpress.com/2007/04/28/cartesian-product-of-multiple-sets/

Returns:
generator. can loop over it, or list(generator) will give the entire list. NOTE - itertools in python 2.6 provides this functionality. We should switch over to it soon.

Definition at line 143 of file util.py.

def util.choose_without_replacement (   list,
  n 
)

choose n elements from list without replacement.

adapted code from cartesian_product

Returns:
generator.

Definition at line 155 of file util.py.

def util.cv2np (   im,
  format = 'RGB' 
)
This function converts an image from openCV format to a numpy array.
   This utility needs both NUMPY and OPENCV to accomplish the conversion.
   cv2np(im, format='RGB')

Definition at line 266 of file util.py.

returns current time as a string: year|month|date_hours|min|sec.

Returns:
current time as a string: year|month|date_hours|min|sec.

Definition at line 40 of file util.py.

def util.getTime ( )

Returns a string that can be used as a timestamp (hours and minutes) in logfiles.

Returns:
timestamp-string

Definition at line 20 of file util.py.

def util.list_mat_to_mat (   list_mat,
  axis = 0 
)

Converts a list of numpy matrices to one large matrix.

Parameters:
list_matthe list of little matrices
axisaxis to concatenate little matrices
Returns:
one large numpy matrix

Definition at line 34 of file util.py.

def util.load_pickle (   filename)

read a pickle and return the object.

Parameters:
filename- name of the pkl
Returns:
- object that had been pickled.

Definition at line 49 of file util.py.

def util.matrixrank (   A,
  tol = 1e-8 
)

compute rank of a matrix.

code copied from: http://mail.scipy.org/pipermail/numpy-discussion/2008-February/031218.html

Definition at line 178 of file util.py.

def util.norm (   mat)

Calculate L2 norm for column vectors in a matrix.

Parameters:
mat- numpy matrix

Definition at line 65 of file util.py.

def util.np2cv (   im,
  force_color = False 
)
Note: force_color -- force grayscale np image into a color cv image
    np2cv(im, force_color=False)

Definition at line 321 of file util.py.

def util.np2pil (   im)
for grayscale - all values must be between 0 and 255.
        not sure about color yet.
    np2pil(im)

Definition at line 289 of file util.py.

def util.pol_of_cart (   p)
Find polar coordinates of cartesian points [x, y]' 

Definition at line 93 of file util.py.

def util.save_pickle (   object,
  filename 
)

Pickle an object.

Parameters:
object- object to be pickled
filename- name of the pkl file

Definition at line 58 of file util.py.

def util.say (   text)

use festival text to speech to make a soud.

Parameters:
text- string to be said.

Definition at line 171 of file util.py.

def util.standard_rad (   t)

Definition at line 23 of file util.py.

def util.unipolar_limit (   x,
  upper 
)
limit the value of x such that
    0 <= x <= upper

Definition at line 73 of file util.py.

def util.unwrap_np_array (   nparr_ros)

convert hrl's ros wrapped numpy array to a numpy array

Parameters:
NumpyArrayobject (hrl_lib/msg/NumpyArray.msg)
Returns:
np array

Definition at line 130 of file util.py.

def util.wrap_np_array (   nparr)

wraps a numpy array into hrl's datatype for sending np arrays over ros.

Parameters:
nparray
Returns:
NumpyArray object (hrl_lib/msg/NumpyArray.msg)

Definition at line 120 of file util.py.


Variable Documentation

Definition at line 193 of file util.py.

Initial value:
00001 {CV_16SC1   : (np.int16, 1),   
00002                               CV_16SC2   : (np.int16, 2),   
00003                               CV_16SC3   : (np.int16, 3),   
00004                               CV_16SC4   : (np.int16, 4),   
00005                               CV_16UC1   : (np.uint16, 1),   
00006                               CV_16UC2   : (np.uint16, 2),   
00007                               CV_16UC3   : (np.uint16, 3),   
00008                               CV_16UC4   : (np.uint16, 4),   
00009                               CV_32FC1   : (np.float32, 1),   
00010                               CV_32FC2   : (np.float32, 2),   
00011                               CV_32FC3   : (np.float32, 3),   
00012                               CV_32FC4   : (np.float32, 4),   
00013                               CV_32SC1   : (np.int32, 1),   
00014                               CV_32SC2   : (np.int32, 2),   
00015                               CV_32SC3   : (np.int32, 3),   
00016                               CV_32SC4   : (np.int32, 4),   
00017                               CV_64FC1   : (np.float64, 1),   
00018                               CV_64FC2   : (np.float64, 2),   
00019                               CV_64FC3   : (np.float64, 3),   
00020                               CV_64FC4   : (np.float64, 4),   
00021                               CV_8SC1     : (np.int8, 1),   
00022                               CV_8SC2     : (np.int8, 2),   
00023                               CV_8SC3     : (np.int8, 3),   
00024                               CV_8SC4     : (np.int8, 4),   
00025                               CV_8UC1     : (np.uint8, 1),   
00026                               CV_8UC2     : (np.uint8, 2),   
00027                               CV_8UC3     : (np.uint8, 3),   
00028                               CV_8UC4     : (np.uint8, 4)}

Definition at line 230 of file util.py.

Initial value:
00001 dict([(str(np.dtype(v[0])), v[1]), k] for
00002                            k,v in cv2np_type_dict_invertible.items())

Definition at line 317 of file util.py.



clutter_segmentation
Author(s): Jason Okerman, Martin Schuster, Advisors: Prof. Charlie Kemp and Jim Regh, Lab: Healthcare Robotics Lab at Georgia Tech
autogenerated on Wed Nov 27 2013 12:07:16