Camera preview image data processing with Android L and Camera2 API

Combining a few answers into a more digestible one because @VP’s answer, while technically clear, is difficult to understand if it’s your first time moving from Camera to Camera2: Using https://github.com/googlesamples/android-Camera2Basic as a starting point, modify the following: In createCameraPreviewSession() init a new Surface from mImageReader Surface mImageSurface = mImageReader.getSurface(); Add that new surface as … Read more

Where can I get the Android camera application source code?

You will need to clone the project from the Android repository using git. The project URL is: https://android.googlesource.com/platform/packages/apps/Camera.git You can clone the project like this: git clone https://android.googlesource.com/platform/packages/apps/Camera.git The source code will be in the directory Camera. This link will tell you how to download all the sources. If you need help with using git … Read more

How to capture picture with AVCaptureSession in Swift?

AVCaptureSession Sample import UIKit import AVFoundation class ViewController: UIViewController { let captureSession = AVCaptureSession() let stillImageOutput = AVCaptureStillImageOutput() var error: NSError? override func viewDidLoad() { super.viewDidLoad() let devices = AVCaptureDevice.devices().filter{ $0.hasMediaType(AVMediaTypeVideo) && $0.position == AVCaptureDevicePosition.Back } if let captureDevice = devices.first as? AVCaptureDevice { captureSession.addInput(AVCaptureDeviceInput(device: captureDevice, error: &error)) captureSession.sessionPreset = AVCaptureSessionPresetPhoto captureSession.startRunning() stillImageOutput.outputSettings = [AVVideoCodecKey:AVVideoCodecJPEG] … Read more

How can I set camera preview size to squared aspect ratio in a squared SurfaceView (like Instagram)

As said before you need to find the correct preview size (the one with aspect ratio 1:1) and probably you have to use FrameLayout for the SurfacePreview. It seems that you have and aspect ratio problem maybe you have the right preview size but you are placing it in an incorrect layout. Another solution might … Read more

How to use AVCapturePhotoOutput

Updated to Swift 4 Hi it’s really easy to use AVCapturePhotoOutput. You need the AVCapturePhotoCaptureDelegate which returns the CMSampleBuffer. You can get as well a preview image if you tell the AVCapturePhotoSettings the previewFormat class CameraCaptureOutput: NSObject, AVCapturePhotoCaptureDelegate { let cameraOutput = AVCapturePhotoOutput() func capturePhoto() { let settings = AVCapturePhotoSettings() let previewPixelType = settings.availablePreviewPhotoPixelFormatTypes.first! let … Read more

Access camera from a browser

As of 2017, WebKit announces support for WebRTC on Safari Now you can access them with video and standard javascript WebRTC E.g. var video = document.createElement(‘video’); video.setAttribute(‘playsinline’, ”); video.setAttribute(‘autoplay’, ”); video.setAttribute(‘muted’, ”); video.style.width=”200px”; video.style.height=”200px”; /* Setting up the constraint */ var facingMode = “user”; // Can be ‘user’ or ‘environment’ to access back or front … Read more

Get last image from Photos.app?

This code snippet will get the latest image from the camera roll (iOS 7 and below): ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; // Enumerate just the photos and videos group by using ALAssetsGroupSavedPhotos. [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) { // Within the group enumeration block, filter to enumerate just photos. [group setAssetsFilter:[ALAssetsFilter allPhotos]]; // … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)