这是我用来创建新图像的代码,在它上面画一个圆圈并显示它:
import numpy as np
import cv2
# create 50x50 image, filled with white
img = np.ones((50,50))
# draw a circle onto the image
cv2.circle(img, (25,25), 10, 0, 2, lineType=cv2.LINE_AA)
# show the image on the screen
cv2.imshow("i", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
如果图像深度不是CV_8U,line_type则自动设置为8。
来自opencv/modules/imgproc/src/drawing.cpp:
if( line_type == CV_AA && img.depth() != CV_8U )
line_type = 8;
Run Code Online (Sandbox Code Playgroud)
由于类型numpy.ones默认为numpy.float64,您将丢失抗锯齿线。
| 归档时间: |
|
| 查看次数: |
1484 次 |
| 最近记录: |