My Experiments with Android : Camera (Part 1 : introduction)

credits : https://pngtree.com/freebackground/camera-background_429514.html

Camera is one of the most used hardware feature of any mobile phone. Today , not only it is being used in clicking photos or recording videos , but it has found its application in many other areas like live streaming, live editing, AI based object recognitions/scanning,  virtual/augmented reality and much more. So, as a developer, it it would be very interesting to understand how this system works.
In this article, I would be covering some basic overview of camera.

Setting up our aim.

Their can be a hundreds of ways an app could use the functionality of camera hardware. The topic of camera is actually so vast that it uses the uses the principles and knowledge from various domains : 
  • The way its lenses captures lights to generate images are covered in Physics
  • The way the camera lenses are arranged and designed are covered in Mechanics, and 
  • The way this image is converted into a digital picture  is covered in Digital Electronics. 
Being an Android developer( and awfully poor in above mentioned subjects), my journey starts from understanding how to capture image/videos via this camera hardware and be able to show/manipulate these pictures in my app . 
So I set my aim to just this : be able to receive a picture clicked via camera hardware into my app (Later I would try to understand how I can manipulate those picture streams to create and apply filters on it).

Getting into the SDK : the camera intent api

So Android has a lot of sdk apis and libraries to let developers interact and use camera hardware . Some ways are:
  1. Easy but very less Powerful. e.g. The SDK based Camera Intent Api.  
  2. Easy, Powerful(somewhat) but very limited . e.g. the SDK based Camera1 Api
  3. Powerful but very confusing/ with flaws and difficult to implement (correction: "painful" to implement). e.g. the SDK based Camera2 Api
  4. Somewhat Powerful , easy to understand, but difficult to customize for our usage. eg the famous camera libraries like camerakit, fotoapparet and the new CameraX library.
By powerful, I mean how much modifications are allowed by an api in the process of getting a picture . If your app has a very light usage of camera, like just getting a picture for making a profile pic, or sending to other person , then Camera intent api would be the best option. 

However if camera usage is a more mainstream feature, like if your app is some kind of live streamer or live editor (eg skype or snap) , you would want to use camera1/2 apis which would give you a more control over the finer aspects of image capturing.

The libraries are somewhat a bridge between those two. These are themselves build on painful camera1/2 apis and try to provide their features in a simpler manner. As many features As they could and As simpler As they could get. But again, no silver bullet here. When you are doing ML based stuff with your live image previews or any other hardcore feature, you would still have to access raw apis from inside. 

So without a further delay, let me jump into another article discussing the details of Camera Intent API 

Comments