jabcode
|
JABCode detector. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "jabcode.h"
#include "detector.h"
#include "decoder.h"
#include "encoder.h"
Functions | |
jab_boolean | checkPatternCross (jab_int32 *state_count, jab_float *module_size) |
Check the proportion of layer sizes in finder pattern. More... | |
jab_boolean | checkModuleSize (jab_float size_r, jab_float size_g, jab_float size_b) |
Check if the input module sizes are the same. More... | |
jab_boolean | seekPattern (jab_bitmap *ch, jab_int32 row, jab_int32 col, jab_int32 *start, jab_int32 *end, jab_float *center, jab_float *module_size, jab_int32 *skip) |
Find a candidate scanline of finder pattern. More... | |
jab_boolean | seekPatternHorizontal (jab_byte *row, jab_int32 *startx, jab_int32 *endx, jab_float *centerx, jab_float *module_size, jab_int32 *skip) |
Find a candidate horizontal scanline of finder pattern. More... | |
jab_int32 | crossCheckPatternDiagonal (jab_bitmap *image, jab_int32 type, jab_float module_size_max, jab_float *centerx, jab_float *centery, jab_float *module_size, jab_int32 *dir, jab_boolean both_dir) |
Crosscheck the finder pattern candidate in diagonal direction. More... | |
jab_boolean | crossCheckPatternVertical (jab_bitmap *image, jab_int32 module_size_max, jab_float centerx, jab_float *centery, jab_float *module_size) |
Crosscheck the finder pattern candidate in vertical direction. More... | |
jab_boolean | crossCheckPatternHorizontal (jab_bitmap *image, jab_float module_size_max, jab_float *centerx, jab_float centery, jab_float *module_size) |
Crosscheck the finder pattern candidate in horizontal direction. More... | |
jab_boolean | crossCheckPatternCh (jab_bitmap *ch, jab_int32 type, jab_int32 h_v, jab_float module_size_max, jab_float *module_size, jab_float *centerx, jab_float *centery, jab_int32 *dir, jab_int32 *dcc) |
Crosscheck the finder pattern candidate in one channel. More... | |
jab_boolean | crossCheckPattern (jab_bitmap *ch[], jab_finder_pattern *fp, jab_int32 h_v) |
Crosscheck the finder pattern candidate. More... | |
jab_int32 | saveAlignmentPattern (jab_alignment_pattern *ap, jab_alignment_pattern *aps, jab_int32 *counter) |
Save a found alignment pattern into the alignment pattern list. More... | |
void | saveFinderPattern (jab_finder_pattern *fp, jab_finder_pattern *fps, jab_int32 *counter, jab_int32 *fp_type_count) |
Save a found finder pattern into the finder pattern list. More... | |
void | drawFoundFinderPatterns (jab_finder_pattern *fps, jab_int32 number, jab_int32 color) |
void | removeBadPatterns (jab_finder_pattern *fps, jab_int32 fp_count, jab_float mean, jab_float threshold) |
Remove the finder patterns with greatly different module size. More... | |
jab_finder_pattern | getBestPattern (jab_finder_pattern *fps, jab_int32 fp_count) |
Find the finder pattern with most detected times. More... | |
jab_int32 | selectBestPatterns (jab_finder_pattern *fps, jab_int32 fp_count, jab_int32 *fp_type_count) |
Select the best finder patterns out of the list. More... | |
void | scanPatternVertical (jab_bitmap *ch[], jab_int32 min_module_size, jab_finder_pattern *fps, jab_int32 *fp_type_count, jab_int32 *total_finder_patterns) |
Scan the image vertically. More... | |
jab_finder_pattern * | findMasterSymbol (jab_bitmap *ch[], jab_detect_mode mode) |
Find the master symbol in the image. More... | |
jab_float | crossCheckPatternDiagonalAP (jab_bitmap *image, jab_int32 ap_type, jab_int32 module_size_max, jab_point center, jab_int32 *dir) |
Crosscheck the alignment pattern candidate in diagonal direction. More... | |
jab_float | crossCheckPatternVerticalAP (jab_bitmap *image, jab_point center, jab_int32 module_size_max, jab_float *module_size) |
Crosscheck the alignment pattern candidate in vertical direction. More... | |
jab_float | crossCheckPatternHorizontalAP (jab_byte *row, jab_int32 channel, jab_int32 startx, jab_int32 endx, jab_int32 centerx, jab_int32 ap_type, jab_float module_size_max, jab_float *module_size) |
Crosscheck the alignment pattern candidate in horizontal direction. More... | |
jab_boolean | crossCheckPatternAP (jab_bitmap *ch[], jab_int32 y, jab_int32 minx, jab_int32 maxx, jab_int32 cur_x, jab_int32 ap_type, jab_float max_module_size, jab_float *centerx, jab_float *centery, jab_float *module_size, jab_int32 *dir) |
Crosscheck the alignment pattern. More... | |
jab_alignment_pattern | findAlignmentPattern (jab_bitmap *ch[], jab_float x, jab_float y, jab_float module_size, jab_int32 ap_type) |
Find alignment pattern around a given position. More... | |
jab_boolean | findSlaveSymbol (jab_bitmap *bitmap, jab_bitmap *ch[], jab_decoded_symbol *host_symbol, jab_decoded_symbol *slave_symbol, jab_int32 docked_position) |
Find a docked slave symbol. More... | |
jab_int32 | getSideSize (jab_int32 size, jab_int32 *flag) |
Get the nearest valid side size to a given size. More... | |
jab_vector2d | calculateSideSize (jab_bitmap *ch[], jab_finder_pattern *fps, jab_float *module_size) |
Calculate the side sizes of master symbol. More... | |
jab_bitmap * | sampleSymbolByAlignmentPattern (jab_bitmap *bitmap, jab_bitmap *ch[], jab_decoded_symbol *symbol, jab_alignment_pattern *fps) |
Sample a symbol with help of alignment patterns. More... | |
jab_boolean | detectMaster (jab_bitmap *bitmap, jab_bitmap *ch[], jab_decoded_symbol *master_symbol) |
Detect and decode a master symbol. More... | |
jab_bitmap * | detectSlave (jab_bitmap *bitmap, jab_bitmap *ch[], jab_decoded_symbol *host_symbol, jab_decoded_symbol *slave_symbol, jab_int32 docked_position) |
Detect a slave symbol. More... | |
jab_boolean | decodeDockedSlaves (jab_bitmap *bitmap, jab_bitmap *ch[], jab_decoded_symbol *symbols, jab_int32 host_index, jab_int32 *total) |
Decode docked slave symbols around a host symbol. More... | |
void | preprocessImage (jab_bitmap *bitmap) |
Preprocess the image. More... | |
jab_data * | decodeJABCodeEx (jab_bitmap *bitmap, jab_int32 mode, jab_int32 *status, jab_decoded_symbol *symbols, jab_int32 max_symbol_number) |
Extended function to decode a JAB Code. More... | |
jab_data * | decodeJABCode (jab_bitmap *bitmap, jab_int32 mode, jab_int32 *status) |
Decode a JAB Code. More... | |
JABCode detector.
libjabcode - JABCode Encoding/Decoding Library
Copyright 2016 by Fraunhofer SIT. All rights reserved. See LICENSE file for full terms of use and distribution.
Contact: Huajian Liu liu@s Waldemar Berchtold it.f raunh ofer .dewalde mar. berch told @sit. frau nhofe r.de
jab_vector2d calculateSideSize | ( | jab_bitmap * | ch[], |
jab_finder_pattern * | fps, | ||
jab_float * | module_size | ||
) |
Calculate the side sizes of master symbol.
ch | the binarized color channels of the image |
fps | the finder patterns |
module_size | the module size |
jab_boolean checkModuleSize | ( | jab_float | size_r, |
jab_float | size_g, | ||
jab_float | size_b | ||
) |
Check if the input module sizes are the same.
size_r | the first module size |
size_g | the second module size |
size_b | the third module size |
jab_boolean checkPatternCross | ( | jab_int32 * | state_count, |
jab_float * | module_size | ||
) |
Check the proportion of layer sizes in finder pattern.
state_count | the layer sizes in pixel |
module_size | the module size |
jab_boolean crossCheckPattern | ( | jab_bitmap * | ch[], |
jab_finder_pattern * | fp, | ||
jab_int32 | h_v | ||
) |
Crosscheck the finder pattern candidate.
ch | the binarized color channels of the image |
fp | the finder pattern |
h_v | the direction of the candidate scanline, 0:horizontal 1:vertical |
jab_boolean crossCheckPatternAP | ( | jab_bitmap * | ch[], |
jab_int32 | y, | ||
jab_int32 | minx, | ||
jab_int32 | maxx, | ||
jab_int32 | cur_x, | ||
jab_int32 | ap_type, | ||
jab_float | max_module_size, | ||
jab_float * | centerx, | ||
jab_float * | centery, | ||
jab_float * | module_size, | ||
jab_int32 * | dir | ||
) |
Crosscheck the alignment pattern.
ch | the binarized color channels of the image |
y | the y coordinate of the horizontal scanline |
minx | the minimal coordinate of the horizontal scanline |
maxx | the maximal coordinate of the horizontal scanline |
cur_x | the start position of the horizontal scanline |
ap_type | the alignment pattern type |
max_module_size | the maximal allowed module size |
centerx | the x coordinate of the alignment pattern center |
centery | the y coordinate of the alignment pattern center |
module_size | the module size in horizontal direction |
dir | the alignment pattern direction |
jab_boolean crossCheckPatternCh | ( | jab_bitmap * | ch, |
jab_int32 | type, | ||
jab_int32 | h_v, | ||
jab_float | module_size_max, | ||
jab_float * | module_size, | ||
jab_float * | centerx, | ||
jab_float * | centery, | ||
jab_int32 * | dir, | ||
jab_int32 * | dcc | ||
) |
Crosscheck the finder pattern candidate in one channel.
ch | the binarized color channel |
type | the finder pattern type |
h_v | the direction of the candidate scanline, 0:horizontal 1:vertical |
module_size_max | the maximal allowed module size |
module_size | the module size in all directions |
centerx | the x coordinate of the finder pattern center |
centery | the y coordinate of the finder pattern center |
dir | the finder pattern direction |
dcc | the diagonal crosscheck result |
jab_int32 crossCheckPatternDiagonal | ( | jab_bitmap * | image, |
jab_int32 | type, | ||
jab_float | module_size_max, | ||
jab_float * | centerx, | ||
jab_float * | centery, | ||
jab_float * | module_size, | ||
jab_int32 * | dir, | ||
jab_boolean | both_dir | ||
) |
Crosscheck the finder pattern candidate in diagonal direction.
image | the image bitmap |
type | the finder pattern type |
module_size_max | the maximal allowed module size |
centerx | the x coordinate of the finder pattern center |
centery | the y coordinate of the finder pattern center |
module_size | the module size in diagonal direction |
dir | the finder pattern direction |
both_dir | scan both diagonal scanlines |
jab_float crossCheckPatternDiagonalAP | ( | jab_bitmap * | image, |
jab_int32 | ap_type, | ||
jab_int32 | module_size_max, | ||
jab_point | center, | ||
jab_int32 * | dir | ||
) |
Crosscheck the alignment pattern candidate in diagonal direction.
image | the image bitmap |
ap_type | the alignment pattern type |
module_size_max | the maximal allowed module size |
center | the alignment pattern center |
dir | the alignment pattern direction |
jab_boolean crossCheckPatternHorizontal | ( | jab_bitmap * | image, |
jab_float | module_size_max, | ||
jab_float * | centerx, | ||
jab_float | centery, | ||
jab_float * | module_size | ||
) |
Crosscheck the finder pattern candidate in horizontal direction.
image | the image bitmap |
module_size_max | the maximal allowed module size |
centerx | the x coordinate of the finder pattern center |
centery | the y coordinate of the finder pattern center |
module_size | the module size in horizontal direction |
jab_float crossCheckPatternHorizontalAP | ( | jab_byte * | row, |
jab_int32 | channel, | ||
jab_int32 | startx, | ||
jab_int32 | endx, | ||
jab_int32 | centerx, | ||
jab_int32 | ap_type, | ||
jab_float | module_size_max, | ||
jab_float * | module_size | ||
) |
Crosscheck the alignment pattern candidate in horizontal direction.
row | the bitmap row |
channel | the color channel |
startx | the start position |
endx | the end position |
centerx | the center of the candidate scanline |
ap_type | the alignment pattern type |
module_size_max | the maximal allowed module size |
module_size | the module size in horizontal direction |
jab_boolean crossCheckPatternVertical | ( | jab_bitmap * | image, |
jab_int32 | module_size_max, | ||
jab_float | centerx, | ||
jab_float * | centery, | ||
jab_float * | module_size | ||
) |
Crosscheck the finder pattern candidate in vertical direction.
image | the image bitmap |
module_size_max | the maximal allowed module size |
centerx | the x coordinate of the finder pattern center |
centery | the y coordinate of the finder pattern center |
module_size | the module size in vertical direction |
jab_float crossCheckPatternVerticalAP | ( | jab_bitmap * | image, |
jab_point | center, | ||
jab_int32 | module_size_max, | ||
jab_float * | module_size | ||
) |
Crosscheck the alignment pattern candidate in vertical direction.
image | the image bitmap |
center | the alignment pattern center |
module_size_max | the maximal allowed module size |
module_size | the module size in vertical direction |
jab_boolean decodeDockedSlaves | ( | jab_bitmap * | bitmap, |
jab_bitmap * | ch[], | ||
jab_decoded_symbol * | symbols, | ||
jab_int32 | host_index, | ||
jab_int32 * | total | ||
) |
Decode docked slave symbols around a host symbol.
bitmap | the image bitmap |
ch | the binarized color channels of the image |
symbols | the symbol list |
host_index | the index number of the host symbol |
total | the number of symbols in the list |
jab_data* decodeJABCode | ( | jab_bitmap * | bitmap, |
jab_int32 | mode, | ||
jab_int32 * | status | ||
) |
Decode a JAB Code.
bitmap | the image bitmap |
mode | the decoding mode(NORMAL_DECODE: only output completely decoded data when all symbols are correctly decoded COMPATIBLE_DECODE: also output partly decoded data even if some symbols are not correctly decoded |
status | the decoding status code (0: not detectable, 1: not decodable, 2: partly decoded with COMPATIBLE_DECODE mode, 3: fully decoded) |
jab_data* decodeJABCodeEx | ( | jab_bitmap * | bitmap, |
jab_int32 | mode, | ||
jab_int32 * | status, | ||
jab_decoded_symbol * | symbols, | ||
jab_int32 | max_symbol_number | ||
) |
Extended function to decode a JAB Code.
bitmap | the image bitmap |
mode | the decoding mode(NORMAL_DECODE: only output completely decoded data when all symbols are correctly decoded COMPATIBLE_DECODE: also output partly decoded data even if some symbols are not correctly decoded |
status | the decoding status code (0: not detectable, 1: not decodable, 2: partly decoded with COMPATIBLE_DECODE mode, 3: fully decoded) |
symbols | the decoded symbols |
max_symbol_number | the maximal possible number of symbols to be decoded |
jab_boolean detectMaster | ( | jab_bitmap * | bitmap, |
jab_bitmap * | ch[], | ||
jab_decoded_symbol * | master_symbol | ||
) |
Detect and decode a master symbol.
bitmap | the image bitmap |
ch | the binarized color channels of the image |
master_symbol | the master symbol |
jab_bitmap* detectSlave | ( | jab_bitmap * | bitmap, |
jab_bitmap * | ch[], | ||
jab_decoded_symbol * | host_symbol, | ||
jab_decoded_symbol * | slave_symbol, | ||
jab_int32 | docked_position | ||
) |
Detect a slave symbol.
bitmap | the image bitmap |
ch | the binarized color channels of the image |
host_symbol | the host symbol |
slave_symbol | the slave symbol |
docked_position | the docked position |
jab_alignment_pattern findAlignmentPattern | ( | jab_bitmap * | ch[], |
jab_float | x, | ||
jab_float | y, | ||
jab_float | module_size, | ||
jab_int32 | ap_type | ||
) |
Find alignment pattern around a given position.
ch | the binarized color channels of the image |
x | the x coordinate of the given position |
y | the y coordinate of the given position |
module_size | the module size |
ap_type | the alignment pattern type |
jab_finder_pattern* findMasterSymbol | ( | jab_bitmap * | ch[], |
jab_detect_mode | mode | ||
) |
Find the master symbol in the image.
ch | the binarized color channels of the image |
mode | the detection mode |
jab_boolean findSlaveSymbol | ( | jab_bitmap * | bitmap, |
jab_bitmap * | ch[], | ||
jab_decoded_symbol * | host_symbol, | ||
jab_decoded_symbol * | slave_symbol, | ||
jab_int32 | docked_position | ||
) |
Find a docked slave symbol.
bitmap | the image bitmap |
ch | the binarized color channels of the image |
host_symbol | the host symbol |
slave_symbol | the slave symbol |
docked_position | the docked position |
jab_finder_pattern getBestPattern | ( | jab_finder_pattern * | fps, |
jab_int32 | fp_count | ||
) |
Find the finder pattern with most detected times.
fps | the finder pattern list |
fp_count | the number of finder patterns in the list |
jab_int32 getSideSize | ( | jab_int32 | size, |
jab_int32 * | flag | ||
) |
Get the nearest valid side size to a given size.
size | the input size |
flag | the flag indicating the magnitude of error |
void preprocessImage | ( | jab_bitmap * | bitmap | ) |
Preprocess the image.
bitmap | the image bitmap |
void removeBadPatterns | ( | jab_finder_pattern * | fps, |
jab_int32 | fp_count, | ||
jab_float | mean, | ||
jab_float | threshold | ||
) |
Remove the finder patterns with greatly different module size.
fps | the finder pattern list |
fp_count | the number of finder patterns in the list |
mean | the average module size |
threshold | the tolerance threshold |
jab_bitmap* sampleSymbolByAlignmentPattern | ( | jab_bitmap * | bitmap, |
jab_bitmap * | ch[], | ||
jab_decoded_symbol * | symbol, | ||
jab_alignment_pattern * | fps | ||
) |
Sample a symbol with help of alignment patterns.
bitmap | the image bitmap |
ch | the binarized color channels of the image |
symbol | the symbol to be sampled |
fps | the finder/alignment patterns |
jab_int32 saveAlignmentPattern | ( | jab_alignment_pattern * | ap, |
jab_alignment_pattern * | aps, | ||
jab_int32 * | counter | ||
) |
Save a found alignment pattern into the alignment pattern list.
ap | the alignment pattern |
aps | the alignment pattern list |
counter | the number of alignment patterns in the list |
void saveFinderPattern | ( | jab_finder_pattern * | fp, |
jab_finder_pattern * | fps, | ||
jab_int32 * | counter, | ||
jab_int32 * | fp_type_count | ||
) |
Save a found finder pattern into the finder pattern list.
fp | the finder pattern |
fps | the finder pattern list |
counter | the number of finder patterns in the list |
fp_type_count | the number of finder pattern types in the list |
void scanPatternVertical | ( | jab_bitmap * | ch[], |
jab_int32 | min_module_size, | ||
jab_finder_pattern * | fps, | ||
jab_int32 * | fp_type_count, | ||
jab_int32 * | total_finder_patterns | ||
) |
Scan the image vertically.
ch | the binarized color channels of the image |
min_module_size | the minimal module size |
fps | the found finder patterns |
fp_type_count | the number of found finder patterns for each type |
total_finder_patterns | the number of totally found finder patterns |
jab_boolean seekPattern | ( | jab_bitmap * | ch, |
jab_int32 | row, | ||
jab_int32 | col, | ||
jab_int32 * | start, | ||
jab_int32 * | end, | ||
jab_float * | center, | ||
jab_float * | module_size, | ||
jab_int32 * | skip | ||
) |
Find a candidate scanline of finder pattern.
ch | the image channel |
row | the row to be scanned |
col | the column to be scanned |
start | the start position |
end | the end position |
center | the center of the candidate scanline |
module_size | the module size |
skip | the number of pixels to be skipped in the next scan |
jab_boolean seekPatternHorizontal | ( | jab_byte * | row, |
jab_int32 * | startx, | ||
jab_int32 * | endx, | ||
jab_float * | centerx, | ||
jab_float * | module_size, | ||
jab_int32 * | skip | ||
) |
Find a candidate horizontal scanline of finder pattern.
row | the bitmap row |
startx | the start position |
endx | the end position |
centerx | the center of the candidate scanline |
module_size | the module size |
skip | the number of pixels to be skipped in the next scan |
jab_int32 selectBestPatterns | ( | jab_finder_pattern * | fps, |
jab_int32 | fp_count, | ||
jab_int32 * | fp_type_count | ||
) |
Select the best finder patterns out of the list.
fps | the finder pattern list |
fp_count | the number of finder patterns in the list |
fp_type_count | the number of each finder pattern type |