2016-07-26 94 views
2

我有需要分割的相差顯微鏡圖像。由於背景中的物體之間缺乏對比(圖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

回答

1

之前申請的門檻,我會通過使用單獨從背景不同的模式白色禮帽。見here the result。那麼你stretch the histogram

然後你可以應用你所做的。

+0

嗨,增加了行'tophatImage = imtophat(histogramEq,strel( '磁盤',7))''後histogramEq'。結果看起來與您的非常相似,但不同之處在於,與您的背景相比,感興趣的對象看起來更亮。你是如何照亮感興趣的物體? '伸展直方圖'是什麼意思? – Senyokbalgul

+0

我的建議是在adapthisteq之前應用大禮帽,而不是之後。頂帽對照明變化不敏感。我添加了一個關於直方圖拉伸的鏈接。 – FiReTiTi

+0

它仍然似乎沒有幫助準確分割。 – Senyokbalgul

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