Пример #1
0
 def __init__(self, **kwargs):
     parameterInitCheck(LiveManagedFilterchain.parameter_defs, kwargs, self) # checks that parameters ok, attaches them as attributes to self
     # remove parameters not used by the mother class
     kwargs.pop("livethread")
     if ("recv_buffer_size"  in kwargs): kwargs.pop("recv_buffer_size") 
     if ("reordering_mstime" in kwargs): kwargs.pop("reordering_mstime")
     super().__init__(**kwargs)
Пример #2
0
    def __init__(self, **kwargs):
        # auxiliary string for debugging output
        self.pre = self.__class__.__name__ + " : "
        # check for input parameters, attach them to this instance as
        # attributes
        parameterInitCheck(MultiForkFilterchain.parameter_defs, kwargs, self)
        generateGetters(self.parameter_defs, self)

        # check some types
        for openglthread in self.openglthreads:
            assert (issubclass(openglthread.__class__, OpenGLThread))
        #if self.valkkafsmanager is not None:
        #    assert(isinstance(self.valkkafsmanager, ValkkaFSManager))
        #if record_type != RecordType.never:
        #    assert(self.id_rec > -1)

        self.idst = str(id(self))

        self.initVars()  # must be called before any clients are requested

        self.make_main_branch()
        self.make_filesystem_branch()  # calls by default self.fs_gate.unSet()
        self.make_decode_branch()
        self.make_analysis_branch()

        self.createContext(
        )  # creates & registers contexes to LiveThread & USBDeviceThread

        self.start()  # starts threads corresponding to this filterchain
Пример #3
0
 def __init__(self, **kwargs):
     # auxiliary string for debugging output
     self.pre = self.__class__.__name__ + " : "
     # check for input parameters, attach them to this instance as
     # attributes
     parameterInitCheck(self.parameter_defs, kwargs, self)
     self.init()
Пример #4
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     parameterInitCheck(
         MovementDetector.parameter_defs, kwargs, self
     )  # checks that kwargs is consistent with parameter_defs.  Attaches parameters as attributes to self
     self.pre = self.__class__.__name__ + " : "
     self.reset()
Пример #5
0
    def __init__(self, **kwargs):
        # auxiliary string for debugging output
        self.pre = self.__class__.__name__ + " : "
        # check for input parameters, attach them to this instance as
        # attributes
        parameterInitCheck(MVisionContainer.parameter_defs, kwargs, self)
        assert (issubclass(self.mvision_class,
                           multiprocess.QValkkaShmemProcess2))
        super().__init__(parent_container=self.parent_container,
                         filterchain_group=self.filterchain_group,
                         n_xscreen=self.n_xscreen)

        tag = self.mvision_class.tag  # identifies a list of multiprocesses in self.process_map

        try:
            queue = self.process_map[tag]
        except KeyError:
            self.mvision_process = None
            return

        try:
            self.mvision_process = queue.pop()
        except IndexError:
            self.mvision_process = None
            return
Пример #6
0
 def __init__(self, **kwargs):
     parameterInitCheck(PlayVideoContainerNxM.parameter_defs, kwargs, self)
     kwargs.pop("n_dim")
     kwargs.pop("m_dim")
     kwargs.pop("valkkafsmanager")
     kwargs.pop("playback_controller")
     super().__init__(**kwargs)
Пример #7
0
 def __init__(self, **kwargs):
     parameterInitCheck(
         USBManagedFilterchain.parameter_defs, kwargs, self
     )  # checks that parameters ok, attaches them as attributes to self
     # remove parameters not used by the mother class
     kwargs.pop("usbthread")
     super().__init__(**kwargs)
Пример #8
0
    def __init__(self, **kwargs):
        # auxiliary string for debugging output
        self.pre = self.__class__.__name__ + " : "
        # check for input parameters, attach them to this instance as
        # attributes
        print(self.pre, kwargs)
        parameterInitCheck(VideoContainer.parameter_defs, kwargs, self)
        self.signals = self.Signals()

        # reset callback functions
        self.set_cb_focus()
        self.set_cb_unfocus()

        # container state variables
        self.double_click_focus = False  # has this container been double-click focused

        # right-click menu
        self.right_click_menu = self.RightClickMenu()
        self.right_click_menu.maximize.triggered.connect(
            lambda x: self.handle_left_double_click(None)
        )  # use lambda as we must connect to a function
        self.right_click_menu.remove_camera.triggered.connect(self.clearDevice)

        # no stream yet
        self.device = None
        self.onvif_thread = None  # TODO: ONVIF
        self.filterchain = None
        self.viewport = ViewPort(
        )  # viewport instance is used by ManagedFilterChain(s)
