在图像上的指定位置内爆

发布于 2025-01-17 10:11:09 字数 215 浏览 0 评论 0原文

我有一个关于 implode 函数的问题 (https://docs.wand-py.org/en/0.6.7/guide/fx.html#implode)。是否有可能对图像中非中心的点使用内爆函数?通过传递例如坐标元组?

I have a question regarding the implode function (https://docs.wand-py.org/en/0.6.7/guide/fx.html#implode). Is there any possibility to use the implode function for a point in the image that is not the center? By passing e.g. a tuple of coordinates?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与风相奔跑 2025-01-24 10:11:09

我会分享我的解决方法以防万一。我编写了一个小脚本,以通过用鼠标在图像上单击图像来找出要爆裂的点的位置。我最终得到了坐标(例如,在形状100、100的图像中40,30)。

在下一步中,我必须以某种方式将40,30的像素“移动”到图像中心。为此,我决定相应地(使用CV2)在图像周围添加边界。因此,我将不得不在图像的左侧水平添加20个(因此图像为120,100,40,30的像素与每个边界的距离相同(右侧60,左侧60)。我愿意垂直轴相同,在这种情况下,尺寸为120x140的图像,

现在我在我指定的点上爆炸,如果我要介绍了四个情况,一切都可以自动化AT是较高或较低的H/2或W/2,因此我知道我必须在哪一侧添加边框

I'll share my workaround just in case. I've written a small script to find out the position of the point I want to implode by clicking on it on the image with the mouse. I end up with coordinates (e.g. 40,30 in a image with the shape 100, 100).

In the next step I'd have to somehow "move" my pixel at 40,30 into the image center. To do so I've decided to add borders around my image accordingly (with cv2). So I'll have to add 20 horizontally on the left side of my image (so the image is 120,100 and my pixel at 40,30 has the same distance to each border (60 to the right, 60 to the left). I do the same for the vertical axis and end up, in this case, with an image with the dimension of 120x140.

Now I cam implode at my specified point and everything is able to being automated if I cover four cases of the point I want to implode at is either higher or lower of h/2 or w/2 so I know on which side I have to add the border.

Afterwards you can use the trim function to get rid of the extended border and you're good to go.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文