本课程使用书目为《计算机网络教程》(第六版|微课版本)
教学老师:陈明
教学内容:1、熟练掌握图像文件的基本操作;2、熟练掌握图像数据的基本操作。
面向专业:智能医学工程,生物医学工程
本文内容:计算机网络协议的概念、协议的分类、常见的计算机网络协议、计算机网络的应用等相关知识点
本实验演示用的是spyder,我用的是VS Code python环境是3.9.16
#载入库
import os#读取文件的库
from skimage import io
from matplotlib import pyplot as plt
如果conda没用对应库的可以用命令行在对应的虚拟环境安装(别装在base)
pip install scikit-image
pip install matplotlib
读取对应文件中的目标图像
plt.close('all')
path = "..//image"
# 鸢尾花彩色图像
imagefile1 = os.path.join(path, 'iris.tif')
# 玫瑰花灰度图像
imagefile2 = os.path.join(path, 'rose.tif')
# 形状二值图像
imagefile3 = os.path.join(path, 'shapes.tif')
# 读取图像文件中的图像数据,请在变量浏览器中观察三种图像的数据类型和大小
img1 = io.imread(imagefile1)
img2 = io.imread(imagefile2)
img3 = io.imread(imagefile3)
plt.figure()
plt.subplot(311);plt.imshow(img1,cmap='gray');plt.title('color image');plt.axis('off')
plt.subplot(312);plt.imshow(img2,cmap='gray');plt.title('gray image');plt.axis('off')
plt.subplot(313);plt.imshow(img3,cmap='gray');plt.title('binary image');plt.axis('off')
plt.subplots_adjust(hspace=0.1)
plt.show()
可以通过变量监视器查看三张图片的内容和三张图片的参数值,进行对比,分析不同类型的图像的区别