改善低对比度图像分割

时间:2016-07-26 16:16:08

标签: matlab image-processing image-segmentation contrast

我有相位对比显微镜图像需要分段。由于背景中的物体之间缺乏对比,因此将它们分割似乎非常困难(图1)。我使用函数adapthisteq来增加单元格的可见性(图像2)。有什么方法可以改善细胞的分割吗?

normalImage = imread(fileName);
channlImage = rgb2gray(normalImage);
histogramEq = adapthisteq(channlImage,'NumTiles',[50 50],'ClipLimit',0.1);
saturateInt = imadjust(histogramEq);
binaryImage = im2bw(saturateInt,graythresh(saturateInt));
binaryImage = 1 - binaryImage;

normalImage - 原始图像 normalImage histogramEq - 增加可见性图像 histogramEq binaryImage - 二值化图像 binaryImage

2 个答案:

答案 0 :(得分:1)

在应用阈值之前,我会使用白色礼帽将不同的图案与背景分开。见here the result。然后你stretch the histogram

然后你可以应用你所做的。

答案 1 :(得分:0)

我想建立FiReTiTi的答案。我有下面的代码和一些截图。我使用OpenCV 3.0.0

完成了这项工作
import cv2

x = 'test.jpg'
img = cv2.imread(x, 1)
cv2.imshow("img",img)

#----converting the image to grayscale
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
cv2.imshow('gray', gray)

enter image description here

#----binarization of image
ret,thresh = cv2.threshold(gray,250,255,cv2.THRESH_BINARY)
cv2.imshow("thresh",thresh)

enter image description here

#----performing adaptive thresholding
athresh=cv2.adaptiveThreshold(thresh, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 11, 2)
cv2.imshow('athresh', athresh)

enter image description here

kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(7, 7))

#----morphological operation
closing = cv2.morphologyEx(athresh, cv2.MORPH_CLOSE, kernel)
cv2.imshow('closing', closing)

enter image description here

#----masking the obtained result on the grayscale image
result = cv2.bitwise_and(gray, gray, mask= closing)
cv2.imshow('result ', result )

enter image description here