Beispiel #1
0
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconbgcalc.jpg')
        OTModulePlugin.__init__(self, name, iconFile=icon_path)

        self._video = OTParamVideoInput("Video")

        self._jumpFrame = OTParamSlider("Frame jump step", 1000, 1, 4000)
        self._jump2Frame = OTParamSlider("Compare frame", 1500, 1, 4000)
        self._threshold = OTParamSlider("Threshold", 5, 0, 255)

        self._export = OTParamButton("Export")

        self._editMode = OTParamCheckBox("Edit mode", False)
        self._run = OTParamButton("Run")
        self._player = OTParamPlayer("Video player")
        self._progress = OTParamProgress()

        self._formset = [('_video', '_run', '_editMode', '_export'),
                         ('_jumpFrame', '_jump2Frame', '_threshold'),
                         "_player", "_progress"]

        self._run.value = self.run
        self._player.processFrame = self.processFrame
        self._video.valueUpdated = self.newVideoInputChoosen

        self._export.value = self.export_clicked

        self._backgroundDetector = None
        self._progress.hide()
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        TypeColorVideoPipe.__init__(self)
        OTModulePlugin.__init__(self, name, iconFile=icon_path)

        self._video = ModuleConnection("Video", connecting=TypeColorVideo)
        self._player = ControlPlayer("Video player")
        self._colorDomain = ControlCombo("Color domain")

        self._colorDomain.addItem("XYZ", cv2.COLOR_BGR2XYZ)
        self._colorDomain.addItem("YCrCb", cv2.COLOR_BGR2YCR_CB)
        self._colorDomain.addItem("HSV", cv2.COLOR_BGR2HSV)
        self._colorDomain.addItem("HLS", cv2.COLOR_BGR2HLS)
        self._colorDomain.addItem("Lab", cv2.COLOR_BGR2LAB)
        self._colorDomain.addItem("Luv", cv2.COLOR_BGR2LUV)

        self._colorDomain.changed = self._player.refresh
        self._video.changed = self.newVideoInputChoosen
        self._player.processFrame = self.processFrame

        self._formset = [
            '_video',
            '_colorDomain',
            "_player",
        ]
Beispiel #3
0
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'icongeo.png')
        OTBaseModuleGeometry.__init__(self,name, iconFile = icon_path)

        self._imgWidth = 0.0
        self._imgHeight = 0.0
        self._startPoint = None
        self._endPoint = None

        self._selectedPoly = None
        self._selectedPoint = None
        

        self._video  = OTParamVideoInput("Video")
        self._player = OTParamPlayer("Video")
        self._remove = OTParamButton("Remove")
        self._square = OTParamToggle("Square")
        self._circle = OTParamToggle("Circle")
        self._export = OTParamButton("Export")
        self._import = OTParamButton("Import")

        self._formset = [ '_video',"_player", ("_square", "_circle", " ","_remove"," ", "_export", "_import"), "=", "_polygons" ]

        self._video.valueUpdated = self.videoSelected
        self._square.value = self.square_toggle
        self._circle.value = self.circle_toggle
        self._remove.value = self.remove_clicked
        self._export.value = self.export_clicked
        self._import.value = self.import_clicked
        
        self._player._videoWidget.onDrag = self.onDragInVideoWindow
        self._player._videoWidget.onEndDrag = self.onEndDragInVideoWindow
        self._player._videoWidget.onClick = self.onClickInVideoWindow
        self._player._videoWidget.onDoubleClick = self.onDoubleClickInVideoWindow
        self._player.processFrame = self.processFrame
Beispiel #4
0
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        OTModuleInputVideoPipe.__init__(self)
        OTPAdaptativeThresholdFilter.__init__(self)
        OTModulePlugin.__init__(self, name,  iconFile=icon_path)
       
        self._video = OTParamVideoInput("Video")
        self._player = OTParamPlayer("Video player")

        #THRESHOLD 
        self._blockSize = OTParamSlider("Block size", 3, 3, 1000,varname='_param_tb_block_size')
        self._C = OTParamSlider("C", 255, 0, 510,varname='_param_tb_c')
        self._adaptiveMethod = OTParamCombo("Adaptive method",varname='_param_tb_adaptive_method')
        self._adaptiveMethod.addItem("Mean", cv2.cv.CV_ADAPTIVE_THRESH_MEAN_C)
        self._adaptiveMethod.addItem("Gaussian", cv2.cv.CV_ADAPTIVE_THRESH_GAUSSIAN_C)
        
        self._th_thresholdType = OTParamCombo("ThresholdType",varname='_param_tb_threshold_type')
        self._th_thresholdType.addItem("THRESH_BINARY", cv2.THRESH_BINARY)
        self._th_thresholdType.addItem("THRESH_BINARY_INV", cv2.THRESH_BINARY_INV)
        #END THRESHOLD

        self._adaptiveMethod.valueUpdated = self.refreshValue
        self._blockSize.valueUpdated = self.refreshValue
        self._C.valueUpdated = self.refreshValue
        
        self._formset = [ 
                '_video',"_player",
                ('_adaptiveMethod','_th_thresholdType'), 
                ('_blockSize',"_C"),
            ]
        
        self._player.processFrame = self.processFrame
        self._video.valueUpdated = self.newVideoInputChoosen
Beispiel #5
0
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'icon.jpg')
        OTModuleResultsPlugin.__init__(self, name, iconFile=icon_path)

        self._positions = OTParamPositions("Positions")
        self._video = OTParamVideoInput("Video")
        self._player = OTParamPlayer("Video player")
        self._nobjects = OTParamSlider("Number of objects to track", 1, 1, 10)
        self._run = OTParamButton("Run")
        self._apply = OTParamButton("Apply changes")
        self._progress = OTParamProgress()

        #self._query.readOnly = True
        self._run.value = self.run
        self._apply.value = self.apply
        self._video.valueUpdated = self.newVideoInputChoosen
        self._player.processFrame = self.processFrame
        self._query.form.tableView.keyPressEvent = self.keyPressEvent

        self._current_row = None

        self._formset = [('_video', "_positions", '_nobjects', '_run'),
                         '_player', '=', ("_results", '_apply'), "_query",
                         "_progress"]

        self._progress.hide()
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        OTPConvertColor.__init__(self)
        OTModulePlugin.__init__(self, name, iconFile=icon_path)

        self._video = OTParamVideoInput("Video")
        self._player = OTParamPlayer("Video player")

        self._colorDomain = OTParamCombo("Colors space",
                                         varname='_param_color_domain')
        self._colorDomain.addItem("RGB", -1)
        self._colorDomain.addItem("GRAY", cv2.COLOR_BGR2GRAY)
        self._colorDomain.addItem("XYZ", cv2.COLOR_BGR2XYZ)
        self._colorDomain.addItem("YCrCb", cv2.COLOR_BGR2YCR_CB)
        self._colorDomain.addItem("HSV", cv2.COLOR_BGR2HSV)
        self._colorDomain.addItem("HLS", cv2.COLOR_BGR2HLS)
        self._colorDomain.addItem("Lab", cv2.COLOR_BGR2LAB)
        self._colorDomain.addItem("Luv", cv2.COLOR_BGR2LUV)

        self._colorDomain.valueUpdated = self.refreshValue

        self._formset = [
            '_video',
            '_colorDomain',
            "_player",
        ]

        self._player.processFrame = self.processFrame
        self._video.valueUpdated = self.newVideoInputChoosen
