android直接调用摄像头

android可以通过Intent来调用摄像头,那样调用的系统提供的摄像头程序,如果想直接调用摄像头的硬件,也可以直接访问摄像头.
具体可以参考[url]http://developer.android.com/guide/topics/media/camera.html[/url]里"Building a Camera App"这一节
关键的两个步骤是
创建SurfaceView用来绘制摄像头的预览
创建layout确定SurfaceView的位置,比如在这里可以在摄像头预览上加上自己定制的组件
要注意的几点是
camera要及时的在onPause方法中release掉
activity要加上 android:screenOrientation="landscape"否则预览和实际图像往往有90度角的偏转
[quote]On most devices, the default orientation of the camera preview is landscape. This example layout specifies a horizontal (landscape) layout and the code below fixes the orientation of the application to landscape. For simplicity in rendering a camera preview, you should change your application's preview activity orientation to landscape by adding the following to your manifest.
[/quote]

比如加上瞄准镜的效果 :D
[img]http://dl.iteye.com/upload/picture/pic/123280/1d8447df-b8ec-39db-8278-90c0a7630655.jpg[/img]
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值