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') 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
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
def saveContent(self, saver): """ OTModuleBackgroundCalc.saveContent reimplementation """ OTModulePlugin.saveContent(self, saver) if self._backgroundDetector != None and self._backgroundDetector._background != None: saver['_backgroundDetector'] = {} self._backgroundDetector.save(saver['_backgroundDetector'])
def loadSavedContent(self, loader): """ OTModuleBackgroundCalc.loadSavedContent reimplementation """ OTModulePlugin.loadSavedContent(self, loader) if '_backgroundDetector' in loader: self._backgroundDetector = OTPBackGroundDetector( capture=self._video.value.videoInput) self._backgroundDetector.load(loader['_backgroundDetector'])
def __init__(self, name, iconFile=None): OTModulePlugin.__init__(self, name, iconFile=iconFile) self._results = OTParamCombo("List of results") self._query = OTParamDBQuery("Result") self._formset = ["_results", "_query"] self._results.valueUpdated = self.newResultChoosen self._query.form.tableView.selectionChanged = self.selectionChanged
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
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
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
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__, '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
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
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()
def loadSavedContent(self, loader): if 'results' in loader: results = loader['results'] for key, sql in results.items(): self._results.addItem(key, sql) OTModulePlugin.loadSavedContent(self, loader)
def saveContent(self, saver): saver['results'] = self._results._items OTModulePlugin.saveContent(self, saver)