Beispiel #7
0
    def exportCodeTo(self, folder):
        files_to_copy = []        
        classes, imports, constructer_params, parameters = [], [], [], []
        classes_tmp, imports_tmp, constructer_params_tmp, parameters_tmp = self._video.value.exportCodeTo(folder)
        classes += classes_tmp; imports += imports_tmp; constructer_params += constructer_params_tmp; parameters += parameters_tmp;

        #SET OTPRemoveBackground
        if isinstance(self._video.value, OTModuleColorFilter):
            files_to_copy.append( 'OTPThreshBlobs' )
            parameters.append("self._param_tb_color_component = %d " % self._colorComponent.value )
            parameters.append("self._param_tb_color_domain = %d " % self._colorDomain.value )
            parameters.append("self._param_tb_adaptive_method = %d " % self._adaptiveMethod.value )
            parameters.append("self._param_tb_box_height = %d " % self._boxHeight.value )
            parameters.append("self._param_tb_box_width = %d " % self._boxWidth.value )
            parameters.append("self._param_tb_block_size = %d " % self._blockSize.value )
            parameters.append("self._param_tb_c = %d " % self._C.value )
        else:
            files_to_copy.append( 'OTPThreshImage' )
            parameters.append("self._param_tb_color_component = %d " % self._colorComponent.value )
            parameters.append("self._param_tb_color_domain = %d " % self._colorDomain.value )
            parameters.append("self._param_tb_adaptive_method = %d " % self._adaptiveMethod.value )
            parameters.append("self._param_tb_block_size = %d " % self._blockSize.value )
            parameters.append("self._param_tb_c = %d " % self._C.value )
        #END SET

    
        classes += files_to_copy
        for file_to_copy in files_to_copy:
            filename = file_to_copy+".py"; originalfilepath = tools.getFileInSameDirectory(__file__, filename); destinyfilepath = os.path.join( folder, filename )            
            f = open(originalfilepath, 'r'); text = f.read(); f.close(); text = text.replace("from mcvgui.core.controllers.", "from "); f = open(destinyfilepath, 'w'); f.write(text); f.close()
            imports.append( "from %s import %s" % (file_to_copy, file_to_copy) )
        
        return classes, imports, constructer_params, parameters
	def __init__(self, name):
		OTModulePlugin.__init__(self, name, iconFile = tools.getFileInSameDirectory(__file__, 'iconvi.jpg'))
		TypeColorVideo.__init__(self)
	
		self._file      = ControlFile("File")
		self._player    = ControlPlayer("Video")

		self._formset = [ "_file", "_player"]
		
		self._file.changed = self.__videoSelected
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        OTModulePlugin.__init__(self, name, iconFile=icon_path)

        self._video1 = OTParamVideoInput("Video 1")
        self._video2 = OTParamVideoInput("Video 2")
        self._player = OTParamPlayer("Video player")

        self._formset = [('_video1', '_video2'), "_player"]

        self._player.processFrame = self.processFrame
        self._video1.valueUpdated = self.newVideoInputChoosen
Beispiel #10
0
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconvi.jpg')
        super(OTModuleVideoInput, self).__init__(name, iconFile=icon_path)
        OTModuleInputVideo.__init__(self)

        self._file = OTParamFile("File")
        self._player = OTParamPlayer("Video", varname='__capture')
        self._progress = OTParamProgress()

        self._formset = ["_file", "_player", "_progress"]

        self._file.valueUpdated = self.videoSelected
        self._progress.hide()
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        OTModuleInputVideoPipe.__init__(self)
        OTPAdaptativeThreshold.__init__(self)
        OTModulePlugin.__init__(self, name,  iconFile=icon_path)
       
        self._video = OTParamVideoInput("Video")
        self._player = OTParamPlayer("Video player")

        #THRESHOLD 
        self._blockSize = OTParamSlider("Block size", 3, 3, 500,varname='_param_tb_block_size')
        self._C = OTParamSlider("C", 0, 0, 500,varname='_param_tb_c')
        self._adaptiveMethod = OTParamCombo("Adaptive method",varname='_param_tb_adaptive_method')
        self._adaptiveMethod.addItem("Mean", cv2.cv.CV_ADAPTIVE_THRESH_MEAN_C)
        self._adaptiveMethod.addItem("Gaussian", cv2.cv.CV_ADAPTIVE_THRESH_GAUSSIAN_C)
        
        self._th_colorDomain = OTParamCombo("Colors space",varname='_param_tb_color_domain')
        self._th_colorDomain.addItem("RGB", -1)
        self._th_colorDomain.addItem("Gray",   cv2.COLOR_BGR2GRAY)
        self._th_colorDomain.addItem("XYZ",    cv2.COLOR_BGR2XYZ)
        self._th_colorDomain.addItem("YCrCb",  cv2.COLOR_BGR2YCR_CB)
        self._th_colorDomain.addItem("HSV",    cv2.COLOR_BGR2HSV)
        self._th_colorDomain.addItem("HLS",    cv2.COLOR_BGR2HLS)
        self._th_colorDomain.addItem("Lab",    cv2.COLOR_BGR2LAB)
        self._th_colorDomain.addItem("Luv",    cv2.COLOR_BGR2LUV)
        
        self._colorComponent = OTParamCombo("Component",varname='_param_tb_color_component')
        self._colorComponent.addItem("A", 0)
        self._colorComponent.addItem("B", 1)
        self._colorComponent.addItem("C", 2)

        self._th_thresholdType = OTParamCombo("ThresholdType",varname='_param_tb_threshold_type')
        self._th_thresholdType.addItem("THRESH_BINARY", cv2.THRESH_BINARY)
        self._th_thresholdType.addItem("THRESH_BINARY_INV", cv2.THRESH_BINARY_INV)
        #END THRESHOLD

        self._th_colorDomain.valueUpdated = self.refreshValue
        self._colorComponent.valueUpdated = self.refreshValue
        self._adaptiveMethod.valueUpdated = self.refreshValue
        self._blockSize.valueUpdated = self.refreshValue
        self._C.valueUpdated = self.refreshValue
        
        self._formset = [ 
                '_video',"_player",
                ('_th_colorDomain','_colorComponent','_adaptiveMethod','_th_thresholdType'), 
                ('_blockSize',"_C"),
            ]
        
        self._player.processFrame = self.processFrame
        self._video.valueUpdated = self.newVideoInputChoosen
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        OTModulePlugin.__init__(self, name,  iconFile=icon_path)
        OTPFindBlobs.__init__(self)

        self._video = OTParamVideoInput("Video")
        self._player = OTParamPlayer("Video player")

        self._minArea = OTParamSlider("Blob min. area", 100,   0,  50000, varname='_param_min_area')
        self._maxArea = OTParamSlider("Blob max. area", 10000, 0, 100000, varname='_param_max_area')

        self._formset = [ '_video', ('_minArea','_maxArea'), "_player" ]
        
        self._player.processFrame = self.processFrame
        self._video.valueUpdated = self.newVideoInputChoosen
