一文总结Python数字图像处理基础知识与前沿应用
点击上方“小白学视觉”,选择加"星标"或“置顶” 重磅干货,第一时间送达 ![]()
了解图像实际上是什么
图像处理帮助
-
改进我们存储的数字信息。 -
使图像处理自动化。 -
更好的图像优化,实现高效的存储和传输。
图像处理用途
1. 图像校正、锐化和分辨率校正
2. 编辑应用程序和社交媒体的过滤器

3. 医疗技术

4. 计算机/机器视觉

5. 模式识别
6. 视频处理
Python 图像处理入门
安装
pip install pillow
import matplotlib.image as img
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline

# reading jpg image
img = img.imread('image1.jpg')
plt.imshow(img)

# modifying the shape of the image
lum1 = img[:, :, 0]
plt.imshow(lum1)

plt.imshow(lum1, cmap ='hot')
plt.colorbar()

imgplot = plt.imshow(lum1)
imgplot.set_cmap('nipy_spectral')

#data type of lum1
print(type(lum1))
print(lum1)
len(lum1)
len(lum1[300])
from PIL import Image

img2 = Image.open('people.jpg')
plt.imshow(img2)

img2.thumbnail((50, 50), Image.ANTIALIAS) # resizes image in-place
imgplot = plt.imshow(img2)

imgplot1 = plt.imshow(img2, interpolation="nearest")

imgplot2 = plt.imshow(img2, interpolation="bicubic")

#some more interesting stuff
file='image1.jpg'
with Image.open(file) as image:
width, height = image.size
#Image width, height is be obtained

#Relative Path
img3 = Image.open("image1.jpg")
#Angle given
img_rot= img3.rotate(180)
#Saved in the same relative location
img_rot.save("rotated_picture.jpg")

#transposing image
transposed_img = img3.transpose(Image.FLIP_LEFT_RIGHT)
#Saved in the same relative location
transposed_img.save("transposed_img.jpg")

尾注
下载1:OpenCV-Contrib扩展模块中文版教程
在「小白学视觉」公众号后台回复:扩展模块中文教程,即可下载全网第一份OpenCV扩展模块教程中文版,涵盖扩展模块安装、SFM算法、立体视觉、目标跟踪、生物视觉、超分辨率处理等二十多章内容。
下载2:Python视觉实战项目52讲 在「小白学视觉」公众号后台回复:Python视觉实战项目,即可下载包括图像分割、口罩检测、车道线检测、车辆计数、添加眼线、车牌识别、字符识别、情绪检测、文本内容提取、面部识别等31个视觉实战项目,助力快速学校计算机视觉。
下载3:OpenCV实战项目20讲 在「小白学视觉」公众号后台回复:OpenCV实战项目20讲,即可下载含有20个基于OpenCV实现20个实战项目,实现OpenCV学习进阶。
交流群
欢迎加入公众号读者群一起和同行交流,目前有SLAM、三维视觉、传感器、自动驾驶、计算摄影、检测、分割、识别、医学影像、GAN、算法竞赛等微信群(以后会逐渐细分),请扫描下面微信号加群,备注:”昵称+学校/公司+研究方向“,例如:”张三 + 上海交大 + 视觉SLAM“。请按照格式备注,否则不予通过。添加成功后会根据研究方向邀请进入相关微信群。请勿在群内发送广告,否则会请出群,谢谢理解~
评论