Ask Your Question

opencv2.4.2 - open Front camera issue

asked 2013-03-20 04:07:33 -0600

karthi gravatar image

updated 2013-03-20 04:15:54 -0600

berak gravatar image

I developed an android application to capture image with the help of opencv2.4.2(with face detection). So I want to open device's front camera. I used the following code to open front camera,

mCamera = new VideoCapture(Highgui.CV_CAP_ANDROID+1)

It is working in mobile(SAMSUNG GALAXY S II. front and back camera available). But it is not working in my tablet(800 * 480 screen resolution. only front camera available).

If I use the following code,

mCamera = new VideoCapture(Highgui.CV_CAP_ANDROID)

It is working in tablet. But it is not working in my mobile. Can someone help me to fix this?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-03-20 04:34:38 -0600

Basically, this means that the assigned addresses of your camera hardware are switched between the tablet and the mobile phone. Without knowing the exact code (no experience in this programming on mobile plarforms) you should perform these steps:

  1. Detect which instrument you are using, there must be a identifier for that
  2. Define which command to use in that case, assigning to the correct camera, based on this identifier

There is no common agreement on which address should be assigned to which hardware, so this is totally platform dependent :)

edit flag offensive delete link more

Question Tools


Asked: 2013-03-20 04:07:33 -0600

Seen: 366 times

Last updated: Mar 20 '13