1
votes

i have a video display in my flex app. which is attached to the camera. The camera resolution can vary depending on the user's selection, While the video display (preview) dimensions are fixed. i am then doing this:

bmd.draw(vidDisplay);

where bmd is the bitmap.. The problem is the resulting bitmap has the correct size of the camera settings (which is set) but the capture from the video is always the size of the video display inside the bitmap.. I hope i am making sense.. The result looks like a little picture inside a bigger image top left justified..

I want to have a video display preview with fixed height, but be able to take snapshot with varying resolution.. Any help is appreciated!

2
you can use a matrix to change the scale of your snapshots, i dont have an example you would need to look it up, its the second param in the draw method, image.draw(obj, yourMatrix); - Neil

2 Answers

0
votes

You can set the size of the Bitmap when creating it:

var bmd: BitmapData = new BitmapData(video.width, video.height);

and then draw the videoDisplay (the video iteself, not the preview window) into it:

bmd.draw(vidDisplay);
0
votes

The easiest way is to simply resize the VideoDisplay before taking the snapshot.

videoDisplay.width = desiredWidth;
videoDisplay.height = desiredHeight;

// validate immediately to see new size    
videoDisplay.validateNow();

bitmapData.draw(videoDisplay);

// now restore to original size
videoDisplay.width = originalWidth;
videoDisplay.height = originalHeight;

videoDisplay.validateNow();

Even better would be if you used a separate flash.media.Video object just for the purpose of taking a snapshot.