def __init__(self, parent=None): super(DistancesWindow, self).__init__('Distances', parent_win=parent) self.mainwindow = parent self.set_margin(5) #self.layout().setMargin(5) self.setMinimumHeight(400) self.setMinimumWidth(800) self._datasets_panel = ControlEmptyWidget('Paths') self._progress = ControlProgress('Progress') self._apply = ControlButton('Apply', checkable=True) self._formset = ['_datasets_panel', '_apply', '_progress'] self.load_order = ['_datasets_panel'] self.datasets_dialog = DatasetsDialog(self) self._datasets_panel.value = self.datasets_dialog self.datasets_dialog.datasets_filter = lambda x: isinstance( x, (Path, Contours)) self._apply.value = self.__apply_event self._apply.icon = conf.ANNOTATOR_ICON_PATH self._progress.hide()
def __init__(self, parent=None): BaseWidget.__init__(self, 'Motion counter', parent_win=parent) self.set_margin(5) self.setMinimumHeight(300) self.setMinimumWidth(500) self._player = ControlPlayer('Player') self._datasets = ControlEmptyWidget('Paths', default=DatasetsDialog()) self._backgrounds = ControlEmptyWidget('Backgrounds', default=ObjectsDialog()) self._show_diff = ControlCheckBox('Show diffs boxes') self._threshold = ControlSlider('Threshold', default=5, minimum=1, maximum=255) self._radius = ControlSlider('Radius', default=30, minimum=1, maximum=200) self._apply = ControlButton('Apply', checkable=True) self._compare = ControlCombo('Compare with') self._progress = ControlProgress('Progress') self._formset = [ '_datasets', '=', '_compare', '_backgrounds', ('_threshold', '_radius', '_show_diff'), '_player', '_apply', '_progress' ] self._compare.add_item('Last frame', 1) self._compare.add_item('First frame', 2) self._compare.add_item('Background image', 3) self.load_order = ['_threshold', '_radius', '_show_diff'] self._backgrounds.value.datasets_filter = lambda x: isinstance( x, Image) self._datasets.value.datasets_filter = lambda x: isinstance( x, (Contours, Path)) self._player.process_frame_event = self.__process_frame_event self._datasets.value.video_selection_changed_event = self.__video_selection_changed_event self._compare.changed_event = self.__compare_changed_event self._apply.value = self.__apply_btn_event self._apply.icon = conf.ANNOTATOR_ICON_MOTION self._progress.hide() self._backgrounds.hide()
def __init__(self, parent=None): BaseWidget.__init__(self, 'Regions filter', parent_win=parent) self.mainwindow = parent self.set_margin(5) self.setMinimumHeight(300) self.setMinimumWidth(500) self._paths = [] self._pathspanel = ControlEmptyWidget('Path to process') self._geomspanel = ControlEmptyWidget('Geometries') self._apply = ControlButton('Apply', checkable=True) self._progress = ControlProgress('Progress') self._formset = [ '_pathspanel', '_geomspanel', '_apply', '_progress' ] self.load_order = ['_start', '_end', '_panel'] self.paths_dialog = DatasetsDialog(self) self.paths_dialog.objects_filter = lambda x: isinstance(x, Object2D) self.paths_dialog.datasets_filter = lambda x: isinstance(x, (Contours,Path) ) self._pathspanel.value = self.paths_dialog self.geoms_dialog = ObjectsDialog(self) self.geoms_dialog.objects_filter = lambda x: isinstance(x, Geometry) self._geomspanel.value = self.geoms_dialog self._apply.value = self.__apply_btn_event self._apply.icon = conf.ANNOTATOR_ICON_REGIONS self._progress.hide()
def __init__(self, parent=None): super(SmoothPathsWindow, self).__init__('Smooth paths', parent_win=parent) self.mainwindow = parent self.set_margin(5) self.setMinimumHeight(400) self.setMinimumWidth(800) self._datasets_panel = ControlEmptyWidget('Paths') self._progress = ControlProgress('Progress') self._apply = ControlButton('Apply', checkable=True) self._winsize = ControlSlider('Window size', minimum=3, default=3, maximum=100) self._order = ControlSlider('Order', minimum=0, default=0, maximum=10) self._deriv = ControlSlider('Derivative', minimum=0, default=0, maximum=10) self._rate = ControlSlider('Rate', minimum=0, default=0, maximum=10) self._formset = [ '_datasets_panel', '=', '_winsize', '_order', '_deriv', '_rate', ' ', '_apply', '_progress' ] self.load_order = ['_datasets_panel'] self.datasets_dialog = DatasetsDialog(self) self._datasets_panel.value = self.datasets_dialog self.datasets_dialog.datasets_filter = lambda x: isinstance( x, (Path, Value)) self._apply.value = self.__apply_event self._apply.icon = conf.ANNOTATOR_ICON_PATH self._progress.hide()
def __init__(self, parent=None): super(FindOrientationWindow, self).__init__('Estimate countour orientation', parent_win=parent) self.mainwindow = parent self.set_margin(5) self.setMinimumHeight(300) self.setMinimumWidth(300) self._panel = ControlEmptyWidget('Videos') self._progress = ControlProgress('Progress') self._apply = ControlButton('Apply', checkable=True) self._debug = ControlCheckBox('Create all the intermediate values') self._min_steps = ControlSlider('Minimum steps', default=20, minimum=1, maximum=1000) self._min_dist = ControlSlider('Minimum distance', default=30, minimum=1, maximum=1000) self._panel.value = self.contours_dialog = DatasetsDialog(self) self.contours_dialog.datasets_filter = lambda x: isinstance( x, Contours) self._formset = [ '_panel', ('_min_steps', '_min_dist'), '_debug', '_apply', '_progress' ] self._apply.value = self.__apply_event self._apply.icon = conf.ANNOTATOR_ICON_PATH self._progress.hide()
def __init__(self, **kwargs): BaseWidget.__init__(self, 'Path mask') Class.__init__(self, **kwargs) try: self.layout().setContentsMargins(10, 5, 10, 5) self.setMinimumHeight(170) except: pass self._control_pathmask_radius = ControlSlider('Mask radius', default=30, minimum=1, maximum=600) self._panel = ControlEmptyWidget('Panel', default=DatasetsDialog() ) self._panel.value.interval_visible = False self._panel.value.datasets_filter = lambda x: isinstance(x, (Contours,Path) ) self._panel.value.datasets_changed_event = self.__update_paths self._formset = [ '_panel', '_control_pathmask_radius', ] self._control_pathmask_radius.changed_event = self.__control_pathmask_radius_changed_event
def __init__(self, parent=None): super(ContoursImagesWindow, self).__init__('Contour images', parent_win=parent) self.mainwindow = parent self.set_margin(5) self.setMinimumHeight(400) self.setMinimumWidth(800) self._contourspanel = ControlEmptyWidget('Contours datasets') self._progress = ControlProgress('Progress', visible=False) self._apply = ControlButton('Apply', checkable=True) self._toolbox = ControlToolBox('Toolbox') self._exportdir = ControlDir('Export images to folder', default='images-from-contour') #### mask ###################################################### self._usemaskimg = ControlCheckBox('Apply a mask to the image') self._usemaskdilate = ControlCheckBox('Dilate the mask and apply it to the image') self._maskdilatesize = ControlSlider('Dilate size', default=0, minimum=0, maximum=100) self._usemaskellipse = ControlCheckBox('Apply the min. ellipse as a mask to the image') self._usemaskcircular = ControlCheckBox('Apply a circular mask to the image') self._maskcircularsize = ControlSlider('Circular radius', default=0, minimum=0, maximum=100) self._usemaskrect = ControlCheckBox('Apply the min. rect as a mask to the image') ################################################################ #### margin #################################################### self._margin = ControlSlider('Margin size', default=0, minimum=0, maximum=100) ################################################################ #### imagesize ################################################# self._imagesize = ControlSlider('Image size', default=0, minimum=0, maximum=400) ################################################################ #### cut ####################################################### self._usecut = ControlCheckBox('Cut image') self._cutx = ControlBoundingSlider('X cut', default=(10,30), minimum=0, maximum=1000) self._cuty = ControlBoundingSlider('Y cut', default=(10,30), minimum=0, maximum=1000) ################################################################ #### use stretch ############################################### self._usestretch = ControlCheckBox('Stretch image') ################################################################ #### filter per events ######################################### self._eventslst = ControlCheckBoxList('Events', enabled=True) self._reloadevts = ControlButton('Reload events', enabled=True, default=self.__reload_events_btn_evt) ################################################################ #### rotation ################################################## self._userotup = ControlCheckBox('Turn the contour always up') self._userotdown = ControlCheckBox('Turn the contour always down') self._usefixedangle = ControlCheckBox('Use a fixed orientation') self._fixedangle = ControlSlider('Rotate the images using a fixed angle', enabled=True, default=0, minimum=0, maximum=360) self._usedatasetangle = ControlCheckBox('Use the orientation of other contour') self._datasetanglepanel = ControlEmptyWidget('Datasets for the orientation', enabled=True) ################################################################ #### image position ############################################ self._useposdataset = ControlCheckBox('Use a dataset to center the image') self._datasetpospanel = ControlEmptyWidget('Datasets for the image position', enabled=True) ################################################################ self.formset = [ '_toolbox', '_exportdir', '_apply', '_progress' ] self.load_order = [ '_contourspanel','_userotup', '_userotdown', '_exportdir','_usemaskimg','_usemaskdilate','_usemaskellipse','_usemaskellipse', '_usemaskcircular', '_maskcircularsize', '_usemaskrect', '_margin', '_imagesize', '_usestretch', '_eventslst', '_usefixedangle', '_fixedangle', '_usedatasetangle', '_datasetanglepanel', '_useposdataset', '_datasetpospanel', '_usecut', '_cuty', '_cutx' ] #datasets painel self.datasets_dialog = DatasetsDialog(self) self.datasets_dialog.datasets_filter = lambda x: isinstance(x, Contours ) self._contourspanel.value = self.datasets_dialog self.posdatasets_dialog = DatasetsDialog(self) self.posdatasets_dialog.datasets_filter = lambda x: isinstance(x, (Contours,Path) ) self._datasetpospanel.value = self.posdatasets_dialog self.orientdatasets_dialog = DatasetsDialog(self) self.orientdatasets_dialog.datasets_filter = lambda x: isinstance(x, Contours ) self.orientdatasets_dialog.interval_visible = False self._datasetanglepanel.value = self.orientdatasets_dialog self._apply.value = self.__apply_event self._apply.icon = conf.ANNOTATOR_ICON_PATH self._imagesize.changed_event = self.__image_size_changed_evt self._toolbox.value = [ ('Extract from contours',( self.datasets_dialog, )), ('Mask',( self._usemaskimg, (self._usemaskdilate,self._maskdilatesize), (self._usemaskcircular,self._maskcircularsize), (self._usemaskellipse,self._usemaskrect), )), ('Margin, image size and stretch image',( self._usestretch, self._margin, self._imagesize, self._usecut, self._cutx, self._cuty )), ('Rotate images',( (self._userotup, self._userotdown), (self._usefixedangle, self._fixedangle), self._usedatasetangle, self._datasetanglepanel )), ('Center images',( self._useposdataset, self._datasetpospanel, )), ('Export images per events',( self._reloadevts, self._eventslst, )), ] self.__reload_events_btn_evt() self.__image_size_changed_evt()
def __init__(self, parent=None): super(VideosExporterGui, self).__init__('Videos exporter', parent_win=parent) self.set_margin(5) self.setMinimumHeight(400) self.setMinimumWidth(400) self._toolbox = ControlToolBox('Tool') self._panel_area = ControlEmptyWidget('Set the object area', default=DatasetsDialog(self)) self._panel_colors = ControlEmptyWidget('Set the object color', default=DatasetsDialog(self)) self._panel_imgs = ControlEmptyWidget('Set the video background', default=ImagesDialog(self)) #### path panel ################################################ self._panel_path = ControlEmptyWidget('Set the object path', default=DatasetsDialog(self)) self._drawpath = ControlCheckBox('Draw paths') ################################################################ #### draw events ############################################### self._drawevents = ControlCheckBoxList('Events') self._eventstitles = ControlCheckBox('Draw titles') self._evtsreload1 = ControlButton('Reload events') ################################################################ #### split by events ########################################### self._splitevents = ControlCheckBoxList('Events') self._evtsreload2 = ControlButton('Reload events') ################################################################ self._codec = ControlCheckBox('Force AVI') self._outdir = ControlDir('Output directory') self._outfile = ControlText('Output file name') self._player = ControlPlayer('Player') self._progress = ControlProgress('Progress') self._apply = ControlButton('Export video(s)', checkable=True) self._apply.icon = conf.ANNOTATOR_ICON_PATH self._apply.enabled = False self._usefixedsize = ControlCheckBox('Use a fixed size') self._usefixedcolor = ControlCheckBox('Use a fixed color') self._radius = ControlSlider('Circle radius', default=10, minimum=1, maximum=300) self._color = ControlText('BGR color', default='255,255,255') self.formset = [('_toolbox', '||', '_player'), '=', '_outdir', ('_outfile', '_codec'), '_apply', '_progress'] self._toolbox.value = [ ('Path', [self._panel_path, self._drawpath]), ('Circle (optional)', [self._panel_area, (self._usefixedsize, self._radius)]), ('Circle color (optional)', [self._panel_colors, (self._usefixedcolor, self._color)]), ('Background (optional)', [self._panel_imgs]), ('Draw events (optional)', [self._evtsreload1, self._drawevents, self._eventstitles]), ('Split files by events (optional)', [self._evtsreload2, self._splitevents]), ] self._panel_path.value.datasets_filter = lambda x: isinstance( x, (Contours, Path)) #self._panel_area.value.datasets_filter = lambda x: isinstance(x, Value ) self._panel_colors.value.datasets_filter = lambda x: isinstance( x, (Contours, Path)) and hasattr(x, 'has_colors_avg' ) and x.has_colors_avg ### Set the controls events ############################################# self._evtsreload1.value = self.__reload_events self._evtsreload2.value = self.__reload_events self._outfile.changed_event = self.outputfile_changed_event self._usefixedsize.changed_event = self.__usefixedsize_changed_event self._usefixedcolor.changed_event = self.__usefixedcolor_changed_event self._splitevents.selection_changed_event = self.outputfile_changed_event self._panel_path.value.video_selection_changed_event = self.__video_selection_changed_event self._codec.changed_event = self.__video_selection_changed_event ## function from VideosExporterProcess class self._apply.value = self.apply_event ## function from VideosExporterPreview class self._player.process_frame_event = self.player_processframe_event self._evtsreload1.icon = conf.ANNOTATOR_ICON_REFRESH self._evtsreload2.icon = conf.ANNOTATOR_ICON_REFRESH self._progress.hide() self._radius.hide() self._color.hide() self.__check_areatab_event()