<commit_before>﻿//////////////////////////////////////////////////////////////////////////
// 
// SOURCE CODE: https://github.com/yunfuliu/pixkit
// 
// BEIRF: pixkit-image contains image processing related methods which have been published (on articles, e.g., journal or conference papers). 
//	In addition, some frequently used related tools are also involved.
// 
//////////////////////////////////////////////////////////////////////////
#include <opencv\cxcore.hpp>
#include <opencv\cxcore.h>

#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2\highgui\highgui.hpp>

#include <cmath>
#include <iostream>
#include <vector>		// std::vector
#include <fstream>
#include <ctime>		// srand

#ifndef __PIXKIT_IMAGE_HPP__
#define __PIXKIT_IMAGE_HPP__

namespace pixkit{


	//////////////////////////////////////////////////////////////////////////
	/// Attack
	namespace attack{

		/**
		* @brief		add Gaussian noise to each pixel
		*
		* @param		sd:	standard deviation, unit: grayscale. range: 0~255
		*/
		bool	addGaussianNoise(const cv::Mat &src,cv::Mat &dst,const double sd);

		/**
		* @brief		add white noise to each pixel
		*
		* @param		maxMag: the biggest mag of the noise
		*/
		bool	addWhiteNoise(const cv::Mat &src,cv::Mat &dst,const double maxMag);

	}

	//////////////////////////////////////////////////////////////////////////
	/// Filtering related
	namespace filtering{

		/**
		* @brief		filtering with median filter
		* @brief		paper: no
		*
		* @author		<NAME> (<EMAIL>)
		* @date			Sept. 6, 2013
		* @version		1.0
		*
		* @param		src: input image (grayscale only)
		* @param		dst: output image
		* @param		blocksize: the used block size
		*
		* @return		bool: true: successful, false: failure
		*/
		bool medianfilter(const cv::Mat &src,cv::Mat &dst,cv::Size blocksize);

		// fast box filtering
		bool FBF(const cv::Mat &src,cv::Mat &dst,cv::Size blockSize,cv::Mat &sum=cv::Mat());

	}

	//////////////////////////////////////////////////////////////////////////
	/// Edge detection related
	namespace edgedetection{

		/**
		* @brief		Sobel edge detection
		* @brief		paper: digital image processing textbook
		*
		* @author		<NAME> (<EMAIL>)
		* @date			Sept. 4, 2013
		* @version		1.0
		*
		* @param		src: input image (grayscale only)
		* @param		dst: output image
		*
		* @return		bool: true: successful, false: failure
		*/
		bool Sobel(const cv::Mat &src, cv::Mat &dst);
	}

	//////////////////////////////////////////////////////////////////////////
	/// Halftoning related
	namespace halftoning{


		/// Ordered Dither related
		namespace errordiffusion{
			
			/**
			* @brief		paper: V. Ostromoukhov, ��A simple and efficient error diffusion algorithm,�� in proc. Of SIGGRAPH, 2001.
			*
			* @author		<NAME> (<EMAIL>)
			* @date			Feb 25, 2014
			* @version		1.0
			* 
			* @param		src: input image (grayscale only)
			* @param		dst: output image
			*
			* @return		bool: true: successful, false: failure
			*/ 
			bool			Ostromoukhov2001(const cv::Mat &src, cv::Mat &dst);

			/**
			* @brief		paper: <NAME> and <NAME>, ��Improving mid-tone quality of variable coefficient error diffusion using threshold modulation��, ACM Trans. on Graphics, 2003.
			*				extension research of [ V. Ostromoukhov, ��A simple and efficient error diffusion algorithm,�� in proc. Of SIGGRAPH, 2001. ]
			*
			* @author		<NAME> (<EMAIL>)
			* @date			Feb 25, 2014
			* @version		1.0
			* 
			* @param		src: input image (grayscale only)
			* @param		dst: output image
			*
			* @return		bool: true: successful, false: failure
			*/ 
			bool			ZhouFang2003(const cv::Mat &src, cv::Mat &dst);
		
		}


		/// Ordered Dither related
		namespace ordereddithering{
			
			/**
			* @brief		paper: <NAME> and <NAME>, "Aperiodic micro screen design using DBS and training," pp. 386-397, 1998.
			*				By using DBS train the aperiodic screen
			* 
			* @param		ctSize:	CT size
			*/
		