Beispiel #13
0
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        OTModulePlugin.__init__(self, name, iconFile=icon_path)
        TypeComponentsVideoPipe.__init__(self)

        self._video = ModuleConnection("Video", connecting=TypeColorVideo)
        self._player = ControlPlayer("Video player")

        self._player.processFrame = self.processFrame
        self._video.changed = self.newVideoInputChoosen

        self._formset = [
            '_video',
            "_player",
        ]
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'centre.png')
        super(OTModuleCircleCenter, self).__init__(name, iconFile=icon_path)

        self._video = OTParamVideoInput("Video")
        self._player = OTParamPlayer("Video")
        self._run = OTParamButton("Run")

        self._formset = [('_video', '_run'), "_player"]

        self._video.valueUpdated = self.videoSelected
        self._run.value = self.__run

        self._center = None
        self._player.processFrame = self.processFrame
Beispiel #15
0
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        OTModulePlugin.__init__(self, name,  iconFile=icon_path)
        OTPSelectBiggerBlobs.__init__(self)

        self._video = OTParamVideoInput("Video")
        self._blobs  = OTParamModuleConnection("Blobs", connecting=OTModuleBlobs)
        self._player = OTParamPlayer("Video player")

        self._howMany = OTParamSlider("How many?", 1, 1, 20, varname='_param_n_blobs')

        self._formset = ['_video','_blobs', '_howMany', "_player" ]
        
        self._player.processFrame = self.processFrame
        self._video.valueUpdated = self.newVideoInputChoosen
Beispiel #16
0
 def exportCodeTo(self, folder):
     constructer_params = []
     parameters = []
     file_to_copy = 'OTPOpenVideo'
     imports = ["from %s import %s" % (file_to_copy, file_to_copy)]
     filename = file_to_copy + ".py"
     originalfilepath = tools.getFileInSameDirectory(__file__, filename)
     destinyfilepath = os.path.join(folder, filename)
     f = open(originalfilepath, 'r')
     text = f.read()
     f.close()
     text = text.replace("from mcvgui.core.controllers.", "from ")
     f = open(destinyfilepath, 'w')
     f.write(text)
     f.close()
     return [file_to_copy], imports, constructer_params, parameters
Beispiel #17
0
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        OTModulePlugin.__init__(self, name,  iconFile=icon_path)
        OTPThreshImage.__init__(self)
        OTPThreshBlobs.__init__(self)
        self._video = OTParamVideoInput("Video")
        self._player = OTParamPlayer("Video player")
        self._polygons = OTParamGeometry("Geometry")
        
        self._blockSize = OTParamSlider("Block size", 3, 3, 500,varname='_param_tb_block_size')
        self._C = OTParamSlider("C", 0, 0, 500,varname='_param_tb_c')
        self._boxWidth = OTParamSlider("Width", 0, 0, 30,varname='_param_tb_box_width')
        self._boxHeight = OTParamSlider("Height", 0, 0, 30,varname='_param_tb_box_height')
        self._adaptiveMethod = OTParamCombo("Adaptive method",varname='_param_tb_adaptive_method')
        self._adaptiveMethod.addItem("Mean", cv2.cv.CV_ADAPTIVE_THRESH_MEAN_C)
        self._adaptiveMethod.addItem("Gaussian", cv2.cv.CV_ADAPTIVE_THRESH_GAUSSIAN_C)
        
        self._colorDomain = OTParamCombo("Colors space",varname='_param_tb_color_domain')
        self._colorDomain.addItem("RGB", -1)
        self._colorDomain.addItem("Gray",   cv2.COLOR_BGR2GRAY)
        self._colorDomain.addItem("XYZ",    cv2.COLOR_BGR2XYZ)
        self._colorDomain.addItem("YCrCb",  cv2.COLOR_BGR2YCR_CB)
        self._colorDomain.addItem("HSV",    cv2.COLOR_BGR2HSV)
        self._colorDomain.addItem("HLS",    cv2.COLOR_BGR2HLS)
        self._colorDomain.addItem("Lab",    cv2.COLOR_BGR2LAB)
        self._colorDomain.addItem("Luv",    cv2.COLOR_BGR2LUV)
        
        self._colorComponent = OTParamCombo("Component",varname='_param_tb_color_component')
        self._colorComponent.addItem("A", 0)
        self._colorComponent.addItem("B", 1)
        self._colorComponent.addItem("C", 2)

        self._formset = [ 
                ('_video','_polygons'),"_player",('_colorDomain','_colorComponent','_adaptiveMethod'), ('_boxWidth', '_boxHeight'),('_blockSize',"_C")
            ]

        self._colorDomain.valueUpdated = self.refreshValue
        self._colorComponent.valueUpdated = self.refreshValue
        self._adaptiveMethod.valueUpdated = self.refreshValue
        self._boxHeight.valueUpdated = self.refreshValue
        self._boxWidth.valueUpdated = self.refreshValue
        self._blockSize.valueUpdated = self.refreshValue
        self._C.valueUpdated = self.refreshValue
        
        self._player.processFrame = self.processFrame
        self._video.valueUpdated = self.newVideoInputChoosen
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'radius.png')
        OTBaseModuleGeometry.__init__(self, name, iconFile=icon_path)

        self._video = OTParamVideoInput("Video")
        self._circlecenter = OTParamModuleConnection(
            "Circle center", connecting=OTModuleCircleCenter)
        self._player = OTParamPlayer("Video")
        self._run = OTParamButton("Run")

        self._formset = [('_video', '_circlecenter', '_run'), "_player", "=",
                         '_polygons']

        self._video.valueUpdated = self.videoSelected
        self._run.value = self.__run

        self._radius = None
        self._player.processFrame = self.processFrame
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconmask.jpg')
        OTModulePlugin.__init__(self, name, iconFile=icon_path)
        OTModuleInputVideoPipe.__init__(self)

        self._polygons = OTParamModuleConnection(
            "Polygons", connecting=OTBaseModuleGeometry)
        self._video = OTParamVideoInput("Video")
        self._player = OTParamPlayer("Video")

        self._formset = ['_video', "_polygons", "_player"]

        self._video.valueUpdated = self.videoSelected
        self._polygons.valueUpdated = self.polygonsSelected
        self._player.processFrame = self.processFrame

        self._mask_color = None
        self._mask_gray = None
