def INIT(robot):
    return {
        "camera":
        FakeCamera(pattern="vision/tutorial2/?.ppm",
                   start=1,
                   stop=10,
                   interval=1,
                   visionSystem=VisionSystem())
    }
Beispiel #2
0
def INIT(robot):
    return {
        "camera":
        FakeCamera(pattern="vision/iarc2006/fiducial-?.ppm",
                   start=1,
                   stop=5,
                   interval=1,
                   visionSystem=VisionSystem())
    }
def INIT(robot):
    return {
        "camera":
        FakeCamera(pattern="vision/blimp/bullseye-?.pbm",
                   start=1,
                   stop=5,
                   interval=1,
                   visionSystem=VisionSystem())
    }
Beispiel #4
0
def INIT(robot):
    return {"camera": FakeCamera(visionSystem=VisionSystem())}
Beispiel #5
0
      if not self.getActive():
         self.updateOnce()
      return "Ok"

   def clearCallbackList(self):
      # callback is a function that has first param
      # as self (ie, the visionSystem object)
      while len(self.callbackList) > 0: self.callbackList.pop()
      while len(self.callbackTextList) > 0: self.callbackTextList.pop()
      if not self.getActive():
         self.updateOnce()
      return "Ok"

   def clearFilters(self):
      self.clearCallbackList()
      
   def processAll(self):
      if self.filterMode and self.vision != None:
         self.vision.applyFilterList()
         while len(self.filterResults): self.filterResults.pop()
         for filterFunc in self.callbackList:
            self.filterResults.append( filterFunc(self) )

if __name__ == '__main__':
   from pyrobot.vision.cvision import VisionSystem
   from pyrobot.camera.fake import FakeCamera
   cam = FakeCamera(visionSystem = VisionSystem())
   cam.makeWindow()
   cam.updateWindow()
   cam.window.mainloop()
Beispiel #6
0
            self.updateOnce()
        return "Ok"

    def clearCallbackList(self):
        # callback is a function that has first param
        # as self (ie, the visionSystem object)
        self.callbackList[:] = []
        self.callbackTextList[:] = []
        if not self.getActive():
            self.updateOnce()
        return "Ok"

    def clearFilters(self):
        self.clearCallbackList()

    def processAll(self):
        if self.filterMode and self.vision != None:
            self.vision.applyFilterList()
            self.filterResults[:] = [
                filterFunc(self) for filterFunc in self.callbackList
            ]


if __name__ == '__main__':
    from pyrobot.vision.cvision import VisionSystem
    from pyrobot.camera.fake import FakeCamera
    cam = FakeCamera(visionSystem=VisionSystem())
    cam.makeWindow()
    cam.updateWindow()
    cam.window.mainloop()
Beispiel #7
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()
Beispiel #8
0
         #im = i
         UI(root, im).pack()
         root.mainloop()
         print("Done!")
     except:
         print(
             "Failed! Probably you don't have Tkinter or ImageTk installed")
 else:
     print("skipping...")
 print(
     "Do you want to run test 7: create a camera view, and display 10 frames in ASCII? ",
     end=' ')
 if sys.stdin.readline().lower()[0] == 'y':
     print("Running...")
     from pyrobot.camera.fake import FakeCamera
     image = FakeCamera()
     for x in range(10):
         image.update()
         image.display()
     print("Done!")
 else:
     print("skipping...")
 print("Do you want to run test 8: create a histogram of the image? ",
       end=' ')
 if sys.stdin.readline().lower()[0] == 'y':
     print("Running...")
     from pyrobot.camera.fake import FakeCamera
     image = FakeCamera()
     image.update()
     histogram = image.histogram(15, 20)
     histogram.display()
        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? ",
    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)
Beispiel #10
0
def INIT(robot):
    return {"FakeCamera": FakeCamera(visionSystem=myVision())}