所以,我有一个10x10的网格。关于如何在其中可视化2025个矩形有什么想法吗? 我的意思是,我想把它们放在一页(也许是一张图片)上,但我不知道该用哪一个库。 我想用alphas来形象化所有的东西,比如当彼此之间有更多的边界时,我也想形象化。我是说我不知道怎么做。我不需要给我代码或任何东西,我只想要一个库名称使用。你知道吗
编辑:
我的矩形是在一个有4个元组的列表中定义的,其中一个元组有一个角的x,y坐标,比如:[(x, y), (x2, y), (x, y2), (x2, y2)]
编辑2: 现在我的代码是:
multipler = 100
canvasH = 10 * multipler # 10 == Y in squares.py
canvasW = 10 * multipler # 10 == X in squares.py
img = numpy.zeros((canvasH, canvasW, 3), numpy.uint8)
# img = cv2.line(img, (0, 0), (511, 511), (255, 0, 0), 5)
rectangles = [[(0, 0), (1, 0), (0, 1), (1, 1)], [(0, 0), (1, 0), (0, 2), (1, 2)], [(0, 0), (1, 0), (0, 3), (1, 3)]...]
for rectangle in rectangles:
cv2.rectangle(img, (rectangle[0][0] * multipler, rectangle[0][1] * multipler), (rectangle[3][0] * multipler, rectangle[3][1] * multipler), (206, 220, 242))
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
但是我只看到9x9
张照片,所以我不能看到所有的照片(我有2025张照片)。你知道吗
谢谢你, 马西
你的问题有很多未知数。这是一种可能的解释。你知道吗
一些评论:
savefig
可以保存为多种格式。png“最适合纯图像格式。”。svg对于高质量的矢量格式来说很有趣。你知道吗PS1:对于你在评论中关于网格上重叠的许多矩形的附加问题,你可以画一个由覆盖每个单位正方形的矩形的数量着色的图像。一些示例代码:
PS2:以10x10网格上几乎所有整数坐标的矩形为例,一个想法是只画边,使用随机颜色区分并随机移动所有点,这样它们就不再重叠。即便如此,仍然有大量几乎重叠的矩形。你知道吗
相关问题 更多 >
编程相关推荐