All Projects → RedApparat → Fotoapparat

RedApparat / Fotoapparat

Licence: apache-2.0
Making Camera for Android more friendly. 📸

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Fotoapparat

Stickercamera
This is an Android application with camera,picture cropping,collage sticking and tagging.贴纸标签相机,功能:拍照,相片裁剪,给图片贴贴纸,打标签。
Stars: ✭ 3,109 (-16.06%)
Mutual labels:  camera
Android Ffmpeg Camerarecord
使用JavaCV提供的支持, 使用OpenGL实时处理+显示摄像头采集的图像, 并使用FFMPEG实时录制音视频
Stars: ✭ 334 (-90.98%)
Mutual labels:  camera
Easy handeye
Automated, hardware-independent Hand-Eye Calibration
Stars: ✭ 355 (-90.42%)
Mutual labels:  camera
Goprostream
Tools for handling/displaying GoPro HTTP/UDP stream (Python/Ruby)
Stars: ✭ 311 (-91.6%)
Mutual labels:  camera
Photo Booth
A multi-platform photo booth software using Electron and your camera
Stars: ✭ 324 (-91.25%)
Mutual labels:  camera
Android Hidden Camera
This library is to take picture using camera without camera preview.
Stars: ✭ 339 (-90.85%)
Mutual labels:  camera
Kyshutterbutton
KYShutterButton is a custom button that is similar to the shutter button of the camera app
Stars: ✭ 293 (-92.09%)
Mutual labels:  camera
Multi sensor fusion
Multi-Sensor Fusion (GNSS, IMU, Camera) 多源多传感器融合定位 GPS/INS组合导航 PPP/INS紧组合
Stars: ✭ 357 (-90.36%)
Mutual labels:  camera
Magicalcamera
A library to take picture easy, transform your data in different format and save photos in your device
Stars: ✭ 327 (-91.17%)
Mutual labels:  camera
Android Goldeneye
A wrapper for Camera1 and Camera2 API which exposes simple to use interface.
Stars: ✭ 356 (-90.39%)
Mutual labels:  camera
Phockup
Media sorting tool to organize photos and videos from your camera in folders by year, month and day.
Stars: ✭ 310 (-91.63%)
Mutual labels:  camera
Raindropeffect
RainDropEffect for the Unity Asset Store
Stars: ✭ 320 (-91.36%)
Mutual labels:  camera
Homebridge Unifi Protect
📹 Complete HomeKit integration for UniFi Protect with full support for most features including autoconfiguration, motion detection, and multiple controllers: https://homebridge.io
Stars: ✭ 335 (-90.96%)
Mutual labels:  camera
Xiaopi
An Open Source Home Security Camera For Raspberry Pi
Stars: ✭ 311 (-91.6%)
Mutual labels:  camera
Android Smartwebview
A webview integrated w/ native features to help create most advanced hybrid applications.
Stars: ✭ 357 (-90.36%)
Mutual labels:  camera
Androidffmpeg
android 读取摄像头和麦克风,使用rtmp推流
Stars: ✭ 298 (-91.95%)
Mutual labels:  camera
Ypimagepicker
📸 Instagram-like image picker & filters for iOS
Stars: ✭ 3,661 (-1.16%)
Mutual labels:  camera
Handeye calib camodocal
Easy to use and accurate hand eye calibration which has been working reliably for years (2016-present) with kinect, kinectv2, rgbd cameras, optical trackers, and several robots including the ur5 and kuka iiwa.
Stars: ✭ 364 (-90.17%)
Mutual labels:  camera
Camera
二代身份证信息识别
Stars: ✭ 360 (-90.28%)
Mutual labels:  camera
Wallpaper
透明屏幕
Stars: ✭ 348 (-90.6%)
Mutual labels:  camera

Fotoapparat

Build status

Camera API in Android is hard. Having 2 different API for new and old Camera does not make things any easier. But fret not, that is your lucky day! After several years of working with Camera, we came up with Fotoapparat.

