网络摄像头问题 [英] webcam problem

查看:98
本文介绍了网络摄像头问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经制作了一个图片盒和一个编码女巫在图片框中拍照,但问题是我需要将它保存为图像文件才能使用getpixel,所以当我使用保存图片框作为图像时,VB .NET返回错误,图像不存在,

解决方案

你能告诉我们你到目前为止尝试了什么,那是不行的?

我知道Patr正在谈论什么,我也想知道如何做到这一点。

Debasisdas做了如何从网络摄像头捕获并在图片框中显示实时视频的示例。但是,Windows是什么实际做的是在图片框上显示图片(称为覆盖)。因此,图片框实际上仍然是空的,这意味着GetPixel()将无法返回相机图像的颜色,而SavePicture()显然也无法保存图像。


我们需要一种方法来实际设置图片框的内容,最简单的方法似乎是从相机保存图像并将其加载到图片框中,然后可以将其用作任何其他加载的图像文件。这样做的缺点是,由于文件系统的开销(或者可能是硬盘本身,反复读取/写入文件),帧速率可能会非常低(可能不超过4 fps左右)。 br />

编辑:顺便说一下,我正在使用VB6和Windows XP,而且这种情况仍然存在。但是,我尝试使用MCI在一个图片框中播放视频(这与网络摄像头有关,因为MCI也只是在XP中覆盖),在运行Windows 98的极其旧的计算机上,以及GetPixel()工作 - 我想这可能是因为与XP相比,GetPixel()在98上的工作方式不同,而不是其他任何东西。


编辑2:愚蠢的是,我当时没有想到尝试使用SavePicture(),这可以确认是否只是GetPixel()在98上是不同的,或者如果98实际上将图片放入图片框


正是我所说的。


I have made a picturebox and a coding witch takes a picture in the picturebox, but the problem is that I need to save it as a image file before I can use getpixel, so when I use a save picturebox as image then VB.NET returns an error with image not exists,

解决方案

Can you show us what you''ve attempted so far, that doesn''t work?


I know what Patr''s talking about, and I''d like to know how to do this too.
Debasisdas has made an example of how to capture from a webcam and "display the live video in a picturebox". However, what Windows is actually doing is displaying the picture on top of the picture box (known as overlaying). Therefore the picturebox actually still is empty, meaning that GetPixel() will fail to give back colours of the camera''s images, and SavePicture() will obviously also fail to save the images.

We need a way to actually set the contents of the picturebox, and the easiest way seems to be by saving an image from the camera and loading it into the picturebox, where it can then be used as any other loaded image file. The downside to this is that the frame rate would probably be very low (probably no more than 4 fps or so) due to overheads from the file system (or possibly the hard disk itself, reading/writing the file over and over).

EDIT: I''m using VB6 and Windows XP, by the way, and this still happens. However, I tried using MCI to play a video in a picture box (this being related to webcams because MCI also just overlays in XP), on an extremely old computer running Windows 98, and GetPixel() worked - I think that may be because GetPixel() works differently on 98 compared to XP, rather than anything else.

EDIT2: Stupidly, it didn''t occur to me at the time to try SavePicture(), which would confirm whether it was just GetPixel() being different on 98, or if 98 was actually placing the picture into the picturebox
.


that is exactly what I am talking about.


这篇关于网络摄像头问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