All Projects → pvasa → Cameraview Ex

pvasa / Cameraview Ex

Licence: apache-2.0
Easy Android camera integration, advanced features.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Cameraview Ex

Pbjvision
📸 iOS Media Capture – features touch-to-record video, slow motion, and photography
Stars: ✭ 1,940 (+965.93%)
Mutual labels:  camera
Irldocumentscanner
A drop-in Objective-C ViewController that will Automatically scan a document for you you.
Stars: ✭ 172 (-5.49%)
Mutual labels:  camera
Croperino
📷 A simple image cropping tool that provides gallery or camera help for Native Android (Java)
Stars: ✭ 176 (-3.3%)
Mutual labels:  camera
Neuvision
Structured Light based 3D scanner
Stars: ✭ 165 (-9.34%)
Mutual labels:  camera
Kalibr
The Kalibr visual-inertial calibration toolbox
Stars: ✭ 2,410 (+1224.18%)
Mutual labels:  camera
Aquila
IPCamera, aim to support V4L2/UVC/RaspberryPi/Hisi/XXX SDK production
Stars: ✭ 173 (-4.95%)
Mutual labels:  camera
Robot
Simple library for controlling a raspberry pi based robot
Stars: ✭ 156 (-14.29%)
Mutual labels:  camera
Unitybarcodescanner
Simple Unity Barcode Scanner
Stars: ✭ 180 (-1.1%)
Mutual labels:  camera
Alcameraviewcontroller
A camera view controller with custom image picker and image cropping.
Stars: ✭ 2,023 (+1011.54%)
Mutual labels:  camera
Flutter camera ml vision
A flutter widget that show the camera stream and allow ML vision recognition on it, it allow you to detect barcodes, labels, text, faces...
Stars: ✭ 175 (-3.85%)
Mutual labels:  camera
Fastbuy App
App to manage the products of the FastBuy Store (built with React Native and Redux).
Stars: ✭ 168 (-7.69%)
Mutual labels:  camera
Annca
Android library to simplify work with camera for video and photo with using different camera apis.
Stars: ✭ 169 (-7.14%)
Mutual labels:  camera
Blinkpy
A Python library for the Blink Camera system
Stars: ✭ 174 (-4.4%)
Mutual labels:  camera
Patches
Patches is a visual programming editor for building WebVR and WebGL experiences.
Stars: ✭ 164 (-9.89%)
Mutual labels:  camera
Icimulator
Simulate camera functions on iOS Simulator with images, videos, or your MacBook Camera.
Stars: ✭ 177 (-2.75%)
Mutual labels:  camera
Stereo Vision
This program has been developed as part of a project at the University of Karlsruhe in Germany. The final purpose of the algorithm is to measure the distance to an object by combining two webcams and use them as a Stereo Camera.
Stars: ✭ 160 (-12.09%)
Mutual labels:  camera
Matisse
基于知乎Matisse增强,一行代码实现图片/视频选择,裁剪,微信同款视频录制和拍照,无需权限申请!
Stars: ✭ 174 (-4.4%)
Mutual labels:  camera
Camerafilters
📷 摄像头实时滤镜处理库,自带10多种滤镜,支持滤镜扩展,并且兼容七牛云直播滤镜处理
Stars: ✭ 181 (-0.55%)
Mutual labels:  camera
Rawspeed
fast raw decoding library
Stars: ✭ 179 (-1.65%)
Mutual labels:  camera
Haishinkit.swift
Camera and Microphone streaming library via RTMP, HLS for iOS, macOS, tvOS.
Stars: ✭ 2,237 (+1129.12%)
Mutual labels:  camera

Build Status Download License

CameraViewEx

This is an extended version of Google's cameraview library with better stability and many more features.

CameraViewEx highly simplifies integration of camera implementation and various camera features into any Android project. It uses new camera2 api with advanced features on API level 21 and higher and smartly switches to camera1 on older devices (API < 21).

Minimum API 14 is required to use CameraViewEx.

API Level Camera API Preview View
14-20 Camera1 TextureView
21+ Camera2 TextureView

Why another camera library?

