image-js icon indicating copy to clipboard operation
image-js copied to clipboard

Error : warpingFourPoints method

Open fridezlucas opened this issue 4 years ago • 2 comments

Hi !

I use image-js to compute a warping 4 points image transformation. When I used this method, I always receive the error "pts muste be an array of 4 elements".

How to fix it

I check in the sources and I see that the param pts is an object like this :

pts: {
    pts: [[0,0], [100,0], [0, 100], [100, 100]]
};

You'll need to unwrap pts in an object and method will work !

fridezlucas avatar Nov 06 '20 07:11 fridezlucas

Seems to me the parameter pts is an array of 4 XY as in this testcase

https://github.com/image-js/image-js/blob/bb06fbe41fd5b9497720a926b69609e1d6e5b596/src/image/transform/tests/warping.js#L29-L34

Not sure I understand what is the problem.

lpatiny avatar Dec 19 '20 06:12 lpatiny