当前位置:网站首页>Opencv learning -- geometric transformation of image processing
Opencv learning -- geometric transformation of image processing
2022-07-04 16:24:00 【I won't wait for tomorrow】
Image zoom
cv2.INTER_NEAREST | Nearest neighbor interpolation |
cv2.INTER_LINEAR | Bilinear interpolation ( Default ) |
cv2.INTER_AREA | Resampling using pixel region relationship |
cv2.INTER_CUBIC | 4x4 Double of pixel neighborhood 3 Sub interpolation |
cv2.INTER_LANCZOS4 | 8x8 Pixel neighborhood Lanczos interpolation |
Image translation

Image rotation
img = cv.imread('test.jpg')
rows, cols=img.shape[:2]
M=cv.getRotationMatrix2D((cols/2, rows/2), 90, 1)
dst=cv.warpAffine(img,M,(cols, rows))
cv.imshow('xuanzhuan', dst)
cv.waitKey(0)Affine transformation

img = cv.imread('test.jpg')
rows, cols=img.shape[:2]
pts1 = np.float32([[50, 50], [200, 50], [50, 200]]) # To find three points
pts2 = np.float32([[100, 100], [200, 50], [100, 250]])
M = cv.getAffineTransform(pts1,pts2)
dst = cv.warpAffine(img,M,(cols,rows))
cv.imshow('fsbh', dst)
cv.waitKey(0)
Transmission transformation
img = cv.imread('test.jpg')
rows, cols=img.shape[:2]
pts1 = np.float32([[56, 65], [368, 52], [28, 387], [389, 390]]) # To find four points
pts2 = np.float32([[100, 145], [300, 100], [80, 290], [310, 300]])
T = cv.getPerspectiveTransform(pts1, pts2)
dst = cv.warpPerspective(img, T, (cols, rows))
cv.imshow('tsbh', dst)
cv.waitKey(0)
Image pyramid

img = cv.imread('test.jpg')
up_img = cv.pyrUp(img)
down_img = cv.pyrDown(img)
cv.imshow('up', up_img)
cv.imshow('down', down_img)
cv.waitKey(0)summary :

边栏推荐
- Functional interface, method reference, list collection sorting gadget implemented by lambda
- Weekly recruitment | senior DBA annual salary 49+, the more opportunities, the closer success!
- [tutorial] yolov5_ DeepSort_ The whole process of pytoch target tracking and detection
- MySQL federated primary key_ MySQL creates a federated primary key [easy to understand]
- Shell 编程基础
- What should ABAP do when it calls a third-party API and encounters garbled code?
- Using celery in projects
- Unity脚本API—Time类
- %F format character
- How to rapidly deploy application software under SaaS
猜你喜欢

@EnableAspectAutoJAutoProxy_ Exposeproxy property

Data Lake Governance: advantages, challenges and entry

Interface fonctionnelle, référence de méthode, Widget de tri de liste implémenté par lambda

MFC implementation of ACM basic questions encoded by the number of characters

I let the database lock the table! Almost fired!

The 17 year growth route of Zhang Liang, an open source person, can only be adhered to if he loves it
![[tutorial] yolov5_ DeepSort_ The whole process of pytoch target tracking and detection](/img/a7/92d670776e3fd3d5add3aa144617c7.jpg)
[tutorial] yolov5_ DeepSort_ The whole process of pytoch target tracking and detection

Cut! 39 year old Ali P9, saved 150million

Lombok使用引发的血案
![[North Asia data recovery] a database data recovery case where the disk on which the database is located is unrecognized due to the RAID disk failure of HP DL380 server](/img/79/3fab19045e1ab2f5163033afaa4309.jpg)
[North Asia data recovery] a database data recovery case where the disk on which the database is located is unrecognized due to the RAID disk failure of HP DL380 server
随机推荐
Interface test - knowledge points and common interview questions
MySQL - MySQL adds self incrementing IDs to existing data tables
Vscode setting outline shortcut keys to improve efficiency
Selenium browser (2)
What encryption algorithm is used for the master password of odoo database?
Recommend 10 excellent mongodb GUI tools
2021 Google vulnerability reward program review
Unity脚本API—GameObject游戏对象、Object 对象
科普达人丨一文看懂阿里云的秘密武器“神龙架构”
干货 | fMRI标准报告指南新鲜出炉啦,快来涨知识吧
The four most common errors when using pytorch
[hcie TAC] question 5 - 1
【读书会第十三期】FFmpeg 查看媒体信息和处理音视频文件的常用方法
MySQL learning notes - data type (numeric type)
【读书会第十三期】视频文件的编码格式
The 17 year growth route of Zhang Liang, an open source person, can only be adhered to if he loves it
Shell programming basics
An article learns variables in go language
TypeError: not enough arguments for format string
Book of night sky 53 "stone soup" of Apache open source community