Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
706 views
in Technique[技术] by (71.8m points)

flash - How to increase the Quality of the camera using 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;

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?

Thanks for the help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here is a sample code

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();
        }

    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...