Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It seems that the only way to get the most of your Android Camera is to use the Java API.

You should write a Java video capture class, that receives notifications every time a new frame is captured. (Similarly, you can start the camera in picture preview mode, and get new frame notification callbacks).

Then, forward the frame buffers to you native code using JNI calls.

The exact way to do it depends on the Android version, and sometimes, on the phone maker. They do not always use the Android conventions. If you want a portable camera app, you should write different implementations for each Android version, and load the appropriate one at runtime:

class CameraInterface {};
class CameraInterface2.2 : public CameraInterface {};
class CameraInterfaceIceCream : public CameraInterface {};
....

CameraInterface camera;
if(AndroidVersion == IceCream)
{
    camera = new CameraInterfaceIceCream();
}
...

Please read carefully the documentation for the camera API. You should guarantee some maximum delay for camera callbacks, and make sure the frame is not altered, and so on.

It seems that the only way to get the most of your Android Camera is to use the Java API.API (The Android API for camera access, not the OpenCV-provided ones).

You should write a Java video capture class, that receives notifications every time a new frame is captured. (Similarly, you can start the camera in picture preview mode, and get new frame notification callbacks).

Then, forward the frame buffers to you native code using JNI calls.

The exact way to do it depends on the Android version, and sometimes, on the phone maker. They do not always use the Android conventions. If you want a portable camera app, you should write different implementations for each Android version, and load the appropriate one at runtime:

class CameraInterface {};
class CameraInterface2.2 : public CameraInterface {};
class CameraInterfaceIceCream : public CameraInterface {};
....

CameraInterface camera;
if(AndroidVersion == IceCream)
{
    camera = new CameraInterfaceIceCream();
}
...

Please read carefully the documentation for the camera API. You should guarantee some maximum delay for camera callbacks, and make sure the frame is not altered, and so on.

It seems that the only way to get the most of your Android Camera is to use the Java API (The Android API for camera access, not the OpenCV-provided ones).

You should write a Java video capture class, that receives notifications every time a new frame is captured. (Similarly, you can start the camera in picture preview mode, and get new frame notification callbacks).

Then, forward the frame buffers to you native code using JNI calls.

The exact way to do it depends on the Android version, and sometimes, on the phone maker. They do not always use the Android conventions. If you want a portable camera app, you should write different implementations for each Android version, and load the appropriate one at runtime:

class CameraInterface {};
class CameraInterface2.2 : public CameraInterface {};
class CameraInterfaceIceCream : public CameraInterface {};
....

CameraInterface camera;
if(AndroidVersion == IceCream)
{
    camera = new CameraInterfaceIceCream();
}
...

Here is where you can start: http://developer.android.com/reference/android/hardware/Camera.html#setPreviewCallbackWithBuffer(android.hardware.Camera.PreviewCallback)

Please read carefully the documentation for the camera API. You should guarantee some maximum delay for camera callbacks, and make sure the frame is not altered, and so on.

It seems that the only way to get the most of your Android Camera is to use the Java API (The Android API for camera access, not the OpenCV-provided ones).

You should write a Java video capture class, that receives notifications every time a new frame is captured. (Similarly, you can start the camera in picture preview mode, and get new frame notification callbacks).

Then, forward the frame buffers to you native code using JNI calls.

The exact way to do it depends on the Android version, and sometimes, on the phone maker. They do not always use the Android conventions. If you want a portable camera app, you should write different implementations for each Android version, and load the appropriate one at runtime:

class CameraInterface {};
class CameraInterface2.2 : public CameraInterface {};
class CameraInterfaceIceCream : public CameraInterface {};
....

CameraInterface camera;
if(AndroidVersion == IceCream)
{
    camera = new CameraInterfaceIceCream();
}
...

Here [Here is where you can start: http://developer.android.com/reference/android/hardware/Camera.html#setPreviewCallbackWithBuffer(android.hardware.Camera.PreviewCallback)start](http://developer.android.com/reference/android/hardware/Camera.html#setPreviewCallbackWithBuffer(android.hardware.Camera.PreviewCallback))

Please read carefully the documentation for the camera API. You should guarantee some maximum delay for camera callbacks, and make sure the frame is not altered, and so on.

It seems that the only way to get the most of your Android Camera is to use the Java API (The Android API for camera access, not the OpenCV-provided ones).

You should write a Java video capture class, that receives notifications every time a new frame is captured. (Similarly, you can start the camera in picture preview mode, and get new frame notification callbacks).

Then, forward the frame buffers to you native code using JNI calls.

The exact way to do it depends on the Android version, and sometimes, on the phone maker. They do not always use the Android conventions. If you want a portable camera app, you should write different implementations for each Android version, and load the appropriate one at runtime:

class CameraInterface {};
class CameraInterface2.2 CameraInterface2_2 : public CameraInterface {};
class CameraInterfaceIceCream : public CameraInterface {};
....

CameraInterface camera;
if(AndroidVersion == IceCream)
{
    camera = new CameraInterfaceIceCream();
}
...

[Here is where you can start](http://developer.android.com/reference/android/hardware/Camera.html#setPreviewCallbackWithBuffer(android.hardware.Camera.PreviewCallback))

Please read carefully the documentation for the camera API. You should guarantee some maximum delay for camera callbacks, and make sure the frame is not altered, and so on.