本文整理汇总了Python中photo.Photo.take方法的典型用法代码示例。如果您正苦于以下问题:Python Photo.take方法的具体用法?Python Photo.take怎么用?Python Photo.take使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类photo.Photo
的用法示例。
在下文中一共展示了Photo.take方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from photo import Photo [as 别名]
# 或者: from photo.Photo import take [as 别名]
class PyPhotoBooth:
def __init__(self):
self.photo = Photo()
self.photo_live = True
self.global_count = 0
self.MainWindow = uic.loadUi('main.ui')
self.webcam = cv.CreateCameraCapture(-1)
self.timer = QtCore.QTimer(self.MainWindow)
self.MainWindow.connect(
self.timer, QtCore.SIGNAL('timeout()'), self.show_frame
)
self.MainWindow.connect(
self.MainWindow.pushButton, QtCore.SIGNAL("clicked()"),
self.take_photo
)
if AUTO_PRINT:
self.MainWindow.pushButton_2.hide()
else:
self.MainWindow.connect(
self.MainWindow.pushButton_2, QtCore.SIGNAL("clicked()"),
self.print_photo_button
)
if PATCH_BACKGROUND_IMG is not None:
palette = QtGui.QPalette()
palette.setBrush(
QtGui.QPalette.Background, QtGui.QBrush(
QtGui.QPixmap(PATCH_BACKGROUND_IMG)
)
)
self.MainWindow.setPalette(palette)
if PATCH_LOGO_IMG is not None:
self.MainWindow.lbllogo.setPixmap(
QtGui.QPixmap(PATCH_LOGO_IMG)
)
self.timer.start(1)
def take_photo(self):
self.photo.take(self)
def print_photo_button(self):
result, count = self.photo.printing(self.global_count)
if result:
self.MainWindow.lcdNumber.display(0)
self.MainWindow.lcdNumber.repaint()
self.MainWindow.pick_01.setText(' ')
self.MainWindow.pick_01.repaint()
self.MainWindow.pick_02.setText(' ')
self.MainWindow.pick_02.repaint()
self.MainWindow.pick_03.setText(' ')
self.MainWindow.pick_03.repaint()
self.global_count = count
def show_frame(self):
if self.photo_live:
ipl_image = cv.QueryFrame(self.webcam)
data = ipl_image.tostring()
image = QtGui.QImage(
data, ipl_image.width, ipl_image.height, ipl_image.channels
* ipl_image.width, QtGui.QImage.Format_RGB888)
pixmap = QtGui.QPixmap()
pixmap.convertFromImage(image.rgbSwapped())
self.MainWindow.lblWebcam.setPixmap(pixmap)