Ask Your Question

SerialCoder's profile - activity

2016-02-01 05:23:00 -0600 received badge  Scholar (source)
2016-02-01 05:22:44 -0600 answered a question LineSegmentDetector in java

I found the issue, the source image needs to be converted to grayscale as stated in the documentation

2016-01-29 22:37:38 -0600 asked a question LineSegmentDetector in java

I'm trying to use LineSegmentDetector in java with OpenCV 3.1.0 :

Mat image = Imgcodecs.imread(file.getAbsolutePath());
LineSegmentDetector lsd = Imgproc.createLineSegmentDetector();
Mat lines=new Mat();
lsd.detect(image, lines);

But I've got this error :

OpenCV Error: Assertion failed (!fixedType() || ((Mat*)obj)->type() == mtype) in cv::_OutputArray::create, file C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\core\src\matrix.cpp, line 2191
CvException [org.opencv.core.CvException: cv::Exception: C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\core\src\matrix.cpp:2191: error: (-215) !fixedType() || ((Mat*)obj)->type() == mtype in function cv::_OutputArray::create
]
    at org.opencv.imgproc.LineSegmentDetector.detect_1(Native Method)
    at org.opencv.imgproc.LineSegmentDetector.detect(LineSegmentDetector.java:58)

From the C++ sample which uses vector<vec4f> for output I tried MatOfFloat4 but same error

Mat lines = new MatOfFloat4();

What I am doing wrong ?