Here is a simple code which puts a text value onto a black frame and displays it:
frame = np.zeros((50,200,3))
org=(0,45)
font=cv2.FONT_HERSHEY_SIMPLEX
fontScale=1
fontColor=(1,0,0) ##rgb
out_img = cv2.putText(frame, "text" , org, font, fontScale, fontColor)
plt.imshow(out_img)
I am trying to understand how the color intensity is treated:
- fontColor=(1,0,0) versus fontColor=(255,0,0). Both print red text with no change to intensity. Shouldn’t the intensity vary based on the strength we have given? Same with other colors also. For e.g (0,1,0) versus fontColor=(0,255,0)
- How do we explain behaviour when we are mixing colors. For e.g. by fontColor=(255,255,0), we are mixing red and green which rightly gives us yellow text. But fontColor=(1,255,0) also gives us exactly the same yellow text (as if red and green are mixed in equal proportions)
Sidenote: The problem I am trying to solve is to decipher the color of the text in a given image. I was able to get the text contours and isolate the text by putting it onto a large black mask and then get the second prominent color (foreground). So far so good. However I am having trouble deciphering the intensities of the obtained foreground color.