def get_ramanan_path_from_image_path(self, imagepath): """Transforms an (absolute) imagepath into the path to the file containing keypoints precomputed by Ramanan's algorithm Default version simply performs all substitutions in property ramanan_search_replace, if it exists. Reuturns None otherwise. """ if hasattr(self, 'ramanan_search_replace'): return search_replace(imagepath, self.ramanan_search_replace) return None
def get_picasa_path_from_image_path(self, imagepath): """Transforms an (absolute) imagepath into the path to the file containing bounding box info precomputed by picasa Default version simply performs all substitutions in property picasa_search_replace, if it exists. Reuturns None otherwise. """ if hasattr(self, 'picasa_search_replace'): return search_replace(imagepath, self.picasa_search_replace) return None
def get_ramanan_paths_from_image_path(self, imagepath): """Transforms an (absolute) imagepath into the path to the file containing keypoints precomputed by Ramanan's algorithm Default version simply performs all substitutions in property ramanan_search_replace, if it exists. Reuturns None otherwise. """ if imagepath is None: return [] basepath = imagepath if hasattr(self, 'ramanan_search_replace'): newpath = search_replace(imagepath, self.ramanan_search_replace) if os.path.exists(os.path.dirname(newpath)): basepath = newpath basepath, ext = os.path.splitext(basepath) # print "Ramanan searching for "+basepath+"_ramanan_face??.mat" ramananpaths = glob.glob(basepath+"_ramanan_face??.mat") ramananpaths.sort() if os.path.exists(basepath+"_ramanan.mat"): # possible path for single face obtained from ramanan on whole image ramananpaths.append(basepath+"_ramanan.mat") if len(ramananpaths)==0 and os.path.exists(basepath+".mat"): # possible old path for single face obtained from ramanan on whole image ramananpaths.append(basepath+".mat") return ramananpaths