android – How can I extract only horizontal or vertical line after processing in Canny Edge with OpenCV?-ThrowExceptions

Exception or error:

This is what I’ve reached so far. It just does Canny Edge filtering.

override fun onCameraFrame(inputFrame: CvCameraViewFrame): Mat? {
    mRgba = inputFrame.rgba()

    Imgproc.cvtColor(mRgba, mRgbaFiltered, Imgproc.COLOR_BGR2GRAY)
    val mMat = Mat()

    Imgproc.Canny(mRgbaFiltered, mMat, threshold.toDouble(), threshold * 3.toDouble())

    return mMat
}

On top of that, I’d like to extract only vertical or horizontal lines.

Forget about the vertical lines. But at least, I’d like to extract the horizontal lines.
It should detect even like 15 degrees as horizontal lines. And then, If it’s not horizontal enough, then, I’d like to show vertical lines of each line instead. After that, I’d like to count the number of horizontal lines. How can I accomplish this implementation?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *