Binarize the image.  
More...
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "jabcode.h"
|  | 
| #define | BLOCK_SIZE_POWER   3 | 
|  | 
| #define | BLOCK_SIZE   (1 << BLOCK_SIZE_POWER) | 
|  | 
| #define | BLOCK_SIZE_MASK   (BLOCK_SIZE - 1) | 
|  | 
| #define | MINIMUM_DIMENSION   (BLOCK_SIZE * 5) | 
|  | 
| #define | CAP(val, min, max)   (val < min ? min : (val > max ? max : val)) | 
|  | 
|  | 
| jab_boolean | isBiTrimodal (jab_float hist[], jab_int32 channel) | 
|  | Check bimodal/trimodal distribution.  More... 
 | 
|  | 
| jab_int32 | getMinimumThreshold (jab_int32 hist[], jab_int32 channel) | 
|  | Get the minimal value in a histogram with bimodal distribution.  More... 
 | 
|  | 
| jab_bitmap * | binarizerHist (jab_bitmap *bitmap, jab_int32 channel) | 
|  | Binarize a color channel of a bitmap using histogram binarization algorithm.  More... 
 | 
|  | 
| jab_bitmap * | binarizerHard (jab_bitmap *bitmap, jab_int32 channel, jab_int32 threshold) | 
|  | Binarize a color channel of a bitmap using a given threshold.  More... 
 | 
|  | 
| void | getBinaryBitmap (jab_bitmap *bitmap, jab_int32 channel, jab_int32 sub_width, jab_int32 sub_height, jab_byte *black_points, jab_bitmap *binary) | 
|  | Do local binarization based on the black points.  More... 
 | 
|  | 
| void | calculateBlackPoints (jab_bitmap *bitmap, jab_int32 channel, jab_int32 sub_width, jab_int32 sub_height, jab_byte *black_points) | 
|  | Calculate the black point of each block.  More... 
 | 
|  | 
| void | filterBinary (jab_bitmap *binary) | 
|  | Filter out noises in binary bitmap.  More... 
 | 
|  | 
| jab_bitmap * | binarizer (jab_bitmap *bitmap, jab_int32 channel) | 
|  | Binarize a color channel of a bitmap using local binarization algorithm.  More... 
 | 
|  | 
Binarize the image. 
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.nosp@m.it.f.nosp@m.raunh.nosp@m.ofer.nosp@m..de Waldemar Berchtold walde.nosp@m.mar..nosp@m.berch.nosp@m.told.nosp@m.@sit..nosp@m.frau.nosp@m.nhofe.nosp@m.r.de 
Binarize a color channel of a bitmap using local binarization algorithm. 
- Parameters
- 
  
    | bitmap | the input bitmap |  | channel | the color channel |  
 
- Returns
- binarized bitmap | NULL if failed 
 
 
Binarize a color channel of a bitmap using a given threshold. 
- Parameters
- 
  
    | bitmap | the input bitmap |  | channel | the color channel |  | threshold | the threshold |  
 
- Returns
- binarized bitmap | NULL if failed 
 
 
Binarize a color channel of a bitmap using histogram binarization algorithm. 
- Parameters
- 
  
    | bitmap | the input bitmap |  | channel | the color channel |  
 
- Returns
- binarized bitmap | NULL if failed 
 
 
      
        
          | void calculateBlackPoints | ( | jab_bitmap * | bitmap, | 
        
          |  |  | jab_int32 | channel, | 
        
          |  |  | jab_int32 | sub_width, | 
        
          |  |  | jab_int32 | sub_height, | 
        
          |  |  | jab_byte * | black_points | 
        
          |  | ) |  |  | 
      
 
Calculate the black point of each block. 
- Parameters
- 
  
    | bitmap | the input bitmap |  | channel | the color channel |  | sub_width | the number of blocks in x direction |  | sub_height | the number of blocks in y direction |  | black_points | the black points |  
 
 
 
Filter out noises in binary bitmap. 
- Parameters
- 
  
    | binary | the binarized bitmap |  
 
 
 
      
        
          | void getBinaryBitmap | ( | jab_bitmap * | bitmap, | 
        
          |  |  | jab_int32 | channel, | 
        
          |  |  | jab_int32 | sub_width, | 
        
          |  |  | jab_int32 | sub_height, | 
        
          |  |  | jab_byte * | black_points, | 
        
          |  |  | jab_bitmap * | binary | 
        
          |  | ) |  |  | 
      
 
Do local binarization based on the black points. 
- Parameters
- 
  
    | bitmap | the input bitmap |  | channel | the color channel |  | sub_width | the number of blocks in x direction |  | sub_height | the number of blocks in y direction |  | black_points | the black points |  | binary | the binarized bitmap |  
 
 
 
      
        
          | jab_int32 getMinimumThreshold | ( | jab_int32 | hist[], | 
        
          |  |  | jab_int32 | channel | 
        
          |  | ) |  |  | 
      
 
Get the minimal value in a histogram with bimodal distribution. 
- Parameters
- 
  
    | hist | the histogram |  | channel | the color channel |  
 
- Returns
- minimum threshold | -1 if failed 
 
 
      
        
          | jab_boolean isBiTrimodal | ( | jab_float | hist[], | 
        
          |  |  | jab_int32 | channel | 
        
          |  | ) |  |  | 
      
 
Check bimodal/trimodal distribution. 
- Parameters
- 
  
    | hist | the histogram |  | channel | the color channel |  
 
- Returns
- JAB_SUCCESS | JAB_FAILURE