仿射变换
什么是仿射变换?
Affine Transformation.任意由线性变换(矩阵乘法)+向量加法操作构成的变换操作. 包括平移(Translation), Rescale(放缩), Rotate(旋转).
仿射变换的视觉特点是: 原图中平行的线在变换后图片中仍然平行. (而透视变换Perspective Transformation则是垂直方向的直线一直垂直)
它可以表示为: \(f(x) = Ax + b\), 其中, \(A\)是一个\(2\times 2\)的矩阵, \(b\)是一个二维列向量. 若使用增广向量\(\bar x = [x' , 1]'\), 则\(f(x) = [A, b] \bar x\)
Rescaling
图片放缩. 通过插值上采样放大, 下采样缩小.
http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_geometric_transformations/py_geometric_transformations.html#scaling
Translation
Rotation
参考 http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_geometric_transformations/py_geometric_transformations.html#rotation
直接按照文档中的方法, 在\(\frac {k\pi} 2\)rotate时会出现黑边, 部分图片还可能会被剪掉, 参考https://www.oschina.net/translate/opencv-rotation 可实现无损无黑边rotate
Reference
http://docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/warp_affine/warp_affine.html
http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#cv2.warpAffine
Daniel的学习笔记
浙江大学计算机专业15级硕士在读, 方向: Machine Learning, Deep Learning, Computer Vision.
blog内容是我个人的学习笔记, 由于个人水平限制, 肯定有不少错误或遗漏. 若发现, 欢迎留言告知, Thanks!