【转】Webcam Manipulation with Javascript

( From:http://blog.trumpton.org.uk/2009/02/webcam-manipulation-with-javascript.html )

I purchased an IcamView web server, and megapixel webcam, which I have waterproofed, and placed in the garden.

The IcamView web server has a low power processor, and is unable to manipulate the images at all. When you use the ActiveX or Java video viewer, the viewer manipulates the image for you (on the client PC).

If you access still frames, you have no such tool, and the frames come straight from the camera, warts and all. The most obvious issue is when images are flipped by the camera, and it expects the software to flip the images back.

I have created a Javascript file (webcam.js), which can post-process images from webcams. It is intended for people who don't know or want to know how to perform any Javascript programming.

Adding the Code in your HTML File

All you need to do is use your favorite web editor, and include the Javascript, a webcam tag, and a normal img tag for backwards comatibility with non-Javascript capable browsers.

<script language="javascript" src="webcam.js"></script>

<webcam src="http://www.trumpton.org.uk/webcam/garden0.jpg"
graceful="yes" errsrc="http://www.trumpton.org.uk/webcam/offline-320x200.jpg" alt="Tomy Cam" showdate="yes" bgc="black" fgc="white" refresh="310" />

<noscript><img class="webcam" src='http://www.trumpton.org.uk/webcam/garden0.jpg' alt="Tomy Cam" /></noscript>
The Code all belongs in the <body> section of the web page.
  • The <script> tag loads the Javascript file.
  • The <webcam> tag is interpreted by the script, and loads / edits the image.
  • The <noscript> tag is ignored by browsers that can process Javascript, and handled by any other ones - the images displayed on these browsers will not be flipped / rotated or labelled.
More Information

More information, including the source code, can be found here.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值