This commit is contained in:
Matthew Hill
2016-10-21 20:37:24 -04:00
32 changed files with 2044 additions and 105 deletions

View File

@@ -98,12 +98,9 @@ Binaries
Pre-compiled Windows binaries can be downloaded on the [releases page] (https://github.com/openalpr/openalpr/releases) Pre-compiled Windows binaries can be downloaded on the [releases page] (https://github.com/openalpr/openalpr/releases)
Install OpenALPR on Ubuntu 14.04 x64 with the following commands: Install OpenALPR on Ubuntu 16.04 with the following commands:
wget -O - http://deb.openalpr.com/openalpr.gpg.key | sudo apt-key add - sudo apt-get update && sudo apt-get install -y openalpr openalpr-daemon openalpr-utils libopenalpr-dev
echo "deb http://deb.openalpr.com/master/ openalpr main" | sudo tee /etc/apt/sources.list.d/openalpr.list
sudo apt-get update
sudo apt-get install openalpr openalpr-daemon openalpr-utils libopenalpr-dev
Documentation Documentation
--------------- ---------------

View File

@@ -1,3 +1,12 @@
openalpr (2.3.0-1) unstable; urgency=low
* Added plate detection mask and prewarp config changes via API
* Improved plate patterns
* Improved accuracy
* Upload sponsored by Petter Reinholdtsen
-- Matthew Hill <matthill@openalpr.com> Sat, 17 Sep 2016 11:27:25 -0500
openalpr (2.2.4-1) unstable; urgency=low openalpr (2.2.4-1) unstable; urgency=low
* Added Python3 bindings (Closes: #815961) * Added Python3 bindings (Closes: #815961)

2
distros/debian/watch Normal file
View File

@@ -0,0 +1,2 @@
version=3
https://github.com/openalpr/openalpr/tags .*/v?(\d.*)\.(?:tgz|tbz2|tar\.(?:gz|bz2|xz))

View File

@@ -9,7 +9,7 @@ OpenALPR Web Server
Requirements Requirements
================ ================
OpenALPR monitors video streams in real-time to gather all license plates seen by your cameras. This data is browsable, searchable, and can trigger alerts. The Web server can be available either: OpenALPR monitors video streams in real-time to gather all license plates seen by your cameras. This data is browsable, searchable, and can trigger alerts. The Web server is available either:
#. In the cloud #. In the cloud
#. Installed On-Premises within your network #. Installed On-Premises within your network
@@ -21,41 +21,58 @@ In order to get started, you will need:
1. An IP camera capable of serving MJPEG or H264 video 1. An IP camera capable of serving MJPEG or H264 video
2. A computer (Intel i5 or better) with network access to the IP camera. This will be your OpenALPR Agent. 2. A computer (Intel i5 or better) with network access to the IP camera. This will be your OpenALPR Agent.
First, configure your IP camera to capture the area that you wish to monitor. The camera must be capable of capturing a clear image of the license plate in order for OpenALPR to properly identify the numbers. You may want to experiment with different angles, optical zoom levels, and resolutions to get the best image quality. A straight-on shot of the license plate is best, but OpenALPR can work with shots at an angle if necessary. First, configure your IP camera to capture the area that you wish to monitor. The camera must be capable of capturing a clear image of the license plate in order for OpenALPR to properly identify the numbers. You may want to experiment with different angles, optical zoom levels, and resolutions to get the best image quality. A straight-on shot of the license plate is best, but that is usually not possible, so OpenALPR can work with shots at an angle. Try to angle the camera so that the plate is clearly visible, and the vehicle is seen for as long as possible.
Once your camera is setup, make sure that it has an IP address and that you can connect to the MJPEG or H264 stream. Some cameras support arguments in the URL to control resolution, frame-rate, etc. The Firefox web browser has the best MJPEG support among major browsers. Type in the MJPEG or H264 stream URL to Firefox and you should be able to clearly see your video. Some users reduce the frames per second (fps) of their video feed in order to reduce the stream bandwidth. Fifteen frames per second is usually more than sufficient to capture passing vehicles from a fixed-camera. Once your camera is setup, make sure that it has an IP address and that you can connect to the MJPEG or H264 stream. A useful, free utility for testing the video URL is `VLC Media Player <http://www.videolan.org/>`_. You can test your video URL by selecting File -> Open Media Stream. Type in the MJPEG or H264 stream URL and you should be able to clearly see your video.
Some cameras support arguments in the URL to control resolution, frame-rate, etc. You may reduce the frames per second (fps) of the video feed in order to reduce the stream bandwidth. Fifteen frames per second is usually more than sufficient to capture passing vehicles from a fixed-camera. The resolution also should not be too high. A resolution of 720p is generally sufficient for capturing license plates as long as the plate characters are legible. Higher resolution often results in longer processing time without a gain in accuracy.
Architecture Architecture
============= =============
.. image:: images/webserver_architecture.png The OpenALPR agent reads a video stream from your IP camera, processes it, and uploads plate metadata to the OpenALPR web server. The agent also stores all of the plate images in a rolling buffer on the hard drive.
:scale: 100%
:alt: OpenALPR Web Server Architecture
There is a constant stream of data flowing between the camera and the agent as well as between the agent and the web server. The data sent to the cloud is relatively low-bandwidth because it contains text metadata describing the license plates. The OpenALPR Web Server does not store your plate images, these are downloaded directly from the agent when you select a plate to view from the web server.
As depicted in the diagram above, the OpenALPR agent reads a video stream from your IP camera, processes it, and uploads plate metadata to the OpenALPR web server. The agent also stores all of the plate images on a rolling buffer in its hard drive. OpenALPR Agent
There is a constant stream of data flowing between the camera and the agent as well as between the agent and the cloud. The data sent to the cloud is relatively low-bandwidth because it contains text metadata describing the license plates, and not the images. OpenALPR Cloud does not store your plate images, these are downloaded directly from the agent when you select a plate to view from the web server.
Installation
=============================== ===============================
The OpenALPR web server and the :ref:`OpenALPR agent <alprd>` is installed as either a Virtual Machine (VM) or natively on 64-bit Ubuntu Linux 14.04. The OpenALPR Agent is a service that runs as a background task on your PC. The agent analyzes video streams from one or more IP cameras and finds the license plates for the vehicles that pass by the camera. We recommend a dedicated PC for the agent due to the amount of CPU used during processing; however, it can be installed on any machine. The plate numbers may be kept completely within your network (on the On-Premise web server), or sent to the OpenALPR Cloud.
We recommend installing natively on Linux, since this provides higher performance and excellent reliability. Running a VM on Windows is recommended for evaluations. * If you wish to use the OpenALPR Cloud to store your data, first `sign-up for an account <https://cloud.openalpr.com/account/register>`_.
* If you wish to use the On-Premises web server, request an evaluation key from `info@openalpr.com <mailto:info@openalpr.com?subject=Requesting%20OpenALPR%20Evaluation%20Key>`_ and install the Web Server using the Linux Installer instructions below.
Windows Installer
------------------
1. Download the `OpenALPR Windows Installer <http://deb.openalpr.com/windows/openalpr-latest.exe>`_
2. Install the program onto your PC
3. Start the "Configure OpenALPR" program after the install completes
4. Depending on how you wish to use the OpenALPR agent, you may choose one of four radio buttons
.. image:: images/agent-windows-config.png
:scale: 100%
:alt: Windows Agent Configuration
a. **OpenALPR Cloud** - Type in the E-mail address and password that you used to sign-up for the OpenALPR Cloud Service
b. **OpenALPR On-Premises Web Server** -- Type in the URL of the on-premises web server and the e-mail address / password of the master account
c. **Generic HTTP URL** -- Used for :ref:`Integrating other applications with the OpenALPR Agent <alprd>`.
d. **Local Queue** -- Another method for :ref:`Integrating other applications with the OpenALPR Agent <alprd>`.
Linux Installation You have now successfully connected the OpenALPR Agent with the OpenALPR web server. All configuration / management is performed centrally on the OpenALPR web server. The next step is to :ref:`configure the agent and add video streams to monitor <agent_configuration>`
Linux Installer
---------------------- ----------------------
Download the Ubuntu 14.04 64-bit install DVD image and burn to a DVD: Download the Ubuntu 16.04 64-bit install DVD image and burn to a DVD:
- http://releases.ubuntu.com/14.04/ubuntu-14.04.4-desktop-amd64.iso - http://releases.ubuntu.com/16.04/ubuntu-16.04.1-desktop-amd64.iso
Follow this installation guide to install Ubuntu 14.04 64-bit: Follow this installation guide to install Ubuntu 16.04 64-bit:
- http://howtoubuntu.org/how-to-install-ubuntu-14-04-trusty-tahr - http://www.ubuntu.com/download/desktop/install-ubuntu-desktop
Run the following command from the terminal: Run the following command from the terminal:
@@ -68,72 +85,13 @@ Run the following command from the terminal:
:scale: 100% :scale: 100%
:alt: OpenALPR VM installation step 4 :alt: OpenALPR VM installation step 4
- Choose the options for what you wish to install. - Choose one of the following:
- If you want to connect the agent to the OpenALPR Cloud, just choose "install agent". - To connect the agent to the OpenALPR Cloud, just choose "install agent".
- If you wish to host the data on the VM (On-Premises configuration) choose "install webserver" - To host the data on your own web server (On-Premises configuration) choose "install webserver"
Virtual Machine Installation
---------------------------------
The OpenALPR Virtual Machine (VM) installs in a few minutes and can run on any operating system (e.g., Windows, Linux, Mac OS X). Installing a VM on a datacenter-class server (such as VMware ESXi or Citrix XenServer) is considered production-grade. Installing on a desktop system (e.g., VirtualBox on Windows 10) works well for evaluation, but we recommend installing it directly on Linux for longer-term usage. .. _agent_configuration:
The OpenALPR VM comes pre-installed with the OpenALPR agent. The on-premesis web server can also be installed on this VM as well if you wish. When the web-server is installed, then all OpenALPR processing and storage is maintained inside the VM and no data is sent to the cloud.
- Start downloading the `latest OpenALPR Virtual Machine <http://deb.openalpr.com/downloads/openalpr.ova>`_.
- Download and install the `VirtualBox installer <https://www.virtualbox.org/wiki/Downloads>`_ for your operating system. The OpenALPR VM will also work with other hypervisors such as VMware or Xen if you prefer to use one of those. We are recommendeding VirtualBox because it is free.
- Open VirtualBox and choose File → Import Appliance
- Choose the openalpr.ova file downloaded in step #1
- Accept the default memory and CPU settings and click "Import"
.. image:: images/webserver_vminstall1.png
:scale: 100%
:alt: OpenALPR VM installation step 1
- Select the openalpr-agent-vm and click "Start"
- The VM should boot up quickly and provide you with a login prompt. Login with the default credentials:
- Username: admin
- Password: admin
- You should see a menu like the one below. Use the up/down, tab, and enter keys to navigate the menu.
.. image:: images/webserver_vminstall2.png
:scale: 100%
:alt: OpenALPR VM installation step 2
- First setup the network by choosing **Network****eth0**.
- Select either DHCP or static depending on your LAN configuration
- Select Network → Test and make sure that you can successfully ping www.google.com
.. image:: images/webserver_vminstall3.png
:scale: 100%
:alt: OpenALPR VM installation step 3
- Select **Upgrade** from the main menu. The OpenALPR software is updated more frequently than the VM, there may be updates available.
- Optionally, select **Password** from the main menu to change your password to something more secure.
- Next select **Register** from the main menu. Choose where you wish to send data. You can send data to the OpenALPR Cloud, host the data on the OpenALPR Web
server on the same VM, or send the data to another server.
.. image:: images/webserver_vmregister1.png
:scale: 100%
:alt: OpenALPR VM Registration step 1
- Type in your credentials (e-mail address and password) and select **OK**
.. image:: images/webserver_vmregister2.png
:scale: 100%
:alt: OpenALPR VM Registration step 2
- If registration is successful, you will see a success message.
.. image:: images/webserver_vmregister2.png
:scale: 100%
:alt: OpenALPR VM Registration step 2
- The rest of the configuration is managed via the OpenALPR web server. Login to the OpenALPR web server to configure your agent.
Configuration Configuration
=============================== ===============================
@@ -171,7 +129,7 @@ Configuration
:scale: 100% :scale: 100%
:alt: OpenALPR VM installation step 4 :alt: OpenALPR VM installation step 4
- Lastly, if you scroll to the bottom of the page you can watch the agent status. At this point you should see **Video FPS** and other information indicating that video is being pulled from the camera and license plates are being recognized. Now that the agent is configured, it will continue collecting data from the configured video streams. If the agent is rebooted, the OpenALPR agent will automatically start. If the camera goes down and comes back, or the network is down temporarily, the agent will retry until connectivity is restored. All results are queued, so no data is lost in the event of an outage. - Lastly, if you scroll to the bottom of the page you can watch the agent status. You should now see **Video FPS** and other information indicating that video is being pulled from the camera and license plates are being recognized. Now that the agent is configured, it will continue collecting data from the configured video streams. If the agent is rebooted, the OpenALPR agent will automatically start. If the camera goes down and comes back, or the network is down temporarily, the agent will retry until connectivity is restored. All results are queued, so no data is lost in the event of an outage.
.. image:: images/webserver_vminstall7.png .. image:: images/webserver_vminstall7.png
:scale: 100% :scale: 100%

View File

@@ -20,6 +20,11 @@ manufacturers:
mjpeg: mjpeg:
- "http://[username]:[password]@[ip_address]/mjpeg?res=full&x0=0&y0=0&x1=100%&y1=100%&quality=12&doublescan=0&fps=15&ver=HTTP/1.1" - "http://[username]:[password]@[ip_address]/mjpeg?res=full&x0=0&y0=0&x1=100%&y1=100%&quality=12&doublescan=0&fps=15&ver=HTTP/1.1"
- "http://[username]:[password]@[ip_address]/image?res=half&x0=0&y0=0&x1=1600&y1=1200&quality=15&doublescan=0" - "http://[username]:[password]@[ip_address]/image?res=half&x0=0&y0=0&x1=1600&y1=1200&quality=15&doublescan=0"
Avigilon:
mjpeg:
- "http://[username]:[password]@[ip_address]/media/still.jpg"
h264:
- "rtsp://[username]:[password]@[ip_address]/defaultPrimary?streamType=u"
Aviosys: Aviosys:
mjpeg: mjpeg:
- "http://[username]:[password]@[ip_address]/GetData.cgi" - "http://[username]:[password]@[ip_address]/GetData.cgi"
@@ -103,6 +108,9 @@ manufacturers:
IQeye: IQeye:
mjpeg: mjpeg:
- "http://[username]:[password]@[ip_address]/now.jpg?snap=spush" - "http://[username]:[password]@[ip_address]/now.jpg?snap=spush"
h264:
- "rtsp://[username]:[password]@[ip_address]/stream1"
- "rtsp://[username]:[password]@[ip_address]/now.mp4&res=high"
Intellinet: Intellinet:
mjpeg: mjpeg:
- "http://[username]:[password]@[ip_address]/jpg/image.jpg" - "http://[username]:[password]@[ip_address]/jpg/image.jpg"
@@ -181,6 +189,8 @@ manufacturers:
- "http://[username]:[password]@[ip_address]/image" - "http://[username]:[password]@[ip_address]/image"
- "http://[username]:[password]@[ip_address]/image?speed=0" - "http://[username]:[password]@[ip_address]/image?speed=0"
- "http://[username]:[password]@[ip_address]/oneshotimage.jpg" - "http://[username]:[password]@[ip_address]/oneshotimage.jpg"
h264:
- "rtsp://[username]:[password]@[ip_address]/media/video1"
Surecom: Surecom:
mjpeg: mjpeg:
- "http://[username]:[password]@[ip_address]/mjpeg.cgi" - "http://[username]:[password]@[ip_address]/mjpeg.cgi"

View File

@@ -0,0 +1,46 @@
; 35-50; 45-60, 55-70, 65-80, 75-90
char_analysis_min_pct = 0.35
char_analysis_height_range = 0.15
char_analysis_height_step_size = 0.10
char_analysis_height_num_steps = 5
segmentation_min_speckle_height_percent = 0.4
segmentation_min_box_width_px = 2
segmentation_min_charheight_percent = 0.4;
segmentation_max_segment_width_percent_vs_average = 2.0;
plate_width_mm = 400
plate_height_mm = 130
multiline = 0
char_height_mm = 70
char_width_mm = 50
char_whitespace_top_mm = 45
char_whitespace_bot_mm = 20
template_max_width_px = 150
template_max_height_px = 49
; Higher sensitivity means less lines
plateline_sensitivity_vertical = 18
plateline_sensitivity_horizontal = 55
; Regions smaller than this will be disqualified
min_plate_size_width_px = 65
min_plate_size_height_px = 21
; Results with fewer or more characters will be discarded
postprocess_min_characters = 7
postprocess_max_characters = 7
ocr_language = lbr
; Override for postprocess letters/numbers regex.
postprocess_regex_letters = [A-Z]
postprocess_regex_numbers = [0-9]
; Whether the plate is always dark letters on light background, light letters on dark background, or both
; value can be either always, never, or auto
invert = auto

View File

@@ -0,0 +1,50 @@
; One-line European style plates
; 35-50; 45-60, 55-70, 65-80, 75-90
char_analysis_min_pct = 0.35
char_analysis_height_range = 0.15
char_analysis_height_step_size = 0.10
char_analysis_height_num_steps = 5
segmentation_min_speckle_height_percent = 0.2
segmentation_min_box_width_px = 5
segmentation_min_charheight_percent = 0.4;
segmentation_max_segment_width_percent_vs_average = 2.0;
plate_width_mm = 520
plate_height_mm = 110
multiline = 0
char_height_mm = 80
char_width_mm = 53
char_whitespace_top_mm = 10
char_whitespace_bot_mm = 10
template_max_width_px = 184
template_max_height_px = 46
; Higher sensitivity means less lines
plateline_sensitivity_vertical = 18
plateline_sensitivity_horizontal = 55
; Regions smaller than this will be disqualified
min_plate_size_width_px = 65
min_plate_size_height_px = 18
; Results with fewer or more characters will be discarded
postprocess_min_characters = 5
postprocess_max_characters = 8
detector_file = eu.xml
ocr_language = lfr
; Override for postprocess letters/numbers regex.
postprocess_regex_letters = [A-Z]
postprocess_regex_numbers = [0-9]
; Whether the plate is always dark letters on light background, light letters on dark background, or both
; value can be either always, never, or auto
invert = auto

53
runtime_data/config/vn2.conf Executable file
View File

@@ -0,0 +1,53 @@
; Two-line Vietnam style plates
; 35-50; 45-60, 55-70, 65-80, 75-90
char_analysis_min_pct = 0.05
char_analysis_height_range = 0.25
char_analysis_height_step_size = 0.05
char_analysis_height_num_steps = 6
;segmentation_min_speckle_height_percent = 0.15
segmentation_min_box_width_px = 5
segmentation_min_charheight_percent = 0.1
segmentation_max_segment_width_percent_vs_average = 2.0
plate_width_mm = 287
plate_height_mm = 209
multiline = 1
char_height_mm = 80
char_width_mm = 40
char_height_mm = 80
char_width_mm = 40
char_whitespace_top_mm = 13
char_whitespace_bot_mm = 13
char_whitespace_between_lines_mm = 13
template_max_width_px = 287
template_max_height_px = 209
; Higher sensitivity means less lines
plateline_sensitivity_vertical = 100
plateline_sensitivity_horizontal = 80
; Regions smaller than this will be disqualified
min_plate_size_width_px = 60
min_plate_size_height_px = 45
detector_file = vn2.xml
ocr_language = leu
; Override for postprocess letters/numbers regex.
postprocess_regex_letters = [A-Z]
postprocess_regex_numbers = [0-9]
; Whether the plate is always dark letters on light background, light letters on dark background, or both
; value can be either always, never, or auto
invert = auto

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
br @@@####

783
runtime_data/region/br.xml Normal file
View File

@@ -0,0 +1,783 @@
<?xml version="1.0"?>
<opencv_storage>
<cascade>
<stageType>BOOST</stageType>
<featureType>LBP</featureType>
<height>14</height>
<width>42</width>
<stageParams>
<boostType>GAB</boostType>
<minHitRate>9.9500000476837158e-001</minHitRate>
<maxFalseAlarm>4.4999998807907104e-001</maxFalseAlarm>
<weightTrimRate>9.4999999999999996e-001</weightTrimRate>
<maxDepth>1</maxDepth>
<maxWeakCount>100</maxWeakCount></stageParams>
<featureParams>
<maxCatCount>256</maxCatCount>
<featSize>1</featSize></featureParams>
<stageNum>12</stageNum>
<stages>
<!-- stage 0 -->
<_>
<maxWeakCount>3</maxWeakCount>
<stageThreshold>-8.2853245735168457e-001</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 37 285216984 -583724588 1359073759 -585301731
-1207919366 -4685672 -1744271105 -1693972344</internalNodes>
<leafValues>
-8.2473558187484741e-001 7.9090112447738647e-001</leafValues></_>
<_>
<internalNodes>
0 -1 23 269504592 -707788396 419500415 2132086785
-2138529618 -1164967776 402655407 -1960181752</internalNodes>
<leafValues>
-7.4675083160400391e-001 7.1070402860641479e-001</leafValues></_>
<_>
<internalNodes>
0 -1 39 -202378098 -251670049 -1903268086 -537928017
-1263013447 -252423748 -272171121 -572523877</internalNodes>
<leafValues>
-6.7105877399444580e-001 7.4295401573181152e-001</leafValues></_></weakClassifiers></_>
<!-- stage 1 -->
<_>
<maxWeakCount>3</maxWeakCount>
<stageThreshold>-8.1748569011688232e-001</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 17 287364601 -584025864 -720897 -537571911 -1117732865
-1073948680 1069072383 -1081602328</internalNodes>
<leafValues>
-7.6333057880401611e-001 8.1242781877517700e-001</leafValues></_>
<_>
<internalNodes>
0 -1 31 -203434240 -2121399 352571791 -134749749 -3556389
-360480633 -1198814209 13625999</internalNodes>
<leafValues>
-7.8441995382308960e-001 6.5391725301742554e-001</leafValues></_>
<_>
<internalNodes>
0 -1 15 285250768 -1657798636 152180093 420675585
-1207926532 -8257400 419960987 -1148256087</internalNodes>
<leafValues>
-6.5546298027038574e-001 7.3026490211486816e-001</leafValues></_></weakClassifiers></_>
<!-- stage 2 -->
<_>
<maxWeakCount>6</maxWeakCount>
<stageThreshold>-1.3338762521743774e+000</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 16 -581922373 -572703591 1025064957 -42623043
-587923713 -204836 -1646481409 -1651654770</internalNodes>
<leafValues>
-6.9488149881362915e-001 7.8489482402801514e-001</leafValues></_>
<_>
<internalNodes>
0 -1 39 -100663297 -201985617 -7361009 -67108881 -138543185
1106571701 -11538609 -134221109</internalNodes>
<leafValues>
-5.4936617612838745e-001 8.1860017776489258e-001</leafValues></_>
<_>
<internalNodes>
0 -1 54 356516348 1431327064 337204735 2138898649
-2004301634 -1081597799 218630399 -1196418592</internalNodes>
<leafValues>
-7.7375411987304688e-001 5.7966601848602295e-001</leafValues></_>
<_>
<internalNodes>
0 -1 55 -200875316 -209338238 139778 -249847670 -1269438517
8659008 -1572371798 -213966709</internalNodes>
<leafValues>
-6.1659812927246094e-001 6.5415656566619873e-001</leafValues></_>
<_>
<internalNodes>
0 -1 10 -6450 -122097666 -553865708 951648254 1878088704
1291608053 2147118876 -1</internalNodes>
<leafValues>
-5.5839419364929199e-001 6.7460024356842041e-001</leafValues></_>
<_>
<internalNodes>
0 -1 59 -229644094 -740913019 402653736 1595499402
1629027160 537135104 -339090710 1376477103</internalNodes>
<leafValues>
-6.9653308391571045e-001 5.0569772720336914e-001</leafValues></_></weakClassifiers></_>
<!-- stage 3 -->
<_>
<maxWeakCount>6</maxWeakCount>
<stageThreshold>-1.3329070806503296e+000</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 38 -17 -235014145 -273698930 -1 -655361 -252578305
-1048689 -1</internalNodes>
<leafValues>
-6.2613362073898315e-001 8.3587586879730225e-001</leafValues></_>
<_>
<internalNodes>
0 -1 1 -822088017 -1494220817 -286627166 -521146870
-438311098 1148141431 2004874787 -452986937</internalNodes>
<leafValues>
-6.2483572959899902e-001 7.0758932828903198e-001</leafValues></_>
<_>
<internalNodes>
0 -1 19 1433731065 1567710713 -33685505 -4358209 -1073954819
-745475 -409601 -1080029252</internalNodes>
<leafValues>
-5.6460815668106079e-001 6.4405161142349243e-001</leafValues></_>
<_>
<internalNodes>
0 -1 72 -289409534 572709774 -2136751520 -1605438470
1541534464 538170499 1653335808 -521666585</internalNodes>
<leafValues>
-5.9405732154846191e-001 5.3030282258987427e-001</leafValues></_>
<_>
<internalNodes>
0 -1 47 284718389 1442395637 -1181229569 -4235459
-1466270465 -4196097 -71385857 -1733811012</internalNodes>
<leafValues>
-5.5647981166839600e-001 5.8203917741775513e-001</leafValues></_>
<_>
<internalNodes>
0 -1 30 1081598594 1419768706 -1017120245 -83364286
-389044566 -467664864 -1068501878 -800590846</internalNodes>
<leafValues>
-5.8518677949905396e-001 4.9468857049942017e-001</leafValues></_></weakClassifiers></_>
<!-- stage 4 -->
<_>
<maxWeakCount>6</maxWeakCount>
<stageThreshold>-1.2980090379714966e+000</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 69 -184550649 -8913025 -50331649 -201326593 -18874625
-32897 -218103829 -520093713</internalNodes>
<leafValues>
-5.9198069572448730e-001 7.8156101703643799e-001</leafValues></_>
<_>
<internalNodes>
0 -1 46 -2097153 -788860673 1309495053 -974139641 -252709717
-789389193 1996738051 -33</internalNodes>
<leafValues>
-5.4641300439834595e-001 6.8572372198104858e-001</leafValues></_>
<_>
<internalNodes>
0 -1 14 21242301 -539159755 -1122222113 -2280651 -36897815
-73606052 -79118609 -3630132</internalNodes>
<leafValues>
-6.3102430105209351e-001 5.3388547897338867e-001</leafValues></_>
<_>
<internalNodes>
0 -1 74 -339745273 1137177294 -532159998 -2139162777
-149423358 -449095354 -272110076 -218628233</internalNodes>
<leafValues>
-5.4400163888931274e-001 5.3200685977935791e-001</leafValues></_>
<_>
<internalNodes>
0 -1 42 1030755448 -1073872995 -69569291 -4501512 968236024
-16486 -541393926 -1145553976</internalNodes>
<leafValues>
-7.3628991842269897e-001 4.0775153040885925e-001</leafValues></_>
<_>
<internalNodes>
0 -1 53 -521673725 -9447329 2147450855 -134217929 -457195601
-671622077 -872415777 -1073233405</internalNodes>
<leafValues>
-4.6834933757781982e-001 6.1143130064010620e-001</leafValues></_></weakClassifiers></_>
<!-- stage 5 -->
<_>
<maxWeakCount>6</maxWeakCount>
<stageThreshold>-1.4600841999053955e+000</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 40 -2 -71436289 -1081374964 -17409 -132129 -252646597
-9249 -131073</internalNodes>
<leafValues>
-7.0482200384140015e-001 6.1317390203475952e-001</leafValues></_>
<_>
<internalNodes>
0 -1 27 1431568351 1977614335 2144862207 2013231039
-419434578 -4370 -16848146 -67114870</internalNodes>
<leafValues>
-5.3594231605529785e-001 6.7189788818359375e-001</leafValues></_>
<_>
<internalNodes>
0 -1 3 -286265553 -288883729 -274870686 -353375034
2045506919 1690041199 2147481445 -1048761</internalNodes>
<leafValues>
-5.9768378734588623e-001 5.4696100950241089e-001</leafValues></_>
<_>
<internalNodes>
0 -1 4 -134545410 -5703686 -71540238 -1349334278 1580745724
1308117213 1202520827 1308512223</internalNodes>
<leafValues>
-7.4109089374542236e-001 3.6831066012382507e-001</leafValues></_>
<_>
<internalNodes>
0 -1 44 425729245 -8972291 -38019073 -164417 -1079459842
-67200001 -1143324737 -1092082948</internalNodes>
<leafValues>
-5.6800931692123413e-001 5.0094425678253174e-001</leafValues></_>
<_>
<internalNodes>
0 -1 71 -66 990687228 -67125972 1069285308 -50332163
1044315645 -2571 -41943041</internalNodes>
<leafValues>
-4.9089109897613525e-001 5.5790531635284424e-001</leafValues></_></weakClassifiers></_>
<!-- stage 6 -->
<_>
<maxWeakCount>8</maxWeakCount>
<stageThreshold>-1.3831173181533813e+000</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 11 -681731073 -2246209 -1208139777 -2752580 -37879809
-196643 -572661761 -1075970081</internalNodes>
<leafValues>
-5.6764817237854004e-001 7.4003648757934570e-001</leafValues></_>
<_>
<internalNodes>
0 -1 43 -1057 -754982214 168807941 -1919979961 -253496143
-252514096 -553126561 -68157441</internalNodes>
<leafValues>
-5.1411336660385132e-001 6.2704712152481079e-001</leafValues></_>
<_>
<internalNodes>
0 -1 29 -1349907204 -4903014 -1075574785 -5235820 -105006081
-33809443 -475201 -22496840</internalNodes>
<leafValues>
-6.5674120187759399e-001 4.4796296954154968e-001</leafValues></_>
<_>
<internalNodes>
0 -1 49 -1065900489 -1052761 -268435457 -1 -10273 -2177
-524289 -9181689</internalNodes>
<leafValues>
-4.3221050500869751e-001 6.1747372150421143e-001</leafValues></_>
<_>
<internalNodes>
0 -1 75 -217 -1347420177 -608282330 -487605129 1910499078
1131571950 -3179776 -523763714</internalNodes>
<leafValues>
-5.8398228883743286e-001 4.1473022103309631e-001</leafValues></_>
<_>
<internalNodes>
0 -1 51 259264536 -1149902853 -753876995 2143254457
-645378568 -5314406 -1080132867 -1078428268</internalNodes>
<leafValues>
-7.3157382011413574e-001 3.2581529021263123e-001</leafValues></_>
<_>
<internalNodes>
0 -1 33 -1069030909 -905977946 -8913185 -1710847 -805331457
-327790 -473968641 -1067981309</internalNodes>
<leafValues>
-4.4401237368583679e-001 5.3910166025161743e-001</leafValues></_>
<_>
<internalNodes>
0 -1 8 -421008670 -279056550 -464391041 -539758432
1303335486 -353672409 1890057173 -195561501</internalNodes>
<leafValues>
-4.8434647917747498e-001 4.7722080349922180e-001</leafValues></_></weakClassifiers></_>
<!-- stage 7 -->
<_>
<maxWeakCount>7</maxWeakCount>
<stageThreshold>-1.0721565485000610e+000</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 15 -13041667 -294913 1060863999 1067139069 -15409924
-8707 -546505217 -9761</internalNodes>
<leafValues>
-5.3846156597137451e-001 7.8067737817764282e-001</leafValues></_>
<_>
<internalNodes>
0 -1 67 -4 1058889181 -1109576068 1061024607 -630597636
990968873 -338232644 2139094975</internalNodes>
<leafValues>
-6.1439883708953857e-001 5.0837707519531250e-001</leafValues></_>
<_>
<internalNodes>
0 -1 21 1556954559 -44715049 1066999807 -34212897 -60490753
-121838855 -590770181 1561712573</internalNodes>
<leafValues>
-5.5671542882919312e-001 4.9533960223197937e-001</leafValues></_>
<_>
<internalNodes>
0 -1 2 -421007634 -415770121 -15217666 -18423610 -739772201
-1757702077 -138678277 2004318023</internalNodes>
<leafValues>
-6.7898088693618774e-001 3.6057698726654053e-001</leafValues></_>
<_>
<internalNodes>
0 -1 56 1084745218 -134237397 1132975563 -3672349 -133303569
-84217206 -353381665 -1064833534</internalNodes>
<leafValues>
-5.1906722784042358e-001 4.4790410995483398e-001</leafValues></_>
<_>
<internalNodes>
0 -1 6 -12594 1985637327 -157620114 -386470066 -606119323
2111261223 -439408252 -168362257</internalNodes>
<leafValues>
-5.6427675485610962e-001 4.1696536540985107e-001</leafValues></_>
<_>
<internalNodes>
0 -1 18 287069429 1540717769 1504826367 -1082829027
-56821761 -606297447 1049934591 -1620034247</internalNodes>
<leafValues>
-5.8802723884582520e-001 3.9574873447418213e-001</leafValues></_></weakClassifiers></_>
<!-- stage 8 -->
<_>
<maxWeakCount>8</maxWeakCount>
<stageThreshold>-1.2750341892242432e+000</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 13 -8913413 -7012417 1060835131 2147041247 -589500419
-587924228 -572588033 -536871425</internalNodes>
<leafValues>
-5.0236552953720093e-001 7.6100629568099976e-001</leafValues></_>
<_>
<internalNodes>
0 -1 41 -202381393 -242227537 -542398705 -173409041
-771758709 -253364561 -80740469 -168428577</internalNodes>
<leafValues>
-5.4317152500152588e-001 5.6954395771026611e-001</leafValues></_>
<_>
<internalNodes>
0 -1 24 1087881455 2113665003 -210894853 2146828223
-1140851282 -18 -890437942 -4461558</internalNodes>
<leafValues>
-4.7311496734619141e-001 5.2226537466049194e-001</leafValues></_>
<_>
<internalNodes>
0 -1 61 -16387 939276280 -1283703044 2143205076 -280183363
1034435276 1050948600 -35</internalNodes>
<leafValues>
-4.6256715059280396e-001 4.9628910422325134e-001</leafValues></_>
<_>
<internalNodes>
0 -1 26 171050035 -1221456399 -539869197 -1087169504
-1922552099 -1361411 -281382437 -1410185933</internalNodes>
<leafValues>
-5.3890913724899292e-001 3.8419398665428162e-001</leafValues></_>
<_>
<internalNodes>
0 -1 73 -6137 1120918271 -1368794106 -2144358409 -83927551
1401633275 -775965916 -788529194</internalNodes>
<leafValues>
-5.3902828693389893e-001 4.4206458330154419e-001</leafValues></_>
<_>
<internalNodes>
0 -1 63 -1951234380 -1614915876 1698200827 2145161916
-1355301121 -1141135941 -1145373697 -1074133536</internalNodes>
<leafValues>
-5.5798375606536865e-001 3.4880429506301880e-001</leafValues></_>
<_>
<internalNodes>
0 -1 70 -520096505 1984419111 -460858761 -1832389703
-234095242 -1409595137 -366286102 -2131758089</internalNodes>
<leafValues>
-4.5353689789772034e-001 4.7646188735961914e-001</leafValues></_></weakClassifiers></_>
<!-- stage 9 -->
<_>
<maxWeakCount>8</maxWeakCount>
<stageThreshold>-1.1843473911285400e+000</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 22 -88539393 -2622473 -67436545 -1078223497 -8694275
-388 -276869121 -172161</internalNodes>
<leafValues>
-5.0693207979202271e-001 7.3959207534790039e-001</leafValues></_>
<_>
<internalNodes>
0 -1 62 1382277871 -134223894 -1093669 -789270 2012932831
-10771222 -878706965 -3153270</internalNodes>
<leafValues>
-4.2572146654129028e-001 6.5866845846176147e-001</leafValues></_>
<_>
<internalNodes>
0 -1 46 -84936133 -799817490 201575681 -934553081 -730335557
-1070448605 1359418891 -537919653</internalNodes>
<leafValues>
-5.4319930076599121e-001 4.7171792387962341e-001</leafValues></_>
<_>
<internalNodes>
0 -1 25 1585000699 -111330383 303305717 2078094325
-1344488514 -1086581044 847298555 -215041</internalNodes>
<leafValues>
-4.5561578869819641e-001 4.9395501613616943e-001</leafValues></_>
<_>
<internalNodes>
0 -1 36 -735850437 -5548997 -170426689 -41427919 -722534981
-56665225 -794167809 -637809441</internalNodes>
<leafValues>
-3.9095941185951233e-001 6.1021536588668823e-001</leafValues></_>
<_>
<internalNodes>
0 -1 65 201339189 -109363211 -131585 1601142655 -536940609
-8880131 -1428402450 -1165357912</internalNodes>
<leafValues>
-4.4847896695137024e-001 4.8076605796813965e-001</leafValues></_>
<_>
<internalNodes>
0 -1 34 -1024463798 -67440058 1412853760 -1292148966
-357569761 1109114946 -235150709 1395639042</internalNodes>
<leafValues>
-5.9451353549957275e-001 3.2721316814422607e-001</leafValues></_>
<_>
<internalNodes>
0 -1 66 -252447488 -686295729 -774513665 -2108929 -876294680
-1888788333 -2067312392 1355546591</internalNodes>
<leafValues>
-5.9371763467788696e-001 3.0977559089660645e-001</leafValues></_></weakClassifiers></_>
<!-- stage 10 -->
<_>
<maxWeakCount>9</maxWeakCount>
<stageThreshold>-1.7721819877624512e+000</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 52 1364590559 -6488196 2071953407 -304133 -4210689
-16973858 -69222721 -318838</internalNodes>
<leafValues>
-5.0053322315216064e-001 7.2953337430953979e-001</leafValues></_>
<_>
<internalNodes>
0 -1 9 -1346390051 -1153975463 -168044545 -1073760400
-603979812 -71570664 -78774824 -3146535</internalNodes>
<leafValues>
-4.7651672363281250e-001 5.5323666334152222e-001</leafValues></_>
<_>
<internalNodes>
0 -1 48 -1073492989 -624955969 -629407821 -277350569
-367002093 -1881174853 -370159189 1526981123</internalNodes>
<leafValues>
-5.3586703538894653e-001 4.3482360243797302e-001</leafValues></_>
<_>
<internalNodes>
0 -1 7 -268514049 -2182498 -557921026 -1143833520 1337869053
1595298893 -6356993 -1409037</internalNodes>
<leafValues>
-4.6753937005996704e-001 4.7871547937393188e-001</leafValues></_>
<_>
<internalNodes>
0 -1 28 -4224337 -3210241 -1491399617 -177201 -1666217729
-188466456 -37118977 -570621953</internalNodes>
<leafValues>
-4.5714759826660156e-001 4.2808809876441956e-001</leafValues></_>
<_>
<internalNodes>
0 -1 68 937426204 1025373468 -1189126255 2138821591
-1700284228 -1216642872 -1158053604 805297404</internalNodes>
<leafValues>
-5.4907804727554321e-001 3.8489469885826111e-001</leafValues></_>
<_>
<internalNodes>
0 -1 0 -288366334 -825757274 -460792322 -291581722
1170695122 -884364 -415762442 -227019529</internalNodes>
<leafValues>
-6.1079239845275879e-001 2.9559111595153809e-001</leafValues></_>
<_>
<internalNodes>
0 -1 58 -540048250 322173639 -634957345 -679614881 -82855217
-664080198 -945776257 1431534827</internalNodes>
<leafValues>
-4.9022802710533142e-001 4.0082153677940369e-001</leafValues></_>
<_>
<internalNodes>
0 -1 35 78730549 488199256 1405345655 1971282205 -1734690372
-1398044024 700103675 -1735738837</internalNodes>
<leafValues>
-4.9552637338638306e-001 3.6625802516937256e-001</leafValues></_></weakClassifiers></_>
<!-- stage 11 -->
<_>
<maxWeakCount>9</maxWeakCount>
<stageThreshold>-1.6782010793685913e+000</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 45 -218370049 -31505 -8193 -1110514 -797769730 -2049
-11010053 -8433</internalNodes>
<leafValues>
-4.4659072160720825e-001 7.9415500164031982e-001</leafValues></_>
<_>
<internalNodes>
0 -1 12 -203689238 -11411516 395785395 905899519 -946933521
1479650435 1101129199 1468004095</internalNodes>
<leafValues>
-5.4474192857742310e-001 4.7251713275909424e-001</leafValues></_>
<_>
<internalNodes>
0 -1 20 -496508273 -1048657 -4097 2146957074 -553652225
-65713 -17 -179837374</internalNodes>
<leafValues>
-3.9359572529792786e-001 5.4971671104431152e-001</leafValues></_>
<_>
<internalNodes>
0 -1 60 1358984660 -1210300454 404051839 -545474884
567032571 -1093952574 781125119 -5567960</internalNodes>
<leafValues>
-4.8279407620429993e-001 4.3091443181037903e-001</leafValues></_>
<_>
<internalNodes>
0 -1 57 1426068991 1601467897 992870367 2145386399
2038484222 -71778387 -341114881 -585061027</internalNodes>
<leafValues>
-5.4100221395492554e-001 3.2671278715133667e-001</leafValues></_>
<_>
<internalNodes>
0 -1 5 -35655857 1692374991 -453645532 -867243825 2042613767
-467932117 -1149248511 -184552449</internalNodes>
<leafValues>
-5.2549248933792114e-001 4.0258836746215820e-001</leafValues></_>
<_>
<internalNodes>
0 -1 32 1342691326 1475291005 -1055105 1073430447 -538386740
-1048577 -270038549 -68424022</internalNodes>
<leafValues>
-3.8929802179336548e-001 4.6440866589546204e-001</leafValues></_>
<_>
<internalNodes>
0 -1 50 2071425138 166474750 2007511288 1015435772
-743868420 449328296 323123188 1875607550</internalNodes>
<leafValues>
-6.6830915212631226e-001 2.5718382000923157e-001</leafValues></_>
<_>
<internalNodes>
0 -1 64 -198224875 2014237438 1368741745 823456091 -9455171
-268766785 -760679910 -1970341089</internalNodes>
<leafValues>
-4.3688443303108215e-001 3.7087124586105347e-001</leafValues></_></weakClassifiers></_></stages>
<features>
<_>
<rect>
0 2 2 2</rect></_>
<_>
<rect>
0 3 1 2</rect></_>
<_>
<rect>
0 3 3 2</rect></_>
<_>
<rect>
0 4 1 1</rect></_>
<_>
<rect>
0 5 3 3</rect></_>
<_>
<rect>
0 7 1 1</rect></_>
<_>
<rect>
0 7 1 2</rect></_>
<_>
<rect>
0 10 2 1</rect></_>
<_>
<rect>
1 1 2 3</rect></_>
<_>
<rect>
1 1 9 2</rect></_>
<_>
<rect>
1 5 1 3</rect></_>
<_>
<rect>
2 1 12 2</rect></_>
<_>
<rect>
2 2 13 1</rect></_>
<_>
<rect>
2 3 12 1</rect></_>
<_>
<rect>
3 0 12 3</rect></_>
<_>
<rect>
3 3 9 1</rect></_>
<_>
<rect>
4 1 12 2</rect></_>
<_>
<rect>
4 11 7 1</rect></_>
<_>
<rect>
6 11 4 1</rect></_>
<_>
<rect>
6 11 5 1</rect></_>
<_>
<rect>
7 1 1 3</rect></_>
<_>
<rect>
7 1 11 2</rect></_>
<_>
<rect>
7 2 6 1</rect></_>
<_>
<rect>
7 4 10 1</rect></_>
<_>
<rect>
8 2 7 3</rect></_>
<_>
<rect>
8 8 3 2</rect></_>
<_>
<rect>
9 1 5 1</rect></_>
<_>
<rect>
9 3 6 2</rect></_>
<_>
<rect>
10 7 6 2</rect></_>
<_>
<rect>
10 10 6 1</rect></_>
<_>
<rect>
11 1 1 3</rect></_>
<_>
<rect>
11 2 3 3</rect></_>
<_>
<rect>
11 4 5 1</rect></_>
<_>
<rect>
12 1 1 3</rect></_>
<_>
<rect>
12 4 1 2</rect></_>
<_>
<rect>
13 0 9 1</rect></_>
<_>
<rect>
13 1 2 2</rect></_>
<_>
<rect>
13 11 9 1</rect></_>
<_>
<rect>
14 4 3 3</rect></_>
<_>
<rect>
14 5 3 2</rect></_>
<_>
<rect>
14 5 3 3</rect></_>
<_>
<rect>
14 6 3 2</rect></_>
<_>
<rect>
14 11 6 1</rect></_>
<_>
<rect>
15 5 2 2</rect></_>
<_>
<rect>
16 0 3 1</rect></_>
<_>
<rect>
16 5 1 2</rect></_>
<_>
<rect>
16 5 2 2</rect></_>
<_>
<rect>
17 0 6 1</rect></_>
<_>
<rect>
17 1 2 2</rect></_>
<_>
<rect>
18 0 2 3</rect></_>
<_>
<rect>
19 7 2 2</rect></_>
<_>
<rect>
19 11 5 1</rect></_>
<_>
<rect>
20 4 3 1</rect></_>
<_>
<rect>
21 1 1 3</rect></_>
<_>
<rect>
21 11 6 1</rect></_>
<_>
<rect>
22 5 2 1</rect></_>
<_>
<rect>
23 0 1 4</rect></_>
<_>
<rect>
23 11 5 1</rect></_>
<_>
<rect>
24 3 2 2</rect></_>
<_>
<rect>
24 5 2 2</rect></_>
<_>
<rect>
25 4 3 1</rect></_>
<_>
<rect>
26 8 1 2</rect></_>
<_>
<rect>
27 3 2 2</rect></_>
<_>
<rect>
29 11 3 1</rect></_>
<_>
<rect>
30 2 4 2</rect></_>
<_>
<rect>
32 0 2 1</rect></_>
<_>
<rect>
33 1 3 3</rect></_>
<_>
<rect>
33 8 3 2</rect></_>
<_>
<rect>
33 11 3 1</rect></_>
<_>
<rect>
35 1 2 3</rect></_>
<_>
<rect>
36 1 2 3</rect></_>
<_>
<rect>
36 8 2 2</rect></_>
<_>
<rect>
39 2 1 3</rect></_>
<_>
<rect>
39 3 1 1</rect></_>
<_>
<rect>
39 3 1 2</rect></_>
<_>
<rect>
39 4 1 1</rect></_></features></cascade>
</opencv_storage>

625
runtime_data/region/vn2.xml Executable file
View File

@@ -0,0 +1,625 @@
<?xml version="1.0"?>
<opencv_storage>
<cascade>
<stageType>BOOST</stageType>
<featureType>LBP</featureType>
<height>20</height>
<width>28</width>
<stageParams>
<boostType>GAB</boostType>
<minHitRate>9.9500000476837158e-01</minHitRate>
<maxFalseAlarm>4.4999998807907104e-01</maxFalseAlarm>
<weightTrimRate>9.4999999999999996e-01</weightTrimRate>
<maxDepth>1</maxDepth>
<maxWeakCount>100</maxWeakCount></stageParams>
<featureParams>
<maxCatCount>256</maxCatCount>
<featSize>1</featSize></featureParams>
<stageNum>11</stageNum>
<stages>
<!-- stage 0 -->
<_>
<maxWeakCount>5</maxWeakCount>
<stageThreshold>-1.0226867198944092e+00</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 3 -236978690 -71328259 1469446622 -41985 300805055
1974514928 -341061633 -1</internalNodes>
<leafValues>
-8.1343281269073486e-01 5.4749196767807007e-01</leafValues></_>
<_>
<internalNodes>
0 -1 47 -1068506578 -535837126 -2139095038 -1065140221
-1073493873 1073774592 -1056185469 -203425825</internalNodes>
<leafValues>
-6.8157231807708740e-01 6.2008899450302124e-01</leafValues></_>
<_>
<internalNodes>
0 -1 8 -882644473 6749795 -1069291346 -2140212948 1350526835
84000771 -786963725 -403177497</internalNodes>
<leafValues>
-6.5852028131484985e-01 5.9720140695571899e-01</leafValues></_>
<_>
<internalNodes>
0 -1 55 -1959252296 -2389544 -721100803 -6546476 -1240731201
-1077882627 -1080099841 -1141371716</internalNodes>
<leafValues>
-6.6024768352508545e-01 5.6097584962844849e-01</leafValues></_>
<_>
<internalNodes>
0 -1 13 -957023424 1876153335 -629018556 -1009843309
-527056715 -1831865877 868609770 -1350571009</internalNodes>
<leafValues>
-6.3601404428482056e-01 5.6986278295516968e-01</leafValues></_></weakClassifiers></_>
<!-- stage 1 -->
<_>
<maxWeakCount>5</maxWeakCount>
<stageThreshold>-1.1183853149414062e+00</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 34 -1087352324 -2420483 1372910047 2113212445
-1148650759 -106239812 -1148650566 -1683482424</internalNodes>
<leafValues>
-8.1584769487380981e-01 3.6146789789199829e-01</leafValues></_>
<_>
<internalNodes>
0 -1 36 -796671862 -796737406 1363214376 1573376133
1342235266 1073741825 1359870346 -606085153</internalNodes>
<leafValues>
-6.9792109727859497e-01 5.0962162017822266e-01</leafValues></_>
<_>
<internalNodes>
0 -1 43 -1596738302 -738756081 -1291747361 -137389281
-915801681 -91504437 -1413752657 -1347442137</internalNodes>
<leafValues>
-6.6823571920394897e-01 5.3261423110961914e-01</leafValues></_>
<_>
<internalNodes>
0 -1 5 -208153610 -237777985 -1626780180 -2626532
-1148627972 1912312479 -83100674 1504688623</internalNodes>
<leafValues>
-6.7626368999481201e-01 5.1578819751739502e-01</leafValues></_>
<_>
<internalNodes>
0 -1 18 -1110436427 -141552556 -788442881 1059033301
-1719130691 -1178345416 -1102521443 -1423963940</internalNodes>
<leafValues>
-6.2948453426361084e-01 6.0341739654541016e-01</leafValues></_></weakClassifiers></_>
<!-- stage 2 -->
<_>
<maxWeakCount>5</maxWeakCount>
<stageThreshold>-1.9752599000930786e+00</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 27 -1785702947 -547547947 -1761485315 -191011
-1995924485 -72740104 -1095976257 -1086846584</internalNodes>
<leafValues>
-7.5782203674316406e-01 4.6846845746040344e-01</leafValues></_>
<_>
<internalNodes>
0 -1 39 1360056540 1607733652 1363221981 -2404139
-1115123526 -1717827448 1048783807 -1079312374</internalNodes>
<leafValues>
-6.4150768518447876e-01 5.1527595520019531e-01</leafValues></_>
<_>
<internalNodes>
0 -1 44 -1060126074 -238824509 536903680 1363780187 688994
1342193665 -788413717 -614474865</internalNodes>
<leafValues>
-5.6712394952774048e-01 5.3354203701019287e-01</leafValues></_>
<_>
<internalNodes>
0 -1 50 -1 1073537022 -285212675 -1082261513 -266243
-1619984385 -536904452 2079972863</internalNodes>
<leafValues>
-5.3560340404510498e-01 6.0510307550430298e-01</leafValues></_>
<_>
<internalNodes>
0 -1 23 571474481 869470705 219369951 2113346335 -1859444519
-1073801157 262856381 993657368</internalNodes>
<leafValues>
-6.9949334859848022e-01 4.7212797403335571e-01</leafValues></_></weakClassifiers></_>
<!-- stage 3 -->
<_>
<maxWeakCount>5</maxWeakCount>
<stageThreshold>-1.1232472658157349e+00</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 54 -209198525 1413661190 200706 -1031028670 1342246978
1090683040 -1320974197 -201326641</internalNodes>
<leafValues>
-7.6172041893005371e-01 3.1445312500000000e-01</leafValues></_>
<_>
<internalNodes>
0 -1 15 -562303134 -351020713 -687681060 -278937155
2074210739 2073986273 -74059777 -65</internalNodes>
<leafValues>
-6.4060848951339722e-01 4.7522404789924622e-01</leafValues></_>
<_>
<internalNodes>
0 -1 19 457708756 -1122564679 298209791 2100761337
-1153410374 -23527032 -1146312257 -1180169800</internalNodes>
<leafValues>
-6.1004692316055298e-01 5.2203148603439331e-01</leafValues></_>
<_>
<internalNodes>
0 -1 56 -857758202 181110223 -326838386 1890572927
1772073743 556974267 -67110257 -268436546</internalNodes>
<leafValues>
-6.1680519580841064e-01 5.0427693128585815e-01</leafValues></_>
<_>
<internalNodes>
0 -1 35 966284540 -1861185520 -2128946723 1599144983
-1568640262 -812021606 -1082090808 186259912</internalNodes>
<leafValues>
-6.8607240915298462e-01 4.8699402809143066e-01</leafValues></_></weakClassifiers></_>
<!-- stage 4 -->
<_>
<maxWeakCount>5</maxWeakCount>
<stageThreshold>-1.1578670740127563e+00</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 17 -68170961 -293084402 1224843871 -536349562
1914930007 1615036999 -427568249 -173015109</internalNodes>
<leafValues>
-7.0355576276779175e-01 3.6879432201385498e-01</leafValues></_>
<_>
<internalNodes>
0 -1 38 -225984374 -1339698556 8503296 1397211650 17690282
1026 1428418698 -706742369</internalNodes>
<leafValues>
-6.1560535430908203e-01 4.2747393250465393e-01</leafValues></_>
<_>
<internalNodes>
0 -1 28 1367400440 353696080 -778858247 2111820247 23722697
1085485 199917759 455060462</internalNodes>
<leafValues>
-6.7115384340286255e-01 4.1770645976066589e-01</leafValues></_>
<_>
<internalNodes>
0 -1 7 1977602766 1365111615 -1121728050 -75506241
1904999412 1342548476 -75269489 -2099009</internalNodes>
<leafValues>
-7.1227186918258667e-01 3.8815173506736755e-01</leafValues></_>
<_>
<internalNodes>
0 -1 33 -754195830 -804126526 285313328 287547920
-1073026872 -2113927040 -1073495932 -788012309</internalNodes>
<leafValues>
-5.5254626274108887e-01 5.0164043903350830e-01</leafValues></_></weakClassifiers></_>
<!-- stage 5 -->
<_>
<maxWeakCount>6</maxWeakCount>
<stageThreshold>-8.1348818540573120e-01</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 14 320344829 -74104167 428873215 -551614349 -2136303362
-108412247 788179407 -1616373368</internalNodes>
<leafValues>
-7.2034955024719238e-01 2.9809725284576416e-01</leafValues></_>
<_>
<internalNodes>
0 -1 4 -704643113 -4533929 1082326870 -7810978 1352882687
2125561071 1786216411 -8209</internalNodes>
<leafValues>
-5.1959729194641113e-01 5.5615991353988647e-01</leafValues></_>
<_>
<internalNodes>
0 -1 53 -243801590 -802967637 1426271746 -1007683850
-719071406 1342486726 -173605946 -218628353</internalNodes>
<leafValues>
-5.2952307462692261e-01 5.4032027721405029e-01</leafValues></_>
<_>
<internalNodes>
0 -1 26 -1719397360 -33811304 530659327 1073021083
1342178488 -1197471567 1332354559 221188457</internalNodes>
<leafValues>
-6.9718199968338013e-01 4.0761217474937439e-01</leafValues></_>
<_>
<internalNodes>
0 -1 32 774911472 -270794532 -251332257 357829517
-1183835398 -1412759130 1653264319 173019184</internalNodes>
<leafValues>
-8.4420329332351685e-01 3.1606295704841614e-01</leafValues></_>
<_>
<internalNodes>
0 -1 9 -33554641 1079180070 -649870898 -560999525 1822128983
1622257847 -557127169 -247473492</internalNodes>
<leafValues>
-6.3315248489379883e-01 4.0907686948776245e-01</leafValues></_></weakClassifiers></_>
<!-- stage 6 -->
<_>
<maxWeakCount>5</maxWeakCount>
<stageThreshold>-1.0814472436904907e+00</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 60 -269489361 1340063903 -2112495645 -186662433
-88871577 160158602 -73665789 -135528513</internalNodes>
<leafValues>
-7.2124838829040527e-01 2.3564356565475464e-01</leafValues></_>
<_>
<internalNodes>
0 -1 1 1147561570 -8231937 -220728609 -3718145 1883448309
-180711173 -120018177 -268738097</internalNodes>
<leafValues>
-7.1248924732208252e-01 2.9627996683120728e-01</leafValues></_>
<_>
<internalNodes>
0 -1 16 -143657486 803066203 -641576488 -1346414113
2038822369 1527474988 -170528044 -269615161</internalNodes>
<leafValues>
-6.1012923717498779e-01 3.9779847860336304e-01</leafValues></_>
<_>
<internalNodes>
0 -1 42 -208674686 -778570287 -972684030 -772808502
-1608535872 1174671461 1456465871 1930416427</internalNodes>
<leafValues>
-5.7085311412811279e-01 4.4576171040534973e-01</leafValues></_>
<_>
<internalNodes>
0 -1 6 1060821245 -4636683 -1094763521 1039835037 -4436487
-557998850 -16998435 -1349909272</internalNodes>
<leafValues>
-4.3154692649841309e-01 6.0856270790100098e-01</leafValues></_></weakClassifiers></_>
<!-- stage 7 -->
<_>
<maxWeakCount>5</maxWeakCount>
<stageThreshold>-1.0268830060958862e+00</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 58 -268439793 1842990043 -850919954 -6303489 1873804103
868219595 -69484857 -4194305</internalNodes>
<leafValues>
-7.6132076978683472e-01 1.3425549864768982e-01</leafValues></_>
<_>
<internalNodes>
0 -1 51 -550508545 918351897 -140393124 -1784757941
-70477123 964518571 -617522756 -4205059</internalNodes>
<leafValues>
-5.9086549282073975e-01 3.8894322514533997e-01</leafValues></_>
<_>
<internalNodes>
0 -1 41 -248266622 -739784177 -2141289952 -174370260
1624499111 268931154 1074787021 -210767953</internalNodes>
<leafValues>
-5.2205401659011841e-01 4.8417466878890991e-01</leafValues></_>
<_>
<internalNodes>
0 -1 0 -1525134091 -1109897859 -1660522017 -1644247684
2074655422 -1146365853 -1975981059 -1977334748</internalNodes>
<leafValues>
-5.8343207836151123e-01 4.1282418370246887e-01</leafValues></_>
<_>
<internalNodes>
0 -1 59 -814749150 -1044386650 -974208256 -570560821
1852832912 295171443 -415239197 -1283458081</internalNodes>
<leafValues>
-4.4459566473960876e-01 5.5129295587539673e-01</leafValues></_></weakClassifiers></_>
<!-- stage 8 -->
<_>
<maxWeakCount>7</maxWeakCount>
<stageThreshold>-1.3468582630157471e+00</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 48 -22544385 -268373114 -315937931 -1707545 -1078199041
-134163304 -477295989 -1050113</internalNodes>
<leafValues>
-6.5963971614837646e-01 3.6756756901741028e-01</leafValues></_>
<_>
<internalNodes>
0 -1 2 1879015207 542897023 -652233029 -461379155
-1618347145 1912720139 -34868294 -218103817</internalNodes>
<leafValues>
-6.0403579473495483e-01 3.4924373030662537e-01</leafValues></_>
<_>
<internalNodes>
0 -1 22 470828248 -6851716 358111701 -195361684 973667294
-1090908119 -1113556485 993534360</internalNodes>
<leafValues>
-7.1156060695648193e-01 3.0485236644744873e-01</leafValues></_>
<_>
<internalNodes>
0 -1 46 -475012190 -468764761 -940574656 -1313374241
-672152701 1350922110 -424151066 -137363457</internalNodes>
<leafValues>
-4.6654438972473145e-01 4.8787227272987366e-01</leafValues></_>
<_>
<internalNodes>
0 -1 24 895540479 -4213861 1371697377 1000022554 268436724
-96456319 -987466515 -66885</internalNodes>
<leafValues>
-4.8980873823165894e-01 4.9601224064826965e-01</leafValues></_>
<_>
<internalNodes>
0 -1 10 830986078 978498018 1212634268 -7868086 -338953233
1955102955 2076283886 2121920686</internalNodes>
<leafValues>
-7.6825737953186035e-01 3.0441379547119141e-01</leafValues></_>
<_>
<internalNodes>
0 -1 49 -464527326 -266403822 61910 -764964158 -804131566
690462785 105570303 -492711073</internalNodes>
<leafValues>
-6.0366225242614746e-01 3.9621585607528687e-01</leafValues></_></weakClassifiers></_>
<!-- stage 9 -->
<_>
<maxWeakCount>6</maxWeakCount>
<stageThreshold>-1.7895716428756714e+00</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 21 1364573183 -582112869 2058695295 -6161477
-1357251393 -662336771 -89413125 -3556673</internalNodes>
<leafValues>
-6.8916153907775879e-01 2.6106193661689758e-01</leafValues></_>
<_>
<internalNodes>
0 -1 30 -1657268752 -45612848 486638045 1067013433
-363278408 -1732736120 -1614242561 523377052</internalNodes>
<leafValues>
-6.9656443595886230e-01 3.0079075694084167e-01</leafValues></_>
<_>
<internalNodes>
0 -1 45 -385876192 1524605990 -2059037737 -2645738
-1884430347 -542584354 1737419071 692039206</internalNodes>
<leafValues>
-6.3620084524154663e-01 3.1837970018386841e-01</leafValues></_>
<_>
<internalNodes>
0 -1 12 -279972306 -1360670259 -1823676278 -87565865
1161158962 2003271952 -878236737 -203951493</internalNodes>
<leafValues>
-6.3273507356643677e-01 3.5124236345291138e-01</leafValues></_>
<_>
<internalNodes>
0 -1 40 -715361008 -1756993828 -2084937297 -36753112
-1299701250 2074255770 -2096715345 153813130</internalNodes>
<leafValues>
-6.5382730960845947e-01 3.5776382684707642e-01</leafValues></_>
<_>
<internalNodes>
0 -1 20 -1818091375 -741326623 -691960385 -1116518535
-1333224993 -560015974 -1901407763 -1346762324</internalNodes>
<leafValues>
-4.9002870917320251e-01 4.4960626959800720e-01</leafValues></_></weakClassifiers></_>
<!-- stage 10 -->
<_>
<maxWeakCount>7</maxWeakCount>
<stageThreshold>-1.0691219568252563e+00</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 37 -81003525 461435274 -1012705865 -10497345 -350241793
-91580696 2005598335 -7249</internalNodes>
<leafValues>
-6.5210670232772827e-01 3.1233596801757812e-01</leafValues></_>
<_>
<internalNodes>
0 -1 57 -826278137 1217917183 -1265116640 1813248574
1159199588 1243425723 -473966044 -520881157</internalNodes>
<leafValues>
-6.4328962564468384e-01 3.0107370018959045e-01</leafValues></_>
<_>
<internalNodes>
0 -1 29 -546572126 -184109686 1342882304 -754068276
1653012961 1074103457 1090766283 868218843</internalNodes>
<leafValues>
-5.6011921167373657e-01 3.4936606884002686e-01</leafValues></_>
<_>
<internalNodes>
0 -1 31 1980780701 -1115998562 296448463 -121827015
-1147606888 -1346840419 985705599 -1625683479</internalNodes>
<leafValues>
-4.6067923307418823e-01 4.4133010506629944e-01</leafValues></_>
<_>
<internalNodes>
0 -1 11 1189554799 1319077781 1998031309 -22283985 833051954
1385818172 -138953845 -1879377169</internalNodes>
<leafValues>
-5.6165486574172974e-01 3.9155927300453186e-01</leafValues></_>
<_>
<internalNodes>
0 -1 52 -653270518 1105913099 -1022296000 -796692293
690149379 1359175685 -218376541 -1297088609</internalNodes>
<leafValues>
-5.0313746929168701e-01 4.5016640424728394e-01</leafValues></_>
<_>
<internalNodes>
0 -1 25 1677398999 -9492915 -1460127170 597994023
-2143238736 -657328155 -166293761 -1611679921</internalNodes>
<leafValues>
-4.3750682473182678e-01 5.0037056207656860e-01</leafValues></_></weakClassifiers></_></stages>
<features>
<_>
<rect>
0 0 3 1</rect></_>
<_>
<rect>
0 2 7 3</rect></_>
<_>
<rect>
0 4 2 2</rect></_>
<_>
<rect>
0 4 9 5</rect></_>
<_>
<rect>
0 8 4 4</rect></_>
<_>
<rect>
0 9 9 3</rect></_>
<_>
<rect>
1 0 5 1</rect></_>
<_>
<rect>
1 4 9 3</rect></_>
<_>
<rect>
1 5 2 3</rect></_>
<_>
<rect>
1 6 2 1</rect></_>
<_>
<rect>
1 7 9 4</rect></_>
<_>
<rect>
2 4 2 1</rect></_>
<_>
<rect>
2 6 3 1</rect></_>
<_>
<rect>
3 1 3 5</rect></_>
<_>
<rect>
3 1 7 1</rect></_>
<_>
<rect>
3 3 3 3</rect></_>
<_>
<rect>
3 4 3 3</rect></_>
<_>
<rect>
3 5 1 3</rect></_>
<_>
<rect>
4 0 3 1</rect></_>
<_>
<rect>
4 17 3 1</rect></_>
<_>
<rect>
5 1 3 1</rect></_>
<_>
<rect>
5 2 6 4</rect></_>
<_>
<rect>
5 15 4 1</rect></_>
<_>
<rect>
6 2 4 1</rect></_>
<_>
<rect>
6 6 4 2</rect></_>
<_>
<rect>
6 7 3 2</rect></_>
<_>
<rect>
6 8 4 1</rect></_>
<_>
<rect>
6 16 4 1</rect></_>
<_>
<rect>
7 7 5 1</rect></_>
<_>
<rect>
7 11 1 1</rect></_>
<_>
<rect>
7 14 4 1</rect></_>
<_>
<rect>
7 15 4 1</rect></_>
<_>
<rect>
8 16 4 1</rect></_>
<_>
<rect>
9 7 1 2</rect></_>
<_>
<rect>
9 15 4 1</rect></_>
<_>
<rect>
9 15 5 1</rect></_>
<_>
<rect>
10 5 1 3</rect></_>
<_>
<rect>
10 5 4 3</rect></_>
<_>
<rect>
10 6 1 3</rect></_>
<_>
<rect>
10 8 3 1</rect></_>
<_>
<rect>
10 9 3 1</rect></_>
<_>
<rect>
11 5 1 3</rect></_>
<_>
<rect>
11 9 1 2</rect></_>
<_>
<rect>
12 0 5 3</rect></_>
<_>
<rect>
12 5 1 3</rect></_>
<_>
<rect>
13 0 5 4</rect></_>
<_>
<rect>
13 5 1 1</rect></_>
<_>
<rect>
13 5 1 3</rect></_>
<_>
<rect>
13 5 3 3</rect></_>
<_>
<rect>
13 7 1 2</rect></_>
<_>
<rect>
13 8 5 4</rect></_>
<_>
<rect>
13 11 5 3</rect></_>
<_>
<rect>
14 5 1 1</rect></_>
<_>
<rect>
14 5 1 3</rect></_>
<_>
<rect>
15 5 1 3</rect></_>
<_>
<rect>
16 0 2 1</rect></_>
<_>
<rect>
16 5 2 1</rect></_>
<_>
<rect>
17 6 3 3</rect></_>
<_>
<rect>
18 5 2 1</rect></_>
<_>
<rect>
19 11 1 1</rect></_>
<_>
<rect>
22 6 1 1</rect></_></features></cascade>
</opencv_storage>

View File

@@ -47,6 +47,10 @@ if ( NOT DEFINED WITH_BINDING_JAVA )
SET(WITH_BINDING_JAVA ON) SET(WITH_BINDING_JAVA ON)
ENDIF() ENDIF()
if ( NOT DEFINED WITH_BINDING_C )
SET(WITH_BINDING_C ON)
ENDIF()
if ( NOT DEFINED WITH_BINDING_PYTHON ) if ( NOT DEFINED WITH_BINDING_PYTHON )
SET(WITH_BINDING_PYTHON ON) SET(WITH_BINDING_PYTHON ON)
ENDIF() ENDIF()
@@ -204,6 +208,10 @@ if (WITH_BINDING_PYTHON)
add_subdirectory(bindings/python) add_subdirectory(bindings/python)
ENDIF() ENDIF()
if (WITH_BINDING_C)
add_subdirectory(bindings/c)
ENDIF()
if (WITH_BINDING_GO) if (WITH_BINDING_GO)
set(OPENALPR_LIB_GO openalprgo) set(OPENALPR_LIB_GO openalprgo)
set(TAG_OPENALPR_LIB_GO "-l${OPENALPR_LIB_GO}") set(TAG_OPENALPR_LIB_GO "-l${OPENALPR_LIB_GO}")

View File

@@ -0,0 +1,24 @@
cmake_minimum_required (VERSION 2.6)
include_directories(../../openalpr/)
set(alprc_source
alpr_c.cpp
)
add_library(openalprc SHARED ${alprc_source})
#set_target_properties(openalprc PROPERTIES SOVERSION ${OPENALPR_MAJOR_VERSION})
TARGET_LINK_LIBRARIES(openalprc openalpr)
add_executable(alprc_test alprc_test.c)
TARGET_LINK_LIBRARIES(alprc_test openalprc)
install (TARGETS openalprc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install (FILES alpr_c.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)

117
src/bindings/c/alpr_c.cpp Normal file
View File

@@ -0,0 +1,117 @@
/*
* Copyright (c) 2016 OpenALPR Technology, Inc.
* Open source Automated License Plate Recognition [http://www.openalpr.com]
*
* This file is part of OpenALPR.
*
* OpenALPR is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License
* version 3 as published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "alpr_c.h"
#include <alpr.h>
#include <string.h>
#include <vector>
#include <stdlib.h>
OPENALPRC_DLL_EXPORT OPENALPR* openalpr_init(const char* country, const char* configFile, const char* runtimeDir)
{
alpr::Alpr* alpr_inst = new alpr::Alpr(country, configFile, runtimeDir);
return (OPENALPR*) alpr_inst;
}
OPENALPRC_DLL_EXPORT int openalpr_is_loaded(OPENALPR* instance)
{
return (int) ((alpr::Alpr*) instance)->isLoaded();
}
// Set the country used for plate recognition
OPENALPRC_DLL_EXPORT void openalpr_set_country(OPENALPR* instance, const char* country)
{
((alpr::Alpr*) instance)->setCountry(country);
}
// Update the prewarp setting without reloading the library
OPENALPRC_DLL_EXPORT void openalpr_set_prewarp(OPENALPR* instance, const char* prewarp_config)
{
((alpr::Alpr*) instance)->setPrewarp(prewarp_config);
}
// Update the detection mask without reloading the library
OPENALPRC_DLL_EXPORT void openalpr_set_mask(OPENALPR* instance, unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight)
{
((alpr::Alpr*) instance)->setMask(pixelData, bytesPerPixel, imgWidth, imgHeight);
}
// Enable/disable region detection. Pass a 0 or 1
OPENALPRC_DLL_EXPORT void openalpr_set_detect_region(OPENALPR* instance, int detectRegion)
{
((alpr::Alpr*) instance)->setDetectRegion(detectRegion);
}
OPENALPRC_DLL_EXPORT void openalpr_set_topn(OPENALPR* instance, int topN)
{
((alpr::Alpr*) instance)->setTopN(topN);
}
OPENALPRC_DLL_EXPORT void openalpr_set_default_region(OPENALPR* instance, const char* region)
{
((alpr::Alpr*) instance)->setDefaultRegion(region);
}
// Recognizes the provided image and responds with JSON.
// Caller must call free() on the returned object
OPENALPRC_DLL_EXPORT char* openalpr_recognize_rawimage(OPENALPR* instance, unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight, AlprCRegionOfInterest roi)
{
std::vector<alpr::AlprRegionOfInterest> rois;
alpr::AlprRegionOfInterest cpproi(roi.x, roi.y, roi.width, roi.height);
rois.push_back(cpproi);
alpr::AlprResults results = ((alpr::Alpr*) instance)->recognize(pixelData,bytesPerPixel, imgWidth, imgHeight, rois);
std::string json_string = alpr::Alpr::toJson(results);
char* result_obj = strdup(json_string.c_str());
return result_obj;
}
OPENALPRC_DLL_EXPORT char* openalpr_recognize_encodedimage(OPENALPR* instance, unsigned char* bytes, long long length, AlprCRegionOfInterest roi)
{
std::vector<alpr::AlprRegionOfInterest> rois;
alpr::AlprRegionOfInterest cpproi(roi.x, roi.y, roi.width, roi.height);
rois.push_back(cpproi);
std::vector<char> byte_vector(length);
memcpy(&byte_vector[0], bytes, length*sizeof(char));
alpr::AlprResults results = ((alpr::Alpr*) instance)->recognize(byte_vector, rois);
std::string json_string = alpr::Alpr::toJson(results);
char* result_obj = strdup(json_string.c_str());
return result_obj;
}
OPENALPRC_DLL_EXPORT void openalpr_free_response_string(char* response)
{
free(response);
}
OPENALPRC_DLL_EXPORT void openalpr_cleanup(OPENALPR* instance)
{
delete ((alpr::Alpr*) instance);
}

84
src/bindings/c/alpr_c.h Normal file
View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 2016 OpenALPR Technology, Inc.
* Open source Automated License Plate Recognition [http://www.openalpr.com]
*
* This file is part of OpenALPR.
*
* OpenALPR is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License
* version 3 as published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ALPR_C_H
#define ALPR_C_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WIN32
#define OPENALPRC_DLL_EXPORT __declspec( dllexport )
#else
#define OPENALPRC_DLL_EXPORT
#endif
typedef void OPENALPR;
struct AlprCRegionOfInterest
{
int x;
int y;
int width;
int height;
};
// Initializes the openALPR library and returns a pointer to the OpenALPR instance
OPENALPR* openalpr_init(const char* country, const char* configFile, const char* runtimeDir);
// Returns 1 if the library was loaded successfully, 0 otherwise
int openalpr_is_loaded(OPENALPR* instance);
// Set the country used for plate recognition
void openalpr_set_country(OPENALPR* instance, const char* country);
// Update the prewarp setting without reloading the library
void openalpr_set_prewarp(OPENALPR* instance, const char* prewarp_config);
// Update the detection mask without reloading the library
void openalpr_set_mask(OPENALPR* instance, unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight);
// Enable/disable region detection. Pass a 0 or 1
void openalpr_set_detect_region(OPENALPR* instance, int detectRegion);
void openalpr_set_topn(OPENALPR* instance, int topN);
void openalpr_set_default_region(OPENALPR* instance, const char* region);
// Recognizes the provided image and responds with JSON.
// Image is expected to be raw pixel data (BGR, 3 channels)
// Caller must call free() on the returned object
char* openalpr_recognize_rawimage(OPENALPR* instance, unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight, struct AlprCRegionOfInterest roi);
// Recognizes the encoded (e.g., JPEG, PNG) image. bytes are the raw bytes for the image data.
char* openalpr_recognize_encodedimage(OPENALPR* instance, unsigned char* bytes, long long length, struct AlprCRegionOfInterest roi);
// Frees a char* response that was provided from a recognition request.
// This is required for interoperating with managed languages (e.g., C#) that can't free the memory themselves
void openalpr_free_response_string(char* response);
// Free the memory for the OpenALPR instance created with openalpr_init
void openalpr_cleanup(OPENALPR* instance);
#ifdef __cplusplus
}
#endif
#endif /* ALPR_C_H */

View File

@@ -0,0 +1,80 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: alprc_test.c
* Author: mhill
*
* Created on October 16, 2016, 11:09 AM
*/
#include <stdio.h>
#include <stdlib.h>
#include "alpr_c.h"
void ReadFile(const char *name, char** buffer, size_t* size)
{
FILE *file;
//Open file
file = fopen(name, "rb");
if (!file)
{
fprintf(stderr, "Unable to open file %s", name);
return;
}
//Get file length
fseek(file, 0, SEEK_END);
*size=ftell(file);
fseek(file, 0, SEEK_SET);
//Allocate memory
*buffer=(char *)malloc(*size+1);
if (!(*buffer))
{
fprintf(stderr, "Memory error!");
fclose(file);
return;
}
//Read file contents into buffer
fread(*buffer, *size, 1, file);
fclose(file);
}
/*
*
*/
int main(int argc, char** argv) {
OPENALPR* openalpr = openalpr_init("us", "/etc/openalpr/openalpr.conf", "/usr/share/openalpr/runtime_data/");
const char* IMAGE_FILE="/storage/projects/alpr/samples/testing/car1.jpg";
size_t size;
char* buffer;
printf("Loading image: %s\n", IMAGE_FILE);
ReadFile(IMAGE_FILE, &buffer, &size);
struct AlprCRegionOfInterest roi;
roi.x = 0;
roi.y = 0;
roi.width = 1024;
roi.height = 768;
printf("Recognizing plates\n");
printf("Image size: %lu\n", (long) size);
char* plate_json = openalpr_recognize_encodedimage(openalpr, buffer, size, roi);
printf("results:\n%s\n", plate_json);
free(plate_json);
free(buffer);
openalpr_cleanup(openalpr);
return (EXIT_SUCCESS);
}

BIN
src/bindings/go/libopenalprgo.so Executable file

Binary file not shown.

View File

@@ -22,7 +22,7 @@ type Alpr struct {
type AlprResults struct { type AlprResults struct {
EpochTime int64 `json:"epoch_time"` EpochTime int64 `json:"epoch_time"`
ImgWidth int `json:"img_witdh"` ImgWidth int `json:"img_width"`
ImgHeight int `json:"img_height"` ImgHeight int `json:"img_height"`
TotalProcessingTimeMs float32 `json:"processing_time_ms"` TotalProcessingTimeMs float32 `json:"processing_time_ms"`
Plates []AlprPlateResult `json:"results"` Plates []AlprPlateResult `json:"results"`

View File

@@ -47,6 +47,14 @@ JNIEXPORT jstring JNICALL Java_com_openalpr_jni_Alpr_native_1recognize__Ljava_la
JNIEXPORT jstring JNICALL Java_com_openalpr_jni_Alpr_native_1recognize___3B JNIEXPORT jstring JNICALL Java_com_openalpr_jni_Alpr_native_1recognize___3B
(JNIEnv *, jobject, jbyteArray); (JNIEnv *, jobject, jbyteArray);
/*
* Class: com_openalpr_jni_Alpr
* Method: native_recognize
* Signature: (JIII)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_openalpr_jni_Alpr_native_1recognize__JIII
(JNIEnv *, jobject, jlong, jint, jint, jint);
/* /*
* Class: com_openalpr_jni_Alpr * Class: com_openalpr_jni_Alpr
* Method: set_default_region * Method: set_default_region

View File

@@ -88,6 +88,24 @@ JNIEXPORT jstring JNICALL Java_com_openalpr_jni_Alpr_native_1recognize___3B
return env->NewStringUTF(json.c_str()); return env->NewStringUTF(json.c_str());
} }
JNIEXPORT jstring JNICALL Java_com_openalpr_jni_Alpr_native_1recognize__JIII
(JNIEnv *env, jobject thisObj, jlong data, jint bytesPerPixel, jint width, jint height)
{
//printf("Recognize data pointer");
AlprResults results = nativeAlpr->recognize(
reinterpret_cast<unsigned char*>(data),
static_cast<int>(bytesPerPixel),
static_cast<int>(width),
static_cast<int>(height),
std::vector<AlprRegionOfInterest>());
std::string json = Alpr::toJson(results);
return env->NewStringUTF(json.c_str());
}
JNIEXPORT void JNICALL Java_com_openalpr_jni_Alpr_set_1default_1region JNIEXPORT void JNICALL Java_com_openalpr_jni_Alpr_set_1default_1region
(JNIEnv *env, jobject thisObj, jstring jdefault_region) (JNIEnv *env, jobject thisObj, jstring jdefault_region)
{ {

View File

@@ -15,6 +15,7 @@ public class Alpr {
private native boolean is_loaded(); private native boolean is_loaded();
private native String native_recognize(String imageFile); private native String native_recognize(String imageFile);
private native String native_recognize(byte[] imageBytes); private native String native_recognize(byte[] imageBytes);
private native String native_recognize(long imageData, int bytesPerPixel, int imgWidth, int imgHeight);
private native void set_default_region(String region); private native void set_default_region(String region);
private native void detect_region(boolean detectRegion); private native void detect_region(boolean detectRegion);
@@ -62,6 +63,18 @@ public class Alpr {
} }
public AlprResults recognize(long imageData, int bytesPerPixel, int imgWidth, int imgHeight) throws AlprException
{
try {
String json = native_recognize(imageData, bytesPerPixel, imgWidth, imgHeight);
return new AlprResults(json);
} catch (JSONException e)
{
throw new AlprException("Unable to parse ALPR results");
}
}
public void setTopN(int topN) public void setTopN(int topN)
{ {
set_top_n(topN); set_top_n(topN);

View File

@@ -45,7 +45,7 @@ class Alpr():
try: try:
# Load the .dll for Windows and the .so for Unix-based # Load the .dll for Windows and the .so for Unix-based
if platform.system().lower().find("windows") != -1: if platform.system().lower().find("windows") != -1:
self._openalprpy_lib = ctypes.cdll.LoadLibrary("openalprpy.dll") self._openalprpy_lib = ctypes.cdll.LoadLibrary("libopenalprpy.dll")
elif platform.system().lower().find("darwin") != -1: elif platform.system().lower().find("darwin") != -1:
self._openalprpy_lib = ctypes.cdll.LoadLibrary("libopenalprpy.dylib") self._openalprpy_lib = ctypes.cdll.LoadLibrary("libopenalprpy.dylib")
else: else:
@@ -100,6 +100,7 @@ class Alpr():
self.alpr_pointer = self._initialize_func(country, config_file, runtime_dir) self.alpr_pointer = self._initialize_func(country, config_file, runtime_dir)
self.loaded = True
def unload(self): def unload(self):
""" """
@@ -107,6 +108,9 @@ class Alpr():
:return: None :return: None
""" """
if self.loaded:
self.loaded = False
self._openalprpy_lib.dispose(self.alpr_pointer) self._openalprpy_lib.dispose(self.alpr_pointer)
def is_loaded(self): def is_loaded(self):
@@ -115,6 +119,9 @@ class Alpr():
:return: A bool representing if OpenALPR is loaded or not :return: A bool representing if OpenALPR is loaded or not
""" """
if not self.loaded:
return False
return self._is_loaded_func(self.alpr_pointer) return self._is_loaded_func(self.alpr_pointer)
def recognize_file(self, file_path): def recognize_file(self, file_path):

View File

@@ -6,7 +6,7 @@
extern "C" { extern "C" {
#if defined(_MSC_VER) #if defined(WIN32)
// Microsoft // Microsoft
#define OPENALPR_EXPORT __declspec(dllexport) #define OPENALPR_EXPORT __declspec(dllexport)
#else #else

View File

@@ -183,6 +183,8 @@ int main( int argc, const char** argv )
pid_t pid; pid_t pid;
std::vector<tthread::thread*> threads;
for (int i = 0; i < daemon_config.stream_urls.size(); i++) for (int i = 0; i < daemon_config.stream_urls.size(); i++)
{ {
pid = fork(); pid = fork();
@@ -203,6 +205,7 @@ int main( int argc, const char** argv )
tdata->clock_on = clockOn; tdata->clock_on = clockOn;
tthread::thread* thread_recognize = new tthread::thread(streamRecognitionThread, (void*) tdata); tthread::thread* thread_recognize = new tthread::thread(streamRecognitionThread, (void*) tdata);
threads.push_back(thread_recognize);
if (daemon_config.uploadData) if (daemon_config.uploadData)
{ {
@@ -210,21 +213,21 @@ int main( int argc, const char** argv )
UploadThreadData* udata = new UploadThreadData(); UploadThreadData* udata = new UploadThreadData();
udata->upload_url = daemon_config.upload_url; udata->upload_url = daemon_config.upload_url;
tthread::thread* thread_upload = new tthread::thread(dataUploadThread, (void*) udata ); tthread::thread* thread_upload = new tthread::thread(dataUploadThread, (void*) udata );
threads.push_back(thread_upload);
} }
break; break;
} }
// Parent process will continue and spawn more children // Parent process will continue and spawn more children
} }
while (daemon_active) while (daemon_active)
{ alpr::sleep_ms(30);
usleep(30000);
}
for (uint16_t i = 0; i < threads.size(); i++)
delete threads[i];
return 0;
} }

View File

@@ -145,7 +145,27 @@ int main( int argc, const char** argv )
{ {
std::string filename = filenames[i]; std::string filename = filenames[i];
if (filename == "stdin") if (filename == "-")
{
std::vector<uchar> data;
int c;
while ((c = fgetc(stdin)) != EOF)
{
data.push_back((uchar) c);
}
frame = cv::imdecode(cv::Mat(data), 1);
if (!frame.empty())
{
detectandshow(&alpr, frame, "", outputJson);
}
else
{
std::cerr << "Image invalid: " << filename << std::endl;
}
}
else if (filename == "stdin")
{ {
std::string filename; std::string filename;
while (std::getline(std::cin, filename)) while (std::getline(std::cin, filename))

View File

@@ -30,6 +30,7 @@
#include <float.h> #include <float.h>
#include <limits.h> #include <limits.h>
#include <ctype.h> #include <ctype.h>
#include <locale.h>
#include "cjson.h" #include "cjson.h"
static const char *ep; static const char *ep;
@@ -117,6 +118,9 @@ static const char *parse_number(cJSON *item,const char *num)
/* Render the number nicely from the given item into a string. */ /* Render the number nicely from the given item into a string. */
static char *print_number(cJSON *item) static char *print_number(cJSON *item)
{ {
char * locale = setlocale(LC_ALL, NULL);
setlocale(LC_NUMERIC, "C");
char *str; char *str;
double d=item->valuedouble; double d=item->valuedouble;
if (fabs(((double)item->valueint)-d)<=DBL_EPSILON && d<=INT_MAX && d>=INT_MIN) if (fabs(((double)item->valueint)-d)<=DBL_EPSILON && d<=INT_MAX && d>=INT_MIN)
@@ -134,6 +138,8 @@ static char *print_number(cJSON *item)
else sprintf(str,"%f",d); else sprintf(str,"%f",d);
} }
} }
setlocale(LC_NUMERIC, locale);
return str; return str;
} }

View File

@@ -19,6 +19,7 @@
#include "config_helper.h" #include "config_helper.h"
#include <clocale>
#include <iostream> #include <iostream>
using namespace std; using namespace std;
@@ -37,7 +38,13 @@ namespace alpr
return defaultValue; return defaultValue;
} }
char * locale = std::setlocale(LC_ALL, NULL);
setlocale(LC_NUMERIC, "C");
float val = atof(pszValue); float val = atof(pszValue);
std::setlocale(LC_NUMERIC, locale);
return val; return val;
} }
@@ -52,12 +59,17 @@ namespace alpr
std::vector<float> response; std::vector<float> response;
char * locale = std::setlocale(LC_ALL, NULL);
std::setlocale(LC_NUMERIC, "C");
// output all of the items // output all of the items
CSimpleIniA::TNamesDepend::const_iterator i; CSimpleIniA::TNamesDepend::const_iterator i;
for (i = values.begin(); i != values.end(); ++i) { for (i = values.begin(); i != values.end(); ++i) {
response.push_back(atof(i->pItem)); response.push_back(atof(i->pItem));
} }
std::setlocale(LC_NUMERIC, locale);
return response; return response;
} }

