1 Star 0 Fork 0

IoTSharp / VLPR

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

IoTSharp.VLPR

这是规定了接口标准的车牌识别封装库, 如果你要在项目里面对接车牌识别, 可以按下面的标准提供给厂家, 让厂家按照接口对接, 然后你只需要拷贝对应动态库到程序目录加载即可。

使用

dotnet add package IoTSharp.VLPR

配置

再appsettings.json中加入下面内容:

 "VLPROptions": {
    "Interval": 300,
    "EasyVLPR": false,
    "VLPRConfigs": [
      {
        "Name": "1",
        "Provider": "libvpr_xlw.so.1.0.0.3",
        "Port": 5001,
        "IPAddress": "10.13.97.91",
        "Password": "admin",
        "UserName": "admin"
      }
    ]
  },

示例:

namespace Console1
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
      
            services.AddVPRService();
          
            services.AddHealthChecks()
                    .AddVLPR("VLPR");

        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {

        }
    }
}

接口对接

1.1 车牌识别库要求

  交付内容, 提供的车牌识别库 命名格式为libVpr_<厂家缩写和型号缩写>.so 有完全测试通过的demo 的代码,包括Makefile 文件。   

1.2 Linux共享库(SO)接口定义

1.2.1车牌识别接口识别车牌的基本原理

1.2.2接口函数说明

** VPR_InitEx 和 VPR_Init 至少实现其中一个, 在程序 dlsym 的时候 优先 VPR_InitEx , **

  • long VPR_InitEx(char* capIpAddress,char* username, char* password ,int uPort)`
  函数说明           													 
  用于初始化系统中的车牌照识别器。  
  参数			 说明      		                                    
  uPort         用户自定义端口,当接口库接收到车牌照识别器的识别结果时,向这个端口发送数据包。  
  username     用户名   
  password      密码   
  capIpAddress  车牌识别IP地址   
  返回值			说明       												      
  <=0       	  错误,0、网络错误 -1, 登录失败、-2、其他错误
  >0          句柄
  • BOOL VPR_Quit(long Handle)
  函数说明             													
  用于关闭系统中的车牌照识别器。
  参数			说明    												      

  返回值			说明    												      
  TRUE    	  关闭牌照识别器成功
  FALSE		  关闭牌照识别器失败   
  • int VPR_GetVehicleInfoEx (long Handle, char *pchPlate, unsigned char *iPlateColor,int *piByteBinImagLen,BYTE *pByteBinImage,int *piJpegImageLen,unsigned char* pByteJpegImage, int* laneId, int* index);
  函数说明:           												
  获取车牌号、车牌二值图、车辆JPEG图像。
  接口与调用说明: DLL_VPR_SetEventCallBackFunc 
参数 说明
pchPlate 返回牌照号
iPlateColor 车牌颜色
piByteBinImagLen 返回车辆二值图的大小
pByteBinImage 返回车牌二值图
piJpegImageLen 返回车辆JPEG图像的大小
pByteJpegImage 返回车辆的图片, 为JPEG格式
laneId 输出参数,车道号,对应VPR_CaptureEx中传入的车道号,
index 输出参数,抓拍ID,对应VPR_CaptureEx中传入的抓拍ID
返回值 说明
--- ---
TRUE 返回车辆的图片, 为JPEG格式
FALSE 获取信息失败
iPlateColor 值 对应颜色
0
1
2
3
4 渐绿
5 黄绿
6 蓝白
VPR_GetVehicleInfoEx接口必读注意事项:
  1. 函数返回时,若没有识别结果,pchPlate将返回“无车牌”,iPlateColor 返回0,pchPlate至少申请30字节的空间。
  2. pByteBinImage 最大为280字节的空间。
  3. pByteJpegImage 最大为 1024 * 1024 * 2 字节的空间。
  4. pchPlate 最大长度为 64字节。
  5. 中文编码采用GB2312编码。
  • int VPR_CaptureEx (long Handle, int laneId, int index )

函数说明:当上位机调用该接口时,该接口作为指令触发方式,告知接口需要取一次车牌信息,车牌识别仪收到后进行抓拍。
参数 说明
Handle 相机句柄,由VPR_Init 或 VPR_InitEx 接口返回 laneId 车道号,需与相机中配置的相对应 index 抓拍ID,用于区分不同的抓拍结果 返回值 说明
TRUE 发送抓拍命令成功 FALSE 发送抓拍命令失败

- int VPR_CheckStatus(long Handle, char * chVprDevStatus)

  ```c
  函数说明           												
  检查牌照识别器状态。  
  参数			     说明      												
  chVprDevStatus	   牌照识别器状态说明,返回值  最长 512字节,中文编码采用GB2312编码
  返回值			     说明      												
  TRUE               牌照识别器状态正常  
  FALSE              牌照识别器状态不正常  
  ```

- int VPR_SetEventCallBackFunc(long Handle, VPR_EventHandleEx cb)

  ```c
  函数说明           												
  设置次回调后, 如果收到车牌识别, 则调用 VPR_EventHandleEx  cb      												
  typedef void   (*VPR_EventHandleEx)(long Handle,  int laneId, int index);      												
  ```
MIT License Copyright (c) 2023 麦壳饼 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

这是一个用于.Net 的车牌识别对接框架, 如果你要在项目里面对接车牌识别, 可以按项目提供的标准提供给厂家, 让厂家按照接口对接, 然后你只需要拷贝对应动态库到程序目录加载即可使用。 在我们内部, 已经有数家厂家进行了对接。 展开 收起
C# 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C#
1
https://gitee.com/IoTSharp/VLPR.git
git@gitee.com:IoTSharp/VLPR.git
IoTSharp
VLPR
VLPR
master

搜索帮助