openharmony 鸿蒙 capi-camera-device-h

2026-08-25 浏览 (1)

camera_device.h

Overview

Defines the basic APIs of the camera device.

File to include: <ohcamera/camera_device.h>

Library: libohcamera.so

System capability: SystemCapability.Multimedia.Camera.Core

Since: 12

Related module: OH_Camera

Summary

Functions

NameDescription
Camera_ErrorCode OH_CameraDevice_GetCameraOrientation(Camera_Device* camera, uint32_t* orientation)Obtains the sensor direction of a camera device.
Camera_ErrorCode OH_CameraDevice_GetHostDeviceName(Camera_Device* camera, char** hostDeviceName)Obtains the name of a remote device.
Camera_ErrorCode OH_CameraDevice_GetHostDeviceType(Camera_Device* camera, Camera_HostDeviceType* hostDeviceType)Obtains the type of a remote device.
Camera_ErrorCode OH_CameraDevice_GetLensEquivalentFocalLengths(const Camera_Device* camera, uint32_t** equivalentFocalLengths, uint32_t* size)Obtains the equivalent focal length of a camera.
Camera_ErrorCode OH_CameraDevice_IsLogicalCamera(const Camera_Device* camera, bool* isLogicalCamera)Checks whether a camera is a logical camera (consisting of multiple physical cameras).
Camera_ErrorCode OH_CameraDevice_GetLogicalCameraConstituentCameraDevices(const Camera_Device* logicalCamera, Camera_Device** constituentCameras, uint32_t* size)Obtains all physical cameras that constitute a logical camera by calling OH_CameraDevice_DeleteConstituentCameraDevices.
Camera_ErrorCode OH_CameraDevice_DeleteConstituentCameraDevices(const Camera_Device* logicalCamera, Camera_Device* constituentCameras, uint32_t size)Deletes all physical cameras that constitute a logical camera.
Camera_ErrorCode OH_CameraDevice_GetLensFocalLength(const Camera_Device* camera, float* lensFocalLength)Obtains the focal length of a camera.
Camera_ErrorCode OH_CameraDevice_GetMinimumFocusDistance(const Camera_Device* camera, float* minimumFocusDistance)Obtains the minimum focus distance of a camera.
Camera_ErrorCode OH_CameraDevice_GetLensDistortion(const Camera_Device* camera, float** lens, uint32_t* size)Obtains the distortion parameters of a camera.
Camera_ErrorCode OH_CameraDevice_GetIntrinsicCalibration(const Camera_Device* camera, float** intrinsicCalibration, uint32_t* size)Obtains the intrinsic calibration parameters of a camera.
Camera_ErrorCode OH_CameraDevice_GetSensorPhysicalSize(const Camera_Device* camera, float* width, float* height)Obtains the physical dimensions of a camera sensor.
Camera_ErrorCode OH_CameraDevice_GetSensorPixelArraySize(const Camera_Device* camera, uint32_t* width, uint32_t* height)Obtains the pixel array dimensions of a camera sensor.
Camera_ErrorCode OH_CameraDevice_GetSensorColorFilterArrangement(const Camera_Device* camera, OH_Camera_SensorColorFilterArrangement* sensorCFA)Obtains the color filter array arrangement of a camera sensor.

Function Description

OH_CameraDevice_GetCameraOrientation()

Camera_ErrorCode OH_CameraDevice_GetCameraOrientation(Camera_Device* camera, uint32_t* orientation)

Description

Obtains the sensor direction of a camera device.

Since: 12

Parameters

NameDescription
Camera_Device* cameraPointer to the camera device.
uint32_t* orientationPointer to the sensor direction obtained.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraDevice_GetHostDeviceName()

Camera_ErrorCode OH_CameraDevice_GetHostDeviceName(Camera_Device* camera, char** hostDeviceName)

Description

Obtains the name of a remote device.

Since: 15

Parameters

NameDescription
Camera_Device* cameraPointer to the camera device.
char** hostDeviceNameDouble pointer to the name of the remote device.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful, and the remote device name is returned.
CAMERA_CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraDevice_GetHostDeviceType()

Camera_ErrorCode OH_CameraDevice_GetHostDeviceType(Camera_Device* camera, Camera_HostDeviceType* hostDeviceType)

Description

Obtains the type of a remote device.

Since: 15

Parameters

NameDescription
Camera_Device* cameraPointer to the camera device.
Camera_HostDeviceType* hostDeviceTypePointer to the type of the remote device.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful, and the remote device name is returned.
CAMERA_CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraDevice_GetLensEquivalentFocalLengths()

Camera_ErrorCode OH_CameraDevice_GetLensEquivalentFocalLengths(const Camera_Device* camera, uint32_t** equivalentFocalLengths, uint32_t* size)

Description

Obtains the equivalent focal length of a camera.

Since: 24

Parameters

NameDescription
const Camera_Device* cameraPointer to the camera device.
uint32_t** equivalentFocalLengthsArray of equivalent focal lengths.
uint32_t* sizeArray size.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraDevice_IsLogicalCamera()

Camera_ErrorCode OH_CameraDevice_IsLogicalCamera(const Camera_Device* camera, bool* isLogicalCamera)

