# 多尺度的图像细节提升

## 多尺度的图像细节提升

### 实现代码：

def multiScaleSharpen(img ,radius):
h,w,chan = img.shape

GaussBlue1 = zeros(img.shape,dtype = uint8)
GaussBlue2 = zeros(img.shape, dtype=uint8)
GaussBlue3 = zeros(img.shape, dtype=uint8)
Dest_float_img = zeros(img.shape, dtype=float32)
Dest_img = zeros(img.shape, dtype=uint8)

w1 = 0.5
w2 = 0.5
w3 = 0.25

for i in range(0,h):
for j in range(0,w):
for k in range(0,chan):
Src = img.item(i,j,k)
D1 = Src-GaussBlue1.item(i,j,k)
D2 = GaussBlue1.item(i,j,k) - GaussBlue2.item(i,j,k)
D3 = GaussBlue2.item(i,j,k) - GaussBlue3.item(i,j,k)
if(D1 > 0):
sig = 1
else:
sig = -1
Dest_float_img.itemset((i,j,k),(1-w1*sig)*D1+w2*D2+w3*D3+Src)

Dest_img = cv2.convertScaleAbs(Dest_float_img)
return Dest_img

if __name__ == '__main__':

multiScaleSharpen_out = zeros(img.shape, dtype=uint8)
multiScaleSharpen_out = multiScaleSharpen(img,5)

cv2.namedWindow("original image", cv2.WINDOW_NORMAL)
cv2.namedWindow("multiScaleSharpen image", cv2.WINDOW_NORMAL)
cv2.namedWindow("Compare image", cv2.WINDOW_NORMAL)

cv2.imshow("original image", img)
cv2.imshow("multiScaleSharpen image", multiScaleSharpen_out)
cv2.imshow("Compare image",hstack((img,multiScaleSharpen_out)))
cv2.imwrite("multiScaleSharpen_LenaRGB.bmp", multiScaleSharpen_out)
cv2.waitKey(0)  # 等待键盘触发事件，释放窗口


### 实现效果图：

SSE图像算法优化系列十二：多尺度的图像细节提升。