Having quality issues? Getting different dimensions from the camera than what you request? Read this note from Adobe:
cam = Camera.getCamera(); cam.setMode(320, 240, 20, false); cam.setQuality(0, 100); cameraVideo.attachCamera(cam); cameraVideo.width = cam.width; cameraVideo.height = cam.height; //Actual Result: cameraVideo's dimension are 320x240 when on IPhone emulator cameraVideo's dimension are 192x144 when on IPhone //Expected Result: cameraVideo's dimension are 320x240 when on IPhone emulator cameraVideo's dimension are 320x240 when on IPhone
This was Adobe’s response
When you call Setmode with some requested width and height, its not necessary that you will get the requested width and height.
The returned width and height depend on a number of factors –
1. Obviously, the values you passed in as width and height.
2. If you passed favorArea=true/false in the setmode API
3. And most importantly, the camera hardware – what are the possible resolutions (and fps) the hardware of camera on you device supports.
Since “3” can be different for different devices you can get different values on different devices (values can vary on WIN Desktop as well with different webcams)
In this case, iOS devices again support different set of possoble resolutions –
ios Camera Presets AVCaptureSessionPresetLow AVCaptureSessionPresetMedium AVCaptureSessionPreset640x40 AVCaptureSessionPreset1280x720 AVCaptureSessionPresetHigh
3G 400×304 400×304 NA NA 400×304
3GS 192×144 480×360 640×480 NA 640×480
4 front 192×144 480×360 640×480 NA 640×480
4 back 192×144 480×360 640×480 1280×720 1280×720
The logic to compute the width and height is somewhat like this (and happens in core, same for all platforms) –
1. core asks platform to provide a list of supported resolutions. (In ios we provide the list as mentioned above , and in the spec)
2. core selects one of these resolutions, the one closest to user’s requirement (basically comparing area using percentatges but is more involved to describe in words).
3. Say user asks for 320 x 240
4. core has now to select the native supported mode closest to this. SO it can either choose 192×144 or 480×360. Seems in this case core decides to use 192×144.
5. core also changes the resolution based on the aspect ratio of the requested resolution (doing any required cropping).
6. So, you will be getting 192 x 144.
Similarly when you choose 384 x 288, core selects 480 x 360 to be the closest native resolution. Camera captures at 480 x 360 and then a cropped part of it (384 x 288) is provided to you.
Also, on Android, you get the desired values because 320 x 240 is one of the supported values by most Android cameras, thus the requested and supported better match in case of Android.
Also as I have genrally observed, Android cameras have a large number of supported resolutions compared to just 4 on iOS. Thus Android camera has a better chance to match the requested resolution. But if you ask for weird numbers like 700 x 400, you will not get that on Android too (but something else based on the above described logic)
Also the same information is mentioned in implementation spec (and comments on the spec) – https://zerowing.corp.adobe.com/display/airlinux/Mobile+Camera+Implementation+spec
See my suggestion here:
Might shed some light on why your video from webcam is so bad. Try increase the setMode values and get the highest quality camera quality returned. Be mindful that the resolution may be different!