Я хочу нанести на изображение с прозрачным фоном текст с цветом. Я вставляю текст в изображение, но цвет шрифта всегда серый
# -*- coding: utf-8 -*-
import cv2
img = cv2.imread('Base-0.png', cv2.IMREAD_UNCHANGED)
# Save the transparency channel alpha
font = cv2.FONT_HERSHEY_SIMPLEX
bottomLeftCornerOfText = (300,500)
fontScale = 1
fontColor = [255, 0, 0]
lineType = 1
gray_layer = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Duplicate the grayscale image to mimic the BGR image and finally add the transparency
*_, alpha = cv2.split(img)
dst = cv2.merge((gray_layer, gray_layer, gray_layer, alpha))
cv2.putText(dst,'Hello',
bottomLeftCornerOfText,
font,
fontScale,
fontColor,
lineType)
hsv=cv2.cvtColor(dst,0)
cv2.imwrite("result.png", hsv)