Home | History | Annotate | Download | only in hardware

Lines Matching defs:Camera

35  * The Camera class is used to set image capture settings, start/stop preview,
37 * client for the Camera service, which manages the actual camera hardware.
39 * <p>To access the device camera, you must declare the
40 * {@link android.Manifest.permission#CAMERA} permission in your Android
43 * manifest element to declare camera features used by your application.
44 * For example, if you use the camera and auto-focus feature, your Manifest
46 * <pre> &lt;uses-permission android:name="android.permission.CAMERA" />
47 * &lt;uses-feature android:name="android.hardware.camera" />
48 * &lt;uses-feature android:name="android.hardware.camera.autofocus" /></pre>
53 * <li>Obtain an instance of Camera from {@link #open(int)}.
57 * <li>If necessary, modify the returned {@link Camera.Parameters} object and call
58 * {@link #setParameters(Camera.Parameters)}.
63 * {@link #setPreviewDisplay(SurfaceHolder)}. Without a surface, the camera
69 * <li>When you want, call {@link #takePicture(Camera.ShutterCallback,
70 * Camera.PictureCallback, Camera.PictureCallback, Camera.PictureCallback)} to
78 * <li><b>Important:</b> Call {@link #release()} to release the camera for
79 * use by other applications. Applications should release the camera
87 * <li>Obtain and initialize a Camera and start preview as described above.
89 * <li>Call {@link #unlock()} to allow the media process to access the camera.
91 * <li>Pass the camera to {@link android.media.MediaRecorder#setCamera(Camera)}.
95 * and re-lock the camera.
111 * more devices, you should not make assumptions about the device camera
114 public class Camera {
115 private static final String TAG = "Camera";
117 // These match the enums in frameworks/base/include/camera/Camera.h
148 * Returns the information about a particular camera.
154 * Information about a camera
158 * The facing of the camera is opposite to that of the screen.
163 * The facing of the camera is the same as that of the screen.
168 * The direction that the camera faces to. It should be
174 * The orientation of the camera image. The value is the angle that the
175 * camera image needs to be rotated clockwise so it shows correctly on
179 * back-facing camera sensor is mounted in landscape. You are looking at
180 * the screen. If the top side of the camera sensor is aligned with the
182 * 90. If the top side of a front-facing camera sensor is aligned with
195 * Creates a new Camera object to access a particular hardware camera.
197 * <p>You must call {@link #release()} when you are done using the camera,
200 * <p>Your application should only have one Camera object active at a time
201 * for a particular hardware camera.
213 * @param cameraId the hardware camera to access, between 0 and
215 * @return a new Camera object, connected, locked and ready for use.
216 * @throws RuntimeException if connection to the camera service fails (for
217 * example, if the camera is in use by another process).
219 public static Camera open(int cameraId) {
220 return new Camera(cameraId);
224 * Creates a new Camera object to access the first back-facing camera on the
225 * device. If the device does not have a back-facing camera, this returns
229 public static Camera open() {
235 return new Camera(i);
241 Camera(int cameraId) {
258 native_setup(new WeakReference<Camera>(this), cameraId);
270 * Disconnects and releases the Camera object resources.
272 * <p>You must call this as soon as you're done with the Camera object.</p>
279 * Unlocks the camera to allow another process to access it.
280 * Normally, the camera is locked to the process with an active Camera
282 * between processes, you can call this method to release the camera
284 * you can call {@link #reconnect()} to reclaim the camera.
287 * {@link android.media.MediaRecorder#setCamera(Camera)}.
291 * @throws RuntimeException if the camera cannot be unlocked.
296 * Re-locks the camera to prevent other processes from accessing it.
297 * Camera objects are locked by default unless {@link #unlock()} is
302 * @throws RuntimeException if the camera cannot be re-locked (for
303 * example, if the camera is still in use by another process).
308 * Reconnects to the camera service after another process used it.
310 * camera; when the process is done, you must reconnect to the camera,
312 * camera.
315 * done recording if {@link android.media.MediaRecorder#setCamera(Camera)}
321 * example, if the camera is still in use by another process).
341 * camera setup and surface creation to happen in parallel, saving time.)
363 * @see #setPreviewCallback(Camera.PreviewCallback)
364 * @see #setOneShotPreviewCallback(Camera.PreviewCallback)
365 * @see #setPreviewCallbackWithBuffer(Camera.PreviewCallback)
376 * with {@link android.hardware.Camera.Parameters#getPreviewFormat()}.
377 * If {@link android.hardware.Camera.Parameters#setPreviewFormat(int)}
380 * @param camera the Camera service object.
382 void onPreviewFrame(byte[] data, Camera camera);
390 * <p>If {@link #setPreviewCallback(Camera.PreviewCallback)},
391 * {@link #setOneShotPreviewCallback(Camera.PreviewCallback)}, or
392 * {@link #setPreviewCallbackWithBuffer(Camera.PreviewCallback)} were
393 Camera.PreviewCallback#onPreviewFrame(byte[], Camera)}
400 * resets the camera for a future call to {@link #startPreview()}.
425 // Always use one-shot mode. We fake camera preview mode by
461 * callback, {@link #setPreviewCallback(Camera.PreviewCallback)} is called,
462 * or {@link #setOneShotPreviewCallback(Camera.PreviewCallback)} is called.
486 * read from {@link Camera.Parameters#getPreviewSize()}. Bytes per pixel
489 * using the image format from {@link Camera.Parameters#getPreviewFormat()}.
505 private Camera mCamera;
507 public EventHandler(Camera c, Looper looper) {
542 // We're faking the camera preview mode to prevent
586 Camera c = (Camera)((WeakReference)camera_ref).get();
597 * Callback interface used to notify on completion of camera auto focus.
603 * {@code android.hardware.camera.autofocus} feature, in the
612 * Called when the camera auto focus completes. If the camera does not
617 * @param camera the Camera service object
619 void onAutoFocus(boolean success, Camera camera);
623 * Starts camera auto-focus and registers a callback function to run when
624 * the camera is focused. This method is only valid when preview is active
628 * {@link android.hardware.Camera.Parameters#getFocusMode()} to determine if
629 * this method should be called. If the camera does not support auto-focus,
630 * it is a no-op and {@link AutoFocusCallback#onAutoFocus(boolean, Camera)}
640 * {@link android.hardware.Camera.Parameters#FLASH_MODE_OFF}, flash may be
641 * fired during auto-focus, depending on the driver and camera hardware.<p>
657 * If the camera does not support auto-focus, this is a no-op.
659 * @see #autoFocus(Camera.AutoFocusCallback)
678 * or give other feedback of camera operation. This may be some time
694 * and {@link Camera.Parameters} settings.
697 * @param camera the Camera service object
699 void onPictureTaken(byte[] data, Camera camera);
714 * Triggers an asynchronous image capture. The camera service will initiate
753 * {@link Camera.OnZoomChangeListener#onZoomChange(int, boolean, Camera)}
759 * if {@link android.hardware.Camera.Parameters#isSmoothZoomSupported}
763 * android.hardware.Camera.Parameters#getMaxZoom}.
774 * android.hardware.Camera.Parameters#isSmoothZoomSupported} is true.
785 * is, the image is reflected along the central vertical axis of the camera
792 * If you want to make the camera image show in the same orientation as
796 * int cameraId, android.hardware.Camera camera) {
797 * android.hardware.Camera.CameraInfo info =
798 * new android.hardware.Camera.CameraInfo();
799 * android.hardware.Camera.getCameraInfo(cameraId, info);
811 * if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
817 * camera.setDisplayOrientation(result);
838 * @param zoomValue the current zoom value. In smooth zoom mode, camera
842 * @param camera the Camera service object
844 void onZoomChange(int zoomValue, boolean stopped, Camera camera);
849 * camera driver during smooth zoom.
859 // Error codes match the enum in include/ui/Camera.h
862 * Unspecified camera error.
863 * @see Camera.ErrorCallback
869 * Camera object and instantiate a new one.
870 * @see Camera.ErrorCallback
875 * Callback interface for camera error notification.
882 * Callback for camera errors.
888 * @param camera the Camera service object
890 void onError(int error, Camera camera);
906 * Changes the settings for this Camera service.
908 * @param params the Parameters to use for this Camera service
916 * Returns the current settings for this Camera service.
918 * to {@link #setParameters(Camera.Parameters)} to take effect.
920 * @see #setParameters(Camera.Parameters)
969 * Camera service settings.
971 * <p>To make camera parameters take effect, applications have to call
972 * {@link Camera#setParameters(Camera.Parameters)}. For example, after
973 * {@link Camera.Parameters#setWhiteBalance} is called, white balance is not
974 * actually changed until {@link Camera#setParameters(Camera.Parameters)}
977 * <p>Different devices may have different camera capabilities, such as
978 * picture size or flash modes. The application should query the camera
980 * should call {@link Camera.Parameters#getSupportedColorEffects()} before
981 * calling {@link Camera.Parameters#setColorEffect(String)}. If the
982 * camera does not support color effects,
983 * {@link Camera.Parameters#getSupportedColorEffects()} will return null.
986 // Parameter keys to communicate with the camera driver.
1163 * Applications are looking for a barcode. Camera driver will be
1188 * Focus is fixed. The camera is always in this mode if the focus is not
1189 * adjustable. If the camera has auto-focus, this mode can fix the
1203 * Continuous auto focus mode intended for video recording. The camera
1206 * #takePicture(Camera.ShutterCallback, Camera.PictureCallback,
1207 * Camera.PictureCallback)} in this mode but the subject may not be in
1374 * The sides of width and height are based on camera orientation. That
1377 * while setting preview size. For example, suppose the camera supports
1544 * @see #setPreviewCallbackWithBuffer(Camera.PreviewCallback)
1571 * maximum fps, the camera outputs frames in fixed frame rate. If not,
1572 * the camera outputs frames in auto frame rate. The actual frame rate
1762 * the camera. This affects the pictures returned from JPEG {@link
1763 * PictureCallback}. The camera driver may set orientation in the
1774 * between camera orientation and natural device orientation. The sum or
1775 * of the two is the rotation angle for back-facing camera. The
1776 * difference of the two is the rotation angle for front-facing camera.
1782 * orientation is 270. Suppose a back-facing camera sensor is mounted in
1783 * landscape and the top side of the camera sensor is aligned with the
1784 * right edge of the display in natural orientation. So the camera
1791 * android.hardware.Camera.CameraInfo info =
1792 * new android.hardware.Camera.CameraInfo();
1793 * android.hardware.Camera.getCameraInfo(cameraId, info);
1798 * } else { // back-facing camera
1805 * orientation of the camera. Rotation can only be 0,
2132 * Gets the focal length (in millimeter) of the camera.
2227 * #getMaxZoom}. 0 means the camera is not zoomed.
2234 * Sets current zoom value. If the camera is zoomed (value > 0), the
2265 * @return the maximum zoom value supported by the camera.
2297 * Gets the distances from the camera to where an object appears to be
2308 * This method is intended to estimate the distance between the camera
2311 * camera hardware, autofocus algorithm, the focus area, and the scene.