Esempio n. 1
0
def run():
    for i in range(5):
        filename = os.path.dirname(
            os.path.abspath(__file__)) + "/../data/color_map.png"
        splash.set_world_attribute("replaceObject",
                                   ["image", "image", "object"])
        splash.set_object_attribute("image", "file", filename)
        sleep(1.0)
        splash.set_world_attribute("replaceObject",
                                   ["image", "image_ffmpeg", "object"])
        sleep(1.0)
        splash.set_world_attribute("replaceObject",
                                   ["image", "image", "object"])
Esempio n. 2
0
    def test_replace_image(self):
        print("Replace the Image object multiple times")

        image_file = f"{SplashTestCase.test_dir}/../../../data/share/splash/color_map.png"
        video_file = f"{SplashTestCase.test_dir}/../../assets/tornado_h264.mov"
        for i in range(5):
            splash.set_world_attribute("replaceObject",
                                       ["image", "image", "image", "object"])
            sleep(0.5)
            splash.set_object_attribute("image", "file", image_file)
            sleep(2.0)
            splash.set_world_attribute(
                "replaceObject", ["image", "image_ffmpeg", "image", "object"])
            sleep(0.5)
            splash.set_object_attribute("image", "file", video_file)
            sleep(2.0)
Esempio n. 3
0
def run():
    splash.set_world_attribute("replaceObject", ["image", "image_v4l2", "object"])
    splash.set_object_attribute("image", "doCapture", 1)
    sleep(1.0)
    splash.set_object_attribute("image", "captureSize", [2048, 2048])
    sleep(1.0)
    splash.set_object_attribute("image", "captureSize", [640, 480])
    sleep(1.0)
    splash.set_object_attribute("image", "doCapture", 0)
    splash.set_world_attribute("replaceObject", ["image", "image", "object"])
Esempio n. 4
0
    def test_image_v4l2(self):
        print("Test V4L2 capture")

        splash.set_world_attribute("replaceObject",
                                   ["image", "image_v4l2", "image", "object"])
        splash.set_object_attribute("image", "doCapture", 1)
        sleep(1.0)
        splash.set_object_attribute("image", "captureSize", [2048, 2048])
        sleep(1.0)
        splash.set_object_attribute("image", "captureSize", [640, 480])
        sleep(1.0)
        splash.set_object_attribute("image", "doCapture", 0)
Esempio n. 5
0
def run():
    splash.set_world_attribute("replaceObject",
                               ["image", "image_ffmpeg", "object"])
    splash.set_object_attribute("image", "file", "./assets/tornado_h264.mov")
    sleep(10.0)
    splash.set_object_attribute("image", "file", "./assets/tornado_hap.mov")
    sleep(10.0)
    splash.set_object_attribute("image", "file",
                                "./assets/tornado_hap_alpha.mov")
    sleep(10.0)
    splash.set_object_attribute("image", "file", "./assets/tornado_hap_q.mov")
    sleep(10.0)
    splash.set_world_attribute("replaceObject", ["image", "image", "object"])
Esempio n. 6
0
    def do_GET(self):
        match = reg.findall(self.path)[0]
        command = match[0]

        if match[0] == "getObjectList":
            result = splash.get_object_list()
            self.sendResult(result)
        elif match[0] == "getObjectTypes":
            result = splash.get_object_types()
            self.sendResult(result)
        elif match[0] == "getObjectAttributeDescription":
            obj = match[1]
            attr = match[2]
            result = splash.get_object_attribute_description(obj, attr)
            self.sendResult(result)
        elif match[0] == "getObjectAttribute":
            obj = match[1]
            attr = match[2]
            result = splash.get_object_attribute(obj, attr)
            self.sendResult(result)
        elif match[0] == "getObjectLinks":
            result = splash.get_object_links()
            self.sendResult(result)
        elif match[0] == "setObjectAttribute":
            obj = match[1]
            attr = match[2]
            value = match[3].split('&')
            for i in range(len(value)):
                converted = False
                try:
                    value[i] = int(value[i])
                    converted = True
                except:
                    pass

                if not converted:
                    try:
                        value[i] = float(value[i])
                    except:
                        pass

            if splash.set_object_attribute(obj, attr, value):
                self.sendResult("OK")
            else:
                self.sendResult("")
Esempio n. 7
0
    def do_GET(self):
        match = reg.findall(self.path)[0]
        command = match[0]

        if match[0] == "getObjectList":
            result = splash.get_object_list()
            self.sendResult(result)
        elif match[0] == "getObjectTypes":
            result = splash.get_object_types()
            self.sendResult(result)
        elif match[0] == "getObjectAttributeDescription":
            obj = match[1]
            attr = match[2]
            result = splash.get_object_attribute_description(obj, attr)
            self.sendResult(result)
        elif match[0] == "getObjectAttribute":
            obj = match[1]
            attr = match[2]
            result = splash.get_object_attribute(obj, attr)
            self.sendResult(result)
        elif match[0] == "getObjectLinks":
            result = splash.get_object_links()
            self.sendResult(result)
        elif match[0] == "setObjectAttribute":
            obj = match[1]
            attr = match[2]
            value = match[3].split('&')
            for i in range(len(value)):
                converted = False
                try:
                    value[i] = int(value[i])
                    converted = True
                except:
                    pass
                
                if not converted:
                    try:
                        value[i] = float(value[i])
                    except:
                        pass

            if splash.set_object_attribute(obj, attr, value):
                self.sendResult("OK")
            else:
                self.sendResult("")
Esempio n. 8
0
    def test_codecs(self):
        print("Testing video codecs")

        splash.set_world_attribute(
            "replaceObject", ["image", "image_ffmpeg", "image", "object"])
        sleep(2.0)
        splash.set_object_attribute(
            "image", "file",
            f"{SplashTestCase.test_dir}/../../assets/tornado_h264.mov")
        sleep(10.0)
        splash.set_object_attribute(
            "image", "file",
            f"{SplashTestCase.test_dir}/../../assets/tornado_hap.mov")
        sleep(10.0)
        splash.set_object_attribute(
            "image", "file",
            f"{SplashTestCase.test_dir}/../../assets/tornado_hap_alpha.mov")
        sleep(10.0)
        splash.set_object_attribute(
            "image", "file",
            f"{SplashTestCase.test_dir}/../../assets/tornado_hap_q.mov")
        sleep(10.0)
    def test_geometric_calibrator(self):
        print("Testing geometric calibrator")

        # Link a "camera" to the geometric calibrator
        splash.set_world_attribute("addObject", ["image_list", "image_list"])
        splash.set_world_attribute("link",
                                   ["image_list", "geometricCalibrator"])
        sleep(1)

        splash.set_object_attribute(
            "image_list", "file",
            f"{SplashTestCase.test_dir}/../../assets/captured_patterns/")

        # Start the calibration
        splash.set_object_attribute("geometricCalibrator", "calibrate", "true")
        sleep(1)
        # Position 1
        splash.set_object_attribute("geometricCalibrator", "nextPosition",
                                    "true")
        sleep(20)
        # Position 2
        splash.set_object_attribute("geometricCalibrator", "nextPosition",
                                    "true")
        sleep(20)
        # Position 3
        splash.set_object_attribute("geometricCalibrator", "nextPosition",
                                    "true")
        sleep(20)

        splash.set_object_attribute("geometricCalibrator",
                                    "finalizeCalibration", "true")
        # Wait for the calibration process to execute
        sleep(30)