这是此答案中此代码生成的图像(绿色圆圈除外,我之后提到):
形状为(707,1028,3),因此每个像素有三个通道(RGB),但只填充白色和黑色.如果它被转换为8位图像会更好.
我需要获取图像中每个矩形的位置和大小.我有一些代码使用PIL并.load()访问每个像素,但速度太慢.在PIL版本中,我寻找开始角落和结束角落.代码就像pixels[x, y] == 255 and pixels[x-1, y] == 0 and pixels[x, y-1] == 0
.load()
pixels[x, y] == 255 and pixels[x-1, y] == 0 and pixels[x, y-1] == 0
python arrays numpy python-imaging-library
arrays ×1
numpy ×1
python ×1
python-imaging-library ×1