本文介绍了如何使用AS3提高相机的质量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试基于网络摄像头的应用程序.我这样开始代码:
I'm trying for a webcam based application. I started the code like this:
import flash.media.Camera;
import flash.media.Video;
var cam:Camera = Camera.getCamera();
a.vid1.attachCamera(cam);
a.vid1.smoothing = true;
我的问题是视频的质量.我使用的是 iMac 机器,它的相机质量很好.有什么办法可以提高相机输出的质量?
My problem is that the quality of the video.Im using an iMac machine, in which camera quality is good.Is there any way to increase the quality of the camera output?
感谢您的帮助.
推荐答案
这里是示例代码
package
{
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.ActivityEvent;
import flash.events.MouseEvent;
import flash.media.Camera;
import flash.media.Video;
public class iosTest extends Sprite
{
private var cam:Camera;
private var vid:Video;
public function iosTest()
{
super();
// support autoOrients
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
cam = Camera.getCamera();
if (!cam)
{
trace("No camera is installed.");
}
else
{
connectCamera();
}
}
private function connectCamera():void
{
cam.setMode(640, 480, 25);
cam.setQuality(0,100);
vid = new Video();
vid.width = cam.width;
vid.height = cam.height;
vid.attachCamera(cam);
addChild(vid);
stage.addEventListener(MouseEvent.CLICK, clickHandler);
}
private function clickHandler(e:MouseEvent):void
{
return;
switch (cam.width) {
case 160:
cam.setMode(320, 240, 10);
break;
case 320:
cam.setMode(640, 480, 5);
break;
default:
cam.setMode(160, 120, 15);
break;
}
removeChild(vid);
connectCamera();
}
}
}
这篇关于如何使用AS3提高相机的质量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!