Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 50 additions & 100 deletions Sample/OpenALPRSample/app/src/main/assets/runtime_data/openalpr.conf
Original file line number Diff line number Diff line change
@@ -1,40 +1,64 @@
[common]

; Specify the path to the runtime data directory
runtime_dir = /data/data/com.sandro.openalprsample/runtime_data


ocr_img_size_percent = 1.33333333
state_id_img_size_percent = 2.0

; detection will ignore plates that are too large. This is a good efficiency technique to use if the
; plates are going to be a fixed distance away from the camera (e.g., you will never see plates that fill
; Calibrating your camera improves detection accuracy in cases where vehicle plates are captured at a steep angle
; Use the openalpr-utils-calibrate utility to calibrate your fixed camera to adjust for an angle
; Once done, update the prewarp config with the values obtained from the tool
prewarp =

; detection will ignore plates that are too large. This is a good efficiency technique to use if the
; plates are going to be a fixed distance away from the camera (e.g., you will never see plates that fill
; up the entire image
max_plate_width_percent = 100
max_plate_height_percent = 100

; detection_iteration_increase is the percentage that the LBP frame increases each iteration.
; It must be greater than 1.0. A value of 1.01 means increase by 1%, 1.10 increases it by 10% each time.
; So a 1% increase would be ~10x slower than 10% to process, but it has a higher chance of landing
; It must be greater than 1.0. A value of 1.01 means increase by 1%, 1.10 increases it by 10% each time.
; So a 1% increase would be ~10x slower than 10% to process, but it has a higher chance of landing
; directly on the plate and getting a strong detection
detection_iteration_increase = 1.1

; The minimum detection strength determines how sure the detection algorithm must be before signaling that
; a plate region exists. Technically this corresponds to LBP nearest neighbors (e.g., how many detections
; The minimum detection strength determines how sure the detection algorithm must be before signaling that
; a plate region exists. Technically this corresponds to LBP nearest neighbors (e.g., how many detections
; are clustered around the same area). For example, 2 = very lenient, 9 = very strict.
detection_strictness = 3

; The detection doesn't necessarily need an extremely high resolution image in order to detect plates
; Using a smaller input image should still find the plates and will do it faster
; Tweaking the max_detection_input values will resize the input image if it is larger than these sizes
; Tweaking the max_detection_input values will resize the input image if it is larger than these sizes
; max_detection_input_width/height are specified in pixels
max_detection_input_width = 1280
max_detection_input_height = 720

opencl_enabled = 0
multithreading_cores = 1
; detector is the technique used to find license plate regions in an image. Value can be set to
; lbpcpu - default LBP-based detector uses the system CPU
; lbpgpu - LBP-based detector that uses Nvidia GPU to increase recognition speed.
; lbpopencl - LBP-based detector that uses OpenCL GPU to increase recognition speed. Requires OpenCV 3.0
; morphcpu - Experimental detector that detects white rectangles in an image. Does not require training.
detector = lbpcpu

; If set to true, all results must match a postprocess text pattern if a pattern is available.
; If not, the result is disqualified.
must_match_pattern = 0

; Bypasses plate detection. If this is set to 1, the library assumes that each region provided is a likely plate area.
skip_detection = 0

; Specifies the full path to an image file that constrains the detection area. Only the plate regions allowed through the mask
; will be analyzed. The mask image must match the resolution of your image to be analyzed. The mask is black and white.
; Black areas will be ignored, white areas will be searched. An empty value means no mask (scan the entire image)
detection_mask_image =

; OpenALPR can scan the same image multiple times with different randomization. Setting this to a value larger than
; 1 may increase accuracy, but will increase processing time linearly (e.g., analysis_count = 3 is 3x slower)
analysis_count = 1

; OpenALPR detects high-contrast plate crops and uses an alternative edge detection technique. Setting this to 0.0
; would classify ALL images as high-contrast, setting it to 1.0 would classify no images as high-contrast.
contrast_detection_threshold = 0.3

max_plate_angle_degrees = 15

Expand All @@ -47,92 +71,18 @@ postprocess_min_confidence = 65
; chance that the character is incorrect and will be skipped. Value is a confidence percent
postprocess_confidence_skip_level = 80

; Reduces the total permutations to consider for scoring.
postprocess_max_substitutions = 2

; Results with fewer characters will be discarded
postprocess_min_characters = 4
postprocess_max_characters = 8

[debug]
general = 0
timing = 0
state_id = 0
plate_lines = 0
plate_corners = 0
char_regions = 0
char_segment = 0
char_analysis = 0
color_filter = 0
ocr = 0
postprocess = 0
show_images = 0
pause_on_frame = 0

;;; Country Specific variables ;;;;

[us]

; 30-50, 40-60, 50-70, 60-80
char_analysis_min_pct = 0.30
char_analysis_height_range = 0.20
char_analysis_height_step_size = 0.10
char_analysis_height_num_steps = 4

segmentation_min_box_width_px = 4
segmentation_min_charheight_percent = 0.5;
segmentation_max_segment_width_percent_vs_average = 1.35;

plate_width_mm = 304.8
plate_height_mm = 152.4

char_height_mm = 70
char_width_mm = 35
char_whitespace_top_mm = 38
char_whitespace_bot_mm = 38

template_max_width_px = 120
template_max_height_px = 60

; Higher sensitivity means less lines
plateline_sensitivity_vertical = 25
plateline_sensitivity_horizontal = 45

; Regions smaller than this will be disqualified
min_plate_size_width_px = 70
min_plate_size_height_px = 35

ocr_language = lus

[eu]

; 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_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

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 = 100
min_plate_size_height_px = 20

ocr_language = leu
debug_general = 0
debug_timing = 0
debug_detector = 0
debug_prewarp = 0
debug_state_id = 0
debug_plate_lines = 0
debug_plate_corners = 0
debug_char_segment = 0
debug_char_analysis = 0
debug_color_filter = 0
debug_ocr = 0
debug_postprocess = 0
debug_show_images = 0
debug_pause_on_frame = 0
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
String result = OpenALPR.Factory.create(MainActivity.this, ANDROID_DATA_DIR).recognizeWithCountryRegionNConfig("us", "", destination.getAbsolutePath(), openAlprConfFile, 10);
OpenALPR instance = OpenALPR.create(MainActivity.this, ANDROID_DATA_DIR, openAlprConfFile, "eu", "pt", 10);

Log.d("ALPR VERSION", instance.getVersion());

String result = instance.recognize(destination.getAbsolutePath());

instance.dispose();

Log.d("OPEN ALPR", result);

Expand Down
4 changes: 2 additions & 2 deletions Sample/OpenALPRSample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Oct 21 11:34:03 PDT 2015
#Sun Mar 05 22:41:36 WET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
Loading