opencv中抗锯齿圆呈锯齿状
这看起来像是一个常见的 OpenCV 圆形配方,会为所绘制的圆形产生真正的锯齿状边缘。这是最低限度可行的可重现代码:
import cv2
import numpy as np
image = np.zeros((512,512,3), np.uint8)
cv2.circle(image, (350, 350), 200, (15,75,50), cv2.FILLED)
cv2.imshow("Circle", image)
cv2.waitKey(0)
cv2.destroyAllWindows()
在非填充圆的情况下可能会好一点(使用 lineType=cv2.LINE_AA
时):
但有时绘制既填充又具有良好圆周边缘的圆圈会很好。
我想知道这个结果是否可以在使用 OpenCV 的框架内得到改进,尽管 OpenCV 可能不会尝试成为一个像素完美的绘图库。
预先感谢您的帮助,因为我缩小了 OpenCV 和 Pyglet 之间的选择范围,以实现特定的计算机视觉与图形实现。而且,即使只是在一些 OpenCV 负载应用程序中随意使用形状绘图,拥有视觉上令人愉悦的传统形状也是很好的。
It may seem like a common OpenCV recipe for a circle yields really jagged edges to the circles being drawn. Here's minimally viable reproducible code:
import cv2
import numpy as np
image = np.zeros((512,512,3), np.uint8)
cv2.circle(image, (350, 350), 200, (15,75,50), cv2.FILLED)
cv2.imshow("Circle", image)
cv2.waitKey(0)
cv2.destroyAllWindows()
It's perhaps a little better in the case of a non-filled circle (when using lineType=cv2.LINE_AA
):
But it's sometimes nice to draw circles which are both filled and have a good edge to their circumference at the same time.
I wonder if this outcome can be improved within the framework of using OpenCV, even though OpenCV probably does not try to be a pixel perfect drawing library.
Thanks in advance for your help as I narrow down my choice between OpenCV and Pyglet for a certain computer vision with graphics implementation. And also because it would be nice to have visually pleasing conventional shapes even for just your haphazard use of shape drawing in some OpenCV laden applications.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在同一调用中使用两者
thickness=cv.FILLED
和lineType=cv.LINE_AA
。您应该始终查阅您所使用的技术的文档。
Use both
thickness=cv.FILLED
andlineType=cv.LINE_AA
in the same call.You should always consult the documentation of the technologies you use.