def __init__(self, region_format, channels=None): """ Constructor Args: region_format: Region format options """ assert (region_format in [trax.Region.RECTANGLE, trax.Region.POLYGON]) if channels is None: channels = ['color'] elif channels == 'rgbd': channels = ['color', 'depth'] elif channels == 'rgbt': channels = ['color', 'ir'] elif channels == 'ir': channels = ['ir'] else: raise Exception('Illegal configuration {}.'.format(channels)) self._trax = trax.Server([region_format], [trax.Image.PATH], channels) request = self._trax.wait() assert (request.type == 'initialize') if isinstance(request.region, trax.Polygon): self._region = Polygon([Point(x[0], x[1]) for x in request.region]) else: self._region = Rectangle(*request.region.bounds()) self._image = [x.path() for k, x in request.image.items()] if len(self._image) == 1: self._image = self._image[0] self._trax.status(request.region)
def __init__(self, region_format, channels=None): """ Constructor Args: region_format: Region format options """ assert(region_format in [trax.Region.RECTANGLE, trax.Region.POLYGON]) if channels is None: channels = ['color'] elif channels == 'rgbd': channels = ['color', 'depth'] elif channels == 'rgbt': channels = ['color', 'ir'] elif channels == 'ir': channels = ['ir'] else: raise Exception('Illegal configuration {}.'.format(channels)) self._trax = trax.Server([region_format], [trax.Image.PATH], channels) # with open('/home/ke_tan/STUDY/CODE/Python/benchmark/pyvis/vot_iter/debug.txt', 'w') as f: # f.write('Hello, world0!' + trax.Image.PATH) request = self._trax.wait() # error assert(request.type == 'initialize') if isinstance(request.region, trax.Polygon): self._region = Polygon([Point(x[0], x[1]) for x in request.region]) else: self._region = Rectangle(*request.region.bounds()) self._image = [x.path() for k, x in request.image.items()] if len(self._image) == 1: self._image = self._image[0] self._trax.status(request.region)