justadudewhohacks / justadudewhohacks/opencv4nodejs
getPerspectiveTransform test has misleading points
- Dominant language
- C++
- Stars
- 5.1k
- Forks
- 826
- PR merge metrics
- No merged PRs in 30d
Description
From the docs, I read that the points should start from top-left and then continue clock-wise. Example:
```
const srcPoints = [
// top-left
new cv.Point(eX.min, eY.min),
// top-right
new cv.Point(eX.max, eY.min),
// bottom-right
new cv.Point(eX.max, eY.max),
// bottom-left
new cv.Point(eX.min, eY.max)
];
const dstPoints = [
// top-left
new cv.Point(0, 0),
// top-right
new cv.Point(240, 0),
// bottom-right
new cv.Point(240, 240),
// bottom-left
new cv.Point(0, 240)
];
```
In the test, it seems you are doing top-left, bottom-right, bottom-left, top-right.
```
describe('transformation matrix getters', () => {
const srcPoints = [new cv.Point(0, 0), new cv.Point(10, 10), new cv.Point(0, 10)];
const dstPoints = [new cv.Point(0, 0), new cv.Point(20, 20), new cv.Point(0, 20)];
...
srcPoints.concat(new cv.Point(10, 0)),
dstPoints.concat(new cv.Point(20, 0))
```
Is this a correct assumption? It sort of tripped me up a bit, and I still haven't gotten my transform to work properly yet so I could be wrong.
Contributor guide
Assessment
This issue has not been assessed yet.