I'd like to dewarp
an image using python
(opencv/PIL
etc.). I have 4 points of which I know that they should form a rectangular on a plane.
In gimp I can manually dewarp
the picture usingbackwards-correction
, but I'd like to write a program, that doesn't rely on gimp
.
All the functions I have found rely on a transformation matrix
, so I guess it would be sufficient to give me some pointers on how to calculate the correct matrix
.
Greets & thanks for the help
To calculate this matrix, use :
cv2.getPerspectiveTransform(src, dst)
With src a list containing your 4 points and dst a list containing the corners of the new image. Be careful, they must be in the right order