当前位置:网站首页>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 :
边栏推荐
- Rearrange array
- [North Asia data recovery] a database data recovery case where the partition where the database is located is unrecognized due to the RAID disk failure of HP DL380 server
- Hidden communication tunnel technology: intranet penetration tool NPS
- Detailed explanation of MySQL composite index (multi column index) use and optimization cases
- 压力、焦虑还是抑郁? 正确诊断再治疗
- What should ABAP do when it calls a third-party API and encounters garbled code?
- Unity animation day05
- Working group and domain analysis of Intranet
- The vscode waveform curve prompts that the header file cannot be found (an error is reported if the header file exists)
- Shell programming basics
猜你喜欢
Lombok使用引发的血案
QT graphical view frame: element movement
The vscode waveform curve prompts that the header file cannot be found (an error is reported if the header file exists)
Filtered off site request to
数据湖治理:优势、挑战和入门
在芯片高度集成的今天,绝大多数都是CMOS器件
. Net applications consider x64 generation
[native JS] optimized text rotation effect
MFC implementation of ACM basic questions encoded by the number of characters
The per capita savings of major cities in China have been released. Have you reached the standard?
随机推荐
Penetration test --- database security: detailed explanation of SQL injection into database principle
2022年九大CIO趋势和优先事项
Common knowledge of unity Editor Extension
Solve the error of JSON module in PHP compilation and installation under CentOS 6.3
Interface test - knowledge points and common interview questions
What should ABAP do when it calls a third-party API and encounters garbled code?
Interpretation of the champion scheme of CVPR 2020 night target detection challenge
What does IOT engineering learn and work for?
Working group and domain analysis of Intranet
Essential basic knowledge of digital image processing
2021 Google vulnerability reward program review
[North Asia data recovery] a database data recovery case where the partition where the database is located is unrecognized due to the RAID disk failure of HP DL380 server
這幾年爆火的智能物聯網(AIoT),到底前景如何?
%F format character
Preliminary practice of niuke.com (10)
Weekly recruitment | senior DBA annual salary 49+, the more opportunities, the closer success!
Book of night sky 53 "stone soup" of Apache open source community
Logstash ~ detailed explanation of logstash configuration (logstash.yml)
LeetCode 35. Search the insertion position - vector traversal (O (logn) and O (n) - binary search)
【读书会第十三期】 音频文件的封装格式和编码格式