如何将算术颜色转换为对应的 RGB 颜色?

How to convert the arithmetic color to its RGB counterpart?

在 openCV 中使用 RGB 颜色 (255.0,0.0,0.0)(红色)时,输出为蓝色。

import cv2
import matplotlib.pyplot as plt

plt.plot([1,2,3,4] ,  color=[1.0, 0.0, 0.0])
plt.savefig('tester.png')
img = cv2.imread('tester.png')
m_img = (cv2.line(img,(0,0),(100,100),(255.0,0.0,0.0),5))
cv2.imwrite('./update.png', m_img)

tester.png :

update.png :

如何修改线 m_img = (cv2.line(img,(0,0),(100,100),(255.0,0.0,0.0),5)) 以便绘制与 plt.plot([1,2,3,4] , color=[1.0, 0.0, 0.0]) 相同的 RGB 线颜色?

OpenCV 使用 BGR,而不是 RGB。交换 0 和 2 通道。

m_img = (cv2.line(img,(0,0),(100,100),(255.0,0.0,0),5))  # blue line
m_img = (cv2.line(img,(0,0),(100,100),(0,0.0,255.0),5))  # red line