Thursday, March 16, 2017

Use of Gaussian Filter to remove noise from Image


I am on the path of upskilling  myself. Hence have started learning about Machine Learning, Computer Vision, Artificial Intelligence and all other related things. Here are the two videos that i did while learning Computer Vision. The first is experimenting the use of Gaussian Filter to remove noise using Octave. And the second is using the same principle but in the Android environment using OpenCV.

https://www.youtube.com/watch?v=dyczVYQOcFQ


https://www.youtube.com/watch?v=N0JJyl-78LQ


The code for Android which is responsible for showing the Noisy Image and the Clear Image (after applying Gaussian Filter) is as follow:


        if(view.equals(mBtnShowNoisyImage)){
                Bitmap bmp = BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.e);
                mImageView.setImageBitmap(bmp);
        }

        if(view.equals(mButtonShowClearImage)){
            Mat m = null;
            try {
                m = Utils.loadResource(getApplicationContext(), R.drawable.e);
            } catch (IOException e) {
                e.printStackTrace();
            }

            Size s = new Size(7,7);
           
           //Apply Gaussian Filter
            Imgproc.GaussianBlur(m, m, s, 2);
            double width = m.size().width;
            double height = m.size().height;

            Bitmap bmp = Bitmap.createBitmap((int)width, (int)height, Bitmap.Config.ARGB_8888);
            Utils.matToBitmap(m,bmp);

            mImageView.setImageBitmap(bmp);

        }
    }

Its a whole new experience that i am going through. Its more than just programming...