View File

@@ -121,7 +121,7 @@ namespace alpr
float maxWidth = ((float) w) * (config->maxPlateWidthPercent / 100.0f) * scale_factor; float maxWidth = ((float) w) * (config->maxPlateWidthPercent / 100.0f) * scale_factor;
float maxHeight = ((float) h) * (config->maxPlateHeightPercent / 100.0f) * scale_factor; float maxHeight = ((float) h) * (config->maxPlateHeightPercent / 100.0f) * scale_factor;
Size minPlateSize(config->minPlateSizeWidthPx * scale_factor, config->minPlateSizeHeightPx * scale_factor); Size minPlateSize(config->minPlateSizeWidthPx, config->minPlateSizeHeightPx);
Size maxPlateSize(maxWidth, maxHeight); Size maxPlateSize(maxWidth, maxHeight);
vector<Rect> allRegions = find_plates(cropped, minPlateSize, maxPlateSize); vector<Rect> allRegions = find_plates(cropped, minPlateSize, maxPlateSize);

View File

@@ -48,7 +48,12 @@ namespace alpr
std::vector<OcrChar> chars = recognize_line(line_idx, pipeline_data); std::vector<OcrChar> chars = recognize_line(line_idx, pipeline_data);
for (uint32_t i = 0; i < chars.size(); i++) for (uint32_t i = 0; i < chars.size(); i++)
postProcessor.addLetter(chars[i].letter, line_idx, chars[i].char_index, chars[i].confidence); {
// For multi-line plates, set the character indexes to sequential values based on the line number
int line_ordered_index = (line_idx * config->postProcessMaxCharacters) + chars[i].char_index;
postProcessor.addLetter(chars[i].letter, line_idx, line_ordered_index, chars[i].confidence);
absolute_charpos++;
}
} }

View File

@@ -17,7 +17,7 @@
long tv_nsec; // Nanoseconds - [0, 999999999] long tv_nsec; // Nanoseconds - [0, 999999999]
}; };
#else #else
#define timespec timeval
#endif #endif
#else #else
#include <sys/time.h> #include <sys/time.h>