halcon remove the background of scanned documents

     halcon remove background of scanned documents by

 
APP has cured a lot of background scanning function: to improve the image quality, image scanning may typically for archiving or printing.
 
Originally want to print scanned, the idea is good, but the file is not printed their own imagine, there are printed background,
And it is serious, then how to do to solve?
 
Photoshop generally familiar to achieve this object is achieved by adjusting the tone scale, but today introduce the stretching function (scale_image) with gray halcon
For this purpose. FIG halcon cured under the effect of the background.
 

 
 
Histogram can be found, for example, this diagram (0,130) to stretch (0,255) - a visualization tool halcon
 
Code
1
2
3
4
5
6
7
8
read_image (Image,  'test.png' )
 
gmin:=0
gmax:=130
multi:=255.0/(gmax-gmin)
add:=-multi * gmin
 
scale_image (Image,ImageScale, multi, add)

  

Guess you like

Origin www.cnblogs.com/wwwbdabc/p/11653579.html