-
大小: 1KB文件類型: .rar金幣: 1下載: 0 次發(fā)布日期: 2021-04-27
- 語言: Matlab
- 標(biāo)簽: MATLAB??log??斑點(diǎn)檢測(cè)??
資源簡(jiǎn)介
log算法檢測(cè)斑點(diǎn)程序,程序可讀性好,檢測(cè)結(jié)果不錯(cuò),可自行加載圖片進(jìn)行檢測(cè)
代碼片段和文件信息
function?[points]?=?log_Blob(imgo_nb_blobs)
????%?功能:提取LoG斑點(diǎn)
????%?輸入:?
????%??????img?–輸入的圖像
????%???????o_nb_blobs?-需要檢測(cè)的斑點(diǎn)區(qū)域的數(shù)量
????%?輸出:
????%???????points?-檢測(cè)出的斑點(diǎn)
????%?參考文獻(xiàn):
????%?Lindeberg?T.?Feature?Detection?with?Automatic?Scale?Selection
????%?IEEE?Transactions?Pattern?Analysis?Machine?Intelligence?1998?30?
????%?77-116
????
????%?輸入圖像
????img?=?double(img(::1));
????????
????%?設(shè)定檢測(cè)到斑點(diǎn)的數(shù)量
????if?nargin==1
????????nb_blobs?=?120;
????else
????????nb_blobs?=?o_nb_blobs;
????end
????
????%?設(shè)定LoG參數(shù)
????sigma_begin?=?2;
????sigma_end???=?15;
????sigma_step??=?1;
????sigma_array?=?sigma_begin:sigma_step:sigma_end;
????sigma_nb????=?numel(sigma_array);
????????
????%?變量
????img_height??=?size(img1);
????img_width???=?size(img2);
????????
????%?計(jì)算尺度規(guī)范化高斯拉普拉斯算子
????snlo?=?zeros(img_heightimg_widthsigma_nb);
????for?i=1:sigma_nb
????????sigma???????=?sigma_array(i);
snlo(::i)?=?sigma*sigma*imfilter(imgfspecial(‘log‘?floor(6*sigma+1)?sigma)‘replicate‘);
????end
????????
????%?搜索局部極值
????snlo_dil?????????????=?imdilate(snloones(333));
????blob_candidate_index?=?find(snlo==snlo_dil);
????blob_candidate_value?=?snlo(blob_candidate_index);
????[tmpindex]??????????=?sort(blob_candidate_value‘descend‘);
????
blob_index???????????=?blob_candidate_index(?index(1:min(nb_blobsnumel(index)))?);
[ligcolsca]????????=?ind2sub([img_heightimg_widthsigma_nb]blob_index);
????points???????????????=?[ligcol3*reshape(sigma_array(sca)[size(lig1)1])];
????
end
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????1636??2012-02-05?19:59??log_Blob.m
-----------?---------??----------?-----??----
?????????????????1636????????????????????1
評(píng)論
共有 條評(píng)論