Пример #1
0
        public dynamic[] ProcessImage1(dynamic[] input)
        {
            //Turn the input vector into a matrix
            //This matrix represents the image
            MatrixData pixelMatrix = input.GetReShapedMatrix(19);

            //Sharpen the image
            pixelMatrix = pixelMatrix.ApplyConvolutionFilter(sharpenFilter);

            //Apply the SobelEdge filter
            pixelMatrix = pixelMatrix.GetSobelEdge();

            //reduce the size of the image to 18x18 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 18x18 image to 6x6 using a custom downsampling algorithm
            pixelMatrix = pixelMatrix.Convert18To6Px();

            //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());
        }
Пример #2
0
        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());
        }