小编yas*_*asi的帖子

在python3 ubunto 14.04下安装opencv-python

我想在Ubunto 14.04中使用python 3下的opencv.我计划使用PyCharm IDE来开发我的程序.

在我选择的PyCharm中,我设置:

文件/设置/项目:HelloWorld/Project Interpreter/3.4.3(/usr/bin/python3.4)

Python 3.4.3是Ubunto 14.04中python的默认版本.

然后我尝试添加opencv-python包:

文件/设置/项目:HelloWorld/Project Interpreter/+(你添加包的地方)

并且系统给了我这个错误:

 Executed command:

 pip install opencv-python 


 Try to run this command from the system terminal. Make sure that you   
 use the correct version of 'pip' installed for your Python interpreter located at '/usr/bin/python3.4'.

 DEPRECATION: --no-install, --no-download, --build, and --no-clean are   deprecated.  See https://github.com/pypa/pip/issues/906.
 Downloading/unpacking opencv-python
 Could not find any downloads that satisfy the requirement opencv-python
 Cleaning up...
 No distributions at all found for opencv-python …
Run Code Online (Sandbox Code Playgroud)

python opencv

5
推荐指数
2
解决办法
4465
查看次数

使用 PyQt 捕获网络摄像头视频

鉴于以下 PyQt 代码,我可以完美地捕捉网络摄像头的流媒体视频。

现在,我想修改代码,因此添加了一个名为“捕获”按钮的按钮,一旦按下它就会捕获流视频并保存图像。我怎样才能做到这一点?

获得的小图像将用于查询对象识别服务器。

import sys
from PyQt4 import QtGui, QtCore
import cv2

class QtCapture(QtGui.QWidget):
    def __init__(self, *args):
        super(QtGui.QWidget, self).__init__()

        self.fps = 24
        self.cap = cv2.VideoCapture(*args)

        self.video_frame = QtGui.QLabel()
        lay = QtGui.QVBoxLayout()
        lay.setMargin(0)
        lay.addWidget(self.video_frame)
        self.setLayout(lay)

    def setFPS(self, fps):
        self.fps = fps

    def nextFrameSlot(self):
        ret, frame = self.cap.read()
        # My webcam yields frames in BGR format
        frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
        img = QtGui.QImage(frame, frame.shape[1], frame.shape[0], QtGui.QImage.Format_RGB888)
        pix = QtGui.QPixmap.fromImage(img)
        self.video_frame.setPixmap(pix)

    def start(self):
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.nextFrameSlot)
        self.timer.start(1000./self.fps)

    def …
Run Code Online (Sandbox Code Playgroud)

python qt opencv pyqt webcam-capture

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

opencv ×2

python ×2

pyqt ×1

qt ×1

webcam-capture ×1