2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
카메라 제어 매개변수 프로그래밍
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
이전 EVS(Extended View System) 1.0 출시에서는 카메라 기기가 읽기 전용 기기로 간주되었습니다. 따라서 앱이 확대/축소 또는 밝기와 같은 카메라 제어 매개변수를 변경할 수 있도록 하는 메서드가 없었습니다.
이로 인해 EVS 앱의 기능이 제한될 수 있으므로 새로운 EVS 1.1에서는 새 메서드를 도입하고 앱이 여러 카메라 제어 매개변수를 프로그래밍할 수 있도록 합니다. 이 매개변수는 모두 enum CameraParam
에 정의되어 있습니다.
/**
* EVS Camera Parameter
*/
enum CameraParam : uint32_t {
/**
* The brightness of image frames
*/
BRIGHTNESS,
/**
* The contrast of image frames
*/
CONTRAST,
/**
* Automatic gain/exposure control
*/
AUTOGAIN,
/**
* Gain control
*/
GAIN,
/**
* Automatic Whitebalance
*/
AUTO_WHITE_BALANCE,
/**
* Manual white balance setting as a color temperature in Kelvin.
*/
WHITE_BALANCE_TEMPERATURE,
/**
* Image sharpness adjustment
*/
SHARPNESS,
/**
* Auto Exposure Control modes; auto, manual, shutter priority, or
* aperture priority.
*/
AUTO_EXPOSURE,
/**
* Manual exposure time of the camera
*/
ABSOLUTE_EXPOSURE,
/**
* Set the focal point of the camera to the specified position. This
* parameter may not be effective when auto focus is enabled.
*/
ABSOLUTE_FOCUS,
/**
* Enables continuous automatic focus adjustments.
*/
AUTO_FOCUS,
/**
* Specify the objective lens focal length as an absolute value.
*/
ABSOLUTE_ZOOM,
};
메서드는 다음과 같이 정의됩니다.
/**
* Requests to be a master client.
*
* When multiple clients subscribe to a single camera hardware and one of
* them adjusts a camera parameter such as the contrast, it may disturb
* other clients' operations. Therefore, the client must call this method
* to be a master client. When it becomes a master, it can
* change camera parameters until either it dies or explicitly gives up the
* role.
*
* @return result EvsResult::OK if a master role is granted.
* EvsResult::OWNERSHIP_LOST if there is already a
* master client.
*/
setMaster() generates (EvsResult result);
/**
* Sets to be a master client forcibly.
*
* The client, which owns the display, has a high priority and can take over
* a master role from other clients without the display.
*
* @param display IEvsDisplay handle. If this is valid, the calling client
* is considered as the high priority client and therefore
* it would take over a master role.
*
* @return result EvsResult::OK if a master role is granted.
* EvsResult::OWNERSHIP_LOST if there is already a
* master client with the display.
*/
forceMaster(IEvsDisplay display) generates (EvsResult result);
/**
* Retires from a master client role.
*
* @return result EvsResult::OK if this call is successful.
* EvsResult::INVALID_ARG if the caller client is not a
* master client.
*/
unsetMaster() generates (EvsResult result);
/**
* Retrieves a list of parameters this camera supports.
*
* @return params A list of CameraParam that this camera supports.
*/
getParameterList() generates (vec<CameraParam> params);
/**
* Requests a valid value range of a camera parameter
*
* @param id The identifier of camera parameter, CameraParam enum.
*
* @return min The lower bound of the valid parameter value range.
* @return max The upper bound of the valid parameter value range.
* @return step The resolution of values in valid range.
*/
getIntParameterRange(CameraParam id)
generates (int32_t min, int32_t max, int32_t step);
/**
* Requests to set a camera parameter.
*
* @param id The identifier of camera parameter,
* CameraParam enum.
* value A desired parameter value.
* @return result EvsResult::OK if it succeeds to set a parameter.
* EvsResult::INVALID_ARG if either a requested
* parameter is not supported or a given value is out
* of bounds.
* effectiveValue A programmed parameter value. This may differ
* from what the client gives if, for example, the
* driver does not support a target parameter.
*/
setIntParameter(CameraParam id, int32_t value)
generates (EvsResult result, int32_t effectiveValue);
/**
* Retrieves a value of given camera parameter.
*
* @param id The identifier of camera parameter, CameraParam enum.
* @return result EvsResult::OK if it succeeds to read a parameter.
* EvsResult::INVALID_ARG if either a requested parameter is
* not supported.
* value A value of requested camera parameter.
*/
getIntParameter(CameraParam id) generates(EvsResult result, int32_t value);
getParameterList()
는 클라이언트가 읽고 쓸 수 있는(클라이언트가 마스터인 경우) 매개변수 목록(CameraParam
enum)을 반환하고 getIntParameterRange()
는 유효한 값 범위 및 해상도를 전달합니다.
마스터 클라이언트가 카메라 매개변수를 변경하면 동일한 카메라 하드웨어의 다른 모든 클라이언트는 매개변수 ID 및 새 값이 있는 PARAMETER_CHANGED
이벤트를 수신하여 알림을 받습니다.
참고: 센서 드라이버는 잘못된 매개변수 값을 서로 다르게 처리할 수 있습니다. 단순히 오류 코드를 반환하거나 유효한 범위의 값을 자르고 적용할 수 있습니다. 따라서 setIntParameter()
메서드는 유효 값을 반환하고 클라이언트는 이 값을 사용하여 요청이 처리된 방식을 확인할 수 있습니다.
여러 카메라 클라이언트 간 중재 요청
이전의 EVS 설계에서는 여러 앱이 하나의 카메라 하드웨어를 동시에 구독할 수 있었기 때문에 한 앱이 카메라 매개변수를 변경하여 다른 앱의 작업을 방해할 수 있었습니다. 또한 여러 클라이언트가 동일한 매개변수를 서로 다르게 조정하려고 할 수 있으며 이 때문에 카메라 서비스를 실행할 때 예상치 못한 동작이 발생할 수 있습니다.
이러한 문제를 방지하기 위해 EVS 관리자는 마스터 클라이언트만 카메라 매개변수를 프로그래밍할 수 있도록 허용합니다. 클라이언트는 카메라 매개변수를 조정하려고 시도하기 전에 setMaster()
메서드를 호출하여 마스터 클라이언트가 되어야 합니다. 마스터 클라이언트가 되지 못한다면 해당 카메라 하드웨어에 이미 활성 마스터 클라이언트가 있음을 의미합니다. 현재 마스터 클라이언트가 종료되거나 unsetMaster()
를 통해 명시적으로 마스터 역할을 포기할 때까지 다른 클라이언트는 카메라 매개변수를 변경할 수 없습니다. 마스터 클라이언트가 권한을 반환하면 다른 모든 앱은 MASTER_RELEASED
이벤트를 통해 알림을 받습니다.
우선순위가 높은 클라이언트
EVS 관리자는 디스플레이를 소유한 클라이언트를 높은 우선순위로 처리하며, 이 클라이언트가 현재 마스터에서 마스터 역할을 훔칠 수 있도록 허용합니다. EVS 디스플레이 소유권은 최신성을 기반으로 하므로 새 클라이언트는 현재 클라이언트로부터 디스플레이를 인계받을 수도 있습니다.
우선순위가 높은 클라이언트가 마스터 역할을 획득하려면 IEvsCamera::forceMaster(sp<IEvsDisplay>& display)
를 호출해야 합니다. EVS 관리자는 지정된 디스플레이 핸들의 상태를 검사하고, 이 상태가 유효하고 DisplayState::NOT_OPEN
및 DisplayState::DEAD
가 아닌 경우에 한해 마스터를 교체합니다. 마스터 역할을 잃게 된 클라이언트는 MASTER_RELEASED
이벤트를 통해 알림을 받으며 반드시 이를 적절하게 처리해야 합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Program camera control parameters\n\nIn the previous Extended View System (EVS) 1.0 release, camera devices were\nconsidered read-only devices and, therefore, no method existed that would enable\nthe app to change camera control parameters such as zoom or brightness.\n\nAs this could constrain the capability of EVS apps, the new EVS 1.1\nintroduces new methods and enables the app to program several camera\ncontrol parameters, all of which are defined in `enum CameraParam`: \n\n```gdscript\n/**\n * EVS Camera Parameter\n */\nenum CameraParam : uint32_t {\n /**\n * The brightness of image frames\n */\n BRIGHTNESS,\n /**\n * The contrast of image frames\n */\n CONTRAST,\n /**\n * Automatic gain/exposure control\n */\n AUTOGAIN,\n /**\n * Gain control\n */\n GAIN,\n /**\n * Automatic Whitebalance\n */\n AUTO_WHITE_BALANCE,\n /**\n * Manual white balance setting as a color temperature in Kelvin.\n */\n WHITE_BALANCE_TEMPERATURE,\n /**\n * Image sharpness adjustment\n */\n SHARPNESS,\n /**\n * Auto Exposure Control modes; auto, manual, shutter priority, or\n * aperture priority.\n */\n AUTO_EXPOSURE,\n /**\n * Manual exposure time of the camera\n */\n ABSOLUTE_EXPOSURE,\n /**\n * Set the focal point of the camera to the specified position. This\n * parameter may not be effective when auto focus is enabled.\n */\n ABSOLUTE_FOCUS,\n /**\n * Enables continuous automatic focus adjustments.\n */\n AUTO_FOCUS,\n /**\n * Specify the objective lens focal length as an absolute value.\n */\n ABSOLUTE_ZOOM,\n};\n```\n\nMethods are defined as: \n\n```gdscript\n/**\n * Requests to be a master client.\n *\n * When multiple clients subscribe to a single camera hardware and one of\n * them adjusts a camera parameter such as the contrast, it may disturb\n * other clients' operations. Therefore, the client must call this method\n * to be a master client. When it becomes a master, it can\n * change camera parameters until either it dies or explicitly gives up the\n * role.\n *\n * @return result EvsResult::OK if a master role is granted.\n * EvsResult::OWNERSHIP_LOST if there is already a\n * master client.\n */\nsetMaster() generates (EvsResult result);\n\n/**\n * Sets to be a master client forcibly.\n *\n * The client, which owns the display, has a high priority and can take over\n * a master role from other clients without the display.\n *\n * @param display IEvsDisplay handle. If this is valid, the calling client\n * is considered as the high priority client and therefore\n * it would take over a master role.\n *\n * @return result EvsResult::OK if a master role is granted.\n * EvsResult::OWNERSHIP_LOST if there is already a\n * master client with the display.\n */\nforceMaster(IEvsDisplay display) generates (EvsResult result);\n\n/**\n * Retires from a master client role.\n *\n * @return result EvsResult::OK if this call is successful.\n * EvsResult::INVALID_ARG if the caller client is not a\n * master client.\n */\nunsetMaster() generates (EvsResult result);\n\n/**\n * Retrieves a list of parameters this camera supports.\n *\n * @return params A list of CameraParam that this camera supports.\n */\ngetParameterList() generates (vec\u003cCameraParam\u003e params);\n\n/**\n * Requests a valid value range of a camera parameter\n *\n * @param id The identifier of camera parameter, CameraParam enum.\n *\n * @return min The lower bound of the valid parameter value range.\n * @return max The upper bound of the valid parameter value range.\n * @return step The resolution of values in valid range.\n */\ngetIntParameterRange(CameraParam id)\n generates (int32_t min, int32_t max, int32_t step);\n\n/**\n * Requests to set a camera parameter.\n *\n * @param id The identifier of camera parameter,\n * CameraParam enum.\n * value A desired parameter value.\n * @return result EvsResult::OK if it succeeds to set a parameter.\n * EvsResult::INVALID_ARG if either a requested\n * parameter is not supported or a given value is out\n * of bounds.\n * effectiveValue A programmed parameter value. This may differ\n * from what the client gives if, for example, the\n * driver does not support a target parameter.\n */\nsetIntParameter(CameraParam id, int32_t value)\n generates (EvsResult result, int32_t effectiveValue);\n\n/**\n * Retrieves a value of given camera parameter.\n *\n * @param id The identifier of camera parameter, CameraParam enum.\n * @return result EvsResult::OK if it succeeds to read a parameter.\n * EvsResult::INVALID_ARG if either a requested parameter is\n * not supported.\n * value A value of requested camera parameter.\n */\ngetIntParameter(CameraParam id) generates(EvsResult result, int32_t value);\n```\n\n`getParameterList()` returns a list of parameters\n(`CameraParam` enum) a client can read and write (if the client is a master),\nand `getIntParameterRange()` relays the valid value range and resolution.\nWhen a master client changes a camera parameter, all other clients on the same camera\nhardware are notified by getting a `PARAMETER_CHANGED` event with a\nparameter ID and new value.\n\n**Note:** The sensor driver may handle invalid parameter\nvalues differently. It may simply return an error code or clip the value in the\nvalid range and apply. Therefore, the `setIntParameter()` method returns\nan effective value and the client can use this value to confirm how the request was\nhandled.\n\nRequest arbitration between multiple camera clients\n---------------------------------------------------\n\nBecause the previous EVS design allowed multiple apps to simultaneously\nsubscribe to a single camera hardware, it is possible that one app can\ndisturb the operations of other apps by changing a camera parameter. Also,\nmultiple clients may want to adjust the same parameter differently and thereby\ncause unexpected behaviors in running camera services.\n\nTo avoid such problems, the EVS manager allows that only *master* client\nto program a camera parameter. Before trying to adjust any camera parameter, the client\n**MUST** become a master client by calling the `setMaster()`\nmethod. If this fails, then it means there is already an active master client\non that camera hardware. Until the current master client dies, or explicitly\ngives up a master role through `unsetMaster()`, no other client is\npermitted to change a camera parameter. When a master client returns its privilege,\nall other apps are notified by a `MASTER_RELEASED` event.\n\n### Clients with high priority\n\nThe EVS manager handles the client that owns the display with the high\npriority and allows it to steal a master role from a current master. Because EVS\ndisplay ownership is based on recency, the new client can even take over from the\ncurrent client with the display.\n\nHigh priority clients must call `IEvsCamera::forceMaster(sp\u003cIEvsDisplay\u003e& display)`\nto attain a master role. The EVS manager examines the state of a given display\nhandle and, if (*and only if* ) its state is valid and neither\n`DisplayState::NOT_OPEN` nor `DisplayState::DEAD`\nreplaces a master. The client, which just loses the master role, is\nnotified by a `MASTER_RELEASED` event and **MUST** handle\nthis properly."]]