将二进制图像转换为2D数组或Python中的矩阵? [英] Convert a binary image to 2D array or Matrix in Python?

查看:57
本文介绍了将二进制图像转换为2D数组或Python中的矩阵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是图像处理的新手,我真的很难理解所有内容……因此,想法是如何使用python中的二进制图像创建矩阵?

I'm new to image processing and I'm really having a hard time understanding stuff...so the idea is that how do you create a matrix from a binary image in python?

类似这样:

尽管有关键点,但它不是同一张图像.谢谢您的帮助,我很感激

It not the same image though the point is there. Thank you for helping, I appreciate it cheers

推荐答案

使用cv2 -阅读更多 使用skimage -详细信息此处

import skimage.io as skio
faces = skio.imread_collection('path/to/images/*.pgm',conserve_memory=True) # can load multiple images at once

使用Scipy -在此处

from scipy import misc
pic = misc.imread('path/to/img.jpg')
print pic

绘制图像

import matplotlib.pyplot as plt
plt.imshow(faces[0],cmap=plt.cm.gray_r,interpolation="nearest")
plt.show()

这篇关于将二进制图像转换为2D数组或Python中的矩阵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