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


Python Camera.takeImage方法代码示例

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


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

示例1: Controller

# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import takeImage [as 别名]
class Controller(object):

    CommandSize = 4
    
    def __init__(self):
        print "spInOS active"
        self._networkInputBuffer = NetworkBuffer.NetworkBuffer()
        self._NetworkInterface = NetworkInterface.NetworkInterface(self._networkInputBuffer)
        self._MotionInterface = MotionInterface(1)
        self._SPIData = GetSpiData()
        self._GyroData = GyroData()
        self._Log = SpinLog.SpinLog()
        self._IOPIN = IOPIN()
        self._Camera = Camera()
        self._Exit = False;
        self._Mode = 1
                
        self._NetworkInterfaceThread = threading.Thread(target=self._NetworkInterface.run)
        self._NetworkInterfaceThread.start()
        self._CommandHandlerThread = threading.Thread(target=self.CommandHandler)
        self._CommandHandlerThread.start()
        self._MotionInterfaceThread = threading.Thread(target=self._MotionInterface.runThread)
        self._MotionInterfaceThread.start()
    
    def CommandHandler(self):
        while self._Exit == False:
            data = self._networkInputBuffer.Pop()    

            if len(str(data)) > 0:
                ID = data[:6]
                Command = data[6:10]
                self._Log.append(str(data))
                
                if Command == "prin":
                    print(data[10:])
                    self._NetworkInterface.Send("Printed: " + data[11:], ID)
                elif Command == "cocl":
                    self._NetworkInterface.Send(len(self._NetworkInterface._NetworkClients), ID)
                elif Command == "glog":
                    self._NetworkInterface.Send(self._Log.get(), ID)
                elif Command  == "cllg":
                    self._NetworkInterface.Send("Cleared log!", ID)
                    self._Log.clear()
                elif Command == "gcpu":
                    self.gcpu(ID)
                elif Command == "tsen":
                   self._NetworkInterface.Send(self._MotionInterface.test(data[11:]), ID)
                elif Command == "gspi":
                    self._NetworkInterface.Send(self._SPIData.getSpi(), ID)
                elif Command == "smde":
                    self._Mode = data[11:12]
                    self._MotionInterface.exit()
                    self._MotionInterfaceThread.join()

                    if self._MotionInterface._currentModeInt != self._Mode:

                        if int(self._Mode) == 1:
                            self._MotionInterface = MotionInterface(1)
                        if int(self._Mode) == 2:
                            self._MotionInterface = MotionInterface(2)
                        if int(self._Mode) == 3:
                            self._MotionInterface = MotionInterface(3)
                        if int(self._Mode) == 4:
                            self._MotionInterface = MotionInterface(4)
                        if int(self._Mode) == 5:
                            self._MotionInterface = MotionInterface(5)
                        if int(self._Mode) == 6:
                            self._MotionInterface = MotionInterface(6)
                        if int(self._Mode) == 7:
                            self._MotionInterface = MotionInterface(7)
                        if int(self._Mode) == 8:
                            self._MotionInterface = MotionInterface(8)
                    self._NetworkInterface.Send("Mode set to:" + self._Mode, ID)
                    self._MotionInterfaceThread = threading.Thread(target=self._MotionInterface.runThread)
                    self._MotionInterfaceThread.start()
                elif Command == "gmde":
                    self._NetworkInterface.Send(self._Mode, ID)
                elif Command == "move":
                    self._NetworkInterface.Send(self._MotionInterface.set_CurrentCommand(data[11:13]), ID)
                elif Command == "slen":
                    self._MotionInterface.setLength(data[11:14])
                    self._NetworkInterface.Send("length has been set", ID)
                elif Command == "shgt":
                    self._MotionInterface.setHeight(data[11:14])
                    self._NetworkInterface.Send("height has been set to:" + data[11:14], ID)
                elif Command == "sspd":
                    self._MotionInterface.setSpeed(data[11:17])
                    self._NetworkInterface.Send("Speed has been set to:" + data[11:14], ID)
                elif Command == "spul":
                    self._MotionInterface.setDefaultPulse(data[11:17])
                    self._NetworkInterface.Send("Defaultpulse has been updated", ID)
                elif Command == "cali":
                    self._MotionInterface.Calibreren(data[11:12], data[14:17])
                    self._NetworkInterface.Send("Defaultpulse has been updated", ID)
                elif Command == "gimg":
                    self._NetworkInterface.Send(self._Camera.takeImage(), ID)
                elif Command == "gifm":
                    self._NetworkInterface.Send(self._Camera.getImageFromMemory(), ID)
                elif Command == "ping":
                    self._NetworkInterface.Send("ping", ID)
#.........这里部分代码省略.........
开发者ID:Speedydown,项目名称:IDP,代码行数:103,代码来源:Controller.py


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