Если вы хотите только центральный blob, вы можете выбрать поиск контуров и выбрать ту, которая имеет максимальную площадь.
Код:
#--- convert image to grayscale ---
imgray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
#--- Perform Otsu threshold ---
ret2, th2 = cv2.threshold(imgray,0,255,cv2.THRESH_BINARY + cv2.THRESH_OTSU)
cv2.imshow('Threshold', th2)
В результате получается двоичное изображение :
#--- Finding contours using the binary image ---
_, contours, hierarchy = cv2.findContours(th2, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
#--- finding the contour with the maximum area ---
big_contour = 0
max_area = 0
for cnt in contours:
if (cv2.contourArea(cnt) > max_area):
max_area = cv2.contourArea(cnt)
big_contour = cnt
#--- creating a mask containing only the biggest contour ---
mask = np.zeros(imgray.shape)
cv2.drawContours(mask, [big_contour], 0, (255,255,255), -1)
cv2.imshow('Mask', mask)
#--- masking the image above with a copy of the original image ---
im2 = im.copy()
fin = cv2.bitwise_and(im2, im2, mask = mask.astype(np.uint8))
cv2.imshow('Final result', fin)
В Beyond Compare вы можете определить «замены».
Пример: различия отмечены красным цветом:
Затем вы можете перейти к Session-> Session Settings и установить замену:
Или еще проще: отметьте текст и определите немедленную замену: [ 1113]
Теперь разница не важна и отмечена синим цветом:
Одним щелчком мыши вы можете игнорировать неважные различия (красная стрелка на скриншоте).
Техническое замечание: я использую BC4 с Pro Edition.