gimp photocopy(影印) 算法

算法与gimp不尽相同,但是在一定照度和距离下也能得到干净的物体边缘的图像
 
gimp photocopy(影印) 算法_第1张图片
 

origin website:http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=14441&start=0

 

 

i checked the description from gimp photocopy.c

/*
* Photocopy algorithm
* -----------------
* Mask radius = radius of pixel neighborhood for intensity comparison
* Threshold = relative intensity difference which will result in darkening
* Ramp = amount of relative intensity difference before total black
* Blur radius = mask radius / 3.0
*
* Algorithm:
* For each pixel, calculate pixel intensity value to be: avg (blur radius)
* relative diff = pixel intensity / avg (mask radius)
* If relative diff < Threshold
* intensity mult = (Ramp - MIN (Ramp, (Threshold - relative diff))) / Ramp
* pixel intensity *= intensity mult
* Else
* pixel intensity = white
*/

i don't really get what they are doing based on that though.

however, based on the picture from  http://docs.gimp.org/en/plug-in-photocopy.html  I would say something like:

convert taj_orig.jpg -colorspace gray -contrast-stretch 10%x0% ( +clone -blur 0x2 ) +swap -compose divide -composite test.png

 --> 

(adjust -contrast-stretch 10%x0% and -blur 0x2 accordingly. For larger pictures a larger blur is needed)


edit:
convert taj_orig.jpg -colorspace gray -contrast-stretch 4%x0% ( +clone -blur 0x3 ) +swap -compose divide -composite -blur 0x1 -unsharp 0x20 test.png
seems to be closer, althought I am not sure if the last blur is desirable:

你可能感兴趣的:(gimp photocopy(影印) 算法)