Beispiel #20
0
    def exportCodeTo(self, folder):
        parameters = [
            'self._param_background_threshold=%d' % self._threshold.value
        ]
        constructer_params = ['capture=capture']

        file_to_copy = 'OTPBackGroundDetector'
        imports = ["from %s import %s \n" % (file_to_copy, file_to_copy)]
        filename = file_to_copy + ".py"
        originalfilepath = tools.getFileInSameDirectory(__file__, filename)
        destinyfilepath = os.path.join(folder, filename)
        f = open(originalfilepath, 'r')
        text = f.read()
        f.close()
        text = text.replace("from mcvgui.core.controllers.", "from ")
        f = open(destinyfilepath, 'w')
        f.write(text)
        f.close()
        return [file_to_copy], imports, constructer_params, parameters
	def __init__(self, name):
		icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
		TypeBWVideoPipe.__init__(self)
		OTModulePlugin.__init__(self, name,  iconFile=icon_path)

		self._video 		 = ModuleConnection("Video", connecting=TypeComponentsVideoPipe)
		self._player 		 = ControlPlayer("Video player")
		self._colorComponent = ControlCombo("Component")
		
		self._colorComponent.addItem("A", 0)
		self._colorComponent.addItem("B", 1)
		self._colorComponent.addItem("C", 2)
		self._colorComponent.valueUpdated = self.refreshValue
		self._video.changed 		  	  = self.newVideoInputChoosen

		self._formset = [ 
				'_video',
				'_colorComponent',
				"_player",
			]
Beispiel #22
0
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        OTModulePlugin.__init__(self, name,  iconFile=icon_path)
        TypeSingleChannelImage.__init__(self)

        self._video     = ModuleConnection("Video", connecting=TypeBWVideoPipe)
        self._player    = ControlPlayer("Video player")

        self._min = ControlSlider("Min", default=1, minimum=0, maximum=255)
        self._max = ControlSlider("Max", default=255, minimum=0, maximum=255)
        
        self._formset = [ 
                '_video',
                "_player",
                '_min',
                '_max'
            ]
        
        self._player.processFrame   = self.processFrame
        self._video.changed         = self.newVideoInputChoosen
        self._min.changed           = self._player.refresh
        self._max.changed           = self._player.refresh
    def exportCodeTo(self, folder):
        listOfPolygons = self._polygons.value._polygons.value
        polygons = [eval(poly) for name, poly in listOfPolygons]
        parameters = [
            "self._params_mask_contours=np.array(%s)" % str(polygons)
        ]
        constructer_params = []

        file_to_copy = 'OTPMaskFromGeometry'
        imports = [
            "from %s import %s" % (file_to_copy, file_to_copy),
            "import numpy as np"
        ]
        filename = file_to_copy + ".py"
        originalfilepath = tools.getFileInSameDirectory(__file__, filename)
        destinyfilepath = os.path.join(folder, filename)
        f = open(originalfilepath, 'r')
        text = f.read()
        f.close()
        text = text.replace("from mcvgui.core.controllers.", "from ")
        f = open(destinyfilepath, 'w')
        f.write(text)
        f.close()
        return [file_to_copy], imports, constructer_params, parameters
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        OTPSplitColors.__init__(self)
        OTModulePlugin.__init__(self, name, iconFile=icon_path)

        self._video = OTParamVideoInput("Video")
        self._player = OTParamPlayer("Video player")

        self._colorComponent = OTParamCombo("Component",
                                            varname='_split_color_channel')
        self._colorComponent.addItem("A", 0)
        self._colorComponent.addItem("B", 1)
        self._colorComponent.addItem("C", 2)

        self._colorComponent.valueUpdated = self.refreshValue

        self._formset = [
            '_video',
            '_colorComponent',
            "_player",
        ]

        self._player.processFrame = self.processFrame
        self._video.valueUpdated = self.newVideoInputChoosen
