Пример #1
0
    def update_filter_page(self, index):
        name     = str(self.cb_filter_group.itemText(index))
        fr       = engine.get_component("filter_rack")
        page     = fr.get_page(name)
        layout   = self.filter_rack_contents.layout()

        try:
            if get_app().user_options["filter_group"] is not None:
                cur_page = fr.get_page(get_app().user_options["filter_group"])
                length   = len(cur_page)
                # Clear the Layout
                while length > 0:
                    i = layout.takeAt(1).widget()
                    i.setParent(None)
                    i.deleteLater()
                    length -= 1
        except:
            log.error("Error when cleaning the Rack UI", exc_info=True)

        get_app().user_options["filter_group"] = name
        # Add the filters contained in the filter page
        for f in page:
            self.add_filter_gui(f.fid, engine.get_plugin(f.fid))

        self.update_filter_uis()
        self.lbl_page_in.setText(page.in_color)
        self.lbl_page_out.setText(page.out_color)
Пример #2
0
    def __init__(self, fid):
        self.fid       = fid
        self.ignore    = False
        # Get plugin to extract the filter in and out parameters
        f   = engine.get_plugin(fid)
        doc = minidom.parse(join(f.root_path, "info.xml"))
        # Extract the slot info
        self.in_color  = str(doc.getElementsByTagName("in")[0].getAttribute("colorspace"))
        self.out_color = str(doc.getElementsByTagName("out")[0].getAttribute("colorspace"))

        # Do a lazy check to see if the colorspaces are contained in the cv2
        # color constants
        color_list = [c for c in dir(cv2) if c.startswith("COLOR")]

        if not [c for c in color_list if self.in_color in c]:
            raise InvalidColorSpace("Invalid colorspace '{}'".format(self.in_color))
        if not [c for c in color_list if self.out_color in c]:
            raise InvalidColorSpace("Invalid colorspace '{}'".format(self.out_color))
Пример #3
0
    def apply_filters(self, frame):
        if self.get_flow_errors():
            raise FilterPageFlowError()

        if frame.color_space != self.in_color:
            raise WrongColorSpace("Frame should be {} and not {}".format(self.in_color, frame.color_space))

        for i in range(0, len(self.flist)):
            if self.flist[i].ignore:
                continue
            p = engine.get_plugin(self.flist[i].fid)
            frame = p.instance.apply_filter(frame)

        if get_app().user_options["preview_source"] == get_app().OPT_PREVIEW_FILTER_PAGE:
            if self.name == get_app().user_options["filter_group"]:
                fs = engine.get_component("frame_stream")
                fs.preview_queue.put(frame.copy())
        return frame
Пример #4
0
 def populate_parameters(self):
     plugin = engine.get_plugin(self.fid)
     for name in plugin.instance.parameters:
         self.add_parameter(name, plugin.instance.parameters[name], plugin.instance.parameter_change)