			/**
			* @brief		paper:  <NAME> and <NAME>, "Aperiodic micro screen design using DBS and training," pp. 386-397, 1998.
			*				By using DBS train the aperiodic screen
			*
			* @author		<NAME> (<EMAIL>)
			* @date			Feb 21, 2014
			* @version		1.0
			* 
			* @param		src: input image (grayscale only)
			* @param		dst: output image
			*
			* @return		bool: true: successful, false: failure
			*/ 
			bool			KackerAllebach1998(const cv::Mat &src, cv::Mat &dst);

		
		
		
		}


		/// Dot diffusion related
		namespace dotdiffusion{

			/**
			* @brief		paper: <NAME> and <NAME>, "New class tiling design for dot-diffused halftoning," IEEE Trans. Image Processing, vol. 22, no. 3, pp. 1199-1208, March 2013.
			* 
			* @param		ctSize:	CT size<commit_msg>remove descriptions of halftoning methods<commit_after>﻿//////////////////////////////////////////////////////////////////////////
// 
// SOURCE CODE: https://github.com/yunfuliu/pixkit
// 
// BEIRF: pixkit-image contains image processing related methods which have been published (on articles, e.g., journal or conference papers). 
//	In addition, some frequently used related tools are also involved.
// 
//////////////////////////////////////////////////////////////////////////
#include <opencv\cxcore.hpp>
#include <opencv\cxcore.h>

#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2\highgui\highgui.hpp>

#include <cmath>
#include <iostream>
#include <vector>		// std::vector
#include <fstream>
#include <ctime>		// srand

#ifndef __PIXKIT_IMAGE_HPP__
#define __PIXKIT_IMAGE_HPP__

namespace pixkit{


	//////////////////////////////////////////////////////////////////////////
	/// Attack
	namespace attack{

		/**
		* @brief		add Gaussian noise to each pixel
		*
		* @param		sd:	standard deviation, unit: grayscale. range: 0~255
		*/
		bool	addGaussianNoise(const cv::Mat &src,cv::Mat &dst,const double sd);

		/**
		* @brief		add white noise to each pixel
		*
		* @param		maxMag: the biggest mag of the noise
		*/
		bool	addWhiteNoise(const cv::Mat &src,cv::Mat &dst,const double maxMag);

	}

	//////////////////////////////////////////////////////////////////////////
	/// Filtering related
	namespace filtering{

		/**
		* @brief		filtering with median filter
		* @brief		paper: no
		*
		* @author		<NAME> (<EMAIL>)
		* @date			Sept. 6, 2013
		* @version		1.0
		*
		* @param		src: input image (grayscale only)
		* @param		dst: output image
		* @param		blocksize: the used block size
		*
		* @return		bool: true: successful, false: failure
		*/
		bool medianfilter(const cv::Mat &src,cv::Mat &dst,cv::Size blocksize);

		// fast box filtering
		bool FBF(const cv::Mat &src,cv::Mat &dst,cv::Size blockSize,cv::Mat &sum=cv::Mat());

	}

	//////////////////////////////////////////////////////////////////////////
	/// Edge detection related
	namespace edgedetection{

		/**
		* @brief		Sobel edge detection
		* @brief		paper: digital image processing textbook
		*
		* @author		<NAME> (<EMAIL>)
		* @date			Sept. 4, 2013
		* @version		1.0
		*
		* @param		src: input image (grayscale only)
		* @param		dst: output image
		*
		* @return		bool: true: successful, false: failure
		*/
		bool Sobel(const cv::Mat &src, cv::Mat &dst);
	}

	//////////////////////////////////////////////////////////////////////////
	/// Halftoning related
	namespace halftoning{

		/// Ordered Dither related
		namespace errordiffusion{ 
			bool			Ostromoukhov2001(const cv::Mat &src, cv::Mat &dst);
			bool			ZhouFang2003(const cv::Mat &src, cv::Mat &dst);		
		}

		/// Ordered Dither related
		namespace ordereddithering{
			bool			KackerAllebach1998(const cv::Mat &src, cv::Mat &dst);
		}


		/// Dot diffusion related
		namespace dotdiffusion{

			/**
			* @brief		paper: Yun-<NAME> and Jing-Ming Guo, "New class tiling design for dot-diffused halftoning," IEEE Trans. Image Processing, vol. 22, no. 3, pp. 1199-1208, March 2013.
			* 
			* @param		ctSize:	CT size
{'fraction_non_alphanumeric': 0.22925204918032788, 'fraction_numerical': 0.019211065573770492, 'mean_word_length': 2.0162224797219004, 'pattern_counts': {'":': 0, '<': 44, '<?xml version=': 0, '>': 44, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '815979', 'n_tokens_mistral': 2976, 'n_tokens_neox': 2502, 'n_words': 733}