没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
取样和量化
import numpy as np
plt.subplot(221)
img = plt.imread('lenna.png')
plt.imshow(img)
print('---image lenna---')
print(img)
# 灰度化
img_gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
plt.subplot(222)
plt.imshow(img_gray, cmap='gray')
print('---image gray---')
print(img_gray)
# 二值化
# rows, cols = img_gray.shape
# for i in range(rows):
# for j in range(cols):
# if (img_gray[i, j] <= 0.5):
# img_gray[i, j] = 0
# else:
# img_gray[i, j] = 1
img_binary = np.where(img_gray >= 0.5, 1, 0)
print("---image binary---")
print(img_binary)
print(img_binary.shape)
plt.subplot(223)
# cmp:colormap颜色图谱'Blues_r', 'BrBG', 'BrBG_r', 'BuGn'
plt.imshow(img_binary, cmap='BrBG')
plt.show()
剩余77页未读,继续阅读
一只bug狗
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0