Beispiel #25
0
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        OTPRemoveBackground.__init__(self)
        OTPColorFilter.__init__(self)        
        OTPAdaptativeThreshold.__init__(self)
        OTPBlur.__init__(self)
        OTPFindBlobs.__init__(self)
        OTPSelectBiggerBlobs.__init__(self)
        OTPMaskImage.__init__(self)
        OTPCanny.__init__(self)
        OTModulePlugin.__init__(self, name,  iconFile=icon_path)

        self._video = OTParamVideoInput("Video")
        #self._polygons = OTParamGeometry("Geometry")
        self._background = OTParamBackground("Background", varname='_param_background')
        self._threshold = OTParamSlider("Threshold", 110, 1, 255, varname='_param_background_threshold')
        self._minArea = OTParamSlider("Blob min. area",100, 0, 50000, varname='_param_min_area')
        self._maxArea = OTParamSlider("Blob max. area", 10000, 0, 100000, varname='_param_max_area')
        self._textAlgo = OTParamText("Blob function ( Operations: [ AND: * ; OR: + ; SUB: - ; NEG: ~ ] Ex: A+B-~C )", "A*B*C", varname='_param_filter_algorithm')
        self._removeBg = OTParamCheckBox("Remove the background", True)
        
        self._player = OTParamPlayer("Video player")

        self._selectBiggests = OTParamCheckBox("Select only the biggests blobs", True)
        self._howMany = OTParamSlider("How many?", 1, 1, 20, varname='_param_n_blobs')

        self._useBlur = OTParamCheckBox("Use blur", True)
        self._kernelSize = OTParamSlider("Kernel size",1, 1, 50, varname='_param_kernel_size')
        self._blurThreshold = OTParamSlider("Blur threshold", 110, 1, 255, varname='_param_blur_threshould')
        
        self._colorDomain = OTParamCombo("Colors space", varname='_param_color_domain')
        self._colorDomain.addItem("RGB", -1)
        self._colorDomain.addItem("XYZ",    cv2.COLOR_BGR2XYZ)
        self._colorDomain.addItem("YCrCb",  cv2.COLOR_BGR2YCR_CB)
        self._colorDomain.addItem("HSV",    cv2.COLOR_BGR2HSV)
        self._colorDomain.addItem("HLS",    cv2.COLOR_BGR2HLS)
        self._colorDomain.addItem("Lab",    cv2.COLOR_BGR2LAB)
        self._colorDomain.addItem("Luv",    cv2.COLOR_BGR2LUV)

        self._activeR = OTParamCheckBox("Active")
        self._activeG = OTParamCheckBox("Active")
        self._activeB = OTParamCheckBox("Active")

        self._minR = OTParamSlider("min. A", 1, 0, 255, varname='_param_a_min')
        self._maxR = OTParamSlider("max. A", 255, 0, 255, varname='_param_a_max')
        self._minG = OTParamSlider("min. B", 1, 0, 255, varname='_param_b_min')
        self._maxG = OTParamSlider("max. B", 255, 0, 255, varname='_param_b_max')
        self._minB = OTParamSlider("min. C", 1, 0, 255, varname='_param_c_min')
        self._maxB = OTParamSlider("max. C", 255, 0, 255, varname='_param_c_max')


        #THRESHOLD 
        self._blockSize = OTParamSlider("Block size", 3, 3, 500,varname='_param_tb_block_size')
        self._C = OTParamSlider("C", 0, 0, 500,varname='_param_tb_c')
        self._boxWidth = OTParamSlider("Width", 0, 0, 30,varname='_param_tb_box_width')
        self._boxHeight = OTParamSlider("Height", 0, 0, 30,varname='_param_tb_box_height')
        self._adaptiveMethod = OTParamCombo("Adaptive method",varname='_param_tb_adaptive_method')
        self._adaptiveMethod.addItem("Mean", cv2.cv.CV_ADAPTIVE_THRESH_MEAN_C)
        self._adaptiveMethod.addItem("Gaussian", cv2.cv.CV_ADAPTIVE_THRESH_GAUSSIAN_C)
        
        self._th_colorDomain = OTParamCombo("Colors space",varname='_param_tb_color_domain')
        self._th_colorDomain.addItem("RGB", -1)
        self._th_colorDomain.addItem("Gray",   cv2.COLOR_BGR2GRAY)
        self._th_colorDomain.addItem("XYZ",    cv2.COLOR_BGR2XYZ)
        self._th_colorDomain.addItem("YCrCb",  cv2.COLOR_BGR2YCR_CB)
        self._th_colorDomain.addItem("HSV",    cv2.COLOR_BGR2HSV)
        self._th_colorDomain.addItem("HLS",    cv2.COLOR_BGR2HLS)
        self._th_colorDomain.addItem("Lab",    cv2.COLOR_BGR2LAB)
        self._th_colorDomain.addItem("Luv",    cv2.COLOR_BGR2LUV)
        
        self._colorComponent = OTParamCombo("Component",varname='_param_tb_color_component')
        self._colorComponent.addItem("A", 0)
        self._colorComponent.addItem("B", 1)
        self._colorComponent.addItem("C", 2)

        self._th_thresholdType = OTParamCombo("ThresholdType",varname='_param_tb_threshold_type')
        self._th_thresholdType.addItem("THRESH_BINARY", cv2.THRESH_BINARY)
        self._th_thresholdType.addItem("THRESH_BINARY_INV", cv2.THRESH_BINARY_INV)
        #END THRESHOLD


        #CANNY
        self._canny_apertureSize = OTParamSlider("Aperture size", 3, 3, 7, varname='_param_canny_apertureSize')
        self._canny_L2gradient = OTParamCheckBox("L2 gradient", True, varname='_param_canny_L2gradient')
        self._canny_threshould1 = OTParamSlider("Threshould 1", 0, 0, 255, varname='_param_canny_threshould1')
        self._canny_threshould2 = OTParamSlider("Threshould 2", 1, 0, 255, varname='_param_canny_threshould2')

        self._canny_colorDomain = OTParamCombo("Colors space",varname='_param_canny_color_domain')
        self._canny_colorDomain.addItem("RGB", -1)
        self._canny_colorDomain.addItem("Gray",   cv2.COLOR_BGR2GRAY)
        self._canny_colorDomain.addItem("XYZ",    cv2.COLOR_BGR2XYZ)
        self._canny_colorDomain.addItem("YCrCb",  cv2.COLOR_BGR2YCR_CB)
        self._canny_colorDomain.addItem("HSV",    cv2.COLOR_BGR2HSV)
        self._canny_colorDomain.addItem("HLS",    cv2.COLOR_BGR2HLS)
        self._canny_colorDomain.addItem("Lab",    cv2.COLOR_BGR2LAB)
        self._canny_colorDomain.addItem("Luv",    cv2.COLOR_BGR2LUV)
        
        self._canny_colorComponent = OTParamCombo("Component",varname='_param_canny_color_component')
        self._canny_colorComponent.addItem("A", 0)
        self._canny_colorComponent.addItem("B", 1)
        self._canny_colorComponent.addItem("C", 2)
        #END CANNY


        self._useColors = OTParamCheckBox("Use colors filter", True)
        self._useThreshold = OTParamCheckBox("Use adaptative threshold", False)
        self._useCanny = OTParamCheckBox("Use canny algorithm", False)        
        self._exportFindBlobs = OTParamCheckBox("Export find blobs", True)

        self._canny_colorDomain.valueUpdated = self.refreshValue
        self._canny_colorComponent.valueUpdated = self.refreshValue
        self._canny_apertureSize.valueUpdated = self.refreshValue
        self._canny_L2gradient.valueUpdated = self.refreshValue
        self._canny_threshould1.valueUpdated = self.refreshValue
        self._canny_threshould2.valueUpdated = self.refreshValue
        self._th_colorDomain.valueUpdated = self.refreshValue
        self._colorComponent.valueUpdated = self.refreshValue
        self._adaptiveMethod.valueUpdated = self.refreshValue
        self._boxHeight.valueUpdated = self.refreshValue
        self._boxWidth.valueUpdated = self.refreshValue
        self._blockSize.valueUpdated = self.refreshValue
        self._C.valueUpdated = self.refreshValue

        
        self._colorDomain.valueUpdated = self.refreshValue
        self._activeR.valueUpdated = self.refreshValue
        self._activeG.valueUpdated = self.refreshValue
        self._activeB.valueUpdated = self.refreshValue
        self._minR.valueUpdated = self.refreshValue
        self._maxR.valueUpdated = self.refreshValue
        self._minG.valueUpdated = self.refreshValue
        self._maxG.valueUpdated = self.refreshValue
        self._minB.valueUpdated = self.refreshValue
        self._maxB.valueUpdated = self.refreshValue

        self._textAlgo.valueUpdated = self.refreshValue
        self._threshold.valueUpdated = self.refreshValue
        self._kernelSize.valueUpdated = self.refreshValue
        self._blurThreshold.valueUpdated = self.refreshValue
        self._maxArea.valueUpdated = self.refreshValue
        self._minArea.valueUpdated = self.refreshValue

        self._removeBg.valueUpdated = self.removeBgUpdate
        self._useBlur.valueUpdated = self.useBlurUpdate
        self._selectBiggests.valueUpdated = self.selectBiggestsUpdate
    
        self._useColors.valueUpdated = self.__useColorsClicked
        self._useThreshold.valueUpdated = self.__useThresholdClicked
        self._useCanny.valueUpdated = self.__useCannyClicked
        
        self._formset = [ 
                ('_video',' ','_useColors','_useThreshold','_useCanny'),
                [
                    "_player",{
                        "Remove background": [ '_removeBg','_background', '_threshold'],
                        "Filter colors" :  ['_colorDomain', ("_minR",'_activeR',"_maxR"), ("_minG",'_activeG',"_maxG"),  ("_minB",'_activeB',"_maxB")],
                        "Threshold filter": [('_th_colorDomain','_colorComponent','_adaptiveMethod','_th_thresholdType'), ('_boxWidth', '_boxHeight'),('_blockSize',"_C")],
                        "Canny": [ ('_canny_colorDomain', '_canny_colorComponent'), '_canny_threshould1','_canny_threshould2','_canny_apertureSize','_canny_L2gradient'],
                        "Filter objects": [ ('_minArea', '_maxArea'), ('_useBlur', '_kernelSize', '_blurThreshold'), ("_selectBiggests", "_howMany"),'_exportFindBlobs' ],
                    },"_textAlgo"                    
                ]
            ]
        
        self._player.processFrame = self.processFrame
        self._video.valueUpdated = self.newVideoInputChoosen

        self._blurThreshold.hide()
        self._kernelSize.hide()
        self._background.hide()
        self._threshold.hide()
        self._howMany.hide()
