ProCamera

Project Url: 18Gray/ProCamera
Introduction: ProCamera 是一款基于 Camera2 API 的相机,实现了相机的常用功能,力求不断挖掘 Camera2 的巨大潜力,锻造一款在功能和设计上完美的相机产品。
More: Author   ReportBugs   
Tags:

ProCamera 是一款基于 Camera2 API 的相机,实现了相机的常用功能,力求不断挖掘 Camera2 的巨大潜力,锻造一款在功能和设计上完美的相机产品。 camera2 modeselect

功能

  1. 相机常用功能:自动对焦/测光,手动对焦/测光,前后摄像头切换,切换闪光灯模式,使用 HDR,添加 GPU 滤镜,拍摄比例调节,延时摄影,录制视频。
  2. 图像处理相关:点击左下角按钮会进入相册,选取相册后可进行图像处理。包括:裁剪,滤镜,字幕,印记,对比度等的调节。

简单使用方法

  1. 在 xml 中引入 Camera2TextureView 这个控件。
  2. 在 Activity 或 Fragment 中,先设置一个 mFile 的路径用以保存图片地址。
  3. 在其 onResume,调用 cameraTextureView.openCamera()打开相机。
  4. 点击拍照按钮,调用 cameraTextureView.takePicture()就完成了拍照。
  5. 在 onPause 中调用 cameraTextureView.closeCamera()关闭相机。

复杂使用方法

复杂使用方法实际是在上面简单使用方法基础上增加了调节闪光灯、前后摄像头切换、设置 HDR、滤镜等功能。 这里普遍采用的一个思路是:在 onClick 中点击按钮后,会弹出一个对话框 Dialog 或 PopupWindow,然后再点击 Dialog 或 PopupWindow 上的选择项,之后消息会通过 EventBus 传到 Camera2Fragment 中,在 Camera2Fragment 中通过 onXXX 方法接收消息,再执行 cameraTextureView.xxx 方法执行相应相机操作。 以闪光灯设置为例:

  1. 在 onClick 中弹出了 PopupWindow。
  2. 选择 PopWindow 中四个选择项的一个,例如 iv_flash_auto 这个,是设置自动闪光,于是通过 EventBus 发送消息。
  3. 在 Camera2Fragment 中的 onFlashSelect 接收到消息,先进行一些 UI 的改动,然后 cameraTextureView.setFlashMode 来设置闪光灯模式。

Gradle 导入

Proguard 混淆

其他问题

ProCamera

ProCamera is a Camera based on Camera2 API, and it implements some common functions about camera. It will excavate the potential of Camera2 API continuously, to forge an impressive product on function and design. camera2 modeselect

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools