public dynamic[] ProcessImage2(dynamic[] input) { //Turn the input vector into a matrix //This matrix represents the image MatrixData pixelMatrix = input.GetReShapedMatrix(19); //Get the emboss edge pixelMatrix = pixelMatrix.GetEmbossEdge(); //Apply with hist EQ function pixelMatrix = pixelMatrix.HistEQ(); //Crop 1 pixel off the edge of the image //this results in a 17x17 image pixelMatrix = pixelMatrix.CropEdges(1); //reduce the size of the image to 16x16 by removing // a random pixel from each row and column pixelMatrix = pixelMatrix.ReduceDimensionByOne(0).ReduceDimensionByOne(1); //Blur the image pixelMatrix = pixelMatrix.ApplyConvolutionFilter(blurFilter); //Reduce the 16x16 image to 8x8 using a custom downsampling algorithm pixelMatrix = pixelMatrix.DownScale(2); //Clamp the output matrix values between 0 and 255 pixelMatrix = pixelMatrix.Clamp(0, 255); //return the pixel matrix as a vector // the size of this vector will be 36 (6x6) return(pixelMatrix.GetVectorizedMatrix()); }
public dynamic[] ProcessImage3(dynamic[] input) { //Turn the input vector into a matrix //This matrix represents the image MatrixData pixelMatrix = input.GetReShapedMatrix(19); //hadamard product pixelMatrix = pixelMatrix * averageFace; //reduce the size of the image to 18x18 by removing // a random pixel from each row and column pixelMatrix = pixelMatrix.ReduceDimensionByOne(0).ReduceDimensionByOne(1); pixelMatrix = pixelMatrix.HistEQ(); return(pixelMatrix.DownScale(2, false).GetVectorizedMatrix()); }