[pixkit image] halftoning: Image halftoning - yunfuliu/pixkit GitHub Wiki

[dotdiffusion] LiuGuo2015

Halftone image with the following dot diffusion technique: [Reference] Y. F. Liu and J. M. Guo, "Dot-Diffused Halftoning with Improved Homogeneity," IEEE Trans. Image Processing, vol. 24, no. 11, pp. 4581-4591, Nov. 2015.

C++: class CLiuGuo2015(std::string pth_resources)

Parameters:

  • pth_resources - Path to the trained resources. As for the resources, please indicate the path to PIXKIT_ROOT/data/LiuGuo2015 for process.

Operations:

  • getPointList(const cv::Size imgSize)
    • imgSize - Size of the image.
  • process(const cv::Mat &src1b, cv::Mat &dst1b)
    • src1b - Source image.
    • dst1b - Destination image.

Example:

CLiuGuo2015 method("data/");
method.getPointList(cv::Size(512, 512));
method.process(src1b, dst1b);

[dotdiffusion] NADD2013

Halftone image with the following dot diffusion technique: [Reference] Y. F. Liu and J. M. Guo, "New class tiling design for dot-diffused halftoning," IEEE Trans. Image Processing, vol. 22, no. 3, pp. 1199-1208, March 2013.

C++: class CNADDCT()

Operations:

  • generation(cv::Size ctSize)
    • ctSize - Size of the class tiling (CT)
  • save(char name[])
    • name - Name of the saved CT.
  • load(char name[])
    • name - Name of the loaded CT.

C++: bool NADD2013(cv::Mat &src,cv::Mat &dst,pixkit::halftoning::dotdiffusion::CNADDCT &cct)

Parameters:

  • src - The source image.
  • dst - The destination image.
  • cct - The used class tiling (CT).

Example:

CNADDCT ct;
ct.generation(cv::Size(512, 512));
NADD2013(src,dst,ct);

[iterative] ElectrostaticHalftoning2010

Generate halftone image with following technique. Notably, it takes a heavy complexity.

[Reference] SCHMALTZ, C., GWOSDEK, P., BRUHN, A., AND WEICKERT, J. "Electrostatic halftoning," Computer Graphics Forum, vol. 29, no. 8, pp. 2313–2327, 2010.

[Developer] Yu Cheng ([email protected])

C: bool iterative::ElectrostaticHalftoning2010(const cv::Mat &src, cv::Mat &dst, int InitialCharge, int Iterations, int GridForce, int Shake, int Debug)

Parameters:

  • src - The source image.
  • dst - The destination image.
  • InitialCharge - specifies how the points are to be initialized: 0. Random distribution and 1. using EH's method.
  • Iterations - the maximum number of iterations.
  • GridForce - specifies whether to use 'GridForce', Y/N=1/0.
  • Shake - specifies whether to use 'Shake', Y/N=1/0.
  • Debug - There are three types can be selected: 0. only output the destination image, 1. the result will be output to "output.bmp" each iteration and 2. the result will be output to Folder named "output", No. 0 is the initial image, and No. 1~Iterations are the result of each iteration.

Example:

iterative::ElectrostaticHalftoning2010(src,dst,1,200,1,0,0);

[dotdiffusion] GuoLiu2009

Halftone image with the following dot diffusion technique:

[Reference] J. M. Guo and Y. F. Liu, "Improved dot diffusion by diffused matrix and class matrix co-optimization," IEEE Trans. Image Processing, vol. 18, no. 8, pp. 1804-1816, Aug. 2009.

C++: bool GuoLiu2009(const cv::Mat &src, cv::Mat &dst,const int ClassMatrixSize)

Parameters:

  • src - The source image.
  • dst - The destination image.
  • ClassMatrixSize - Size of class matrix (CM). Allow only 8 and 16 these two sizes.

Example:

GuoLiu2009(src,dst,8);

[dotdiffusion] LippensPhilips2007

Halftone image with green noise dot diffusion pattern.

[Reference] S. Lippens and W. Philips, "Green-noise halftoning with dot diffusion," in Proc. SPIE - The International Society for Optical Engineering, 2007.