Every camera library out there has some issues. Some good ones uses only camera1 api which cannot give best performance possible with today's devices, some are not updated anymore, some does not have all the features while some has a lot of features but uses complex api. CameraViewEx tries to solve all these issues while providing simpler api and more features.

Features

  • High quality image capture
  • Multiple camera modes like single capture, continuous frame, and video capture
  • Ability to enable all or multiple modes simultaneously
  • Preview frame listener
  • Any size preview
  • Customizable continuous frame and single capture output size (different from preview size and aspect ratio)
  • Support multiple formats for output images like jpeg, yuv_420_888, rgba_8888
  • Pinch to zoom
  • Touch to focus
  • Configurable auto white balance, auto focus, flash, noise reduction, and optical / video stabilization
  • Highly configurable video recording with most of the options from MediaRecorder
  • Support multiple aspect ratios
  • Switch between front and back camera
  • Adjustable output image quality
  • Zero shutter lag mode
  • Shutter animation for single capture

Usage

Import dependency

In app build.gradle,

dependencies {
    // ...
    implementation "com.priyankvasa.android:cameraview-ex:3.5.5-alpha"
}

In layout xml

<com.priyankvasa.android.cameraviewex.CameraView
    android:id="@+id/camera"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:keepScreenOn="true"
    app:aspectRatio="4:3"
    app:autoFocus="continuous_picture"
    app:awb="auto"
    app:cameraMode="single_capture"
    app:continuousFrameSize="W1440,1080"
    app:facing="back"
    app:flash="auto"
    app:jpegQuality="high"
    app:noiseReduction="high_quality"
    app:opticalStabilization="true"
    app:outputFormat="jpeg"
    app:pinchToZoom="true"
    app:shutter="short_time"
    app:singleCaptureSize="1920,H1080"
    app:touchToFocus="true"
    app:zsl="true" />

Setup camera

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

    // Callbacks on UI thread
    camera.addCameraOpenedListener { /* Camera opened. */ }
        .addCameraErrorListener { t: Throwable, errorLevel: ErrorLevel -> /* Camera error! */ }
        .addCameraClosedListener { /* Camera closed. */ }
}

override fun onResume() {
    super.onResume()
    camera.start()
}

override fun onPause() {
    camera.stop()
    super.onPause()
}

override fun onDestroyView() {
    camera.destroy()
    super.onDestroyView()
}

Capture still picture

// enable only single capture mode
camera.setCameraMode(Modes.CameraMode.SINGLE_CAPTURE)
// OR keep other modes as is and enable single capture mode
camera.enableCameraMode(Modes.CameraMode.SINGLE_CAPTURE)
// Output format is whatever set for [app:outputFormat] parameter
// Callback on UI thread
camera.addPictureTakenListener { image: Image -> /* Picture taken. */ }
camera.capture()
// Disable single capture mode
camera.disableCameraMode(Modes.CameraMode.SINGLE_CAPTURE)

Process preview frames

// enable only continuous frame mode
camera.setCameraMode(Modes.CameraMode.CONTINUOUS_FRAME)
// OR keep other modes as is and enable continuous frame mode
camera.enableCameraMode(Modes.CameraMode.CONTINUOUS_FRAME)
// Output format is always ImageFormat.YUV_420_888
// Callback on background thread
camera.setContinuousFrameListener(maxFrameRate = 10f /*optional*/) { image: Image -> /* Frame available. */ }
// Disable continuous frame mode
camera.disableCameraMode(Modes.CameraMode.CONTINUOUS_FRAME)

Record video

// enable only video capture mode
camera.setCameraMode(Modes.CameraMode.VIDEO_CAPTURE)
// OR keep other modes as is and enable video capture mode
camera.enableCameraMode(Modes.CameraMode.VIDEO_CAPTURE)

// Callback on UI thread
camera.addVideoRecordStartedListener { /* Video recording started */ }

// Callback on UI thread
camera.addVideoRecordStoppedListener { isSuccess ->
    // Video recording stopped
    // isSuccess is true if video was recorded and saved successfully
}

camera.startVideoRecording(outputFile) {
    // Configure video (MediaRecorder) parameters
    audioEncoder = AudioEncoder.Aac
    videoFrameRate = 30
    videoStabilization = true
}
// When done recording
camera.stopVideoRecording()

