当前位置: 首页>>代码示例>>Python>>正文


Python Controller.loadImage方法代码示例

本文整理汇总了Python中Controller.Controller.loadImage方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.loadImage方法的具体用法?Python Controller.loadImage怎么用?Python Controller.loadImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Controller.Controller的用法示例。


在下文中一共展示了Controller.loadImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Interface

# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import loadImage [as 别名]
class Interface(Frame):

    def __init__(self, parent):
        Frame.__init__(self, parent)   

        self.parent = parent
        self.controller = Controller(TKRenderer())
        self.initUI()
    
    def initUI(self):
      
        self.parent.title("Kinect Human Finder")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)
        self.columnconfigure(1, weight=1, minsize=100, pad=10)
        self.rowconfigure(1, weight=1, minsize=100, pad=10)
        
        self.initHistoryFrame()
        self.initImageFrame()        
        self.initMenuFrame()
        
    def initHistoryFrame(self):    
        
        self.historyFrame = Frame(self, height=100, width=200, borderwidth=2)
        
        self.backButton = Button(self.historyFrame, text="Back", command=lambda: self.showImage(self.controller.goBack()))
        self.backButton.pack(side=LEFT, padx=5, pady=5)
        
        self.nextButton = Button(self.historyFrame, text="Next", command=lambda: self.showImage(self.controller.goNext()))
        self.nextButton.pack(side=LEFT, padx=5, pady=5)
        
        self.openButton = Button(self.historyFrame, text="Open", command=self.openFile)
        self.openButton.pack(side=LEFT, padx=(490,0), ipadx = 10, pady=5)

        self.historyFrame.grid(row=0, column=0, columnspan=2, sticky=W)
        
    def initImageFrame(self):
        
        self.imageFrame = Frame(self, borderwidth=2)
        if not os.path.exists(WELCOME_IMAGE_PATH):
            print "Welcome image not found at:" + WELCOME_IMAGE_PATH
        else:
            if not os.path.exists(SECOND_WELCOME_IMAGE_PATH):
                print "Second welcome image not found at:" + SECOND_WELCOME_IMAGE_PATH
            else:
                self.showImage(self.controller.loadImage(WELCOME_IMAGE_PATH))
                self.showImage(self.controller.loadImage(SECOND_WELCOME_IMAGE_PATH))

        
    def initMenuFrame(self):
        
        self.menuFrame = Frame(self, width=400)
        self.menuFrame.grid(row=1, column=1, sticky=N + E + S + W)
        self.menuFrame.columnconfigure(0, weight=0, minsize=100, pad=10)

        binaryText = Label(self.menuFrame, text="Mapa binarna")
        preprocessingText = Label(self.menuFrame, text="Preprocessing")
        cogText = Label(self.menuFrame, text="Środek ciężkości")
        snakeText = Label(self.menuFrame, text="Metoda aktywnych konturów")
        
        # Parameters
        self.binarySpinFrame = self.createBinarySpinBoxes()
        self.binarySpinFrame.grid(row=1, column=0, padx=36, pady=(5,15), stick=N + W)

        self.preprocessFrame = self.createPreprocessBoxes()
        self.preprocessFrame.grid(row=3, column=0, padx=36, pady=(0,15), stick=N + W)

        self.cogSpinFrame = self.createCogSpinBoxes()
        self.cogSpinFrame.grid(row=5, column=0, padx=36, pady=(0,15), stick=N + W)

        self.snakeSpinFrame = self.createSnakeSpinBoxes()
        self.snakeSpinFrame.grid(row=7, column=0, padx=36, pady=(0,15), stick=N + W)

        binaryText.grid(row=0, padx=15, stick=N + W)
        preprocessingText.grid(row=2, padx=15, stick=N + W)
        cogText.grid(row=4, padx=15, stick=N + W)
        snakeText.grid(row=6, padx=15, stick=N + W)
        
        # Buttons
        self.binaryButton = Button(self.menuFrame, text="Generuj mapą binarną",
            command=lambda: self.showImage(self.controller.generateBinaryMotionBitmap(
                int(self.binaryThreshold.get())
            )))

        self.preprocessButton = Button(self.menuFrame, text="Preprocessing",
            command=lambda: self.showImage(self.controller.getPreprocessedBitmap(
                int(self.binaryThreshold.get()),
                int(self.erosion.get()), int(self.densityCoefficient.get())
            )))

        self.massCenterButton = Button(self.menuFrame, text="Pokaż centrum masy",
            command=lambda: self.showImage(self.controller.getBitmapWithMassCenter(
                int(self.binaryThreshold.get()),
                int(self.erosion.get()), int(self.densityCoefficient.get()),
                int(self.distanceFromCenterCoefficient.get())
            )))

        self.snakeButton = Button(self.menuFrame, text="Wyznacz kontur",
            command=lambda: self.showImage(self.controller.getTheSnake(
#.........这里部分代码省略.........
开发者ID:pancur,项目名称:khf,代码行数:103,代码来源:Interface.py


注:本文中的Controller.Controller.loadImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。