SimpleCV 基本 getImage 调试

发布于 2025-01-08 07:07:05 字数 948 浏览 1 评论 0原文

我刚刚在我的 Windows 7 Dell XPS 上成功安装了 SimpleCV。我插入了 HP Deluxe 网络摄像头 KQ246AA。我已导航至 SimpleCV Shell。我正在尝试运行教程来拍摄并显示网络摄像头的图片。在 SimpleCV shell 中,我执行以下几行:

cam = Camera()
img = cam.getImage()
img.show()

第一个命令后,网络摄像头上的灯亮起。第二个命令后什么也没有发生。在第三个命令之后,我得到一些文本输出: 并弹出一个全黑的窗口,然后该新窗口执行经典窗口“无响应” ”并询问我是否要强行关闭。当我关闭外壳时,网络摄像头上的灯会关闭。

我也尝试过:

img.save('C:/path/to/file/name.jpg');

将图片保存到正确的位置,但图片只是全黑的。我猜想图片没有正确捕获,但我不知道为什么会导致 img.show() 命令崩溃。

我尝试引用 SimpleCV 文档(http://doc.simplecv.org/),但该链接似乎不存在。我想我真的会从 SimpleCV 中受益。有人对我如何调试这个问题有任何建议吗?或者,文档在哪里?我至少会验证我是否可以从网络摄像头正确捕获图片。然后开始使用一些其他功能。

** 编辑 **

我将从其网站下载的 .deb 文件中的 SimpleCV 软件包安装到运行 Ubuntu 10.10 的 Thinkpad X61 上。安装仅需 5 分钟。我插入了一个非常通用的网络摄像头(甚至不确定它是什么品牌)并重复上面的 3 行代码。我确实看到我的网络摄像头拍摄的照片出现了。所以一切都可以在linux上运行,而且非常简单。

I just successfully installed SimpleCV on my Windows 7 Dell XPS. I have a HP Deluxe Webcam KQ246AA plugged into it. I have navigated to the SimpleCV Shell. I am trying to run the tutorial to take and show a picture from the webcam. From the SimpleCV shell I execute the following lines:

cam = Camera()
img = cam.getImage()
img.show()

After the first command, the light on my webcam turns on. After the second command nothing happens. After the third command I get some text output: <SimpleCV.Display.Display instance at 0x038D2A58> and a window pops up that is all black, and then that new window does the classic windows "Not Responding" and asks me if I want to force close. When I close the Shell, the light on the webcam turns off.

I have also tried:

img.save('C:/path/to/file/name.jpg');

Which saved the picture to the right location, but the picture was just all black. I guess that the picture is not being captured correctly, but I don't know why that causes the img.show() command to crash.

I tried referencing the SimpleCV docs (http://doc.simplecv.org/), but the link appears to be non-existent. I think I would really benefit from SimpleCV. Does anyone have any suggestions how I would debug this problem? Or, where is the documentation? I would at least to verify that I can capture pictures correctly from the webcam. Then get started with some of the other functionality.

** EDIT **

I installed the SimpleCV package from the .deb downloaded from their website onto my Thinkpad X61s running Ubuntu 10.10. 5 minutes for installationn. I plugged in a very generic webcam (not even sure what brand it is) and repeated the 3 lines of code above. I DID see the picture take from my webcam come up. So everything worked on the linux, and was very simple.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不及他 2025-01-15 07:07:05

考虑以下代码:

img = cam.getImage()

如果由于某种原因设备无法检索图像,img 将为 NULL,并且调用 img.show() 肯定会使应用程序崩溃。您需要添加适当的检查来防止此类问题:

import sys

cam = Camera()
if (not cam)
    print 'Camera() Failed!'
    sys.exit(-1)

img = cam.getImage()
if (not img)
    print 'getImage() Failed!'    
    sys.exit(-1)

# Everything succeeded, display image!
img.show()

Consider the following code:

img = cam.getImage()

if for some reason the device could not retrieve an image, img would be NULL and calling img.show()will certainly crash the application. You need to add proper checks to prevent this sort of problem:

import sys

cam = Camera()
if (not cam)
    print 'Camera() Failed!'
    sys.exit(-1)

img = cam.getImage()
if (not img)
    print 'getImage() Failed!'    
    sys.exit(-1)

# Everything succeeded, display image!
img.show()
一花一树开 2025-01-15 07:07:05

我是 SimpleCV 开发人员之一。抱歉,我没有注意到我们的 doc.simplecv.org 无法正常工作。我会尝试让它立即工作,这只是 http://www.simplecv.org/ 的快捷方式文档/

相机可能无法在 Windows 上运行,或者您可能需要手动安装驱动程序。 Linux 在处理这个问题上要好得多。您还可以通过安装应用程序商店中名为“chees”的程序来在 Linux 上测试您的相机,或者:

sudo apt-get install cheese

我通常是 Windows 用户。我还没有找到一个好的免费开源 Windows 网络摄像头查看器来验证您的相机是否正常工作。我们正在开发 1.3 并尝试进行系统测试,以便在出现任何问题时通知您。在尝试使用 SimpleCV 之前,看看是否可以验证您的相机是否可以在 Windows 上正常工作。

I'm one of the SimpleCV developers. Sorry I didn't notice our doc.simplecv.org is not working. I will try to get it working right away, that is just a shortcut to http://www.simplecv.org/doc/.

The camera may just not work on windows, or you may have to manually install the drivers. Linux is much nicer in dealing with it. You can also test your camera on linux by installing a program called cheese from the app store or:

sudo apt-get install cheese

I'm normally a windows guy. I haven't found a good windows webcam viewer that is free and open source to verify that your camera is working. We are working on 1.3 and trying to get system test to notify you if any problems occur. See if you can verify your camera is working on windows before trying it with SimpleCV.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文