def getData(self): img = self.camera.get_image() self.imageData = jderobot.ImageData() self.imageData.description = jderobot.ImageDescription() self.imageData.description.width = img.shape[1] self.imageData.description.height = img.shape[0] self.imageData.description.format = 'RGB8' self.pixelData = np.getbuffer(img) self.imageData.pixelData = self.pixelData return True
def getData(self): self.imageDescription = jderobot.ImageData() self.lock.acquire() self.imageDescription.description = ImageProviderI.getImageDescription( self) if os.path.isfile('./image.jpg'): try: self.im = Image.open('./image.jpg', 'r') self.lock.release() self.im = self.im.convert('RGB') self.imRGB = list(self.im.getdata()) self.pixelData = [] self.im.close() for pixeList in self.imRGB: for pixel in pixeList: self.pixelData.append(pixel) self.imageDescription.pixelData = self.pixelData return True except: self.getData() else: self.lock.release() return False
def __init__(self, cb, formato, lock): self.cb = cb self.format = formato self.imageDescription = jderobot.ImageData() self.lock = lock
def __init__(self,cb,format, camera, uri): self.cb = cb self.format = format self.camera = camera self.imageData = jderobot.ImageData() self.uri = uri