Webcam
Take an image snapshot
Returns an image as a result of a snapshot taken by the webcam in the desired image format and with a specified resolution and compression factor.
URL parameters
hostIp: ip address of the API host.
deviceId: id of the device.
format: image file format. possible values:
0 = jpeg
resolution: resolution of image. possible values:
0 = r1024x768
1 = r640x480
2 = r384x288
compression_factor (optional): range = [50,95], default compression 70 is used on linux devices
- GET https://{hostIp}:7081/hal/devices/{deviceId}/webcam/snapshot?format={format}&resolution={resolution}&compression_factor={compression_factor}
Example request:
GET /hal/devices/webcam1/webcam/snapshot?format={format}&resolution={resolution}&compression_factor={compression_factor} HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS...
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 "Base64 string of binary image"
- Status Codes:
200 OK – OK
400 Bad Request – Bad Request. A descriptive error comes along with this error.
401 Unauthorized – Unauthorized. Something is wrong with the Authorization header of the request
403 Forbidden – Forbidden. Something is wrong with the claims of the user.
500 Internal Server Error – Internal Server Error
- Response Headers:
Content-Type – defines the serialization format for the response body (this depends on the Accept header of the request)
Note
Note that 70 is the preferred value for the compression_factor (best quality vs size ratio).
Attention
The compression_factor parameter is NOT SUPPORTED if the halapi is hosted on a Windows machine.