Android line fit

asked 2014-10-29 01:11:52 -0500

updated 2020-05-09 10:22:11 -0500

I am having some trouble using the fitLine function for the library for android.

public void fit(Mat image){
        Imgproc.Canny(image, image, 80, 90);
        Top topHalf = image.submat(0, image.rows()/2, 0, image.cols());
        Mat fittedLine = new MatOfFloat4();
        Imgproc.fitLine(topHalf, fittedLine, Imgproc.CV_DIST_L2, 0, 0.01, 0.01);
}

Everytime my App runs the fitLine function, it stops working. I was wondering how exactly do I set up the fitLine function. I feel that I did not setup the "fittedLine" variable correctly. If possible, a simple example would be great.

edit retag flag offensive close merge delete

Comments

2

fitLine expects a Mat of Points as 1st arg (points), not an image.

berak gravatar imageberak ( 2014-10-29 01:37:23 -0500 )edit