2

Got stuck In a situation, where working on a Camera app for android. The Camera should be customized and Customized Camera and not just the built-in. That's fine. I want camera to detect the eyes, while capturing the photo.

But I have few questions:

  • What to do for preview of a camera
  • Whether to use TextureView or SurfaceView
  • After capturing the image, where should it be shown
  • What is openCV, if I work with Texture- or SurfaceView do I still need openCV
Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
sarosh siddiq
  • 33
  • 1
  • 7

2 Answers2

1

You can start with one of many tutorials, or pick up some boilerplate from GitHub. There is no big difference whether to use TextureView or SurfaceView. You don't need OpenCV unless you need some real time image processing. It is your free choice whether to show captured picture, where and when.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • So tell me one thing if I Kick start with SurfaceView how would I get features like face detection or eyes detection as in OpenCV? – sarosh siddiq Dec 10 '16 at 11:13
  • what I actually want is to when detecting face It should also draw a circle around it.... is it possible with openCV as the person's face moves the circle should move relatively..... one thing more I have to do it while capturing... – sarosh siddiq Dec 10 '16 at 11:27
  • Android camera [provides](https://developer.android.com/reference/android/hardware/Camera.Face.html) (limited) built-in face detection. In my experience, it may be too sensitive to tilt. Worse, being a built-in feature, it can differ from one device to another. If you need more reliable eyes tracking, your choice is not limited to OpenCV. Actually, OpenCV is an open-source framework which is best suited to developers who know how to adapt common *computer vision* algorithms to their needs. If you are new to the field, you will be better served by some specialized SDK. – Alex Cohn Dec 11 '16 at 10:22
  • You definitely can draw circles over SurfaceView, but image processing will introduce inevitable delay. This delay may be totally acceptable on fast devices when the head movement is relatively slow and limited. But if it isn't, TextureView will not be a cure. To keep precise sync between the camera preview and CV results, you need to artificially delay camera preview frames. You can use OpenGL textures for that, but not TextureView. – Alex Cohn Dec 11 '16 at 10:27
0

OpenCV is a library that provides implementations of various features, like face detection, image processing etc.

If you plan to use OpenCV, then it provides its own implementation of CameraView that can be used for the CameraPreview.

OpenCV should be used as its methods are rigorous and efficient. you may want to refer this for your project
https://github.com/hosek/eyeTrackSample

  • Well Is it possible to get the same feature with SurfaceView? – sarosh siddiq Dec 10 '16 at 11:14
  • Yes it is possible, but may not be very efficient. If you want realtime tracking of eyes, then you may process each frame you get for SurfaceView, process it manually or by using OpenCV and redraw it to the SurfaceView with eyes highlighted and then wait for the next frame and so on – Harjot Singh Oberai Dec 10 '16 at 11:20
  • what I actually want is to when detecting face It should also draw a circle around it.... is it possible with openCV as the person's face moves the circle should move relatively..... I don't want this feature for Pre-captured image.... – sarosh siddiq Dec 10 '16 at 11:27
  • That is what i was saying, as the camera, captures a frame and gives it to surface view for rendering, you can capture the frame data, before it is actually rendered.Then, you can process it anyway you like and then render it. refer this : http://stackoverflow.com/questions/8371055/apply-custom-filters-to-camera-output – Harjot Singh Oberai Dec 10 '16 at 11:32
  • Instead of adding a filter, you may use OpenCV to detect face or eyes in the frame data, process it accordingly and then give the data to SurfaceView for rendering – Harjot Singh Oberai Dec 10 '16 at 11:34
  • Am I able to do something like as In snapchat? – sarosh siddiq Dec 10 '16 at 11:41
  • would you please come to fb I am not able to create chat here...sarosh madara.. you can find me easily – sarosh siddiq Dec 10 '16 at 11:44