當前位置: 首頁>>代碼示例>>Python>>正文


Python Polygon.append方法代碼示例

本文整理匯總了Python中polygon.Polygon.append方法的典型用法代碼示例。如果您正苦於以下問題:Python Polygon.append方法的具體用法?Python Polygon.append怎麽用?Python Polygon.append使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在polygon.Polygon的用法示例。


在下文中一共展示了Polygon.append方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from polygon import Polygon [as 別名]
# 或者: from polygon.Polygon import append [as 別名]

#.........這裏部分代碼省略.........
        self.main_window.setup_play_btn.setEnabled(False)

    def click_setup_pause_btn(self):
        print("Clicked setup pause button!")
        self.play.setup_status = False 
        self.play.setup_timer.stop()
        self.main_window.setup_pause_btn.setEnabled(False)
        self.main_window.setup_play_btn.setEnabled(True)

    def click_setup_bg_btn(self):
        print("Clicked capture background button")
        self.background.capture_frame()

    def click_draw_btn(self):
        print("Clicked draw button")
        self.line_status = False
        self.draw_status = True
        if self.play.setup_status == False:
            self.play.run_setup_pause()
        self.main_window.setup_draw_btn.setEnabled(False)
        self.main_window.setup_line_btn.setEnabled(True)
        # get area of polygon
        area = self.polygon.compute_area()
        self.main_window.area_lbl.setText(str(self.polygon.area))

    def click_line_btn(self):
        print("Clicked line button")
        self.line_status = True 
        self.draw_status = False 
        if self.play.setup_status == False:
            self.play.run_setup_pause()
        self.main_window.setup_line_btn.setEnabled(False)
        self.main_window.setup_draw_btn.setEnabled(True)
        self.main_window.area_lbl.setText("") 

    def click_reset_btn(self):
        print("Clicked reset button")
        self.polygon.reset()
        if self.play.setup_status == False:
            self.play.run_setup_reset()
        self.main_window.setup_reset_btn.setEnabled(False)
        self.main_window.setup_line_btn.setEnabled(False)
        self.main_window.setup_draw_btn.setEnabled(False)
        self.line_status = False 
        self.draw_status = False

    def setup_frame_click(self, event):
        if self.play.setup_status == True:
            print("Pause the source before assigning coordinates")
        else:
            print("Clicked setup frame") 
            x = event.pos().x()
            y = event.pos().y()
            print(x, y)
            print(event.pos())
            point = (x, y)
            self.polygon.append(point)
            self.polygon.get_no_points()
            if self.polygon.no_of_points > 0:
                self.main_window.setup_reset_btn.setEnabled(True)
            if self.polygon.no_of_points > 1:
                self.line_status = True
            if self.polygon.no_of_points > 2:
                self.main_window.setup_draw_btn.setEnabled(True)
            self.play.run_setup_pause()

    def get_video(self):
        return self.video

    def load_video(self, video_id):
        load = False
        s = self.dbs
        result = s.query(Video).filter(Video.id == video_id)
        if result.count() == 1:
            video = result.first() 
            load = True
        elif result.count() > 1:
            print("Found more than 1 match in database!")
        else:
            print("No match found in database!")
        if load == True: 
            self.path = video.path
            self.base_name = video.name 
            self.fps = str(video.fps) 
            self.duration = video.duration
            # address
            self.address_window = AddressWindow(self, self.main_window)
            self.address_window.get_address(video.address_id)
            # polygon
            self.polygon = Polygon(self, self.source)
            self.polygon.get_points(video.id)
            self.polygon.compute_area()
            area = self.polygon.area
            self.main_window.area_lbl.setText(str(abs(area)))
            self.metadata = get_metadata(self.path)
            self.duration = get_duration(self.metadata)
            self.resolution = get_resolution(self.metadata)
            self.format = get_format(self.metadata)
            # load in setup
            self.populate_setup()
開發者ID:janmaghuyop,項目名稱:fuzztrack,代碼行數:104,代碼來源:setup.py


注:本文中的polygon.Polygon.append方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。