@pipedream/platerecognizer 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/actions/run-recognition/run-recognition.mjs +65 -0
- package/common/utils.mjs +6 -0
- package/package.json +4 -1
- package/platerecognizer.app.mjs +27 -5
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
The Plate Recognizer API provides robust tools for converting images of vehicle license plates into text data. Using Pipedream, you can harness this capability to automate various tasks involving vehicle identification and monitoring. This integration is particularly useful in scenarios involving security, parking management, and logistics optimization, where automated plate recognition can streamline operations significantly.
|
|
4
|
+
|
|
5
|
+
# Example Use Cases
|
|
6
|
+
|
|
7
|
+
- **Automated Parking Access**: Set up a workflow where a camera at a parking entrance snaps pictures of incoming vehicles. Use the Plate Recognizer API to decode the license plate and check against a database of authorized vehicles (hosted on a service like Airtable). If the vehicle is authorized, trigger an IoT device to open the gate.
|
|
8
|
+
|
|
9
|
+
- **Security Alert System**: Create a workflow that monitors a feed from security cameras. Use the Plate Recognizer API to identify license plates of vehicles entering a restricted area. If a plate matches a list of flagged vehicles (maintained in a Google Sheets file), send an alert message via Slack or email to security personnel.
|
|
10
|
+
|
|
11
|
+
- **Logistics Tracking**: Develop a system to track the arrival and departure of trucks at a warehouse. Capture license plate images, decode them through the Plate Recognizer API, and log the timestamps in a database. Use this data to analyze logistics efficiency and notify managers via SMS (using Twilio) if there are notable delays or early arrivals.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { getFileStream } from "@pipedream/platform";
|
|
2
|
+
import platerecognizer from "../../platerecognizer.app.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "platerecognizer-run-recognition",
|
|
6
|
+
name: "Run Recognition",
|
|
7
|
+
description: "Triggers a recognition process using the Plate Recognizer SDK.",
|
|
8
|
+
version: "0.1.0",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
platerecognizer,
|
|
12
|
+
imageFileOrUrl: {
|
|
13
|
+
type: "string",
|
|
14
|
+
label: "Image Path or URL",
|
|
15
|
+
description: "The image to be recognized. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myImage.jpg`)",
|
|
16
|
+
},
|
|
17
|
+
regions: {
|
|
18
|
+
type: "string[]",
|
|
19
|
+
label: "Regions",
|
|
20
|
+
description: "Regions to select specific license plate patterns. [See further details here](https://guides.platerecognizer.com/docs/other/country-codes/#country-codes)",
|
|
21
|
+
optional: true,
|
|
22
|
+
},
|
|
23
|
+
cameraId: {
|
|
24
|
+
type: "string",
|
|
25
|
+
label: "Camera ID",
|
|
26
|
+
description: "The ID of the camera that took the image.",
|
|
27
|
+
optional: true,
|
|
28
|
+
},
|
|
29
|
+
mmc: {
|
|
30
|
+
type: "boolean",
|
|
31
|
+
label: "MMC",
|
|
32
|
+
description: "Whether to detect vehicle make, model, and color.",
|
|
33
|
+
optional: true,
|
|
34
|
+
},
|
|
35
|
+
config: {
|
|
36
|
+
type: "object",
|
|
37
|
+
label: "Config",
|
|
38
|
+
description: "Additional configuration. [See further details here](https://guides.platerecognizer.com/docs/snapshot/api-reference/#engine-configuration)",
|
|
39
|
+
optional: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
async run({ $ }) {
|
|
43
|
+
|
|
44
|
+
const stream = await getFileStream(this.imageFileOrUrl);
|
|
45
|
+
const chunks = [];
|
|
46
|
+
for await (const chunk of stream) {
|
|
47
|
+
chunks.push(chunk);
|
|
48
|
+
}
|
|
49
|
+
const buffer = Buffer.concat(chunks);
|
|
50
|
+
|
|
51
|
+
const response = await this.platerecognizer.runRecognition({
|
|
52
|
+
$,
|
|
53
|
+
data: {
|
|
54
|
+
upload: buffer.toString("base64"),
|
|
55
|
+
regions: this.regions,
|
|
56
|
+
camera_id: this.cameraId,
|
|
57
|
+
mmc: this.mmc,
|
|
58
|
+
config: this.config,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
$.export("$summary", "Recognition process triggered successfully");
|
|
63
|
+
return response;
|
|
64
|
+
},
|
|
65
|
+
};
|
package/common/utils.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/platerecognizer",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Pipedream Plate Recognizer Components",
|
|
5
5
|
"main": "platerecognizer.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -11,5 +11,8 @@
|
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@pipedream/platform": "^3.1.0"
|
|
14
17
|
}
|
|
15
18
|
}
|
package/platerecognizer.app.mjs
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
|
|
1
3
|
export default {
|
|
2
4
|
type: "app",
|
|
3
5
|
app: "platerecognizer",
|
|
4
|
-
propDefinitions: {},
|
|
5
6
|
methods: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
_baseUrl() {
|
|
8
|
+
return "https://api.platerecognizer.com/v1";
|
|
9
|
+
},
|
|
10
|
+
_headers(headers) {
|
|
11
|
+
return {
|
|
12
|
+
"Authorization": `Token ${this.$auth.api_token}`,
|
|
13
|
+
...headers,
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
_makeRequest({
|
|
17
|
+
$ = this, path, headers = {}, ...opts
|
|
18
|
+
}) {
|
|
19
|
+
return axios($, {
|
|
20
|
+
url: `${this._baseUrl()}${path}`,
|
|
21
|
+
headers: this._headers(headers),
|
|
22
|
+
...opts,
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
runRecognition(opts = {}) {
|
|
26
|
+
return this._makeRequest({
|
|
27
|
+
method: "POST",
|
|
28
|
+
path: "/plate-reader/",
|
|
29
|
+
...opts,
|
|
30
|
+
});
|
|
9
31
|
},
|
|
10
32
|
},
|
|
11
|
-
};
|
|
33
|
+
};
|