camera.takePicture
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
拍摄等距柱状图像,保存纬度/经度坐标
EXIF(如果您的相机自带 GPS 或在连接时启用了 GPS
手机)。致电camera.setOptions
(如果需要的话)。此命令已在 API 级别 2 中修改。
参数
结果
- API 级别 1
<ph type="x-smartling-placeholder">
- API 级别 2
<ph type="x-smartling-placeholder">
</ph>
- fileUrl::所拍图片的绝对网址,
用于直接从相机的 HTTP 服务器下载。请
请注意,此命令不会立即返回
fileUrl
,因为
拍摄(包括相机内拼接)通常需要一段时间(具体取决于
(几秒到几分钟)即可完成。命令的进度通过
使用 /osc/commands/status API 定期轮询相机,
fileUrl
是命令完成后返回的结果。时间
delayProcessing
为 true,它是预览的绝对网址
图片,可用作 processPicture 中的输入,
否则,就是最终处理后图片的绝对网址。
错误
- missing 参数:缺少
sessionId
。
此错误代码在 API 级别 2 中已废弃。
- invalidParameterName:参数名称无法识别,例如API 级别 2 中无法识别
sessionId
。
- invalidParameterValue::识别输入参数名称,
但其值无效;例如,
sessionId
不存在,
不再有效,或其数据类型不正确。此错误代码在 API 级别 2 中已废弃。
- disabledCommand:命令当前已停用;例如
相机处于视频拍摄模式。此错误代码已添加到 API 级别 2 中。
命令 I/O |
命令输入(API 级别 1) |
{
"parameters": {
"sessionId": "12ABC3"
}
} |
命令输出(API 级别 1) |
{
"results": {
"fileUri": "file URI"
}
} |
命令输出(错误)(API 级别 1) |
{
"error": {
"code": "invalidParameterValue",
"message": "Parameter sessionId doesn't exist."
}
} |
命令输入(API 级别 2) |
none |
命令输出(API 级别 2) |
{
"results": {
"fileUrl": "Absolute file URL"
}
} |
命令输出(错误)(API 级别 2) |
{
"error": {
"code": "disabledCommand",
"message": "Command is currently disabled."
}
} |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-21。
[null,null,["最后更新时间 (UTC):2024-08-21。"],[[["\u003cp\u003eCaptures an equirectangular image and saves location coordinates to EXIF data.\u003c/p\u003e\n"],["\u003cp\u003eAPI level 1 uses \u003ccode\u003efileUri\u003c/code\u003e for the image location, while API level 2 uses \u003ccode\u003efileUrl\u003c/code\u003e and supports direct download.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003esessionId\u003c/code\u003e parameter is required for API level 1, but deprecated in API level 2.\u003c/p\u003e\n"],["\u003cp\u003eAPI level 2 introduces in-camera stitching and provides the final image URL after processing.\u003c/p\u003e\n"],["\u003cp\u003eErrors can occur due to missing or invalid parameters, or if the command is disabled (e.g., during video recording).\u003c/p\u003e\n"]]],["The command captures an equirectangular image, potentially saving GPS data to EXIF. In API level 1, a `sessionId` is required and the `fileUri` of the image is returned. API level 2 deprecates `sessionId`, instead returning a `fileUrl`, the absolute URL of the image, after a processing delay that is checked via polling. Errors include missing or invalid parameters, which were deprecated in API level 2, and disabled command for situations like when the camera is in video mode.\n"],null,["# camera.takePicture\n\nCaptures an equirectangular image, saving lat/long coordinates\nto EXIF (if your camera features its own GPS or GPS is enabled on connected\nmobile phones). Call [camera.setOptions](/streetview/open-spherical-camera/reference/camera/setoptions)\nprior to this command call if needed. **This command was modified in API level 2.**\n\nParameters\n----------\n\n- **sessionId:** Unique session identifier obtained from the [camera.startSession](/streetview/open-spherical-camera/reference/camera/startsession)command. **This field was deprecated in API level 2.**\n\nResults\n-------\n\n- **API level 1**\n - **fileUri:** URI of the captured image. Manufacturers decide whether to use absolute or relative URIs; for example, \"\u003chttp://android.com/robots.txt\u003e\" is an absolute URI while \"robots.txt\" is a relative URI. Clients may treat this as an opaque identifier.\n- **API level 2**\n - **fileUrl:** Absolute URL of the captured image, which can be used to download directly from the HTTP server of the camera. Please note this command doesn't return `fileUrl` immediately since the capture (including in-camera stitching) usually takes a while (varies from seconds to minutes) to complete. The progress of the command is obtained by polling the camera periodically using the [/osc/commands/status](/streetview/open-spherical-camera/guides/osc/commands/status) API and `fileUrl` is the result returned when the command finishes. When `delayProcessing` is true, it is the absolute URL of the preview image, which can be used as input in processPicture to process the image, otherwise, it is the absolute URL of the final processed image.\n\nErrors\n------\n\n- **missingParameter:** `sessionId` is missing. **This error code was deprecated in API level 2.**\n- **invalidParameterName:** The parameter name is unrecognized, e.g. `sessionId` is not recognized in API level 2.\n- **invalidParameterValue:** The input parameter name is recognized, but its value is invalid; for example, the `sessionId` doesn't exist, is no longer active, or its data type is incorrect. **This error code was deprecated in API level 2.**\n- **disabledCommand:** Command is currently disabled; for example, the camera is in video shooting mode. **This error code was added in API level 2.**\n\n| Command I/O ----------- ||\n|------------------------------------------|---------------------------------------------------------------------------------------------------------------|\n| **Command Input (API level 1)** | ```text { \"parameters\": { \"sessionId\": \"12ABC3\" } } ``` |\n| **Command Output (API level 1)** | ```text { \"results\": { \"fileUri\": \"file URI\" } } ``` |\n| **Command Output (Error) (API level 1)** | ```text { \"error\": { \"code\": \"invalidParameterValue\", \"message\": \"Parameter sessionId doesn't exist.\" } } ``` |\n| **Command Input (API level 2)** | ```text none ``` |\n| **Command Output (API level 2)** | ```text { \"results\": { \"fileUrl\": \"Absolute file URL\" } } ``` |\n| **Command Output (Error) (API level 2)** | ```text { \"error\": { \"code\": \"disabledCommand\", \"message\": \"Command is currently disabled.\" } } ``` |"]]