def _getDataFromImg(self, img): """ Get the data from the image """ mc = None if (self._extractor): mc = self._extractor(img) else: temp = self._roi.reassign(img) mc = temp.meanColor() self.data['r'].append(mc[0]) self.data['g'].append(mc[1]) self.data['b'].append(mc[2]) # NEED TO CHECK THAT THIS REALLY RGB self.data['i'].append(Color.getLightness(mc)) self.data['h'].append(Color.getHueFromRGB(mc))
def _getDataFromImg(self, img): """ Get the data from the image """ mc = None if self._extractor: mc = self._extractor(img) else: temp = self._roi.reassign(img) mc = temp.meanColor() self.data["r"].append(mc[0]) self.data["g"].append(mc[1]) self.data["b"].append(mc[2]) # NEED TO CHECK THAT THIS REALLY RGB self.data["i"].append(Color.getLightness(mc)) self.data["h"].append(Color.getHueFromRGB(mc))
def draw(self, color=(255, 0, 0), autocolor=False): """ Call draw() on each feature in the FeatureSet. """ for f in self: if (autocolor): color = Color().getRandom() f.draw(color)
def _getBestValue(self, img): """ Extract the data from the live signal """ if (self._extractor): mc = self._extractor(img) else: temp = self._roi.reassign(img) mc = temp.meanColor() if (self._bestKey == 'r'): return mc[0] elif (self._bestKey == 'g'): return mc[1] elif (self._bestKey == 'b'): return mc[2] elif (self._bestKey == 'i'): return Color.getLightness(mc) elif (self._bestKey == 'h'): return Color.getHueFromRGB(mc)
def _getBestValue(self, img): """ Extract the data from the live signal """ if self._extractor: mc = self._extractor(img) else: temp = self._roi.reassign(img) mc = temp.meanColor() if self._bestKey == "r": return mc[0] elif self._bestKey == "g": return mc[1] elif self._bestKey == "b": return mc[2] elif self._bestKey == "i": return Color.getLightness(mc) elif self._bestKey == "h": return Color.getHueFromRGB(mc)
from SimpleCV import Camera, Display, Color import time #Initialize the camera cam = Camera() # Initialize the display display = Display() #take an initial picture img = cam.getImage() # Write a message on the image img.drawText("Left click to save a photo.", color=Color().getRandom()) # Show the image on the display img.save(display) time.sleep(5) counter = 0 while not display.isDone(): # Update the display with the latest image img = cam.getImage() img.save(display) if display.mouseLeft: #Save image to the current directory img.save('photobooth' + str(counter) + '.png') with Image(filename='photobooth' + str(count) + '.png') as OriginalImagen: