Frosted glass

Principle: all the pixels randomly assigned a value greater than its small, such as: a value between 0-8

import cv2
import numpy as np
import random
img = cv2.imread('D:/pythonob/imageinpaint/img/zidan.jpg',1)
imgInfo = img.shape
height = imgInfo[0]
width = imgInfo[1]
dst = np.zeros((height,width,3),np.uint8)
for i in range(0,height-8):
for j in range(0,width-8):
index = int(random.random()*8)#随机数0-8
(b,g,r) = img[i+index,j+index]
dst[i,j] = (b,g,r)
cv2.imshow('maoboli',dst)
cv2.waitKey(0)

效果图:

 

Guess you like

Origin www.cnblogs.com/cxxBoo/p/11454504.html
Recommended