*************************************************
  Multiscale-COS/CCC Segmentation tool 
*************************************************
This package performs Multiscale-COS/CCC text segmentation
on a color image in TIFF format. The output of the software
is a binary image in TIFF format, where black pixel indicates
text and white pixel indicantes background.
We confirmed that the software works on Linux machines.
For the details of the algorithms, please read the documentation 
in this package.

------------------------------------------------
Directories and Files
------------------------------------------------
This package contains the following directories.

- src : Multiscale-COS/CCC source code ver 1.2
- EISL_TIFF_1.0 : TIFF input/output library
- example : You can test the program in this directory
- documentation : Detailed description about the algorithm

This package contains the following files.

- Build : You need to execute this to complile 
- Clean : You may use this for cleaning *.o files 
- README: Explanation about directories, how-to-compile and 
          how to test the program
- VERSION_INFO: Version information


---------------------------------------------------------------------
MUST TO DO
---------------------------------------------------------------------
Before compling the package, please modify the directory path
in the following files at src/ directory.

(1) Main_segment.c:  
read_lambda("<your path here>/src/para_files/lambda_para.txt", &seg_para);

(2) CCC_library.c
ret = classify(vector, comp_num, ll, clus, FEAT_DIM, "<your path here>/src/para_files/CCC_GM_para", text_cost, non_text_cost);

---------------------------------------------------------------------
How to compile?
---------------------------------------------------------------------

The script "Build" compiles all of the c programs 
needed for multiscale-COS/CCC segmentation tool. 
Please use the following command on a Linux machine. 

./Build

The "Build" command compiles the following directories.
 - EISL_TIFF_1.0
 - src 

---------------------------------------------------------------------
How to test the commands?
---------------------------------------------------------------------
After you finish compiling the programs, 
please go to the following directory to test 
segmentation.

cd example 
./Run

The "Run" script executes the COS segmentation  
for a test image (by calling "Main_segment" command).
For more details, please read the "Run" script.

The "Main_segment" command creates the following files.

<output file>
binary.tif : Segmentation output TIFF binary image 

---------------------------------------------------------------------
How to use the command?
---------------------------------------------------------------------
The basic use of the command is as follows:

./Main_segment -i <input tiff file> -d <resolution (dpi)>

-i and -d are REQUIRED parameters.
The rest of the parameters are optional.

==== REQUIRED parameters ====
  -i  <fname>  :input sRGB image file (TIFF format)
  -d  <num>    :input image resolution (in dpi)

==== Optional parameters ====
  -o  <fname>  :default = "binary.tif"
                segmentation output file name (TIFF format)
  -c  <fname>  :scanner calibration file name (text format)
  -s  <num>    :default = 32, block size (x4 number)
  -n  <num>    :default = 20
                max # of vertical dynamic programming iteration
  -S           :perform only COS segmentation
  -w  <num>    :default = 0.0
                weight for text segmentation (eg. [-2,5])

Please type ./Main_segment, then you will see help.
For more details, please see the documents in the document directory. 

==== Optional parameters for multiscale scheme ====
In src/ directory, there is a prameter file called "lambda_para.txt".
You can modify number of layers and weight coefficients of the
cost function in COS (\lambda1 .. \lambda4).

(format)
             lambda1   lambda2   lambda3   lambda4
------------------------------------------------------
2nd layer    20.483641  8.910729 17.778271 1.0000000          
1st lyer     53.106770 28.722381 39.359016 17.200012          
0th layer    30.680974 21.939354 36.658849 56.000098  


------------------------------------------------
Note
------------------------------------------------
The resolution parameter -d will be used to determine the block size. 
When a block size is specified by -s command, 
the image resolution parameter will be ignored.

The segmentation results are often improved if you descreen the 
input images before you use the command.

The CCC segmentation shows the best performance for 
calibrated sRGB input images. 
The input image should be calibrated based on the scanner you used,
otherwise the algorithm won't give you the best results.
I would suggest you first try COS without CCC segmentation (default).