What it provides:

  • Camera API which does not allow you to shoot yourself in the foot.
  • Simple yet powerful parameters customization.
  • Standalone custom CameraView which can be integrated into any Activity.
  • Fixes and workarounds for device-specific problems.
  • Both Kotlin and Java friendly configurations.
  • Last, but not least, non 0% test coverage.

Taking picture becomes as simple as:

val fotoapparat = Fotoapparat(
    context = this,
    view = cameraView
)

fotoapparat.start()

fotoapparat
    .takePicture()
    .saveToFile(someFile)

How it works

Step One

Add CameraView to your layout

<io.fotoapparat.view.CameraView
    android:id="@+id/camera_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

Step Two

Configure Fotoapparat instance.

Fotoapparat(
            context = this,
            view = cameraView,                   // view which will draw the camera preview
            scaleType = ScaleType.CenterCrop,    // (optional) we want the preview to fill the view
            lensPosition = back(),               // (optional) we want back camera
            cameraConfiguration = configuration, // (optional) define an advanced configuration
            logger = loggers(                    // (optional) we want to log camera events in 2 places at once
                     logcat(),                   // ... in logcat
                     fileLogger(this)            // ... and to file
            ),
            cameraErrorCallback = { error -> }   // (optional) log fatal errors
    )

Check the wiki for the configuration options e.g. change iso

Are you using Java only? See our wiki for the java-friendly configuration.

Step Three

Call start() and stop(). No rocket science here.

override fun onStart() {
    super.onStart()
    fotoapparat.start()
}

override fun onStop() {
    super.onStop()
    fotoapparat.stop()
}

Take a picture

Finally, we are ready to take a picture. You have various options.

val photoResult = fotoapparat.takePicture()

// Asynchronously saves photo to file
photoResult.saveToFile(someFile)

// Asynchronously converts photo to bitmap and returns the result on the main thread
photoResult
    .toBitmap()
    .whenAvailable { bitmapPhoto ->
            val imageView = (ImageView) findViewById(R.id.result)

            imageView.setImageBitmap(bitmapPhoto.bitmap)
            imageView.setRotation(-bitmapPhoto.rotationDegrees)
    }

// Of course, you can also get a photo in a blocking way. Do not do it on the main thread though.
val result = photoResult.toBitmap().await()

// Convert asynchronous events to RxJava 1.x/2.x types.
// See /fotoapparat-adapters/ module
photoResult
        .toBitmap()
        .toSingle()
        .subscribe { bitmapPhoto ->

        }

Update parameters

It is also possible to update some parameters after Fotoapparat was already started.

fotoapparat.updateConfiguration(
        UpdateConfiguration(
                flashMode = if (isChecked) torch() else off()
                // ...
                // all the parameters available in CameraConfiguration
        )
)

Or alternatively, you may provide updates on an existing full configuration.

val configuration = CameraConfiguration(
    // A full configuration
    // ...
)

fotoapparat.updateConfiguration(
    configuration.copy(
            flashMode = if (isChecked) torch() else off()
            // all the parameters available in CameraConfiguration
    )
)

Switch cameras

In order to switch between cameras, Fotoapparat.switchTo() can be used with the new desired lensPosition and its cameraConfiguration.

fotoapparat.switchTo(
    lensPosition = front(),
    cameraConfiguration = newConfigurationForFrontCamera
)

Set up

Add dependency to your build.gradle

implementation 'io.fotoapparat:fotoapparat:2.7.0'

Camera permission will be automatically added to your AndroidManifest.xml. Do not forget to request this permission on Marshmallow and higher.

Face detection

Optionally, you can check out our other library which adds face detection capabilities - FaceDetector.

Credits

We want to say thanks to Mark Murphy for the awesome job he did with CWAC-Camera. We were using his library for a couple of years and now we feel that Fotoapparat is a next step in the right direction.

We also want to say many thanks to Leander Lenzing for the amazing icon. Don't forget to follow his work in dribbble.

License

Copyright 2017 Fotoapparat

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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].