Tuesday, 2 April 2019

How to apply FloodFill algorithm(Image Processing) in CameraView of Android?

i have achieved the implementation of FloodFill algorithm in ImageView. But i am not able achieve it on Camera(Surface View of Android). I'm using OpenCv Library for doing it. i have tried the following code using contour concept. But i am not getting exact result.

public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
        mRgba = inputFrame.rgba();

        if (mIsColorSelected) {
            mDetector.process(mRgba);
            List<MatOfPoint> contours = mDetector.getContours();
            Log.e(TAG, "Contours count: " + contours.size());
            for (int contourIdx = 0; contourIdx < contours.size(); contourIdx++) {
                Imgproc.drawContours(mRgba, contours, contourIdx, new Scalar(0,
                        0, 100, 10), -1);

            }

            Mat colorLabel = mRgba.submat(4, 68, 4, 68);
            colorLabel.setTo(mBlobColorRgba);

            Mat spectrumLabel = mRgba.submat(4, 4 + mSpectrum.rows(), 70,
                    70 + mSpectrum.cols());
            mSpectrum.copyTo(spectrumLabel);


        }

        return mRgba;
    }

Anybody have an idea that how to do it. Thanks in advance.



from How to apply FloodFill algorithm(Image Processing) in CameraView of Android?

No comments:

Post a Comment