def default_action(self): """ Update the texture image. """ # Grab an image from the texture if self.bge_object['capturing'] and (self._n != 0) : # Call the action of the Camera class Camera.default_action(self) self.process_image(morse.core.blenderapi.cameras()[self.name()].source) self.capturing = True if (self._n > 0): self._n -= 1 if (self._n == 0): self.completed(status.SUCCESS) else: self.capturing = False
def default_action(self): """ Update the texture image. """ # Grab an image from the texture if self.bge_object['capturing'] and (self._n != 0): # Call the action of the Camera class Camera.default_action(self) self.process_image(self.image_data) self.capturing = True if self._n > 0: self._n -= 1 if self._n == 0: self.completed(status.SUCCESS) else: self.capturing = False
def default_action(self): """ Update the texture image. """ # Grab an image from the texture if self.bge_object['capturing'] and (self._n != 0) : # Call the action of the Camera class Camera.default_action(self) self.process_image(self.image_data) self.capturing = True if self._n > 0: self._n -= 1 if self._n == 0: self.completed(status.SUCCESS) else: self.capturing = False
def default_action( self ): #super(self.__class__, self).default_action() Camera.default_action( self ) # Grab an image from the texture if self.bge_object['capturing'] and (self._n != 0) : ## Call the action of the parent class #super(self.__class__, self).default_action() #Camera.default_action( self ) #VideoCamera.default_action( self ) # NOTE: Blender returns the image as a binary string # encoded as RGBA image_data = morse.core.blenderapi.cameras()[self.name()].source self.robot_pose = copy.copy(self.robot_parent.position_3d) # Only Reporting Black, White, and Grey to greyscale image # Fill in the exportable data new_image = numpy.array(image_data.image, dtype='uint8') if self.old_image_data != None: self.monochrome = ( new_image[0::4] * .299 + new_image[1::4] * 0.587 + new_image[2::4] * 0.144 ).astype('uint8') #black = self.monochrome > self.old_image_data + 10 #white = self.monochrome < self.old_image_data - 10 black = self.monochrome > self.old_image_data + 15 white = self.monochrome + 15 < self.old_image_data self.local_data['image'] = self.grey - self.step * black + self.step * white else: self.local_data['image'] = self.monochrome#new_image self.capturing = True self.old_image_data = self.monochrome if (self._n > 0): self._n -= 1 if (self._n == 0): self.completed(status.SUCCESS) else: self.capturing = False
def default_action( self ): #super(self.__class__, self).default_action() Camera.default_action( self ) # Grab an image from the texture if self.bge_object['capturing'] and (self._n != 0) : ## Call the action of the parent class #super(self.__class__, self).default_action() #Camera.default_action( self ) #VideoCamera.default_action( self ) # NOTE: Blender returns the image as a binary string # encoded as RGBA image_data = morse.core.blenderapi.cameras()[self.name()].source self.robot_pose = copy.copy(self.robot_parent.position_3d) """ #Simple Subtraction Method # Fill in the exportable data if self.old_image_data != None: self.local_data['image'] = numpy.array(image_data.image, dtype='uint8') - self.old_image_data * self.mask # remove small differences within a tolerance #self.local_data['image'][abs(self.local_data['image']) < 1] = 0 else: self.local_data['image'] = numpy.array(image_data.image, dtype='uint8') """ """ # Reporting the difference relative to Grey # Fill in the exportable data new_image = numpy.array(image_data.image, dtype='uint8') if self.old_image_data != None: self.local_data['image'] = self.grey + (new_image - self.old_image_data) # remove small differences within a tolerance #self.local_data['image'][abs(self.local_data['image']) < 1] = 0 else: self.local_data['image'] = new_image """ """ # Only Reporting Black, White, and Grey # Fill in the exportable data new_image = numpy.array(image_data.image, dtype='uint8') if self.old_image_data != None: black = new_image > self.old_image_data + 10 white = new_image < self.old_image_data - 10 self.local_data['image'] = self.grey - self.step * black + self.step * white # remove small differences within a tolerance #self.local_data['image'][abs(self.local_data['image']) < 1] = 0 else: self.local_data['image'] = new_image """ #""" # Only Reporting Black, White, and Grey to greyscale image # Fill in the exportable data new_image = numpy.array(image_data.image, dtype='uint8') if self.old_image_data != None: self.monochrome = ( new_image[0::4] * .299 + new_image[1::4] * 0.587 + new_image[2::4] * 0.144 ).astype('uint8') #black = self.monochrome > self.old_image_data + 10 #white = self.monochrome < self.old_image_data - 10 black = self.monochrome > self.old_image_data + 15 white = self.monochrome + 15 < self.old_image_data self.local_data['image'] = self.grey - self.step * black + self.step * white #self.local_data['image'] = self.monochrome # remove small differences within a tolerance #self.local_data['image'][abs(self.local_data['image']) < 1] = 0 else: self.local_data['image'] = self.monochrome#new_image #""" self.capturing = True #self.old_image_data = numpy.array(image_data.image, dtype='int8') #self.old_image_data = new_image self.old_image_data = self.monochrome if (self._n > 0): self._n -= 1 if (self._n == 0): self.completed(status.SUCCESS) else: self.capturing = False