Image assembler software
Destination
Fast real-time image processing handler for robotic defects recognition systems. 
This software implements a focus stacking algorithm made on C++ language. 
Code is used in the quality inspection system for the manufacture of human cardiac implants. 
In the picture below you can see the result of the system with the 
material defects found. These are strands of material sticking out of 
the surface of the implant. The bright blue colour of the lines. 
This is a defective product... 
 

 
Focus stacking is useful when your depth of field is shallower than 
all the objects you wish to capture. In macro photography, this is very common. 
Instead, you take a series of pictures where you focus progressively throughout 
the range of images, so that you have a series of images that, in aggregate, 
have everything in focus. Focus stacking, then, merges these images by taking 
the best focused region from all of them to build up the final composite image.
There is a sample program in folder 'software'. 
It assumes that there is a subdirectory called "input" which contains the 
source images. It generates an output called "result.bmp" Max input image size 
5000px width for 25Mp High resolution camera.
I have also included some sample images in the input directory to allow you to 
experiment with the code without having to shoot your own set of images.
 
Options
If you run the program without parameters, it print a list of all possible options.
It is convenient to use batch files for different configurations.
The program folder contains the following examples of *.bat files:
• img-color.bat (slow)
image processing with color
• img-gray.bat (fast)
image processing without color 
• img-resized.bat (very fast)
reduce image size before processing 
• imgstack.cfg
 
use this file if call the application without argument string
  
Argument list
 -i string
 
Load image array from: ../path/folder/filename*.* Here first star 
sign (*) must be image number. Input file format is .* - bmp, png, jpg, gif. 
Number 0 use for based master frame definiton.
  
Case 1: Img0.bmp - img frame with number 0. Exaple: -i step0.jpg -n 4 
Here loading img array: step0.jpg... step3.jpg, 4 frames
    
Case 2: Img2[3].bmp - frame number 3 used like begin master-frame for array Img2. 
Example: -i Camera2[3].bmp -n 6 Here loading img array: 
Camera2[3]... Camera2[8].bmp, 6 frames
 -r value
Reduce incoming image array size by width & heigth, in persents.
 -n value
Image`s count number for loading.
 -s
Show output image on display.
 -w string
  
Write output image: ../path/folder/filename.* - bmp, png, jpg, gif.
 -c
        
Do image output chromaticity, with color enabled.
 -p value
   
If used this options, put here pointer to mem array.
And image`s will be fast downloaded from shared memory.
 -f value
   
Frame align filter threshold forced value.
 -a 
        
Show command argument`s list
 -t 
        
Show image processing time, ms
	
 -x 
        
Show aligned images
 -l string
  
Write aligned images to: path/folder
 -v 
        
Show Laplasian vector`s field
 -h 
        
Show programm usage help