[Additional setting] hysteresis=0. is proposed by paper which is set in function

C++: bool LippensPhilips2007(const cv::Mat &src, cv::Mat &dst)

Parameters:

  • src - The source image.
  • dst - The destination image.

Example:

LippensPhilips2007(src,dst);

[errordiffusion] ZhouFang2003

Halftone image with error diffusion technique.

[Reference] B. Zhou and X. Fang, "Improving mid-tone quality of variable coefficient error diffusion using threshold modulation," ACM Trans. on Graphics, vol. 22, no. 3, pp. 437-444, July 2003.

C++: bool ZhouFang2003(const cv::Mat &src, cv::Mat &dst)

Parameters:

  • src - The source image.
  • dst - The destination image.

Example:

ZhouFang2003(src,dst);

[iterative] dualmetricDBS2002

Generate halftone image with two metrices.

[Reference] S. H. Kim and J. P. Allebach, “Impact of HVS models on model-based halftoning,” IEEE Trans. Image Processing, vol. 11, no. 3, pp. 258-269, March 2002.

[Developer] Yun-Fu Liu ([email protected])

C++: bool iterative::dualmetricDBS2002(const cv::Mat &src, cv::Mat &dst)

Parameters:

  • src - The source image.
  • dst - The destination image.

Example:

iterative::dualmetricDBS2002(src,dst);

[errordiffusion] Ostromoukhov2001

Halftone image with error diffusion technique. [Reference] V. Ostromoukhov, "A simple and efficient error-diffusion algorithm," in Proc. SIGGRAPH, pp. 567-572, 2001.

C++: bool Ostromoukhov2001(const cv::Mat &src, cv::Mat &dst)

Parameters:

  • src - The source image.
  • dst - The destination image.

Example:

Ostromoukhov2001(src,dst);

[dotdiffusion] MeseVaidyanathan2000

Halftone image with the following dot diffusion technique:

[Reference] M. Mese and P. P. Vaidyanathan, “Optimized halftoning using dot diffusion and methods for inverse halftoning,” IEEE Trans. Image Processing, vol. 9, no. 4, pp. 691-709, April 2000.

C++: bool MeseVaidyanathan2000(const cv::Mat &src, cv::Mat &dst, int ClassMatrixSize = 8)

Parameters:

  • src - The source image.
  • dst - The destination image.
  • ClassMatrixSize - Size of class matrix (CM). Allow only 8 and 16 these two sizes.

Example:

MeseVaidyanathan2000(src,dst,8);

[ordereddithering] KackerAllebach1998

Halftone image with ordered dithering technique.

[Reference] D. Kacker and J. P. Allebach, "Aperiodic micro screen design using DBS and training," in Proc. SPIE - The International Society for Optical Engineering, vol. 3300, pp. 386-397, 1998. [Additional setting] Four dither arrays of size 32x32 are adopted in this function.

C++: bool KackerAllebach1998(const cv::Mat &src, cv::Mat &dst)

Parameters:

  • src - The source image.
  • dst - The destination image.

Example:

KackerAllebach1998(src,dst);

[iterative] LiebermanAllebach1997

This is a way of generating DBS halftone image with high efficiency comparing with convention method.

[Reference] D. J. Lieberman and J. P. Allebach, "Efficient Model Based Halftoning Using Direct Binary Search," IEEE International Conference on Image Processing, vol. 1, pp. 775-778, Oct. 1997.

[Developer] Yun-Fu Liu ([email protected])

C++: bool iterative::LiebermanAllebach1997(const cv::Mat &src1b, cv::Mat &dst1b,double * coeData=NULL,int FilterSize=7,bool cppmode=false);

Parameters:

  • src1b - The source image, and it should be CV_8UC1.
  • dst1b - The destination image, and it will be CV_8UC1.
  • coeData - If a customized filter is needed, user could input this and define its size with the following parameter.
  • FilterSize - Customized filter size.
  • cppmode - Used to define that whether the coeData is the c_pp or the psf defined in paper. If it's cpp, cppmode=true; cppmode=false when coeData is psf.

Example:

// with predefined filter in function.
iterative::LiebermanAllebach1997(src,dst);
// or, with customized coe as HVS model.
iterative::LiebermanAllebach1997(src,dst,coe,FilterSize);
// or, indicates that the coe is cpp not psf.
iterative::LiebermanAllebach1997(src,dst,coe,FilterSize,true);

[errordiffusion] ShiauFan1996

Halftone image with error diffusion technique.

[Reference] J.-N. Shiau and Z. Fan, “Set of easily implementable coefficients in error diffusion with reduced worm artifacts,” in Proc. SPIE - The International Society for Optical Engineering, vol. 2658, pp. 222-225, 1996.

C++: bool ShiauFan1996(const cv::Mat &src, cv::Mat &dst, ScanOrder_TYPE = scan_type = Raster)

Parameters:

  • src - The source image.
  • dst - The destination image.
  • scan_type - There are two types can be selected: 1. Raster and 2. Serpentine, to change the processing order.(default value = Raster)

Example:

ShiauFan1996(src,dst,Raster);

[dotdiffusion] Knuth1987

Halftone image with the following dot diffusion technique:

[Reference] D. E. Knuth, “Digital halftones by dot diffusion,” ACM Trans. Graphics, vol. 6, no. 4, Oct. 1987.

C++: bool Knuth1987(const cv::Mat &src, cv::Mat &dst)

Parameters:

  • src - The source image.
  • dst - The destination image.

Example:

Knuth1987(src,dst);

[ordereddithering] Ulichney1987

Halftone image with ordered dithering technique.

[Reference] R. Ulichney, Digital halftoning, Cambridge, MA: MIT Press, 1987.

C++: bool Ulichney1987(const cv::Mat &src, cv::Mat &dst, DitherArray_TYPE odtype = DispersedDot)

Parameters:

  • src - The source image.
  • dst - The destination image.
  • odtype - There are two types can be selected: 1. DispersedDot, 2. ClusteredDotand, to change the dithering array.(default value = DispersedDot)

Example:

Ulichney1987(src,dst,Raster);

[errordiffusion] Stucki1981

Halftone image with error diffusion technique.

[Reference] P. Stucki, “Mecca-a multiple-error correcting computation algorithm for bilevel image hardcopy reproduction,” Research Report RZ1060, IBM Research Laboratory, 1981.

C++: bool Stucki1981(const cv::Mat &src, cv::Mat &dst, ScanOrder_TYPE = scan_type = Raster)

Parameters:

  • src - The source image.
  • dst - The destination image.
  • scan_type - There are two types can be selected: 1. Raster and 2. Serpentine, to change the processing order.(default value = Raster)

Example:

Stucki1981(src,dst,Raster);

[errordiffusion] Jarvis1976

Halftone image with error diffusion technique.

[Reference] J. F. Jarvis, C. N. Judice, and W. H. Ninke, “A survey of techniques for the display of continuous-tone pictures on bilevel displays,” Comp. Graph. Image Proc., vol. 5, no. 1, pp. 13-40, 1976.

C++: bool Jarvis1976(const cv::Mat &src, cv::Mat &dst, ScanOrder_TYPE = scan_type = Raster)

Parameters:

  • src - The source image.
  • dst - The destination image.
  • scan_type - There are two types can be selected: 1. Raster and 2. Serpentine, to change the processing order.(default value = Raster)

Example:

Jarvis1976(src,dst,Raster)

[errordiffusion] FloydSteinberg1975

Halftone image with error diffusion technique.

[Reference] R. W. Floyd and L. Steinberg, “An adaptive algorithm for spatial gray scale,” in Proc. SID 75 Digest. Society for information Display, pp. 36-37, 1975.

C++: bool FloydSteinberg1975(const cv::Mat &src, cv::Mat &dst, ScanOrder_TYPE scan_type = Raster)

Parameters:

  • src - The source image.
  • dst - The destination image.
  • ScanOrder_TYPE - There are two types can be selected: 1. Raster and 2. Serpentine, to change the processing order.(default value = Raster)

Example:

FloydSteinberg1975(src,dst,Raster);