justadudewhohacks / justadudewhohacks/opencv4nodejs

Incorrect result = Imageproc houghLinesP

Open
#548 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5.1k
Forks
826
PR merge metrics
No merged PRs in 30d

Description

Hello Vincent. I'm sorry for creating new issue without contributing. I'm very newbie for OpenCV and node bindings. Anyway, I just wanted to say my opinion about `Mat.houghLinesP()` method. I saw python and C++ results. They returned array of array points [ [x0,y0,x1,y1], ... ]. So I tried to learn this method in my javascript code. Because I love javascript. But `Mat.houghLinesP()` method returns Vec4 array. And x,y,z,w components are not mapped correctly.

This is how I drew lines correctly.
```
const lines = image.houghLinesP(1, Math.PI/180, 100, 50, 50);
lines.forEach(line => {
const p1 = new cv.Point(line.y, line.x);
const p2 = new cv.Point(line.w, line.z);
image.drawLine(p1, p2, green, 3);
});
```
If you noticed when I create point object (x,y) compononts are swittched.

To me `Mat.houghLinesP()` method returns array of array or something else is better instead of Vec4s. It's very confusing.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.