def _test(): pairs = [ ['img01.jpg', 'img03.jpg'], ['img01.jpg', 'img05.jpg'], ['img01.jpg', 'img07.jpg'], ['img01.jpg', 'img09.jpg'], ] for names in pairs: file1 = util.findFile(names[0]) file2 = util.findFile(names[1]) result = stitchingWithFilepaths(file1, file2) if result is not None: cv2.imshow('{}-{}'.format(*names), result) cv2.waitKey(0) cv2.destroyAllWindows()
def __init__(self, filename): if filename: path = findFile(os.path.join("help", "regex-lib.xml")) data = open(path).read() self.data = data else: self.data = ""
def import_layer_component(self, component): for layer_regex in component['layers']: source_path = findFile(component['file']) if source_path is None: raise Exception("Couldn't find source file '%s'" % component['file']) source_layer = self.find_layer(layer_regex, source_path) if source_layer is None: logging.warn("Couldn't find configured layer %s in DXF files", layer_regex) continue filename = "%s-%s" % (sanitize(component['file']), sanitize(source_layer)) self.generate_layer_shapefile(source_path, source_layer, filename) yield parse_layer_config(filename, source_layer, component)
else: self.data = "" def parse(self, data=""): if not data: data = self.data dicts = [] allmatches = rx_entry.findall(data) rx_keys = RX_DICT.keys() for match in allmatches: d = {} for key in rx_keys: m = RX_DICT[key].search(match) if m: d[key] = m.group(1) else: d[key] = "" dicts.append(d) return dicts if __name__ == '__main__': path = findFile(os.path.join("help", "regex-lib.xml")) x = ParseRegexLib(path) dicts = x.parse() print dicts
self.data = "" def parse(self, data=""): if not data: data = self.data dicts = [] allmatches = rx_entry.findall(data) rx_keys = RX_DICT.keys() for match in allmatches: d = {} for key in rx_keys: m = RX_DICT[key].search(match) if m: d[key] = m.group(1) else: d[key] = "" dicts.append(d) return dicts if __name__ == '__main__': path = findFile(os.path.join("help", "regex-lib.xml")) x = ParseRegexLib(path) dicts = x.parse() print dicts