我的問題是,如何改善此代碼以移除圖像中的視盤?
- 此代碼需要太長時間才能加載;
- 某些其他圖像的視盤不起作用。
原始圖像顯示在代碼下面。
raw = imread('DDB (1).jpg')
%%% ===============OPTIC DISC DETECTION==================
adjusted1=imadjust(raw,[0.9 0.8 0; 1 0.9 0.3],[0.1 0.5]); %adjust color to violet for more defined edges
rgb=adjusted1;
szeimg=size(rgb);
width=szeimg(:,1)/2;
k=ones(szeimg(1),szeimg(2));
whiteBG=double(k);
[centersBright, radiiBright, metricBright] = imfindcircles(rgb,[fix(width*0.1) fix(width*0.4)],'ObjectPolarity','bright','Sensitivity',0.92,'EdgeThreshold',0.12);
if isempty(radiiBright)==1;
[centersBright, radiiBright, metricBright] = imfindcircles(rgb,[fix(width*0.1) fix(width*0.4)],'ObjectPolarity','bright','Sensitivity',0.92,'EdgeThreshold',0.06);
if isempty(radiiBright)==1;
ODdetect=whiteBG;
else
ODdetect=insertShape(whiteBG,'FilledCircle',[centersBright(:,1), centersBright(:,2),radiiBright.*1.2],'Color','black','Opacity',1);
end
else
ODdetect=insertShape(whiteBG,'FilledCircle',[centersBright(:,1), centersBright(:,2),radiiBright.*1.2],'Color','black','Opacity',1);
end
對於定時,與分析器檢查以查看哪個部分正在最長(可能'imfindcircles')。另一方面,您必須指定「不起作用」,但最有可能的情況是,您爲此圖像硬編碼的設置('EdgeThreshold'等)不適用於所有圖像。 – nkjt 2014-10-10 12:21:10
什麼是「其他」圖像? – kkuilla 2014-10-10 12:47:17
圖像具有不同光強度的視盤。由於該代碼僅基於用於視盤 – Jamesmeister 2014-10-10 13:03:44