#SSR
def replaceZeroes(data):
min_nonzero = min(data[nonzero(data)])
data[data == 0] = min_nonzero
return data
def SSR(img,size):
L_blur = cv2.GaussianBlur(img,(size,size),0)
eps = float(1e-10)
h,w = img.shape[:2]
dst_img = zeros((h,w),dtype = float32)
dst_Lblur = zeros((h, w),dtype=float32)
dst_R = zeros((h, w), dtype=float32)
img = replaceZeroes(img)
L_blur = replaceZeroes(L_blur)
cv2.log(img,dst_img)
cv2.log(L_blur,dst_Lblur)
log_R = cv2.subtract(dst_img,dst_Lblur)
cv2.normalize(log_R,dst_R,0,255,cv2.NORM_MINMAX)
log_uint8 = cv2.convertScaleAbs(dst_R)
minvalue,maxvalue,minloc,maxloc = cv2.minMaxLoc(log_R)
for i in range(h):
for j in range(w):
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余4页未读,立即下载