gpt4 book ai didi

Python - 多个持久性可修改矩形选择器

转载 作者:太空宇宙 更新时间:2023-11-03 22:38:30 25 4
gpt4 key购买 nike

我目前正在尝试显示具有多个突出显示和可修改的兴趣区域的图像。我想通过使用例如 matplotlib.widgets 中的 rectangleselector 来解决它。

问题是我无法混合多个持久的可拖动可调整大小的边界框。

例子是here .

如果您有其他方法,请告诉我。

我希望在上述示例中有多个矩形选择器对象。我希望你能帮助我。

最佳答案

我找到了一个不错的库作为替代:PyQtGraph - ROI .

Here是一个很好的代码示例:

v3 = w3.addViewBox(row=1, col=0, lockAspect=True) # adds a content area 
# to the existing layout

r3a = pg.ROI([0,0], [10,10]) #creates a bounding box which i need
v3.addItem(r3a) #adding it to the scene
## handles scaling horizontally around center
r3a.addScaleHandle([1, 0.5], [0.5, 0.5]) #append the box with dragable handles
r3a.addScaleHandle([0, 0.5], [0.5, 0.5]) #for nice resizing purposes

## handles scaling vertically from opposite edge
r3a.addScaleHandle([0.5, 0], [0.5, 1])
r3a.addScaleHandle([0.5, 1], [0.5, 0])

## handles scaling both vertically and horizontally
r3a.addScaleHandle([1, 1], [0, 0])
r3a.addScaleHandle([0, 0], [1, 1])

关于Python - 多个持久性可修改矩形选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56306876/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com