我有一个只有文本(总是白色)的图像,我想将文本从它复制到另一个图像.
下面是带有徽标和图像的图像.目前,我正在抓取这个文本的屏幕截图,并将其叠加到另一个图像上.然而,正如你所看到的,我得到了与文本一起的黑色矩形,我如何才能摆脱黑色矩形区域,或者只是将文本从黑色框架复制到图像?
image_2_replace = cv2.imread(mask_image2)
im2r = cv2.cvtColor(image_2_replace, cv2.COLOR_BGR2RGB)
image_2_title_img = cv2.imread(image_2_title)
image_2_titl_img = cv2.cvtColor(image_2_title_img, cv2.COLOR_BGR2RGB)
im2r_title = cv2.resize(image_2_titl_img, (left_image_msg[2], left_image_msg[3]))
# take the coordinate of the location where i need to put the text screenshot and add it over the image.
im2r[153: 153 + 324,
580: 580 + 256] = im2r_title