Beispiel #26
0
    def exportCodeTo(self, folder):
        files_to_copy = []        
        classes, imports, constructer_params, parameters = [], [], [], []
        #classes_tmp, imports_tmp, constructer_params_tmp, parameters_tmp = self._video.value.exportCodeTo(folder)
        #classes += classes_tmp; imports += imports_tmp; constructer_params += constructer_params_tmp; parameters += parameters_tmp;

        #SET OTPRemoveBackground
        if self._removeBg.value:
            classes_tmp, imports_tmp, constructer_params_tmp, parameters_tmp = self._background.value.exportCodeTo(folder)
            classes += classes_tmp; imports += imports_tmp; constructer_params += constructer_params_tmp; parameters += parameters_tmp;
            files_to_copy.append( 'OTPRemoveBackground' )
            parameters.append("self._param_background_threshold = %d " % self._threshold.value )
        #END SET

        

        if self._useThreshold.value:
            #SET OTPAdaptativeThreshold
            files_to_copy.append( 'OTPAdaptativeThreshold' )
            parameters.append("self._param_tb_color_component = %d " % self._colorComponent.value )
            parameters.append("self._param_tb_color_domain = %d " % self._th_colorDomain.value )
            parameters.append("self._param_tb_adaptive_method = %d " % self._adaptiveMethod.value )
            parameters.append("self._param_tb_block_size = %d " % self._blockSize.value )
            parameters.append("self._param_tb_threshold_type = %d " % self._th_thresholdType.value )
            parameters.append("self._param_tb_c = %d " % self._C.value )
            #END SET
        elif self._useCanny.value:
            #SET OTPCanny
            files_to_copy.append( 'OTPCanny' )
            parameters.append("self._param_canny_apertureSize = %d " % self._canny_apertureSize.value )
            parameters.append("self._param_canny_L2gradient = %d " % self._canny_L2gradient.value )
            parameters.append("self._param_canny_threshould1 = %d " % self._canny_threshould1.value )
            parameters.append("self._param_canny_threshould2 = %d " % self._canny_threshould2.value )
            parameters.append("self._param_canny_color_component = %d " % self._canny_colorComponent.value )
            parameters.append("self._param_canny_color_domain = %d " % self._canny_colorDomain.value )
            #END SET
        else:
            #SET OTPColorFilter
            files_to_copy.append( 'OTPColorFilter' )
            parameters.append("self._param_color_domain = %d " % self._colorDomain.value )
            parameters.append("self._param_filter_algorithm = '%s' " % self._textAlgo.value )
            parameters.append("self._param_a_min = %d " % self._minR.value )
            parameters.append("self._param_a_max = %d " % self._maxR.value )
            parameters.append("self._param_b_min = %d " % self._minG.value )
            parameters.append("self._param_b_max = %d " % self._maxG.value )
            parameters.append("self._param_c_min = %d " % self._minB.value )
            parameters.append("self._param_c_max = %d " % self._maxB.value )
            #END SET

        #SET OTPBlur
        if self._useBlur.value: 
            files_to_copy.append( 'OTPBlur' )
            parameters.append("self._param_kernel_size = %d " % self._kernelSize.value )
            parameters.append("self._param_blur_threshould = %d " % self._blurThreshold.value )
        #END SET

        #SET OTPMaskImage
        if isinstance(self._video.value, OTModuleMaskFromGeometry):
            files_to_copy.append( 'OTPMaskImage' )
            parameters.append("self._param_mi_polygons = np.array(%s)" % str(self._video.value._all_polygons) )
            imports.append("import numpy as np")        
        #END SET
        
        #SET OTPFindBlobs
        if self._exportFindBlobs.value:
            files_to_copy.append( 'OTPFindBlobs' )
            parameters.append("self._param_min_area = %d " % self._minArea.value )
            parameters.append("self._param_max_area = %d " % self._maxArea.value )
        #END SET

        #SET OTPSelectBiggerBlobs
        if self._selectBiggests.value: 
            files_to_copy.append( 'OTPSelectBiggerBlobs' )
            parameters.append('self._param_n_blobs = %d' % self._howMany.value )
        #END SET

        classes += files_to_copy
        for file_to_copy in files_to_copy:
            filename = file_to_copy+".py"; originalfilepath = tools.getFileInSameDirectory(__file__, filename); destinyfilepath = os.path.join( folder, filename )            
            f = open(originalfilepath, 'r'); text = f.read(); f.close(); text = text.replace("from mcvgui.core.controllers.", "from "); f = open(destinyfilepath, 'w'); f.write(text); f.close()
            imports.append( "from %s import %s" % (file_to_copy, file_to_copy) )
        
        return classes, imports, constructer_params, parameters