Пример #9
0
 def __init__(self, **kwargs):
     parameterInitCheck(PlaybackFilterChainGroup.parameter_defs, kwargs,
                        self)
     self.pre = self.__class__.__name__ + " : "
     self.chains = []
     self.context_type = None
     self.closed = False
Пример #10
0
 def __init__(self, **kwargs):
     # auxiliary string for debugging output
     self.pre = self.__class__.__name__ + " : "
     # check kwargs agains parameter_defs, attach ok'd parameters to this
     # object as attributes
     parameterInitCheck(self.parameter_defs, kwargs, self)
     self.makeWidget()
     self.reset()
Пример #11
0
 def __init__(self, **kwargs):
     self.pre = self.__class__.__name__ + " : "  # auxiliary string for debugging output
     parameterInitCheck(
         self.parameter_defs, kwargs, self
     )  # check for input parameters, attach them to this instance as attributes
     typeCheck(self.shmem_image_dimensions[0], int)
     typeCheck(self.shmem_image_dimensions[1], int)
     self.init()
Пример #12
0
    def __init__(self, **kwargs):
        # auxiliary string for debugging output
        self.pre = self.__class__.__name__ + " : "
        # check for input parameters, attach them to this instance as
        # attributes
        parameterInitCheck(ManagedFilterchain3.parameter_defs, kwargs, self)
        generateGetters(self.parameter_defs, self)

        for openglthread in self.openglthreads:
            assert(issubclass(openglthread.__class__, OpenGLThread))
        self.init()
Пример #13
0
    def __init__(self, **kwargs):
        # auxiliary string for debugging output
        self.pre = self.__class__.__name__ + " : "

        # check for input parameters, attach them to this instance as attributes
        parameterInitCheck(self.parameter_defs, kwargs, self)
        typeCheck(self.shmem_image_dimensions[0], int)
        typeCheck(self.shmem_image_dimensions[1], int)

        # check type of frag_shmem_cellsize  to review !!!
        # typeCheck(self.frag_shmem_cellsize[0], int)
        # typeCheck(self.frag_shmem_cellsize[1], int)
        # typeCheck(self.frag_shmem_cellsize[2], int)

        self.init()
        setValkkaLogLevel(loglevel_silent)
Пример #14
0
    def __init__(self, **kwargs):
        # auxiliary string for debugging output
        self.pre = self.__class__.__name__ + " : "
        # check for input parameters, attach them to this instance as
        # attributes
        print("MVisionContainer: __init__: kwargs:", pformat(kwargs))
        super().__init__(**filter_keys(super().parameter_defs.keys(), kwargs))
        parameterInitCheck(
            MVisionContainer.parameter_defs,
            filter_keys(MVisionContainer.parameter_defs.keys(), kwargs), self)

        if isinstance(self.mvision_class, str):
            self.mvision_class = nameToClass(self.mvision_class)

        assert (issubclass(self.mvision_class, multiprocess.QShmemProcess))

        tag = self.mvision_class.tag  # identifies a list of multiprocesses in singleton.process_map

        self.verbose = True

        self.mvision_process = self.getProcess(tag)
        if self.mvision_process is None: return

        self.analyzer_widget_connected = False
        if hasattr(self.mvision_process, "analyzer_video_widget_class"):
            # the machine vision class may declare what video widget it wants to use to define the machine vision parameters (line crossing, zone intrusion, etc.)
            self.analyzer_widget = AnalyzerWidget(
                analyzer_video_widget_class=self.mvision_process.
                analyzer_video_widget_class)
            # if hasattr(self.mvision_process, "connectAnalyzerWidget"):
            # self.mvision_process.connectAnalyzerWidget(self.analyzer_widget)
            # self.analyzer_widget_connected = True
            # TODO: init analyzer parameters by sending a signal & serialize analyzer parameters
        else:
            self.analyzer_widget = AnalyzerWidget()

        self.mvision_process.connectAnalyzerWidget(self.analyzer_widget)
        self.analyzer_widget_connected = True
        # self.mvision_process.connectShmem(self.analyzer_widget) # do in connectAnalyzerWidget

        self.analyzer_widget.setVisible(False)
        self.signals.right_double_click.connect(self.right_double_click_slot)

        if self.mvision_parameters:
            self.mvision_process.updateAnalyzerParameters(
                self.mvision_parameters)
            self.analyzer_widget.mvisionToParameters(self.mvision_parameters)
