Esempio n. 1
0
        histogram = image.histogram(15, 20)
        histogram.display()
        #for x in range(99):
        #   image.update()
        #   histogram = image.histogram(15, 20, histogram)
        #   histogram.display()
        print("Done!")
    else:
        print("skipping...")

    print("Do you want to run test 9: find motion in 10 frames? ", end=' ')
    if sys.stdin.readline().lower()[0] == 'y':
        print("Running...")
        from pyrobot.camera.fake import FakeCamera
        camera = FakeCamera()
        camera.update()
        for x in range(10):
            camera.update(1)
            camera.motion.display()
            print("avg color of motion:", camera.motion.avgColor(camera))
        print("Done!")
    else:
        print("skipping...")
    print("Do you want to run test 10: find edges in bitmap? ", end=' ')
    if sys.stdin.readline().lower()[0] == 'y':
        print("Running...")
        image = PyrobotImage(0, 0)
        image.loadFromFile(getenv('PYROBOT') + '/vision/snaps/som-16.ppm')
        image.grayScale()
        mask = image.convolve(edge, 1, 128)
        #mask = mask.convolve(fill, 1)
Esempio n. 2
0
      self._dev = Fourway( self._camera._dev, splits, quad, rot)
      self.vision = VisionSystem()
      self._dev.setRGB(camera.rgb[0], camera.rgb[1], camera.rgb[2])
      self.rgb = camera.rgb
      self.format = camera.format
      self.vision.registerCameraDevice(self._dev)
      self._cbuf = self.vision.getMMap()
      ## -------------------------------------------------
      Camera.__init__(self, self._dev.getWidth(), self._dev.getHeight(), self._dev.getDepth(),
                      "Quad #%d" % quad)
      self.data = CBuffer(self._cbuf)

   def update(self):
      if not self.active: return
      self._dev.updateMMap()
      self.processAll()

if __name__ == "__main__":
   from pyrobot.camera.fake import FakeCamera
   cam = FakeCamera(pattern = "../../vision/tutorial/test-?.ppm", start = 0,
                    stop = 11, interval = 1, visionSystem = VisionSystem())
   cam.update()
   cam.makeWindow()
   cam.updateWindow()
   cameras = [0] * 4
   for i in range(4):
      cameras[i] = FourwayCamera(cam, 4, i)
      cameras[i].update()
      cameras[i].makeWindow()
      cameras[i].updateWindow()
Esempio n. 3
0
        histogram.display()
        # for x in range(99):
        #   image.update()
        #   histogram = image.histogram(15, 20, histogram)
        #   histogram.display()
        print "Done!"
    else:
        print "skipping..."

    print "Do you want to run test 9: find motion in 10 frames? ",
    if sys.stdin.readline().lower()[0] == "y":
        print "Running..."
        from pyrobot.camera.fake import FakeCamera

        camera = FakeCamera()
        camera.update()
        for x in range(10):
            camera.update(1)
            camera.motion.display()
            print "avg color of motion:", camera.motion.avgColor(camera)
        print "Done!"
    else:
        print "skipping..."
    print "Do you want to run test 10: find edges in bitmap? ",
    if sys.stdin.readline().lower()[0] == "y":
        print "Running..."
        image = PyrobotImage(0, 0)
        image.loadFromFile(pyrobotdir() + "/vision/snaps/som-16.ppm")
        image.grayScale()
        mask = image.convolve(edge, 1, 128)
        # mask = mask.convolve(fill, 1)