def _resolve_spec(im1, im2):
im = im1.copy()
img1 = cv.cvtColor(im1, cv.COLOR_BGR2GRAY)
img2 = cv.cvtColor(im2, cv.COLOR_BGR2GRAY)
# Best pixel selection criteria
# 1. Pixel difference should be more than 20. (just an experimentally value. Free to change!)
# 2. Best pixel should have less intensity
# 3. pixel should not be pure black. (just an additional constraint
# to remove black background created by warping)
mask = np.logical_and((img1 - img2) > DIFF_THRESHOLD, img1 > img2)
mask = np.logical_and(mask, img2 != 0)
im[mask] = im2[mask]
return im
评论列表
文章目录