Пример #15
0
    def __init__(self, **kwargs):
        # auxiliary string for debugging output
        self.pre = self.__class__.__name__ + " : "
        # check for input parameters, attach them to this instance as
        # attributes
        # print("MVisionContainer: __init__: kwargs:", pformat(kwargs))

        # remove key-values of this child class & pass the rest to the superclass
        super().__init__(
            **remove_keys(MVisionContainer.parameter_defs.keys(), kwargs))

        # init internal variables for this child class
        parameterInitCheck(
            MVisionContainer.parameter_defs,
            filter_keys(MVisionContainer.parameter_defs.keys(), kwargs), self)

        # print(">>>", self.filterchain_group)
        self.init()
Пример #16
0
    def __init__(self, **kwargs):
        # auxiliary string for debugging output
        self.pre = self.__class__.__name__ + " : "
        # check for input parameters, attach them to this instance as
        # attributes
        parameterInitCheck(RootVideoContainer.parameter_defs, kwargs, self)
        self.signals = self.Signals()
        self.closed = False
        self.children = []
        self.openglthread = self.gpu_handler.openglthreads[self.n_xscreen]
        # TODO: check number of xscreens and correct self.n_xscreen if necessary

        self.signals.close.connect(self.close_slot)

        # this creates the container objects .. their widgets are created in
        # makeWidget
        self.createChildren()
        # create widget into a certain xscreen
        self.makeWidget(self.gpu_handler.true_screens[self.n_xscreen])
Пример #17
0
    def __init__(self, **kwargs):
        # auxiliary string for debugging output
        self.pre = self.__class__.__name__ + " : "
        # check for input parameters, attach them to this instance as
        # attributes
        parameterInitCheck(PlaybackFilterchain.parameter_defs, kwargs, self)
        generateGetters(self.parameter_defs, self)

        # check some types
        for openglthread in self.openglthreads:
            assert (issubclass(openglthread.__class__, OpenGLThread))

        self.idst = str(id(self))

        self.initVars()  # must be called before any clients are requested

        self.make_main_branch()
        self.make_decode_branch()

        self.start()  # starts threads corresponding to this filterchain
Пример #18
0
    def __init__(self, **kwargs):
        self.pre = self.__class__.__name__ + " : "  # auxiliary string for debugging output
        parameterInitCheck(
            GPUHandler.parameter_defs, kwargs, self
        )  # check kwargs agains parameter_defs, attach ok'd parameters to this object as attributes
        self.kwargs = kwargs
        self.true_screens = []  # list of QtCore.QScreen
        self.openglthreads = []  # list of OpenGLThread instances
        self.findXScreens()

        # self.true_screens=[self.true_screens[0]]

        for n_gpu, screen in enumerate(self.true_screens):

            x_connection = ":0." + str(n_gpu)
            # x_connection=":0.1"
            # x_connection=":1.0" # nopes

            print(pre, "GPUHandler: starting OpenGLThread with", x_connection)

            affinity = -1
            if self.cpu_scheme:
                affinity = self.cpu_scheme.getOpenGL()

            openglthread = OpenGLThread(
                name="gpu_" + str(n_gpu),
                # reserve stacks of YUV video frames for various resolutions
                n_720p=self.n_720p,
                n_1080p=self.n_1080p,
                n_1440p=self.n_1440p,
                n_4K=self.n_4K,
                verbose=False,
                msbuftime=self.msbuftime,
                affinity=affinity,
                x_connection=x_connection)

            print(pre, "GPUHandler: OpenGLThread started")

            self.openglthreads.append(openglthread)
Пример #19
0
 def __init__(self, **kwargs):
     parameterInitCheck(VideoContainerNxM.parameter_defs, kwargs, self)
     kwargs.pop("n_dim")
     kwargs.pop("m_dim")
     super().__init__(**kwargs)
Пример #20
0
 def __init__(self, **kwargs):
     parameterInitCheck(ManagedFilterchain2.parameter_defs, kwargs, self)
     kwargs.pop("shmem_image_dimensions")
     kwargs.pop("shmem_n_buffer")
     kwargs.pop("shmem_image_interval")
     super().__init__(**kwargs)
Пример #21
0
 def __init__(self, **kwargs):
     parameterInitCheck(
         Analyzer.parameter_defs, kwargs, self, undefined_ok=True
     )  # checks that kwargs is consistent with parameter_defs.  Attaches parameters as attributes to self.  This is a mother class: there might be more parameters not defined here from child classes
     self.pre = self.__class__.__name__ + " : "