Beispiel #27
0
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'icon.jpg')
        OTModuleResultsPlugin.__init__(self, name, iconFile = icon_path)

        self._x_col = 4 #Indicate the column with the X coord
        self._y_col = 5 #Indicate the column with the Y coord
        self._frame_col = 1 #Indicate the column with the Y coord
        self._object_col = 6
        self._current_row = None

        self._imgWidth = 0.0
        self._imgHeight = 0.0
        self._startPoint = None
        self._endPoint = None

        self._video = OTParamVideoInput("Video")
        self._positions = OTParamPositions("Positions")
        self._showPos = OTParamCheckBox("Show position")
        self._showTrack = OTParamCheckBox("Show track")
        self._trackRange = OTParamSlider("Track range", 10, 10, 1000)
        self._player = OTParamPlayer("Video player")
        self._progress = OTParamProgress()
        
        #Fields used to configure the Position draw function
        self._show_draw_function = OTParamToggle("Show/Hide draw function")
        self._draw_function = OTParamTextArea("Draw function", """def draw(frame, row):
            x, y = int(row[self._x_col]), int(row[self._y_col])
            cv2.circle(frame, (x, y), 3, (0,255,0), thickness=2, lineType= cv2.cv.CV_AA)""")
        self._importFunc = OTParamButton("Import")
        self._exportFunc = OTParamButton("Export")
        
        #Fields used to configure the interpolation
        self._columns = OTParamCheckBoxList("List of columns to interpolate")
        self._run_interpolation = OTParamButton("Interpolate")
        self._run_interpolation_4_all = OTParamButton("Interpolate")

        #organization of the form
        self._formset = [   ('_video','_positions'), 
            [ ('_columns', '_run_interpolation', '_run_interpolation_4_all'),
            "_draw_function", 
            (" ", "_importFunc", "_exportFunc"), 
            "_player",
            ('_showPos',"_showTrack", "_trackRange")
            ,"=","_results", "_query"], '_progress' ]

        self._trackRange.enabled = False
        self._showPos.value = True

        #setting up the fields events
        self._player.processFrame = self.processFrame
        self._video.valueUpdated = self.newVideoInputChoosen
        self._positions.valueUpdated = self.newPositionsChoosen
        self._showTrack.valueUpdated = self.showTrackToggle
        self._query.selectionChanged = self.tableSelectionChanged
        self._trackRange.valueUpdated = self.updateTrackRange
        self._player._videoWidget.onEndDrag = self.onEndDragInVideoWindow
        self._show_draw_function.value = self.showHideDrawFunction
        self._importFunc.value = self.importFunction
        self._exportFunc.value = self.exportFunction
        self._run_interpolation.value = self.interpolationPositions
        self._run_interpolation_4_all.value = self.interpolateAllPositions

        #Hide fields
        self._draw_function.hide()
        self._progress.hide()
        self._importFunc.hide()
        self._exportFunc.hide()
        self._columns.hide()
        self._run_interpolation.hide()
        self._run_interpolation_4_all.hide()
        
        #Configure the popup menu
        self._query.addPopupMenuOption("-")
        self._query.addPopupSubMenuOption("Add", {"Interpolation": self.showColumns4Interpolation, "Duplicate row": self.addDuplicatedRow })
        self._query.addPopupMenuOption("Remove", self._query.remove)
        self._query.addPopupMenuOption("-")
        self._query.addPopupMenuOption("Approximate all positions", self.approximatePositions)
        self._query.addPopupMenuOption("Interpolate all positions", self.showColumns4InterpolationAll)
        
        self._current_row_index = None #Variable used to read the current row when the video is playing
Beispiel #28
0
    def exportCodeTo(self, folder):
        files_to_copy = []
        files_to_include = []
        constructor = ""
        parameters = []
        imports = ""

        files, imp, cons, params = self._video.value.exportCodeTo(folder)
        constructor += cons
        parameters += params
        imports += imp
        files_to_include += files
        print files_to_include, files

        if self._removeBg.value:
            files, imp, cons, params = self._background.value.exportCodeTo(
                folder)
            constructor += cons
            parameters += params
            files_to_copy.append("OTPRemoveBackground")
            imports += imp
            files_to_include += files

            parameters.append("self._param_background_threshold = %d " %
                              self._threshold.value)

        files_to_copy.append("OTPColorFilter")

        parameters.append("self._param_color_domain = %d " %
                          self._colorDomain.value)
        parameters.append("self._param_filter_algorithm = '%s' " %
                          self._textAlgo.value)
        parameters.append("self._param_a_min = %d " % self._minR.value)
        parameters.append("self._param_a_max = %d " % self._maxR.value)
        parameters.append("self._param_b_min = %d " % self._minG.value)
        parameters.append("self._param_b_max = %d " % self._maxG.value)
        parameters.append("self._param_c_min = %d " % self._minB.value)
        parameters.append("self._param_c_max = %d " % self._maxB.value)

        if self._useBlur.value:
            files_to_copy.append("OTPBlur")
            parameters.append("self._param_kernel_size = %d " %
                              self._kernelSize.value)
            parameters.append("self._param_blur_threshould = %d " %
                              self._blurThreshold.value)

        self._objectsFound = files_to_copy.append("OTPFindBlobs")
        parameters.append("self._param_min_area = %d " % self._minArea.value)
        parameters.append("self._param_max_area = %d " % self._maxArea.value)

        if self._selectBiggests.value:
            files_to_copy.append("OTPSelectBiggerBlobs")
            parameters.append("self._param_n_blobs = %d " %
                              self._howMany.value)

        for file_to_copy in files_to_copy:
            filename = file_to_copy + ".py"
            originalfilepath = tools.getFileInSameDirectory(__file__, filename)
            destinyfilepath = os.path.join(folder, filename)
            #shutil.copy2(originalfilepath,destinyfilepath)

            f = open(originalfilepath, 'r')
            text = f.read()
            f.close()
            text = text.replace("from mcvgui.core.controllers.", "from ")
            f = open(destinyfilepath, 'w')
            f.write(text)
            f.close()

            imports += "from %s import %s \n" % (file_to_copy, file_to_copy)

        files_to_include += files_to_copy
        files_to_include.reverse()
        return files_to_include, imports, constructor, parameters
