mw::mo::mocam::autofocus::Handle::Calculate
Member FunctionErrorCodes Calculate( const u8* src0,const u8* src1, u32 width,u32 height,u32 stride, s32 maxParallax, bool formatPlanarY=false );
Name | Description | |
---|---|---|
in | src0 | Pointer to the first picture to focus. Picture format is 8 bits YUY2 (only Y is used so U and V could be 0) or 8 bits planar Y (see formatPlanarY flag below) Must be 4 bytes aligned. |
in | src1 | Pointer to the second picture to focus. Picture format is 8 bits YUY2 (only Y is used so U and V could be 0) or 8 bits planar Y (see formatPlanarY flag below) Must be 4 bytes aligned. |
in | width | Width of src0 and src1 in pixels. |
in | height | Height of src0 and src1 in pixels. |
in | stride | Distance in bytes between successive lines (typically width*2 for YUY2 or width for planar Y format) Must be multiple of 4 bytes. |
in | maxParallax | Maximum parallax value to use internaly for calculation. The higher the maxParallax, the closer the autofocus will be able to focus. As you will have to crop source images by autofocus value, source image width will determine the biggest possible value you can use. For instance, if you capture two VGA pictures (width of 640 pixels), and use 3DS screen display resolution (width of 400 pixels), you will be able to set the maxParallax value to 240=640-400. This value will give a closest focus distance of approximatly 9 cm which is probably too small. A typical "high" value would be around 120 pixels in VGA, which lets to focus as close as the distance where objects become to be "out of 2D focus" (blurred) i.e. 18 cm. A typical "small" value (in VGA) could be 64 for example (34 cm). The CPU load of the autofocus calculation is partially proportional to the maxParallax value. As the parallax is an absolute value, you will have to add your calibration translationX value to the desired maxParallax range to take into account the calibration. |
in | formatPlanarY | Indicate whether src0 and src1 pixel format are YUY2 (default) or planar Y (if this flag is true). |
Calculate 3D autofocus between 2 images (typically left-eye and right-eye camera captured images).
The autofocus tries to focus on the "closest object", but discards "unimportant" objects (smaller than about 20% of the screen surface).
This function do one step calculation on internal autofocus value.
So typically, you will call it asynchronously in a thread to avoid calculating autofocus for every frame,
and then use Get to retrieve an interpolated autofocus value for every frame.
To take into account the camera calibration, you will have to call the autofocus with translation corrected pictures.
Typically you will have (for translationX/translationY calibration):
CONFIDENTIAL