改进低对比度图像分割
Improving Low Contrast Image Segmentation
我有相差显微镜图像需要分割。由于背景中的对象之间缺乏对比度(图 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 - 原始图像
histogramEq - 提高可见度的图像
binaryImage - 二值化图像
在应用阈值之前,我会使用白色礼帽将不同的图案与背景分开。参见 here the result. Then you stretch the histogram。
然后你就可以应用你所做的了。
我想以 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)
#----binarization of image
ret,thresh = cv2.threshold(gray,250,255,cv2.THRESH_BINARY)
cv2.imshow("thresh",thresh)
#----performing adaptive thresholding
athresh=cv2.adaptiveThreshold(thresh, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 11, 2)
cv2.imshow('athresh', athresh)
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(7, 7))
#----morphological operation
closing = cv2.morphologyEx(athresh, cv2.MORPH_CLOSE, kernel)
cv2.imshow('closing', closing)
#----masking the obtained result on the grayscale image
result = cv2.bitwise_and(gray, gray, mask= closing)
cv2.imshow('result ', result )
我有相差显微镜图像需要分割。由于背景中的对象之间缺乏对比度(图 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 - 原始图像
在应用阈值之前,我会使用白色礼帽将不同的图案与背景分开。参见 here the result. Then you stretch the histogram。
然后你就可以应用你所做的了。
我想以 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)
#----binarization of image
ret,thresh = cv2.threshold(gray,250,255,cv2.THRESH_BINARY)
cv2.imshow("thresh",thresh)
#----performing adaptive thresholding
athresh=cv2.adaptiveThreshold(thresh, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 11, 2)
cv2.imshow('athresh', athresh)
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(7, 7))
#----morphological operation
closing = cv2.morphologyEx(athresh, cv2.MORPH_CLOSE, kernel)
cv2.imshow('closing', closing)
#----masking the obtained result on the grayscale image
result = cv2.bitwise_and(gray, gray, mask= closing)
cv2.imshow('result ', result )