Description

Checks whether a camera is a logical camera (consisting of multiple physical cameras).

Since: 24

Parameters

NameDescription
const Camera_Device* cameraPointer to the camera device.
bool* isLogicalCameraBoolean indicating whether the camera is a logical camera.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraDevice_GetLogicalCameraConstituentCameraDevices()

Camera_ErrorCode OH_CameraDevice_GetLogicalCameraConstituentCameraDevices(const Camera_Device* logicalCamera, Camera_Device** constituentCameras, uint32_t* size)

Description

Obtains all physical cameras that constitute a logical camera by calling OH_CameraDevice_DeleteConstituentCameraDevices.

Since: 24

Parameters

NameDescription
const Camera_Device* logicalCameraPointer to the logical camera device.
Camera_Device** constituentCamerasArray of pointers to the physical cameras that constitute the logical camera.
uint32_t* sizeArray size.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraDevice_DeleteConstituentCameraDevices()

Camera_ErrorCode OH_CameraDevice_DeleteConstituentCameraDevices(const Camera_Device* logicalCamera, Camera_Device* constituentCameras, uint32_t size)

Description

Deletes all physical cameras that constitute a logical camera.

Since: 24

Parameters

NameDescription
const Camera_Device* logicalCameraPointer to the logical camera device.
Camera_Device* constituentCamerasArray of pointers to the physical cameras that constitute the logical camera.
uint32_t sizeArray size.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraDevice_GetLensFocalLength()

Camera_ErrorCode OH_CameraDevice_GetLensFocalLength(const Camera_Device* camera, float* lensFocalLength)

Description

Obtains the focal length of a camera.

Since: 24

Parameters

NameDescription
const Camera_Device* cameraPointer to the camera device.
float* lensFocalLengthFocal length.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraDevice_GetMinimumFocusDistance()

Camera_ErrorCode OH_CameraDevice_GetMinimumFocusDistance(const Camera_Device* camera, float* minimumFocusDistance)

Description

Obtains the minimum focus distance of a camera.

Since: 24

Parameters

NameDescription
const Camera_Device* cameraPointer to the camera device.
float* minimumFocusDistanceMinimum focus distance.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraDevice_GetLensDistortion()

Camera_ErrorCode OH_CameraDevice_GetLensDistortion(const Camera_Device* camera, float** lens, uint32_t* size)

Description

Obtains the distortion parameters of a camera.

Since: 24

Parameters

NameDescription
const Camera_Device* cameraPointer to the camera device.
float** lensArray of lens distortion parameters.
uint32_t* sizeArray size.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraDevice_GetIntrinsicCalibration()

Camera_ErrorCode OH_CameraDevice_GetIntrinsicCalibration(const Camera_Device* camera, float** intrinsicCalibration, uint32_t* size)

Description

Obtains the intrinsic calibration parameters of a camera.

Since: 24

Parameters

NameDescription
const Camera_Device* cameraPointer to the camera device.
float** intrinsicCalibrationArray of intrinsic calibration parameters.
uint32_t* sizeArray size.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraDevice_GetSensorPhysicalSize()

Camera_ErrorCode OH_CameraDevice_GetSensorPhysicalSize(const Camera_Device* camera, float* width, float* height)

Description

Obtains the physical dimensions of a camera sensor.

Since: 24

Parameters

NameDescription
const Camera_Device* cameraPointer to the camera device.
float* widthSensor width, in millimeters.
float* heightSensor height, in millimeters.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraDevice_GetSensorPixelArraySize()

Camera_ErrorCode OH_CameraDevice_GetSensorPixelArraySize(const Camera_Device* camera, uint32_t* width, uint32_t* height)

Description

Obtains the pixel array dimensions of a camera sensor.

Since: 24

Parameters

NameDescription
const Camera_Device* cameraPointer to the camera device.
uint32_t* widthPixel array width, in pixels.
uint32_t* heightPixel array height, in pixels.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraDevice_GetSensorColorFilterArrangement()

Camera_ErrorCode OH_CameraDevice_GetSensorColorFilterArrangement(const Camera_Device* camera, OH_Camera_SensorColorFilterArrangement* sensorCFA)

Description

Obtains the color filter array arrangement of a camera sensor.

Since: 24

Parameters

NameDescription
const Camera_Device* cameraPointer to the camera device.
OH_Camera_SensorColorFilterArrangement* sensorCFAArrangement modes of the sensor color filter.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-oh-camera-capturesession-callbacks

openharmony 鸿蒙 arkts-apis-camera-OIS

openharmony 鸿蒙 capi-oh-camera-camera-devicequeryinfo

openharmony 鸿蒙 capi-oh-camera-camera-frameraterange

openharmony 鸿蒙 capi-oh-camera-camera-outputcapability

openharmony 鸿蒙 arkts-apis-camera-Photo

openharmony 鸿蒙 capi-oh-camera-camera-profile

openharmony 鸿蒙 capi-oh-camera-camera-manager

openharmony 鸿蒙 capi-oh-camera-previewoutput-callbacks

openharmony 鸿蒙 arkts-apis-camera-ManualExposureQuery

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/5O8KCtrs