def __init__(self, *args, **kwargs): super().__init__('4-Cam') self.set_margin(10) # Definition of the forms fields self._player1 = ControlPlayer('Player1') self._player2 = ControlPlayer('Player2') self._player3 = ControlPlayer('Player3') self._player4 = ControlPlayer('Player4') self._runbutton = ControlButton('Stop') self._screenshot = ControlButton('Screenshot') self._outputfile = ControlDir('Screenshots Ausgabe Ordner') self._cams = ControlCheckBoxList('Kameras') # Define the event that will be called when the run button is processed self._runbutton.value = self.__stopEvent self._screenshot.value = self._saveImages self.__check_all_avaliable_cameras() self.formset = [{ '0-Kameras': [('_runbutton'), ('_player1', '_player2'), ('_player3', '_player4')], '1-Einstellungen': [('_outputfile'), ('_cams')] }] self._player1.value = self.__assign_capture(0) self._player2.value = self.__assign_capture(1) self._player3.value = self.__assign_capture(2) self._player4.value = self.__assign_capture(3) self._outputfile.value = os.getcwd() self.__runEvent()
def __init__(self, parent=None, video=None): BaseWidget.__init__(self, 'Simple workflow editor', parent_win=parent) self._parent = parent self._player = ControlPlayer('Player') self._imgfilters = ControlList('Image filters') self._imageflows = ControlCombo('Image workflows') self._blobsflows = ControlCombo('Blobs workflows') self._blobsfilters = ControlList('Blobs filters') self.formset = [ '_player', '=', [{ 'a:Image filter': ['_imageflows', '_imgfilters'], 'b:Blobs filter': ['_blobsflows', '_blobsfilters'] }] ] self.load_order = [ '_imageflows', '_blobsflows', '_imgfilters', '_blobsfilters' ] self._imgfilters.select_entire_row = True self._blobsfilters.select_entire_row = True self._imageflows.changed_event = self.__imageflows_changed_event self._blobsflows.changed_event = self.__blobsflows_changed_event self._player.process_frame_event = self.__process_frame self.video_capture = video self._pipelines = {} # dictinary with all the available pipelines self._pipeline = None # active pipeline class
def __init__(self): BaseWidget.__init__(self, 'Video window') self._player = ControlPlayer('Player') self.formset = ['_player']
def __init__(self, parent=None): super(GeometryFromThreshold, self).__init__('Find geometry using a threshold on the image', parent_win=parent) self._filename = ControlFile('Video file name') self._player = ControlPlayer('Player') self._threshold = ControlSlider('Movement threshold', default=10, minimum=0, maximum=255) self._epsilon = ControlSlider('Epsilon', default=10, minimum=1, maximum=255) self._add_contour = ControlButton('add contour') self._formset = [ '_filename', ('_threshold', '_epsilon', '_add_contour'), '_player' ] self._filename.changed_event = self.__filename_changed self._player.process_frame_event = self.__processFrame self._threshold.changed_event = self._player.refresh self._epsilon.changed_event = self._player.refresh self._add_contour.value = self.__add_contours self._filename.value = '/home/ricardo/bitbucket/single-fly-tracker/Circle_and_Square.avi' self._contours = []
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", ]
def __init__(self, *args, **kwargs): super().__init__('Computer vision algorithm example') #Definition of the forms fields self._videofile = ControlFile('Video') self._outputfile = ControlText('Results output file') self._threshold = ControlSlider('Threshold', default=114, minimum=0, maximum=255) self._blobsize = ControlSlider('Minimum blob size', default=110, minimum=100, maximum=2000) self._player = ControlPlayer('Player') self._runbutton = ControlButton('Run') #Define the function that will be called when a file is selected self._videofile.changed_event = self.__video_file_selection_event #Define the event that will be called when the run button is processed self._runbutton.value = self.run_event #Define the event called before showing the image in the player self._player.process_frame_event = self.__process_frame #Define the organization of the Form Controls self._formset = [('_videofile', '_outputfile'), '_threshold', ('_blobsize', '_runbutton'), '_player']
def __init__(self): super(Example1, self).__init__('dir examples') self.parent = None self._directory = ControlDir('Choose a directory') self._file = ControlFile('Choose a file') self._filetree = ControlFilesTree('Choose a file') self._image = ControlImage('Image') self._boundaries = ControlBoundingSlider('Bounding', horizontal=True) self._button = ControlButton('Click') self._button.value = self.onButtonClick # self._directory.value=self.onButtonClick self._checkbox = ControlCheckBox('Choose a directory') self._checkboxList = ControlCheckBoxList('Choose a file') self._player = ControlPlayer('Choose a file') self._slider = ControlSlider('Slider') self._player.show() self._checkboxList.value = [('Item 1', True), ('Item 2', False), ('Item 3', True)] self._combobox = ControlCombo('Choose a item') self._list = ControlList('List label') self._progress = ControlProgress('Progress bar') self._visvisVolume = ControlVisVisVolume('Visvis') self._timeline = ControlEventTimeline('Timeline') self._combobox.add_item('Item 1', 'Value 1') self._combobox.add_item('Item 2', 'Value 2') self._combobox.add_item('Item 3', 'Value 3') self._combobox.add_item('Item 4') self._list.value = [('Item1', 'Item2', 'Item3',), ('Item3', 'Item4', 'Item5',)] imageWithVolume = np.zeros((100, 100, 100), np.uint8) imageWithVolume[30:40, 30:50, :] = 255 imageWithVolume[30:40, 70:72, :] = 255 self._visvisVolume.value = imageWithVolume self._visvis = ControlVisVis('Visvis') values1 = [(i, random.random(), random.random()) for i in range(130)] values2 = [(i, random.random(), random.random()) for i in range(130)] self._visvis.value = [values1, values2] self.formset = [ '_visvis' , '_directory' , '_button' , '_file' , '_boundaries' , '_filetree' , '_image' , '_slider' , ('_checkboxList', '_player') , ('_checkbox', ' ') , ('_combobox', ' ') , '_progress' , '=' , ('_visvisVolume', '||', '_list') , '_timeline' ]
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, 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): super(VideoPlayer, self).__init__('Video Player') #Defnition of the form fields # self._dirname = ControlText('Directory', 'Default Value') self._button_play = ControlButton("Play") self._button_play.value = self.__play_all self._button_pause = ControlButton("Pause") self._button_pause.value = self.__pause_all self._button_refresh = ControlButton("Reload") self._button_refresh.value = self.__refresh_all self._button_print = ControlButton("Print") self._button_print.value = self.__print_value # self.formset = [{'Tab1':['_dirname'],},'_button'] # self._directory = ControlDir('Choose a directory') self._file1 = ControlFile('File 1') self._file2 = ControlFile('File 2') # print(self._file.value) self._filetree = ControlFilesTree('Choose a file') # self._filetree.value = 'C:\\Users\\Ashwini Naik\\Videos\\Captures' # self._checkbox = ControlCheckBox('Choose a directory') # self._checkboxList = ControlCheckBoxList('Choose a file') self._player = ControlPlayer('Choose a file') self._player1 = ControlPlayer('Choose a file') # self._slider = ControlSlider('Slider') self._player.value = '_file.value' # self._player.refresh() self.formset = [('_button_play', '_button_pause', '_button_refresh'), ('_file1', '_file2'), ('_player', '_player1')]
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): global conf conf += 'pythonvideoannotator.resources' # Resources can only be loaded after pyqt is running super(BaseModule, self).__init__('Video annotation editor') self._project = Project(parent=self) Dialog.project = self._project self._player = ControlPlayer("Player") self._time = ControlEventTimeline('Time') self._dock = ControlDockWidget("Timeline", side='bottom', order=1, margin=5) self.formset = ['_player'] self._dock.value = self._time self._player.process_frame_event = self.process_frame_event self._player.click_event = self.on_player_click_event self._time.key_release_event = self.__timeline_key_release_event self.load_order = [] self.mainmenu.insert( 0, { 'File': [{ 'Open': self.__open_project_event, 'icon': conf.ANNOTATOR_ICON_OPEN }, '-', { 'Save': self.__save_project_event, 'icon': conf.ANNOTATOR_ICON_SAVE }, { 'Save as': self.__save_project_as_event, 'icon': conf.ANNOTATOR_ICON_SAVE }, '-', { 'Exit': QApplication.closeAllWindows, 'icon': conf.ANNOTATOR_ICON_EXIT }] }) self.mainmenu.insert(1, {'Modules': []}) self.mainmenu.insert(2, {'Windows': []}) track_user_stats()
def __init__(self): BaseWidget.__init__(self, 'Batch Object Detection') self.batchFolder = "" self.batchFile = "" self._dir = ControlFile() self.Canvas = ControlPlayer('Canvas') self._label1 = ControlLabel("") self._start = ControlButton("Count") self._clr = ControlButton("Clear count") self._Progress = ControlProgress(label="0/0") self._Progress.min = 0 self._clr.value = self.clr_mongo self.Canvas.value = "./batchDetect/test.jpg" self._dir.changed_event = self.folderpath_event self._start.value = self._startCount
def __init__(self, title, parent=None): super(GeometryManualDesigner, self).__init__(title, parent_win=parent) self._threshold_win = None self._start_point = None self._end_point = None self._selected_poly = None self._selected_point = None self._video = ControlFile("Video file") self._player = ControlPlayer("Video") self._remove = ControlButton("Remove") self._square = ControlButton("Square", checkable=True) self._circle = ControlButton("Circle", checkable=True) self._threshold = ControlButton("Threshold") self._export = ControlButton("Export") self._import = ControlButton("Import") self._polygons = ControlList('Polygons') self._apply = ControlButton('Apply') self._formset = [ '_video', "_player", ("_square", "_circle", "_threshold", " ", "_remove", " ", "_export", "_import"), "=", "_polygons", '_apply' ] self._video.changedchanged_event = 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._threshold.value = self.threshold_btn_click self._player.drag_event = self.on_player_drag_in_video_window self._player.end_drag_event = self.on_player_end_drag_in_video_window self._player.click_event = self.on_player_click_in_video_window self._player.double_click_event = self.on_player_double_click_in_video_window self._player.process_frame_event = self.process_frame self._player.key_release_event = self.on_player_key_release self._apply.hide()
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", ]
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 __init__(self, *args, **kwargs): super().__init__('Pixie') tempath = "" #mainMenu self.mainmenu = [{ 'File': [{ 'Open': self.__openEvent }, '-', { 'Save': self.__saveEvent }] }] #definition toolsBox = ToolsBox() toolsBox.parent = self self._dockleft = ControlDockWidget() self._dockleft.value = toolsBox self._imglabel = ControlLabel() self._ControlImage = ControlPlayer('canvas') self._ToolsBox__updateImage("") self._detail = ControlLabel('Detail')
def __init__(self, *args, **kwargs): super().__init__('Hazard Labelling') self._args = { "filepath": FILEPATH, "folder": FOLDER, "dest": DEST } self.set_margin(10) #Definition of the forms fields self._videofile = ControlFile('Video') self._hazardbutton = ControlButton('Hazard') self._next = ControlButton('Next Video') self._save_data = ControlButton('Save labels') self._player = ControlPlayer('Player') self._timeline = ControlEventTimeline('Timeline') self._panel = ControlDockWidget(label='Timeline', side='bottom', margin=10) self._status = ControlText('Status') self._file_list = [] if self._args["folder"] is None: if self._args["filepath"] is not None: self._file_list = self._args["filepath"] elif self._args["folder"] is not None: if os.path.isdir(self._args["folder"]): self.__updateStatus("Source folder found at: {}".format(self._args["folder"])) print("Scanning folder and all subfolders... {}".format(self._args["folder"])) count = 0 for (dirpath, dirnames, filenames) in os.walk(self._args["folder"]): path = [] for f in filenames: if f.rsplit('.')[-1] in ACCEPTABLE_EXT: count += 1 path.append(dirpath + "/" + f) self._file_list.extend(path) if count % 100 == 0: print("Found {} files...".format(count)) print("Scan complete, found {} acceptable files".format(count)) self._video_count = len(self._file_list) self._progress = ControlProgress(label="Video %p of " + str(self._video_count), defaultValue=1, min=1, max=self._video_count) self._hazard_counter = 0 self._current_video = 0 #Define function calls on button presses self._videofile.changed_event = self.__videoFileSelectionEvent self._hazardbutton.value = self.__labelHazard self._next.value = self.__nextVideo self._save_data.value = self.__saveData self._panel.value = self._timeline self._progress.value = self._current_video + 1 #Define events self._player.process_frame_event = self.__processFrame self._player.click_event = self.__clickEvent self._player.key_release_event = self.__tagEvent #Define the organization of the Form Controls self._formset = [ '_player', # '_hazardbutton', '_panel', ('_videofile', '_next'), ('_status', '_save_data'), '_progress' ] self._video_loaded = False try: self.__videoFileSelect(self._file_list[self._current_video]) except Exception as e: self.__updateStatus("Select video...") self._hazard_default_duration = 0
def __init__(self): super(MultipleBlobDetection, self).__init__('Multiple Blob Detection') # Definition of the forms fields self._videofile = ControlFile('Video') self._outputfile = ControlText('Results output file') self._threshold_box = ControlCheckBox('Threshold') self._threshold = ControlSlider('Binary Threshold') self._threshold.value = 114 self._threshold.min = 1 self._threshold.max = 255 self._roi_x_min = ControlSlider('ROI x top') self._roi_x_max = ControlSlider('ROI x bottom') self._roi_y_min = ControlSlider('ROI y left') self._roi_y_max = ControlSlider('ROI y right') # self._blobsize = ControlSlider('Minimum blob size', 100, 100, 2000) self._player = ControlPlayer('Player') self._runbutton = ControlButton('Run') self._start_frame = ControlText('Start Frame') self._stop_frame = ControlText('Stop Frame') self._color_list = ControlCombo('Color channels') self._color_list.add_item('Red Image Channel', 2) self._color_list.add_item('Green Image Channel', 1) self._color_list.add_item('Blue Image Channel', 0) self._clahe = ControlCheckBox('CLAHE ') self._dilate = ControlCheckBox('Morphological Dilation') self._dilate_type = ControlCombo('Dilation Kernel Type') self._dilate_type.add_item('RECTANGLE', cv2.MORPH_RECT) self._dilate_type.add_item('ELLIPSE', cv2.MORPH_ELLIPSE) self._dilate_type.add_item('CROSS', cv2.MORPH_CROSS) self._dilate_size = ControlSlider('Dilation Kernel Size', default=3, min=1, max=10) self._dilate_size.value = 5 self._dilate_size.min = 1 self._dilate_size.max = 10 self._erode = ControlCheckBox('Morphological Erosion') self._erode_type = ControlCombo('Erode Kernel Type') self._erode_type.add_item('RECTANGLE', cv2.MORPH_RECT) self._erode_type.add_item('ELLIPSE', cv2.MORPH_ELLIPSE) self._erode_type.add_item('CROSS', cv2.MORPH_CROSS) self._erode_size = ControlSlider('Erode Kernel Size') self._erode_size.value = 5 self._erode_size.min = 1 self._erode_size.max = 10 self._open = ControlCheckBox('Morphological Opening') self._open_type = ControlCombo('Open Kernel Type') self._open_type.add_item('RECTANGLE', cv2.MORPH_RECT) self._open_type.add_item('ELLIPSE', cv2.MORPH_ELLIPSE) self._open_type.add_item('CROSS', cv2.MORPH_CROSS) self._open_size = ControlSlider('Open Kernel Size') self._open_size.value = 20 self._open_size.min = 1 self._open_size.max = 40 self._close = ControlCheckBox('Morphological Closing') self._close_type = ControlCombo('Close Kernel Type') self._close_type.add_item('RECTANGLE', cv2.MORPH_RECT) self._close_type.add_item('ELLIPSE', cv2.MORPH_ELLIPSE) self._close_type.add_item('CROSS', cv2.MORPH_CROSS) self._close_size = ControlSlider('Close Kernel Size', default=19, min=1, max=40) self._close_size.value = 20 self._close_size.min = 1 self._close_size.max = 40 self._LoG = ControlCheckBox('LoG - Laplacian of Gaussian') self._LoG_size = ControlSlider('LoG Kernel Size') self._LoG_size.value = 20 self._LoG_size.min = 1 self._LoG_size.max = 60 self._progress_bar = ControlProgress('Progress Bar') # Define the function that will be called when a file is selected self._videofile.changed_event = self.__video_file_selection_event # Define the event that will be called when the run button is processed self._runbutton.value = self.__run_event # Define the event called before showing the image in the player self._player.process_frame_event = self.__process_frame self._error_massages = {} # Define the organization of the Form Controls self.formset = [ ('_videofile', '_outputfile'), ('_start_frame', '_stop_frame'), ('_color_list', '_clahe', '_roi_x_min', '_roi_y_min'), ('_threshold_box', '_threshold', '_roi_x_max', '_roi_y_max'), ('_dilate', '_erode', '_open', '_close'), ('_dilate_type', '_erode_type', '_open_type', '_close_type'), ('_dilate_size', '_erode_size', '_open_size', '_close_size'), ('_LoG', '_LoG_size'), ('_runbutton', '_progress_bar'), '_player' ] self.is_roi_set = False
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()
def __init__(self): super(BaseStation, self).__init__('Station de base') self.robot = None #Definition of the forms fields self.textArea = ControlTextArea('Log') self.textTimer = ControlText('Timer') self.textState = ControlText('État') self.textVolt = ControlText('Voltage') self.textCourant = ControlText('Courant')#slot courant self.textPos = ControlText('Position') self.textPiece = ControlText('Pièce') self.textPlayer = ControlPlayer('Playground') self.textImage = ControlImage('Field') self.buttonLog = ControlButton('Start') self.buttonReset = ControlButton('Reset') self.formset = ['', '||', 'textArea', '||', (('textState', '||', 'textPiece'), '=', ('textVolt', '||', 'textCourant'), '=', ('textPos', '||', 'textTimer'), '=', ('buttonLog', '||', 'buttonReset'), '=', ('textPlayer', '||')), '||', '', '=', ''] # Define the button action self.buttonLog.value = self.button_log_action self.buttonReset.value = self.button_reset_action # Define communication entre les thread self.thread_com_log = Communicate() self.thread_com_log.speak[str].connect(self.update_log) self.thread_com_state = Communicate() self.thread_com_state.speak[str].connect(self.update_state) self.thread_com_volt = Communicate() self.thread_com_volt.speak[str].connect(self.update_volt) self.thread_com_pos = Communicate() self.thread_com_pos.speak[str].connect(self.update_pos) self.thread_com_piece = Communicate() self.thread_com_piece.speak[str].connect(self.update_piece) self.thread_com_image = Communicate() self.thread_com_image.speak[np.ndarray].connect(self.update_image) self.thread_com_timer = Communicate() self.thread_com_timer.speak[str].connect(self.update_timer) self.thread_com_courant = Communicate() self.thread_com_courant.speak[str].connect(self.update_courant) self.vision = MainController(self) self.web_socket = WebSocket(self.textArea, self) # debut visison/pathfinding self.camera_monde = CameraMonde(self.textPlayer, self) self.camera_monde.thread_start_camera() self.draw_playgroung = DrawPlayground(self.textImage, self.textPos) #self.draw_playgroung.draw_robot(8, 3) self.world = None self.image = None self.path_finding = None self.qr_Code = None
def __init__(self): global conf conf += 'pythonvideoannotator.resources' # Resources can only be loaded after pyqt is running super(BaseModule, self).__init__('Video annotation editor') self._project = Project(parent=self) Dialog.project = self._project self._player = ControlPlayer("Player") self._time = ControlEventTimeline('Time') self._dock = ControlDockWidget("Timeline", side='bottom', order=1, margin=5) self.formset = ['_player'] self._dock.value = self._time self._player.process_frame_event = self.process_frame_event self._player.click_event = self.on_player_click_event self._time.key_release_event = self.__timeline_key_release_event self.load_order = [] self.mainmenu.insert( 0, { 'File': [{ 'Open': self.__open_project_event, 'icon': conf.ANNOTATOR_ICON_OPEN }, '-', { 'Save': self.__save_project_event, 'icon': conf.ANNOTATOR_ICON_SAVE }, { 'Save as': self.__save_project_as_event, 'icon': conf.ANNOTATOR_ICON_SAVE }, '-', { 'Exit': QApplication.closeAllWindows, 'icon': conf.ANNOTATOR_ICON_EXIT }] }) self.mainmenu.insert(1, {'Modules': []}) self.mainmenu.insert(2, {'Windows': []}) track_user_stats() ######################################################################## ###### CHECK NEW VERSIONS RELEASES ##################################### ######################################################################## try: versions = pypi_xmlrpc.package_releases('Python-video-annotator') if versions is not None: new_version = versions[0] new_version_numbers = [int(x) for x in new_version.split('.')] version_numbers = [int(x) for x in __version__.split('.')] for new_n, n in zip(new_version_numbers, version_numbers): if new_n > n: response = self.question( "<h2>New version <b>[{0}]</b> available</h2>" "<p>Do you wish to update the software?</p>" "<p>The software can be updated later by running the next command in the terminal:</p>" "<i>pip install python-video-annotator --force-reinstall</i>" .format(new_version), 'New version [{0}]'.format(new_version)) if response == 'yes': subprocess.call([ sys.executable, "-m", "pip", "install", 'python-video-annotator', '--force-reinstall' ]) self.message( 'The software was updated and this session will be closed. Please execute the software again.', 'Restart required') exit() break else: print('Enabled to check new versions') except Exception as e: print('Enabled to check new versions:')
def __init__(self): global conf conf += 'pythonvideoannotator.resources' # Resources can only be loaded after pyqt is running super().__init__('Video annotation editor') self._project = Project(parent=self) Dialog.project = self._project self._player = ControlPlayer("Player") self._time = ControlEventTimeline('Time') self._dock = ControlDockWidget("Timeline", side='bottom', order=1, margin=5) self._progress = ControlProgress('Progress', visible=False) # define the application toolbar self.toolbar = [ ControlButton('Open', icon=conf.ANNOTATOR_ICON_OPEN, default=self.__open_project_event), ControlButton('Save', icon=conf.ANNOTATOR_ICON_SAVE, default=self.__save_project_event) ] self.formset = ['_player', '_progress'] self._dock.value = self._time self._player.process_frame_event = self.process_frame_event self._player.click_event = self.on_player_click_event self._player.double_click_event = self.on_player_double_click_event self._player.drag_event = self.on_player_drag_event self._player.end_drag_event = self.on_player_end_drag_event # ignore these controls key release event self._time.key_release_event = lambda x: x self._player.key_release_event = lambda x: x self.load_order = [] self.mainmenu.insert( 0, { 'File': [{ 'Open': self.__open_project_event, 'icon': conf.ANNOTATOR_ICON_OPEN }, '-', { 'Save': self.__save_project_event, 'icon': conf.ANNOTATOR_ICON_SAVE }, { 'Save as': self.__save_project_as_event, 'icon': conf.ANNOTATOR_ICON_SAVE }, '-', { 'Exit': QApplication.closeAllWindows, 'icon': conf.ANNOTATOR_ICON_EXIT }] }) self.mainmenu.insert(1, {'Modules': []}) self.mainmenu.insert(2, {'Windows': []}) track_user_stats() ######################################################################## ###### CHECK NEW VERSIONS RELEASES ##################################### ######################################################################## try: versions = pypi_xmlrpc.package_releases('Python-video-annotator') if versions is not None: new_version = versions[0] if float(new_version) > float(__version__): response = self.question( "<h2>New version <b>[{0}]</b> available</h2>" "<p>Do you wish to update the software?</p>" "<p>The software can be updated later by running the next command in the terminal:</p>" "<i>pip install python-video-annotator --force-reinstall</i>" .format(new_version), 'New version [{0}]'.format(new_version)) if response == 'yes': subprocess.call([ sys.executable, "-m", "pip", "install", 'python-video-annotator', '--force-reinstall' ]) self.message( 'The software was updated and this session will be closed. Please execute the software again.', 'Restart required') exit() else: print('Unable to check new versions') except Exception as e: print('Unable to check new versions:')