首页 > 代码库 > Flash ANE camera for android
Flash ANE camera for android
使用 opencv2.4.9 ndk 打包的Android原生摄像头ANE
现在不是很好用
在Nexus7-I (4.4.4)中能够运行
但是在Sony LT18i上目前还不行
private function openCam():void{
if( !Camera.isSupported )
return;
var cameraNam:Array = Camera.names;
var cameraID:uint = 0;
if( cameraNam.length == 2 ){
cameraID = 1099;//// for back or 1098 for front
}
_cam = NativeCamera.instance;
_cam.addEventListener( NativeCamera.NATIVE_CAMERA_CREATED, onCreated );
_cam.addEventListener( NativeCamera.NATIVE_CAMERA_ERROR, one rror );
_cam.initCamWith( cameraID );
}
......
///onCreated
var bestR:NativeCameraSupportedResolution = _cam.getMaxCamParam();
if(bestR == null ) bestR = new NativeCameraSupportedResolution( _width, _height );
_cam.setCameraParam(bestR.camWidth,bestR.camHeight,1, 0);
this.addEventListener( Event.ENTER_FRAME, onShow );
/////// 获得bitmapdata 数据
_bitmapdata = http://www.mamicode.com/_cam.grabData();
///// 设置白平衡 index = 0-7;
_cam.setCamWhiteBalance( index );
//////释放
_cam.releaseCam();
_cam = null;
点击下载
目前支持的设备