7

ImageView で FloodFill アルゴリズムの実装を達成しました。しかし、私はカメラ(AndroidのSurface View)でそれを達成することができません。私はそれを行うためにOpenCVライブラリを使用しています。輪郭の概念を使用して次のコードを試しました。しかし、私は正確な結果を得ていません。

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;
    }

誰もがそれを行う方法について考えを持っています。前もって感謝します。

4

0 に答える 0