File size: 884 Bytes
2eacc9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import cv2
import numpy as np
import os

# create_watermark ===============================================================
# return:
#	(<Boolean> True/False), depending on the transformation process
def create_watermark(nude):

	# Add alpha channel if missing
	# if nude.shape[2] < 4:
	# 	nude = np.dstack([nude, np.ones((512, 512), dtype="uint8") * 255])

	# watermark = cv2.imread("fake.png", cv2.IMREAD_UNCHANGED)
	
	# f1 = np.asarray([0, 0, 0, 250])   # red color filter
	# f2 = np.asarray([255, 255, 255, 255])
	# mask = cv2.bitwise_not(cv2.inRange(watermark, f1, f2))
	# mask_inv = cv2.bitwise_not(mask)

	# res1 = cv2.bitwise_and(nude, nude, mask = mask)
	# # res2 = cv2.bitwise_and(nude, nude, mask = mask)
	# # res2 = cv2.bitwise_and(watermark, watermark, mask = mask_inv)
	# res = res1

	# alpha = 0.6
	# return cv2.addWeighted(res, alpha, nude, 1 - alpha, 0) 
	return nude