Beispiel #29
0
    def __init__(self, name):
        icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg')
        OTPRemoveBackground.__init__(self)
        OTPColorFilter.__init__(self)
        OTPBlur.__init__(self)
        OTPFindBlobs.__init__(self)
        OTPSelectBiggerBlobs.__init__(self)
        OTModuleResultsPlugin.__init__(self, name, iconFile=icon_path)

        self._video = OTParamVideoInput("Video")
        self._background = OTParamBackground("Background",
                                             varname='_param_background')
        self._threshold = OTParamSlider("Threshold",
                                        110,
                                        1,
                                        255,
                                        varname='_param_background_threshold')
        self._minArea = OTParamSlider("Blob min. area",
                                      100,
                                      0,
                                      50000,
                                      varname='_param_min_area')
        self._maxArea = OTParamSlider("Blob max. area",
                                      10000,
                                      0,
                                      100000,
                                      varname='_param_max_area')
        self._textAlgo = OTParamText(
            "Blob function ( Operations: [ AND: * ; OR: + ; SUB: - ; NEG: ~ ] Ex: A+B-~C )",
            "A*B*C",
            varname='_param_filter_algorithm')
        self._removeBg = OTParamCheckBox("Remove the background", True)
        self._editMode = OTParamCheckBox("Edit mode", True)
        self._run = OTParamButton("Run")
        self._player = OTParamPlayer("Video player")
        self._progress = OTParamProgress()

        self._selectBiggests = OTParamCheckBox(
            "Select only the biggests blobs", True)
        self._howMany = OTParamSlider("How many?",
                                      1,
                                      1,
                                      20,
                                      varname='_param_n_blobs')

        self._useBlur = OTParamCheckBox("Use blur", True)
        self._kernelSize = OTParamSlider("Kernel size",
                                         1,
                                         1,
                                         50,
                                         varname='_param_kernel_size')
        self._blurThreshold = OTParamSlider("Blur threshold",
                                            110,
                                            1,
                                            255,
                                            varname='_param_blur_threshould')

        self._colorDomain = OTParamCombo("Colors space",
                                         varname='_param_color_domain')
        self._colorDomain.addItem("RGB", -1)
        self._colorDomain.addItem("XYZ", cv2.COLOR_BGR2XYZ)
        self._colorDomain.addItem("YCrCb", cv2.COLOR_BGR2YCR_CB)
        self._colorDomain.addItem("HSV", cv2.COLOR_BGR2HSV)
        self._colorDomain.addItem("HLS", cv2.COLOR_BGR2HLS)
        self._colorDomain.addItem("Lab", cv2.COLOR_BGR2LAB)
        self._colorDomain.addItem("Luv", cv2.COLOR_BGR2LUV)

        self._activeR = OTParamCheckBox("Active")
        self._activeG = OTParamCheckBox("Active")
        self._activeB = OTParamCheckBox("Active")

        self._minR = OTParamSlider("min. A", 1, 0, 255, varname='_param_a_min')
        self._maxR = OTParamSlider("max. A",
                                   255,
                                   0,
                                   255,
                                   varname='_param_a_max')
        self._minG = OTParamSlider("min. B", 1, 0, 255, varname='_param_b_min')
        self._maxG = OTParamSlider("max. B",
                                   255,
                                   0,
                                   255,
                                   varname='_param_b_max')
        self._minB = OTParamSlider("min. C", 1, 0, 255, varname='_param_c_min')
        self._maxB = OTParamSlider("max. C",
                                   255,
                                   0,
                                   255,
                                   varname='_param_c_max')

        self._groupBlobs = OTParamCheckBox("Group blobs", True)
        self._maxDistance = OTParamSlider("Max. dist. between blobs", 1, 30,
                                          300)

        self._groupBlobs.valueUpdated = self.groupBlobsUpdated
        self._colorDomain.valueUpdated = self.refreshValue

        self._activeR.valueUpdated = self.refreshValue
        self._activeG.valueUpdated = self.refreshValue
        self._activeB.valueUpdated = self.refreshValue

        self._minR.valueUpdated = self.refreshValue
        self._maxR.valueUpdated = self.refreshValue
        self._minG.valueUpdated = self.refreshValue
        self._maxG.valueUpdated = self.refreshValue
        self._minB.valueUpdated = self.refreshValue
        self._maxB.valueUpdated = self.refreshValue

        self._textAlgo.valueUpdated = self.refreshValue
        self._threshold.valueUpdated = self.refreshValue
        self._kernelSize.valueUpdated = self.refreshValue
        self._blurThreshold.valueUpdated = self.refreshValue
        self._maxArea.valueUpdated = self.refreshValue
        self._minArea.valueUpdated = self.refreshValue
        self._maxDistance.valueUpdated = self.refreshValue

        self._removeBg.valueUpdated = self.removeBgUpdate
        self._useBlur.valueUpdated = self.useBlurUpdate
        self._selectBiggests.valueUpdated = self.selectBiggestsUpdate

        self._formset = [
            ('_video', '_editMode', '_run'),
            [
                "_player", {
                    "1. Filter colors": [
                        '_colorDomain', ("_minR", '_activeR', "_maxR"),
                        ("_minG", '_activeG', "_maxG"),
                        ("_minB", '_activeB', "_maxB"), "_textAlgo"
                    ],
                    "2. Remove background":
                    ['_removeBg', '_background', '_threshold'],
                    "3. Filter objects":
                    [('_minArea', '_maxArea'),
                     ('_useBlur', '_kernelSize', '_blurThreshold'),
                     ("_selectBiggests", "_howMany")],
                    "4. Tracking": [('_groupBlobs', '_maxDistance')],
                }, "=", "_results", "_query"
            ], "_progress"
        ]

        self._run.value = self.run
        self._player.processFrame = self.processFrame
        self._video.valueUpdated = self.newVideoInputChoosen

        self._isRunning = False

        self._blurThreshold.hide()
        self._kernelSize.hide()
        self._background.hide()
        self._threshold.hide()
        self._progress.hide()
        self._howMany.hide()
        self._results.hide()
        self._query.hide()
        self._maxDistance.hide()