[討論] bwdistgeodesic 函式

看板MATLAB作者 (Donkin??Donkey)時間12年前 (2013/10/11 14:21), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
各位板上大大們好 小弟想把骨架圖上每個endpoint到branchpoint的邊砍掉 因此利用 bwdistgeodesic 這個function 計算skel裡從endpoint 走到 branch point的路徑。 並根據原本的骨架圖刪除上述的路徑 我的方法如下: 1.從每個endpoint出發,並找到離各個endpoint最近的branch point 2.紀錄該endpoint到最近branchpoint的路徑 3.原本骨架圖和上述紀錄的路徑相減得知 程式如下: %找出ima的骨架 skel= bwmorph(ima,'skel',Inf); %針對骨架找出branchpoints B = bwmorph(skel, 'branchpoints'); %針對骨架找出endpoints E = bwmorph(skel, 'endpoints'); %找出endpoints的座標及branchpoints在矩陣的非 0 element [y,x] = find(E); B_loc = find(B); %建立同skel相同size的0矩陣,用來標記各個endpoint到最近branch的路徑 Dmask = false(size(skel)); %針對endpoint的x長度跑迴圈 for k = 1:length(x) %從骨架圖的每個endpoint出發,並找尋附近最近的branchpoint,延途把此endpoint 到最近branchpoint的路徑標記到mask中 D = bwdistgeodesic(skel,x(k),y(k)); distanceToBranchPt = min(D(B_loc)); Dmask(D < distanceToBranchPt) =true; end %得到新骨架圖,該圖為以去除branch到endpoint的邊 skelD = skel - Dmask; %秀圖 imshow(skelD); hold all; [y,x] = find(B); plot(x,y,'ro') 但是執行到bwdistgeodesic這function時 顯示??? Undefined function or method 'bwdistgeodesic' for input arguments of type 'double' 去看了一下x(k)和y(k)都是整數 (x,y是endpoint的座標) 只是怎麼會產生這麼問題呢? 跪求板上大大們的指引 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 120.127.47.203
文章代碼(AID): #1ILvZNjU (MATLAB)