小编Dan*_*Dan的帖子

导入错误:安装 python-opencv 后没有名为 opencv 的模块

我在python中安装opencv并运行$ sudo apt-get install python-opencv并成功安装。但是当运行这段代码时

import opencv
import opencv.highgui
import time
import commands

def get_image():
    image = opencv.highgui.cvQueryFrame(camera)
    return opencv.adaptors.Ipl2PIL(image)

camera = opencv.highgui.cvCreateCameraCapture(-1)

while 1:
    image = get_image()
    image.thumbnail((32, 24, ))
    image = tuple(ord(i) for i in image.tostring())
    x = int((int((max(image) / 256.0) * 10) + 1) ** 0.5 / 3 * 10)
    cmd = ("sudo su -c 'echo " + str(x) +
        " > /sys/devices/virtual/backlight/acpi_video0/brightness'")
    status, output = commands.getstatusoutput(cmd)
    assert status is 0
Run Code Online (Sandbox Code Playgroud)

有跟随错误

$ python bright.py …
Run Code Online (Sandbox Code Playgroud)

python opencv

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

标签 统计

opencv ×1

python ×1