config_clothpart.py
Go to the documentation of this file.
00001 from config import Config
00002 from glob import glob
00003 import numpy as np
00004 
00005 # Helper functions
00006 
00007 def gen_bbox_from_poly(polys):
00008     if type(polys)==list:
00009         bboxes = []
00010         for poly in polys:
00011             top    = int(round(min(poly[:,1])))
00012             left   = int(round(min(poly[:,0])))
00013             bottom = int(round(max(poly[:,1])))
00014             right  = int(round(max(poly[:,0])))
00015             bboxes.append((left, top, right, bottom))
00016     else:
00017         top    = int(round(min(polys[:,1])))
00018         left   = int(round(min(polys[:,0])))
00019         bottom = int(round(max(polys[:,1])))
00020         right  = int(round(max(polys[:,0])))
00021         bboxes = (left, top, right, bottom)
00022     return bboxes
00023 #-----
00024 
00025 def set_default_vlfeat_sift(config, cluster_extra_str=''):
00026     config.det_prog='vlfeat'
00027     config.desc_format='siftgeo'
00028     config.clusterfile=config.basedir+'cluster/'+cluster_extra_str+'vlfeat_dense_k'+str(config.nb_centroids)+'.fvecs'
00029 
00030 #####################################################################
00031 # Global Config (all images)
00032 #####################################################################    
00033 
00034 class ClothPartConfig(Config):
00035 
00036     def __init__(self, basedir='/home/aramisa/datasets/ClothPartDataset/'):
00037         Config.__init__(self)
00038         self.basedir=basedir
00039         self.nimg=len(glob(self.basedir+'png/*.png'))
00040         print "Num imgs", self.nimg
00041 
00042     def img_filename(self,n):
00043         return "%s/png/n%05d.png"%(self.basedir,n)
00044 
00045     def mask_filename(self,n):
00046         return "%s/masks/n%05d.png"%(self.basedir,n)
00047 
00048     def pcd_filename(self,n):
00049         return "%s/pcd/n%05d.pcd"%(self.basedir,n)
00050     
00051     def desc_filename(self,n):
00052         return None
00053 
00054 
00055 #-------------------------------------------------------------------------------
00056 #-------------------------------------------------------------------------------
00057 #OTHERS
00058 
00059 class ICRA13Config(ClothPartConfig):
00060     def __init__(self):
00061         ClothPartConfig.__init__(self,'/home/dmartinez/icra13/')
00062         self.basepath2='/home/dmartinez/icra13/'
00063 
00064     def desc_filename(self,n): 
00065         return self.basepath2+"/feats/sp4_o8_rad31_sample6/n%05d.ndesc"%n
00066 
00067     def mask2_filename(self,n):
00068         return self.basepath2+"/masks2/n%05d.png"%n


iri_bow_object_detector
Author(s): dmartinez
autogenerated on Fri Dec 6 2013 22:45:45