我有一堆滿是點的培養皿,我想在Matlab中計數。這可以可靠地分批完成嗎?在培養皿上計數菌落
E.g.該板具有352個菌落
我試過ImageJ的,但需要做相當多的裁剪出邊界,並得到不同的結果。
你有什麼建議嗎?
我有一堆滿是點的培養皿,我想在Matlab中計數。這可以可靠地分批完成嗎?在培養皿上計數菌落
E.g.該板具有352個菌落
我試過ImageJ的,但需要做相當多的裁剪出邊界,並得到不同的結果。
你有什麼建議嗎?
我對這個問題的方法如下:
This file exchange toolbox爲我們提供了一個工作循環Hough變換。事情很簡單,從那裏:
function [count,colonies,bw] = colony_count(I)
I = rgb2gray(im2double(I)); %# Color-to-gray conversion.
[m,n] = size(I);
%# Uncomment this if you have might have some images with light background
%# and dark colonies. It will invert any that seem that way.
%#if graythresh(I) < 0.5
%# I = imcomplement(I);
%#end
bw = I > graythresh(I); %# Otsu's method.
radii = 115:1:130; %# Approx. size of plate, narrower range = faster.
h = circle_hough(bw,radii,'same','normalise'); %# Circular HT.
peaks = circle_houghpeaks(h, radii, 'npeaks', 10); %# Pick top 10 circles.
roi = true(m,n);
for peak = peaks
[x, y] = circlepoints(peak(3)); %# Points on the circle of this radius.
x = x + peak(1); %# Translate the circle appropriately.
y = y + peak(2);
roi = roi & poly2mask(x,y,m,n); %# Cumulative union of all circles.
end
%# Restrict segmentation to dish. The erosion is to make sure no dish pixels
%# are included in the segmentation.
bw = bw & bwmorph(roi,'erode');
%# Colonies are merged in the segmented image. Observing that colonies are
%# quite bright, we can find a single point per colony by as the regional
%# maxima (the brightest points in the image) which occur in the segmentation.
colonies = imregionalmax(I) & bw;
%# Component labeling with 4-connectivity to avoid merging adjacent colonies.
bwcc = bwconncomp(colonies,4);
count = bwcc.NumObjects;
我們使用此代碼:
I = imread('http://i.stack.imgur.com/TiLS3.jpg');
[count,colonies,mask] = colony_count(I);
我還上傳了colony_count
功能on the file exchange。如果您的圖片不起作用,但您認爲應該,請在該處留言。
計數是359,我認爲它非常接近。您可以檢查分割(mask
)和菌落標誌(colonies
),看看那裏的錯誤是由:
%# Leave out the changes to mask to just see the colony markers.
%# Then you can see why we are getting some false colonies.
R = I; R(mask) = 255; R(colonies) = 0;
G = I; G(mask) = 0; G(colonies) = 255;
B = I; B(mask) = 0; B(colonies) = 0;
RGB = cat(3,R,G,B);
imshow(RGB);
+1奇妙的答案。 – 2012-03-31 14:08:28
@ Li-aungYip謝謝,但希望沒有人把他們的盤子放在白色背景上...... – 2012-03-31 14:14:16
[什麼樣的吸盤會這樣做?](http://farm4.static.flickr.com/3008/2367953025_b5760be025_o。jpg) – 2012-03-31 14:16:09
我會做的是:
圖像變換到binary image可使用 一些threshold on the Intensity來完成。 注意這些點較淺,因此您可以在 達到閾值後執行1-binaryImage
。我不知道你爲什麼說他們是黑人,但同樣的想法,不管他們是什麼顏色英寸
後,您可以使用Hough transform和情節的rho and theta
,並在 histogram該直方圖可能會在半徑rho ==上取得第二個閾值。
加了:
Detect circles with various radii in grayscale image via Hough Transform
你可以使用一個稱爲連通區域標記可用於在圖像中的不同對象之間做區分技術。
首先你需要通過閾值的一些平均值來製作圖像二進制。標籤是通過掃描每個像素行兩次,一次從左到右,一次從右到左完成的。我們正在尋找對象像素,即具有值1
在左到右的掃描即像素: 對於每個像素p:如果p是對象像素,從上方或複製標籤剩下。如果p是背景像素或p有一個標籤,什麼也不做。
對於從右到左掃描: 對於每個像素p:如果p是對象像素,從右側複製標籤,如果有一個, 否則設置一個新的標籤。如果p是背景像素或p有一個標籤,什麼也不做。如果 標籤存在,並且p右側的像素具有不同的標籤,請記下此標籤。
例如(從講座在http://webstaff.itn.liu.se/~bjogu/TNM087-2012/Fo7-2012-AH.pdf幻燈片):
當你掃描的整體形象,合併,你已經注意到所有的標籤(它們連接到同一個對象),然後算不同標籤的數量,你會有你的計數。
我瞭解您所描述的程序。我的圖像有一個額外的困難,培養皿邊界是一個麻煩,特別是因爲它的顏色與點類似...這可以消除沒有物理移除? – HCAI 2012-03-31 12:06:20
很好的解釋隊友! – 2017-03-08 12:46:12
已經很久,因爲我不得不做這樣的事,或使用Matlab的 - 但不要你必須使用[邊緣檢測](http://initora.wordpress.com/article/learn-matlab-image-processing-edge-232y3pcqwxodx-29/))?那裏必須有很多預先寫好的腳本。 – 2012-03-31 10:04:42
這個工具有這個工具:[NICE](http://www.nist.gov/pml/div682/grp01/nice.cfm),但我無法打開它。它抱怨沒有一個特定的dll文件。 – HCAI 2012-03-31 10:10:26
嘗試下載/安裝.dll?檢查你的Matlab版本是否正確等。 – 2012-03-31 10:16:03