日常爬虫实践之车牌信息的识别
车牌识别在日常生活中有着广发的应用,特别是在高速公路上,还有其他一些比如我们常见的电子收费(ETC)系统和交通违章车辆的检测,除此之外像小区或地下车库门禁也会用到,基本上凡是需要对车辆进行身份检测的地方都会用到。
刚好有次朋友聚会时,听到有个朋友说起他正在做一个车牌识别的项目,于是对其定位车牌的位置算法颇有兴趣,今天比较闲就研究了下。事实上车牌识别算是比较成熟的技术了。所以这里我只是简单实现。
简单的实现如下:
const http = require("http");
const url = require("url");
// 要访问的目标页面
const targetUrl = "http://httpbin.org/ip";
const urlParsed = url.parse(targetUrl);
// 代理服务器(产品官网 www.16yun.cn)
const proxyHost = "t.16yun.cn";
const proxyPort = "36600";
// 生成一个随机 proxy tunnel
var seed = 1;
function random() {
var x = Math.sin(seed++) * 10000;
return x - Math.floor(x);
}
const tunnel = random()*100;
// 代理验证信息
const proxyUser = "username";
const proxyPass = "password";
const base64 = new Buffer.from(proxyUser + ":" + proxyPass).toString("base64");
const options = {
host: proxyHost,
port: proxyPort,
path: targetUrl,
method: "GET",
headers: {
"Host": urlParsed.hostname,
"Proxy-Tunnel": tunnel,
"Proxy-Authorization" : "Basic " + base64
}
};
http.request(options, function (res) {
console.log("got response: " + res.statusCode);
res.pipe(process.stdout);
}).on("error", function (err) {
console.log(err);
}).end();这是一个比较简单粗糙的车牌识别访问,网上关于这方面的技术文章还是挺多的,但是小编建议小伙伴最好是亲自实践,毕竟看了不代表会了。
日常爬虫实践之车牌信息的识别
xiaotaomi
会员积分:7320
车牌识别在日常生活中有着广发的应用,特别是在高速公路上,还有其他一些比如我们常见的电子收费(ETC)系统和交通违章车辆的检测,除此之外像小区或地下车库门禁也会用到,基本上凡是需要对车辆进行身份检测的地方都会用到。
刚好有次朋友聚会时,听到有个朋友说起他正在做一个车牌识别的项目,于是对其定位车牌的位置算法颇有兴趣,今天比较闲就研究了下。事实上车牌识别算是比较成熟的技术了。所以这里我只是简单实现。
简单的实现如下:
const http = require("http");
const url = require("url");
// 要访问的目标页面
const targetUrl = "http://httpbin.org/ip";
const urlParsed = url.parse(targetUrl);
// 代理服务器(产品官网 www.16yun.cn)
const proxyHost = "t.16yun.cn";
const proxyPort = "36600";
// 生成一个随机 proxy tunnel
var seed = 1;
function random() {
var x = Math.sin(seed++) * 10000;
return x - Math.floor(x);
}
const tunnel = random()*100;
// 代理验证信息
const proxyUser = "username";
const proxyPass = "password";
const base64 = new Buffer.from(proxyUser + ":" + proxyPass).toString("base64");
const options = {
host: proxyHost,
port: proxyPort,
path: targetUrl,
method: "GET",
headers: {
"Host": urlParsed.hostname,
"Proxy-Tunnel": tunnel,
"Proxy-Authorization" : "Basic " + base64
}
};
http.request(options, function (res) {
console.log("got response: " + res.statusCode);
res.pipe(process.stdout);
}).on("error", function (err) {
console.log(err);
}).end();这是一个比较简单粗糙的车牌识别访问,网上关于这方面的技术文章还是挺多的,但是小编建议小伙伴最好是亲自实践,毕竟看了不代表会了。

21-09-13 16:46

1194

0
回复
暂无评论