//using System; //using System.Collections.Generic; //using System.Drawing; //using System.Linq; //using System.Text; //using System.Threading.Tasks; //namespace MarketData.CNNProcessing //{ // public class Matrix // { // private T[,] elements; // private int rows; // private int cols; // public Matrix(int rows, int cols) // { // this.rows=rows; // this.cols=cols; // elements=new T[rows, cols]; // } // public T this[int row, int col] // { // get { return elements[row,col]; } // set { elements[row,col] = value; } // } // public int Rows // { // get{return rows;} // } // public int Cols // { // get{return cols;} // } // } // public class Kernel : Matrix // { // public Kernel(int rows,int cols) // : base(rows,cols) // { // } // public double GetMultiplier(int row,int col) // { // if(row>Rows+1 || col>Cols+1)throw new Exception("Index out of range."); // return this[row,col]; // } // public virtual void Process(ImageHelper imageHelper) // { // for(int rowIndex=0;rowIndex=imageHelper.Height)imageSourceRow=imageHelper.Height-1; // if(imageSourceCol>=imageHelper.Width)imageSourceCol=imageHelper.Width-1; // Color color=imageHelper.GetPixel(imageSourceRow,imageSourceCol); // double multiplier=GetMultiplier(kernelRow,kernelCol); // redAccumulator=redAccumulator+(color.R * multiplier); // greenAccumulator=greenAccumulator+(color.G * multiplier); // blueAccumulator=blueAccumulator+(color.B * multiplier); // } // } // if(redAccumulator>255)redAccumulator=redAccumulator%255; // if(greenAccumulator>255)greenAccumulator=greenAccumulator%255; // if(blueAccumulator>255)blueAccumulator=blueAccumulator%255; // Color newColor=Color.FromArgb((int)redAccumulator,(int)greenAccumulator,(int)blueAccumulator); // Point setPoint=new Point(imageRow,imageCol); // setPoint=imageHelper.TranslatePoint(setPoint); // imageHelper.SetPixel(setPoint.X, setPoint.Y, newColor); // } // } // public class GaussianBlurKernelV1 : Kernel // { // public GaussianBlurKernelV1() // : base(7,7) // { // this[1,2]=.01; // this[1,3]=.01; // this[1,4]=.01; // this[2,1]=.01; // this[2,2]=.05; // this[2,3]=.11; // this[2,4]=.05; // this[2,5]=.01; // this[3,1]=.01; // this[3,2]=.11; // this[3,3]=.25; // this[3,4]=.11; // this[3,5]=.01; // this[4,1]=.01; // this[4,2]=.05; // this[4,3]=.11; // this[4,4]=.05; // this[4,5]=.01; // this[5,2]=.01; // this[5,3]=.01; // this[5,4]=.01; // } // } // public class GaussianIdentityKernel : Kernel // { // public GaussianIdentityKernel() // : base(3,3) // { // this[1,1]=1; // } // } // public class BoxFilteringKernel : Kernel // { // public BoxFilteringKernel() // : base(3,3) // { // this[0,0]=1.0/9.0; // this[0,1]=1.0/9.0; // this[0,2]=1.0/9.0; // this[1,0]=1.0/9.0; // this[1,1]=1.0/9.0; // this[1,2]=1.0/9.0; // this[2,0]=1.0/9.0; // this[2,1]=1.0/9.0; // this[2,2]=1.0/9.0; // } // } //}