Home > Web Front-end > JS Tutorial > python opencv image size transformation method

python opencv image size transformation method

不言
Release: 2018-04-02 16:39:47
Original
2618 people have browsed it

The following editor will share with you an article on python opencv image size conversion method, which has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor and take a look.

Using cv.Resize (source, target, transformation method) in Python OpenCV, you can transform it into the desired size

Source file: Needless to say

Target:You can zoom in and out of the image or input it directly Size

Transformation method:

CV_INTER_NN - nearest neighbor interpolation,

CV_INTER_LINEAR - bilinear interpolation (missing Use less)

CV_INTER_AREA - Use pixel relational resampling. This method can avoid ripples when the image is zoomed out. When the image is enlarged, it is similar to the CV_INTER_NN method..

CV_INTER_CUBIC - cubic interpolation.

For example, I want to change a picture into a 32*32 size

 image=cv2.imread('test.jpg')
 res=cv2.resize(image,(32,32),interpolation=cv2.INTER_CUBIC)
 cv2.imshow('iker',res)
 cv2.imshow('image',image)
 cv2.waitKey(0)
 cv2.destoryAllWindows()
Copy after login

Of course, you must import the opencv library normally. I have tried many of them on the Harbin Internet and are outdated

Related recommendations:

Python-OpenCV basic operation method detailed explanation_python

The above is the detailed content of python opencv image size transformation method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template