【发布时间】:2022-08-20 19:47:34
【问题描述】:
我创建了一个应用程序来捕获图像并将其转换为铅笔素描。
我需要在为文档找到的捕获图像中添加水印,但我没有得到确切的文档,让我知道如何在图像中添加水印,否则将不胜感激。
import base64
import streamlit as st
import numpy as np
from PIL import Image
import cv2
def dodgeV2(x, y):
return cv2.divide(x, 255 - y, scale=256)
def pencilsketch(inp_img):
img_gray = cv2.cvtColor(inp_img, cv2.COLOR_BGR2GRAY)
img_invert = cv2.bitwise_not(img_gray)
img_smoothing = cv2.GaussianBlur(img_invert, (21, 21),sigmaX=0, sigmaY=0)
final_img = dodgeV2(img_gray, img_smoothing)
logo_img = cv2.imread(\"Watertext.jpg\")
logo_gray = cv2.cvtColor(logo_img, cv2.COLOR_BGR2GRAY)
logo_height, logo_width = logo_gray.shape[:2]
#y_offset = x_offset = 0 # paste to the top left of image
x_offset = final_img.shape[1] - logo_width
y_offset = 0
final_img[x_offset:x_offset+logo_height, y_offset:y_offset+logo_width] = logo_gray
return(final_img)
-
这个问题实际上并没有使用streamlit ...你为什么要这样标记它?你为什么不标记你实际使用的其他库?
标签: python python-imaging-library streamlit