24_#浮雕效果
作者:互联网
import cv2
import numpy as np
import math
img = cv2.imread('ruonan.jpg',1)
Info = img.shape
height = Info[0]
width = Info[1]
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
dst = np.zeros((height,width,1),np.uint8)
#newp = gray[i,j]- gray[i,j+1]+150
for i in range(0,height):
for j in range(0,width-1):
newp = gray[i,j]-gray[i,j+1]+150
if newp >=255:
dst[i,j]=255
else:
dst[i,j] = newp
cv2.imshow('Dst',dst)
cv2.waitKey(0)
标签:24,gray,img,dst,cv2,height,newp,_#,浮雕 来源: https://blog.51cto.com/u_14229365/2923905