当前位置:网站首页>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 :

边栏推荐
- 【读书会第十三期】视频文件的编码格式
- Stew in disorder
- AI has surpassed Dr. CS in question making?
- [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
- [North Asia data recovery] data recovery case of database data loss caused by HP DL380 server RAID disk failure
- Selenium element interaction
- A trap used by combinelatest and a debouncetime based solution
- Working group and domain analysis of Intranet
- Review of Weibo hot search in 2021 and analysis of hot search in the beginning of the year
- Unity脚本API—Transform 变换
猜你喜欢
Hidden communication tunnel technology: intranet penetration tool NPS
Blood cases caused by Lombok use
Unity animation day05
@EnableAspectAutoJAutoProxy_ Exposeproxy property
AI system content recommendation issue 24
The per capita savings of major cities in China have been released. Have you reached the standard?
Preliminary practice of niuke.com (10)
[Previous line repeated 995 more times]RecursionError: maximum recursion depth exceeded
Game theory
在芯片高度集成的今天,绝大多数都是CMOS器件
随机推荐
在芯片高度集成的今天,绝大多数都是CMOS器件
The 17 year growth route of Zhang Liang, an open source person, can only be adhered to if he loves it
Scientific research cartoon | what else to do after connecting with the subjects?
Explore mongodb - mongodb compass installation, configuration and usage introduction | mongodb GUI
Unity脚本常用API Day03
Web components series - detailed slides
AI has surpassed Dr. CS in question making?
Daily notes~
In today's highly integrated chips, most of them are CMOS devices
Will the memory of ParticleSystem be affected by maxparticles
Unity脚本生命周期 Day02
Some fields of the crawler that should be output in Chinese are output as none
[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
LNX efficient search engine, fastdeploy reasoning deployment toolbox, AI frontier paper | showmeai information daily # 07.04
Understand the rate control mode rate control mode CBR, VBR, CRF (x264, x265, VPX)
MySQL learning notes - data type (2)
案例分享|金融业数据运营运维一体化建设
After the eruption of Tonga volcano, we analyzed the global volcanic distribution and found that the area with the most volcanoes is here!
Interface fonctionnelle, référence de méthode, Widget de tri de liste implémenté par lambda
Recommend 10 excellent mongodb GUI tools