当前位置:网站首页>Which interpolation is better for opencv to zoom in and out??
Which interpolation is better for opencv to zoom in and out??
2022-08-01 02:08:00 【The child YanRe water】
If you are enlarging the image, you should prefer to use INTER_LINEAR or INTER_CUBIC interpolation. If you are shrinkingstrong> the image, you should prefer to use INTER_AREA interpolation.
Cubic interpolation is computationally more complex, and hence slower than linear interpolation. However, the quality of the resulting image will be higher.
To overcome this problem,You should find out the new dimensions of a given image that can be interpolated.And copy the interpolated sample image on the target image, such as:
# create target image and copy sample image into it(wt, ht) = imgSize # target image size(h, w) = img.shape # given image sizefx = w/wtfy = h/htf = max(fx, fy)newSize = (max(min(wt, int(w / f)), 1),max(min(ht, int(h / f)), 1)) # scale according to f (result at least 1 and at most wt or ht)img = cv2.resize(img, newSize, interpolation=cv2.INTER_CUBIC) #INTER_CUBIC interpolationtarget = np.ones([ht, wt]) * 255 # shape=(64,800)target[0:newSize[1], 0:newSize[0]] = imgAbout each interpolationAs a result, cv2 resize interpolation methods- Chadrick's Blog
One
Some possible possibilities in openCVThe interpolation is:
- INTER_NEAREST – nearest neighbor interpolation
- INTER_LINEAR – Bilinear interpolation (used by default)
- INTER_AREA – Resampling using pixel area relation.It may be the preferred method for image decimation as it provides moiré-free results.But when the image is scaled, it is similar to the INTER_NEAREST method.
- INTER_CUBIC – Bicubic interpolation of 4×4 pixel neighborhood
- INTER_LANCZOS4 – Lanczos Interpolation of 8x8 Pixel Neighborhood

边栏推荐
- The device node structure is converted into a platform_device structure
- 解决IDEA默认情况下新建文件时,右击,new,没有XML文件的问题
- Soft Exam Senior System Architect Series: Basic Knowledge of Information Systems
- Super like the keyboard made from zero, IT people love it
- RTL8762DK UART(二)
- ROS2 series of knowledge (4): understand the concept of [service]
- Inheritance Considerations
- What practical projects can machine learning beginners learn?
- MYSQL Keyword Explain Analysis
- 北京突然宣布,元宇宙重大消息
猜你喜欢

Introduction to machine learning how to?

How to get started with YOLO?How to implement your own training set?

HCIP(15)

leetcode:1648. 销售价值减少的颜色球【二分找边界】

初出茅庐的小李第114篇博客项目笔记之机智云智能浇花器实战(3)-基础Demo实现

解决IDEA默认情况下新建文件时,右击,new,没有XML文件的问题

机器学习初学者可以学哪些实战项目?
![leetcode: 1648. Color ball with decreasing sales value [Boundary find by two points]](/img/b9/7bd33bd981ace25e3bbfc7be9117ff.png)
leetcode: 1648. Color ball with decreasing sales value [Boundary find by two points]

【Cryptography/Cryptanalysis】Cryptanalysis method based on TMTO

IDEA无法识别module(module右下角没有蓝色小方块)
随机推荐
500 miles
ARM cross compilation
High dimensional Gaussian distribution basics
leetcode:1648. 销售价值减少的颜色球【二分找边界】
Blueprint: Yang Hui's Triangular Arrangement
sqlserver无法远程连接
OSD read SAP CRM One Order application log way of optimization
高维高斯分布基础
Flink deploys and submits jobs
HCIP(14)
RTL8762DK WDG (six)
解决安装MySQL后,Excel打开很慢的问题
更换树莓派内核
500 miles
MYSQL two-phase commit
2022 CSP-J1 CSP-S1 Round 1 Preliminary Competition Registration Guide
RTL8762DK uses DebugAnalyzer (four)
【密码学/密码分析】基于TMTO的密码分析方法
Luogu P3373: Segment tree
MYSQL query interception optimization analysis