コード例 #1
0
ファイル: smooth_self.py プロジェクト: majpyi/enhanceEdge
# raw_Filter = cv2.bilateralFilter(raw, 9, 50, 50)
cv2.imwrite(outpath + "raw_Filter___" + src + ".jpg", raw_Filter)

raw2 = cv2.cvtColor(raw_Filter, cv2.COLOR_BGR2GRAY)
raw2_Filter = cv2.bilateralFilter(raw2, 9, 150, 150)
# raw2_Filter = cv2.bilateralFilter(raw2, 9, 50, 50)

cv2.imwrite(outpath + "raw2_Filter___" + src + ".jpg", raw2_Filter)

noise_num = 2
th = 6

# raw2_Filter = raw22
# raw_Filter = raw

a, inner, guodu, edge_big, edge_small = modify_rgb.noise_array(
    raw2_Filter, raw_Filter, noise_num, th)
# a, inner, guodu, edge_big, edge_small = modify_rgb.noise_array(raw22, raw, noise_num, th)

# for i in range(guodu.shape[0]):
# 	for j in range(guodu.shape[1]):
# 		if edge_big[i, j] == 1:
# 			edge_big[i, j] = 255
#
# for i in range(guodu.shape[0]):
# 	for j in range(guodu.shape[1]):
# 		if edge_small[i, j] == 1:
# 			edge_small[i, j] = 255
#
# for i in range(guodu.shape[0]):
# 	for j in range(guodu.shape[1]):
# 		if inner[i, j] == 1:
コード例 #2
0
ファイル: BeforeSmooth.py プロジェクト: majpyi/enhanceEdge
raw = cv2.imread(inpath + src + ".jpg")
raw_Filter = cv2.bilateralFilter(raw, 7, 50, 50)
# raw_Filter = cv2.bilateralFilter(raw, 7, 150, 150)
# raw_Filter = raw
raw2 = cv2.cvtColor(raw, cv2.COLOR_BGR2GRAY)
raw2_Filter = cv2.bilateralFilter(raw2, 7, 50, 50)
# raw2_Filter = raw2
# raw2_Filter = cv2.bilateralFilter(raw2, 7, 150, 150)
cv2.imwrite("D:\\out\\try\\raw_Filter" + "___" + src + ".jpg", raw_Filter)
cv2.imwrite("D:\\out\\try\\raw2" + "___" + src + ".jpg", raw2)
cv2.imwrite("D:\\out\\try\\raw2_Filter" + "___" + src + ".jpg", raw2_Filter)

# 获取过渡区域
noise_num = 2
th = 20
a, b, guodu, d, e = modify_rgb.noise_array(raw2_Filter, raw_Filter, noise_num, th)
th2 = 20
# a2, b2, guodu2, d2, e2 = modify_rgb.noise_array(raw2_Filter, raw_Filter, noise_num, th2)
guodu2 = guodu

for i in range(guodu.shape[0]):
	for j in range(guodu.shape[1]):
		if guodu[i, j] == 1:
			guodu[i, j] = 255
for i in range(guodu2.shape[0]):
	for j in range(guodu2.shape[1]):
		if guodu2[i, j] == 1:
			guodu2[i, j] = 255

cv2.imencode('.jpg', guodu)[1].tofile("D:\\out\\try\\寻找过渡区域" + str(th) + "___" + src + ".jpg")
cv2.imencode('.jpg', guodu)[1].tofile("D:\\out\\try\\寻找过渡区域22222" + str(th2) + "___" + src + ".jpg")