コード例 #1
0
def main():
    # Command line options:
    parser = ArgumentParser(description="A very simple VisionCpp demo. Opens "
                            "the webcam capture feed, performs some colour "
                            "space conversions, and displays the result.")
    parser.add_argument("-v",
                        "--verbose",
                        action="store_true",
                        help="verbose output printing")
    parser.add_argument("-C",
                        "--computecpp",
                        type=str,
                        metavar="PATH",
                        default="~/ComputeCpp-CE-0.1-Linux",
                        help="Path to ComputeCpp installation directory")
    args = parser.parse_args()
    if args.verbose: logging.basicConfig(level=logging.DEBUG)
    vp.init(args.computecpp)

    # VisionCpp expression tree:
    image_in = vp.Webcam()
    node1 = vp.BGRToRGB(image_in)
    node2 = vp.U8C3ToF32C3(node1)
    node3 = vp.RGBToHSV(node2)
    node4 = vp.HSVToRGB(node3)
    node5 = vp.F32C3ToU8C3(node4)
    node6 = vp.RGBToBGR(node5)
    output = vp.show(node6)

    vp.run(output)
コード例 #2
0
 def test_init_path_set(self):
     path = vp.init('README.rst')
     self.assertEqual(path, os.path.abspath('README.rst'))
     path2 = vp.init()
     self.assertEqual(path, path2)
コード例 #3
0
 def test_init_bad_path(self):
     with self.assertRaises(vp.VisionCppException):
         vp.init("/not/a/real/path/i/think")
コード例 #4
0
 def test_init_path_unchanged(self):
     path = vp.init()
     path2 = vp.init()
     self.assertEqual(path, path2)