How can i remove horizontal lines(stave) in a sheet music image?

asked 2019-01-23 08:31:03 -0500

Janrex gravatar image

I'm try to make an app that will take an image input of a music sheet and play it. but before i go to playing the mus sheet i first need to remove horizontal lines to classify each notes using a trained cnn. How can I remove horizontal lines from an image? any ideas? I'm done with the grayscale and binary part.

Bitmap bitmapCapture = CameraUtils.optimizeBitmap(BITMAP_SAMPLE_SIZE, imageStoragePath);

        Mat image = new Mat();
        Mat gray = new Mat();
        Mat binary = new Mat();
        Bitmap binarybit = Bitmap.createBitmap(bitmapCapture.getWidth(),bitmapCapture.getHeight(),Bitmap.Config.RGB_565);

        Utils.bitmapToMat(bitmapCapture, image);
        Imgproc.cvtColor(image,gray, Imgproc.COLOR_RGB2GRAY);
        Imgproc.adaptiveThreshold(gray,binary,255,Imgproc.ADAPTIVE_THRESH_MEAN_C,Imgproc.THRESH_BINARY,5,4);

        Utils.matToBitmap(binary,binarybit);
        imageView3.setImageBitmap(binarybit);
edit retag flag offensive close merge delete

Comments

1
sturkmen gravatar imagesturkmen ( 2019-01-23 08:58:03 -0500 )edit

@sturkmen thanks for the link but can you explain what int horizontalsize = horizontal.cols / 30 is for? i know that this is going tobe the size of the filter but why 30?

Janrex gravatar imageJanrex ( 2019-01-23 09:56:16 -0500 )edit