Layout of the output array img is incompatible with cv::Mat
cv2.circle函数报错,解决方法,前面加上代码:
'''修改后的'''
b, g, r = cv2.split(new_image1)
new_image1 = cv2.merge([r, g, b])
后面就可以运行了:
# cv2.imshow('222', new_image1)
# cv2.waitKey(5000)
# cv2.destroyAllWindows()
cv2.circle(new_image1, (int(x_y[0]), int(x_y[1])), 2, (0, 0, 255), -1)
本文介绍了解决使用OpenCV库中cv2.circle函数时报错的问题,通过调整图像通道顺序,确保输出数组布局与cv::Mat兼容,从而顺利执行画圆操作。
2350

被折叠的 条评论
为什么被折叠?



