在先前的擴展視圖系統 (EVS) 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
枚舉)(如果客戶端是主裝置),而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
事件的通知,並且必須正確處理該事件。
在先前的擴展視圖系統 (EVS) 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
枚舉)(如果客戶端是主裝置),而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
事件的通知,並且必須正確處理該事件。