web中检测摄像头

jrl5365 2008-01-27 10:16:33
我现在有一个网站,用到摄像头拍照,现在问题是如果没有安装,或安装了,他把摄像头拨了,这个检测怎么写呢?
请前辈有做过的,帮个忙
...全文
553 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
lass_name 2008-04-18
  • 打赏
  • 举报
回复
up
犇啊 2008-01-30
  • 打赏
  • 举报
回复
或者去看看facebook里边的写日志功能,当中就有个启动摄像头录像的,它能很好的检测出目前摄像头的状态
犇啊 2008-01-29
  • 打赏
  • 举报
回复
从JPEG数据源(摄像机)读取数据是非常简单的——你只要不断向这个数据源发送HTTP的请求,下载传回的数据(Response),从中抽取出一个位图出来就可以了。
下面是一个从IP摄像机读取单个JPEG侦的示例:

string sourceURL = "http://webcam.mmhk.cz/axis-cgi/jpg/image.cgi";
byte[] buffer = new byte[100000];
int read, total = 0;
// create HTTP request
HttpWebRequest req = (HttpWebRequest) WebRequest.Create( sourceURL );
// get response
WebResponse resp = req.GetResponse( );
// get response stream
Stream stream = resp.GetResponseStream( );
// read data from stream
while ( ( read = stream.Read( buffer, total, 1000 ) ) != 0 )
{
total += read;
}
// get bitmap
Bitmap bmp = (Bitmap) Bitmap.FromStream(
new MemoryStream( buffer, 0, total ) );
据此,你只需要判断传回来的值是否为空或者为0(对应关闭或者没装摄像头)
zmaini1420 2008-01-29
  • 打赏
  • 举报
回复
关注下!~
jrl5365 2008-01-27
  • 打赏
  • 举报
回复
呵呵...

flash 可是我的强项...

^o^

你好能和我联系一下么我的QQ3603356
shinaterry 2008-01-27
  • 打赏
  • 举报
回复
呵呵...

flash 可是我的强项...

^o^
jrl5365 2008-01-27
  • 打赏
  • 举报
回复
我的摄象头拍照就这样实现的
//flash post出来的数据,有width,height
int width = 0;
int height = 0;

if (!int.TryParse(Request.Form["width"], out width) &&
!int.TryParse(Request.Form["height"], out height))
{
throw new ApplicationException("照片格式不正确!");
}
width = int.Parse(Request.Form["width"]);
height = int.Parse(Request.Form["height"]);

//定义bitmap ,宽,高,和格式
Bitmap bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
Rectangle rect = new Rectangle(0, 0, width, height);
//宽*长 *3是因为每一点都需要rgb三种色值填充
int iBytes = width * height * 3;
byte[] PixelValues = new byte[iBytes];
//当前位置
int iPoint = 0;

for (int i = 0; i < height; i++)//填充每一行的色值
{
string[] ss = Request.Form["px" + i].Split(','); //解析行数据分组
for (int j = 0; j < width; j++)
{
string values = ss[j];
while (values.Length < 6)
{
values = "0" + values; //位不足填充
}
string s1, s2, s3;//获取RGB
s1 = values.Substring(0, 2);
s2 = values.Substring(2, 2);
s3 = values.Substring(4, 2);
PixelValues[iPoint] = Convert.ToByte(Convert.ToInt32(s1, 16));
PixelValues[iPoint + 1] = Convert.ToByte(Convert.ToInt32(s2, 16));
PixelValues[iPoint + 2] = Convert.ToByte(Convert.ToInt32(s3, 16));
//设置点陈color
bmp.SetPixel(j, i, Color.FromArgb(PixelValues[iPoint], PixelValues[iPoint + 1], PixelValues[iPoint + 2]));

iPoint += 3;
}
}

现在不知道怎么样来判断我之前说的情况
王集鹄 2008-01-27
  • 打赏
  • 举报
回复
这篇文章楼主可以参考一下,然后找人做个flash即可。
FScommand与javascript通讯
王集鹄 2008-01-27
  • 打赏
  • 举报
回复
利用flash来判断

var camArray = Camera.names; 

if (camArray.length == 0)
{
trace("没有摄像头");
}
tiansf85 2008-01-27
  • 打赏
  • 举报
回复
这个东西我不懂!帮不上忙!学习中...
zzuyongp 2008-01-27
  • 打赏
  • 举报
回复
不懂顶一个,希望楼主解决后给我说说解决思路,我过一段时间也要做这个,
jrl5365 2008-01-27
  • 打赏
  • 举报
回复
高手们啊,帮个忙吧

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