// On APIs 24 and above video recording can be paused and resumed as well
camera.pauseVideoRecording()
camera.resumeVideoRecording()

// Disable video capture mode
camera.disableCameraMode(Modes.CameraMode.VIDEO_CAPTURE)

Set multiple modes simultaneously

  • In xml
<com.priyankvasa.android.cameraviewex.CameraView
    android:id="@+id/camera"
    app:cameraMode="single_capture|continuous_frame|video_capture" />
  • Or in code
camera.setCameraMode(Modes.CameraMode.SINGLE_CAPTURE or Modes.CameraMode.CONTINUOUS_FRAME or Modes.CameraMode.VIDEO_CAPTURE)

// Setup all the listeners including preview frame listener

camera.startVideoRecording(outputFile)
camera.capture()

// The listeners will receive their respective outputs

Switch through cameras for set facing

camera.facing = Modes.Facing.FACING_BACK // Open default back facing camera
camera.nextCamera() // Switch to next back facing camera

Sample apps

Configuration

CameraView property XML Attribute Possible Values
(bold value is the default one)
Camera1 Support (API 14 to 20) Camera2 Support (API 21+)
cameraMode app:cameraMode single_capture, continuous_frame, video_capture ✔️ ✔️
facing app:facing back, front, external ✔️ ✔️
aspectRatio app:aspectRatio 4:3, 16:9, 3:2, 16:10, 17:10, 8:5
(or any other ratio supported by device)
✔️ ✔️
continuousFrameSize app:continuousFrameSize W1920,H1080, W1440,1080, 1280,H720
(or any other size)
✔️ ✔️
singleCaptureSize app:singleCaptureSize W1920,H1080, W1440,1080, 1280,H720
(or any other size)
✔️ ✔️
touchToFocus app:touchToFocus false, true ✔️
autoFocus app:autoFocus off, auto, macro, continuous_video,
continuous_picture, edof
✔️ ✔️
pinchToZoom app:pinchToZoom false, true ✔️
flash app:flash off, on, torch, auto, redEye ✔️ ✔️
awb app:awb off, auto, incandescent, fluorescent, warm_fluorescent,
daylight, cloudy_daylight, twilight, shade
✔️
opticalStabilization app:opticalStabilization false, true ✔️
noiseReduction app:noiseReduction off, fast, high_quality, minimal, zero_shutter_lag ✔️
shutter app:shutter off, short_time, long_time ✔️ ✔️
outputFormat app:outputFormat jpeg, yuv_420_888, rgba_8888 ✔️ ✔️
jpegQuality app:jpegQuality default (90), low (60), medium (80), high (100) ✔️ ✔️
zsl app:zsl false, true ✔️
cameraId
(get only)
N/A Id of currently opened camera device ✔️ ✔️
cameraIdsForFacing
(get only)
N/A Sorted set of ids of camera devices for selected facing ✔️ ✔️
isActive
(get only)
N/A True if this CameraView instance is active and usable, false otherwise. It is set to false after CameraView.destroy() call. ✔️ ✔️
isCameraOpened
(get only)
N/A True if camera is opened, false otherwise. ✔️ ✔️
isSingleCaptureModeEnabled
(get only)
N/A True if single capture mode is enabled, false otherwise. ✔️ ✔️
isContinuousFrameModeEnabled
(get only)
N/A True if continuous frame mode is enabled, false otherwise. ✔️ ✔️
isVideoCaptureModeEnabled
(get only)
N/A True if video capture mode is enabled, false otherwise. ✔️ ✔️
isVideoRecording
(get only)
N/A True if there is a video recording in progress, false otherwise. ✔️ ✔️
supportedAspectRatios
(get only)
N/A Returns list of AspectRatio supported by selected camera. ✔️ ✔️
maxDigitalZoom
(get only)
N/A Returns a float value which is the maximum possible digital zoom value supported by selected camera. ✔️
currentDigitalZoom N/A Set camera digital zoom value. Must be between 1.0 and CameraView.maxDigitalZoom inclusive. ✔️

Documentation

For detailed documentation, please refer these docs.

Contribution Guidelines

See CONTRIBUTING.md.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].