Water Meter OCR
API Documentation for Water Meter OCR
Response Definition
HTTP Status | Code | Message | Description |
---|---|---|---|
200 | - | - | OCR success. |
400 | bad_request | Bad Request | None of content in the image was detected |
Extract water meter information
POST https://apis.aigen.online/aiscript/water-meter/v2
Request Body
Name | Type | Description |
---|---|---|
image* | String | Base64 image encoded string |
- 200: OK Successful response
- 400: Bad Request Bad Request
{
"status": "success",
"error": [],
"data": [
{
"numbers": {
"value": "3245.010",
"bboxes": [
[
[428, 401],
[451, 401],
[451, 447],
[428, 447]
],
[
[431, 437],
[451, 437],
[451, 475],
[431, 475]
],
[
[434, 468],
[453, 468],
[453, 504],
[434, 504]
],
[
[432, 492],
[455, 492],
[455, 540],
[432, 540]
],
[
[442, 527],
[462, 527],
[462, 567],
[442, 567]
],
[
[444, 552],
[468, 552],
[468, 605],
[444, 605]
],
[
[446, 582],
[469, 582],
[469, 638],
[446, 638]
]
],
"bboxes_norm": [
[
[0.5296012252431698, 0.37202890352182316],
[0.5568925032213251, 0.37202890352182316],
[0.5568925032213251, 0.41464154007473975],
[0.5296012252431698, 0.41464154007473975]
],
[
[0.5322105110094042, 0.405418507111469],
[0.5574461818143817, 0.405418507111469],
[0.5574461818143817, 0.4400939052051518],
[0.5322105110094042, 0.4400939052051518]
],
[
[0.5359791061075934, 0.43347150081252783],
[0.5603592525050781, 0.43347150081252783],
[0.5603592525050781, 0.4674938289597096],
[0.5359791061075934, 0.4674938289597096]
],
[
[0.5343901939226231, 0.45643311562138045],
[0.5617643551248537, 0.45643311562138045],
[0.5617643551248537, 0.5006439645179722],
[0.5343901939226231, 0.5006439645179722]
],
[
[0.5461938438720547, 0.4888210302913737],
[0.5706925482054189, 0.4888210302913737],
[0.5706925482054189, 0.5250732482464333],
[0.5461938438720547, 0.5250732482464333]
],
[
[0.5487318320565476, 0.5117941113084208],
[0.5781874473238892, 0.5117941113084208],
[0.5781874473238892, 0.560977367272276],
[0.5487318320565476, 0.560977367272276]
],
[
[0.5513140640620398, 0.5393228520224993],
[0.5795096883546724, 0.5393228520224993],
[0.5795096883546724, 0.5911223792525854],
[0.5513140640620398, 0.5911223792525854]
]
],
"bboxes_rotated": [
[
[461, 411],
[464, 433],
[418, 438],
[415, 416]
],
[
[458, 444],
[461, 464],
[423, 468],
[421, 448]
],
[
[461, 474],
[463, 494],
[426, 498],
[424, 478]
],
[
[466, 503],
[468, 525],
[421, 530],
[418, 508]
],
[
[470, 535],
[472, 555],
[433, 559],
[431, 539]
],
[
[481, 564],
[484, 588],
[431, 594],
[428, 570]
],
[
[484, 596],
[487, 618],
[431, 624],
[428, 602]
]
],
"bboxes_rotated_norm": [
[
[0.5691358024691358, 0.38055555555555554],
[0.5728395061728395, 0.4009259259259259],
[0.5160493827160494, 0.40555555555555556],
[0.5123456790123457, 0.3851851851851852]
],
[
[0.5654320987654321, 0.4111111111111111],
[0.5691358024691358, 0.42962962962962964],
[0.5222222222222223, 0.43333333333333335],
[0.519753086419753, 0.4148148148148148]
],
[
[0.5691358024691358, 0.4388888888888889],
[0.571604938271605, 0.45740740740740743],
[0.5259259259259259, 0.46111111111111114],
[0.5234567901234568, 0.4425925925925926]
],
[
[0.5753086419753086, 0.46574074074074073],
[0.5777777777777777, 0.4861111111111111],
[0.519753086419753, 0.49074074074074076],
[0.5160493827160494, 0.4703703703703704]
],
[
[0.5802469135802469, 0.49537037037037035],
[0.582716049382716, 0.5138888888888888],
[0.5345679012345679, 0.5175925925925926],
[0.5320987654320988, 0.49907407407407406]
],
[
[0.5938271604938271, 0.5222222222222223],
[0.5975308641975309, 0.5444444444444444],
[0.5320987654320988, 0.55],
[0.528395061728395, 0.5277777777777778]
],
[
[0.5975308641975309, 0.5518518518518518],
[0.6012345679012345, 0.5722222222222222],
[0.5320987654320988, 0.5777777777777777],
[0.528395061728395, 0.5574074074074075]
]
],
"confidence": 0.7603056856564113,
"angle": 83.69637298583984
}
}
]
}
{
"status": "success",
"error": [
{ "object": "error", "code": "bad_request", "message": "Bad Request" }
],
"data": [
{
"numbers": {
"value": "",
"bboxes": [],
"bboxes_norm": [],
"bboxes_rotated": [],
"bboxes_rotated_norm": [],
"confidence": -1.0,
"angle": 0.0
}
}
]
}
- Python
- Nodejs
- PHP
- CURL
import requests
api = "https://apis.aigen.online/aiscript/water-meter/v2"
headers = {"x-aigen-key": "<key>"}
data = {
"image": "base64_image"
}
res = requests.post(api, json=data, headers=headers)
print(res.json())
const axios = require("axios");
const api = "https://apis.aigen.online/aiscript/water-meter/v2";
const headers = { "x-aigen-key": "" };
const data = {
image: "<base64_string>",
};
axios
.post(api, data, { headers: headers })
.then((res) => {
console.log(res.data);
})
.catch((err) => {
console.error(err.response.data);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://apis.aigen.online/aiscript/water-meter/v2',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"image": "<base64_string>",
"option" : {}
}',
CURLOPT_HTTPHEADER => array(
'X-AIGEN-KEY: <aigen-key>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
curl --location 'https://apis.aigen.online/aiscript/water-meter/v2' \
--header 'X-AIGEN-KEY: <aigen-key>' \
--header 'Content-Type: application/json' \
--data '{
"image": "<base64_string>"
}'