将图片拉伸成类似平行四边形这样
直接上效果图
先不着急上代码,
如果你遇到opencv报以下错误的话,
cv2.error: OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-z4706ql7\opencv\modules\highgui\src\window.cpp:1274: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'
可以是版本没安装对
pip uninstall opencv-python
pip3 install opencv-contrib-python
删了重新安装即可
当然报错还有可能是路径带有中文或空格有时也会报错。
还有的保存是函数的版本不同,老版本返回的是三个参数,新版本却只有两个参数