??????個人主頁:研學(xué)社的博客?
????????歡迎來到本博客????????
??博主優(yōu)勢:??????博客內(nèi)容盡量做到思維縝密,邏輯清晰,為了方便讀者。
??座右銘:行百里者,半于九十。
??????本文目錄如下:??????
目錄
??1 概述
??2 運(yùn)行結(jié)果
??3?參考文獻(xiàn)
??4 Matlab代碼、數(shù)據(jù)、文章講解
??1 概述
從建筑的點(diǎn)集中生成直線建筑輪廓通常分為三個步驟。首先確定構(gòu)成建筑輪廓的邊界。然后從邊緣開始跟蹤一系列點(diǎn)來定義建筑邊界。最后,從點(diǎn)的序列中生成線條,并進(jìn)行調(diào)整以形成規(guī)則的建筑輪廓。現(xiàn)有的解決方案在以下一種或多種情況下存在缺陷:沿凹形狀識別細(xì)節(jié),單獨(dú)識別形狀內(nèi)的“洞”,適當(dāng)?shù)倪吔绺?,以及沿正則化建筑輪廓保存詳細(xì)信息。本文針對這三個步驟提出了新的解決方案。通過使用輸入數(shù)據(jù)中的最大點(diǎn)對點(diǎn)距離,識別步驟的解決方案正確地檢測任何類型形狀的邊界邊緣,并單獨(dú)識別形狀內(nèi)部的孔(如果有的話)。所提出的跟蹤算法將邊界邊劃分為段,準(zhǔn)確獲取每個段的點(diǎn)序列,并在必要時(shí)將它們合并,以生成每個形狀的單一邊界。正則化步驟提出了一種改進(jìn)的角線提取算法,并根據(jù)自動確定的建筑物主方向?qū)μ崛〉木€進(jìn)行調(diào)整。為了評價(jià)其性能,還提出了一種將提取的建筑輪廓線與參考輪廓線進(jìn)行角對應(yīng)的評價(jià)系統(tǒng)。實(shí)驗(yàn)結(jié)果表明,即使在低密度輸入數(shù)據(jù)中,所提出的解決方案也能保持建筑邊界的細(xì)節(jié),并提供較高的基于像素的完整性和幾何精度。
1) 從輸入點(diǎn)集中分別提取(識別和跟蹤)外部邊界和內(nèi)部邊界,
2) 處理任何類型的輸入點(diǎn)集,
3) 從大型和/或密集點(diǎn)集的每個子集中單獨(dú)提取邊界。可以分割原始輸入點(diǎn)集(用戶定義如何分割),然后可以從組合的子集邊界中提?。▋?nèi)部和外部)邊界。這大大降低了大型和/或密集點(diǎn)集的計(jì)算成本。
這些算法還能夠在單個輸入數(shù)據(jù)集中為多個對象提取多個邊界。在這種情況下,兩個對象之間的距離應(yīng)至少是輸入點(diǎn)云中最大點(diǎn)對點(diǎn)距離的 2 倍。
詳細(xì)文章見第4部分。
??2 運(yùn)行結(jié)果
部分代碼:
function [bndry bndryin] = delaunay_boundary02_fig(X,Fd,Plns)
[bndry E Ne] = find_delaunay_boundary03(X,Fd);
%Fd = Fd-0.2;
aThresh = 22.5/2; %standard 45 degree
dFd = 2*Fd;
msd = dFd*dFd;
msd1 = Fd*Fd;
(Ner(j,k) > 1 || Ner(k,j) > 1)) ||...
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (chk2(1,1) == 0 && chk2(2,1) == 0 && (Ner(j,k) > 0 || Ner(k,j) > 0)))%if (j,k) is from the same plane j,k should not be the consecutive points along plane boundary
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if j < k
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Ner(j,k) = Ner(j,k)-1;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Q = [Q; [j k chk2(2,1)]]; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Ner(k,j) = Ner(k,j)-1;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Q = [Q; [k j chk2(2,1)]];
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %plot([X(j,1) X(k,1)], [X(j,2) X(k,2)],'-b'); hold on;?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if Ner(j,k) == 0 && Ner(k,j) == 0
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? here = 1;
her vertics with edge (i,j)
? ? ? ? ? ? ? ? ? ? for v = 1:size(vs,2)
? ? ? ? ? ? ? ? ? ? ? ? here = 1;
? ? ? ? ? ? ? ? ? ? ? ? k = vs(1,v); ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? %for edge (i,k)
? ? ? ? ? ? ? ? ? ? ? ? %check if (i,k) is already in Q
? ? ? ? ? ? ? ? ? ? ? ? chk2 = checkEdgeInGaps03(X,i,k,Plns); %check if the edge (i,k) is within a gap in between two planes
? ? ? ? ? ? ? ? ? ? ? ? %if chk2 == 1
? ? ? ? ? ? ? ? ? ? ? ? fik = 0;
? ? ? ? ? ? ? ? ? ? ? ? if size(Q,1)>0
? ? ? ? ? ? ? ? ? ? ? ? ? ? if sum(Q(:,1) == i & Q(:,2) == k) == 1 || sum(Q(:,1) == k & Q(:,2) == i) == 1
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %it is alreday inlcuded into a previous
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %iteration, so do not add it anymore
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %Er(i,k) = 0;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %Er(k,i) = 0;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %Ner(i,k) = 0;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %Ner(k,i) = 0;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %plot([X(i,1) X(k,1)], [X(i,2) X(k,2)],'-m'); hold on;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fik = 1;
? ? ? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? ? ? if fik == 0 && (Ner(i,k) == 2 || Ner(k,i) == 2) %&& (chk2(1,1) == 1 ||...
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %(chk2(1,1) == 0 && chk2(2,1) == 1 && (Ner(i,k) > 1 || Ner(k,i) > 1)) ||...
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [mn id] = min(dks);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? k = k(1,id);
? ? ? ? end
? ? ? ? else
? ? ? ? ? ? Q = [];
? ? ? ? ? ? Qactive = [];
? ? ? ? end
? ? ? ? B = [];
? ? ? ? while size(Q,1)>0
? ? ? ? ? ? found = 0;
? ? ? ? ? ? for qc = 1:size(Q,1)
? ? ? ? ? ? ? ? q = Q(qc,1);%struct number
? ? ? ? ? ? ? ? if Qactive(qc,1) == 1%if this sturct is not marked inactive
? ? ? ? ? ? ? ? ? ? found = 1;
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? end
? ? ? ? ? ? end
? ? ? ? ? ? if found == 0
? ? ? ? ? ? ? ? Q = [];
? ? ? ? ? ? ? ? Qactive = [];
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? end
? ? ? ? ? ? e = S{q}.f1;%starting edge
? ? ? ? ? ? pv = e(1,1);%previous and current vertices
? ? ? ? ? ? cv = e(1,2);
? ? ? ? ? ? plot([X(pv,1) X(cv,1)], [X(pv,2) X(cv,2)],'-g', 'linewidth', 2); hold on;
? ? ? ? ? ? PVs = pv;%previous vertics, which are left column of S{q}.f1
? ? ? ? ? ? %explore the current struct
? ? ? ? ? ? while(1)
? ? ? ? ? ? ? ? vs = find(Er(cv,:) == 1); %all vertices that are connected to cv
? ? ? ? ? ? ? ? %find all vertices, other than pv, which are along boundary (remove non
? ? ? ? ? ? ? ? %boundary vertices
? ? ? ? ? ? ? ? bv = [];
? ? ? ? ? ? ? ? if cv == 1628 || cv == 156
? ? ? ? ? ? ? ? ? ? here = 1;
? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? for m = 1:size(vs,2)
? ? ? ? ? ? ? ? ? ? k = vs(1,m);
? ? ? ? ? ? ? ? ? ? ? ? ? ? if fv > 0
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? ? ? if fv > 0% a new edge is found
? ? ? ? ? ? ? ? ? ? ? ? ? ? count = count+1;
? ? ? ? ? ? ? ? ? ? ? ? ? ? S{count} = s;
? ? ? ? ? ? ? ? ? ? ? ? ? ? El = [El;[i j count 1]];
? ? ? ? ? ? ? ? ? ? ? ? ? ? chkV(i,j) = 0;
? ? ? ? ? ? ? ? ? ? ? ? ? ? chkV(j,i) = 0;
? ? ? ? ? ? ? ? ? ? ? ? ? ? is = i;
? ? ? ? ? ? ? ? ? ? ? ? ? ? js = j;
? ? ? ? ? ? ? ? ? ? ? ? ? ? Q = [Q;count];%queue for structs to explore
? ? ? ? ? ? ? ? ? ? ? ? ? ? Qactive = [Qactive; 1];
? ? ? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? elseif size(bv,1) == 1
? ? ? ? ? ? ? ? ? ? %only 1 option, so go forward tracking boundary
? ? ? ? ? ? ? ? ? ? k = bv(1,1);
? ? ? ? ? ? ? ? ? ? chkV(cv,k) = 0;
? ? ? ? ? ? ? ? ? ? chkV(k,cv) = 0;
? ? ? ? ? ? ? ? ? ? S{q}.f1 = [S{q}.f1; [cv k]];%update edge list for S{q}
? ? ? ? ? ? ? ? ? ? S{q}.f2 = [S{q}.f2; k];%update vertices list for S{q}
? ? ? ? ? ? ? ? ? ? El = [El; [cv k q size(S{q}.f1,1)]];
? ? ? ? ? ? ? ? ? ? pv = cv;
? ? ? ? ? ? ? ? ? ? cv = k;
? ? ? ? ? ? ? ? ? ? plot([X(pv,1) X(cv,1)], [X(pv,2) X(cv,2)],'-m', 'linewidth', 2); hold on;
? ? ? ? ? ? ? ? ? ? if cv == 2935
? ? ? ? ? ? ? ? ? ? ? ? here = 1;
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? PVs = [PVs;pv]; ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? if sum(PVs == cv)==1 %current vertext has already been visited in an earlier iteration, possibly a loop, so break
? ? ? ? ? ? ? ? ? ? ? ? %self-loop! Update B
? ? ? ? ? ? ? ? ? ? ? ? loopid = find(PVs == cv);
? ? ? ? ? ? ? ? ? ? ? ? B = [B; [q size(S{q}.f1,1) q loopid]];%record the boundary
? ? ? ? ? ? ? ? ? ? ? ? S{q}.f3 = [S{q}.f3; q];%update child list (a previuos paranet becomes a child, so a loop)
? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? %{
? ? ? ? ? ? ? ? ? ? Vi(end,1) = k;
? ? ? ? ? ? ? ? ? ? Vc = [Vc; pv];
? ? ? ? ? ? ? ? ? ? if k == fv % aboundary is found
? ? ? ? ? ? ? ? ? ? ? ? Vi = [];
? ? ? ? ? ? ? ? ? ? ? ? Vc = [Vc; fv];
? ? ? ? ? ? ? ? ? ? ? ? count = count + 1;
? ? ? ? ? ? ? ? ? ? ? ? Vb{count,1} = Vc;
? ? ? ? ? ? ? ? ? ? ? ? Vc = [];
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? %} ? ? ? ? ? ?
? ? ? ? ? ? ? ? else%more than one option, generate new structs to explore latter
? ? ? ? ? ? ? ? ? ? for l = 1:size(bv,1)
? ? ? ? ? ? ? ? ? ? ? ? k = bv(l,1);
? ? ? ? ? ? ? ? ? ? ? ? chkV(cv,k) = 0;
? ? ? ? ? ? ? ? ? ? ? ? chkV(k,cv) = 0;
? ? ? ? ? ? ? ? ? ? ? ? count = count+1;
? ? ? ? ? ? ? ? ? ? ? ? %create a new struct and set q as a parent of new, and new
? ? ? ? ? ? ? ? ? ? ? ? %as a child of q
? ? ? ? ? ? ? ? ? ? ? ? S{count} = struct('f0', q, 'f1', [cv k], 'f2', [cv;k], 'f3', []);
? ? ? ? ? ? ? ? ? ? ? ? El = [El; [cv k count 1]];
? ? ? ? ? ? ? ? ? ? ? ? S{q}.f3 = [S{q}.f3; count];
? ? ? ? ? ? ? ? ? ? ? ? Q = [Q; count];?
? ? ? ? ? ? ? ? ? ? ? ? Qactive = [Qactive; 1];
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? end
? ? ? ? ? ? end
? ? ? ? ? ? if size(Q,1) > qc
? ? ? ? ? ? ? ? Q = Q(qc+1:end,:);
? ? ? ? ? ? ? ? Qactive = Qactive(qc+1:end,:);
? ? ? ? ? ? ? ? if sum(Qactive,1) == 0
? ? ? ? ? ? ? ? ? ? Q = [];
? ? ? ? ? ? ? ? ? ? Qactive = [];
? ? ? ? ? ? ? ? end
? ? ? ? ? ? end
? ? ? ? ? ? if size(Q,1) <= qc || size(Q,1) == 0
? ? ? ? ? ? ? ? Q = [];
? ? ? ? ? ? ? ? Qactive = [];
? ? ? ? ? ? ? ? %look for another boundary edge, if any
? ? ? ? ? ? ? ? ? ? fv = 0;
? ? ? ? ? ? ? ? ? ? bm = (Er & chkV) & (Ner == 1);
? ? ? ? ? ? ? ? ? ? hasB = sum(sum(bm));
? ? ? ? ? ? ? ? ? ? if hasB > 0
? ? ? ? ? ? ? ? ? ? ? ? for i = is:nP
? ? ? ? ? ? ? ? ? ? ? ? ? ? for j = js:nP
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if i < j && bm(i,j)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? s = struct('f0', [], 'f1', [i j], 'f2', [i;j], 'f3', []);%f0: parent struct, f1: edges, f2: vertices list, f3: children structs
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fv = i;%first vertex
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cv = j;%current vertex
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pv = i;%previous vertex
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %show
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %plot(X(fv,1), X(fv,2), 'og'); hold on;
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? %plot(X(pv,1), X(pv,2), 'sy'); hold on;
? ? ? ? ? ? while(cur_num ~= first_num)%if they are different
? ? ? ? ? ? ? ? %then backtrach the edges and nodes
? ? ? ? ? ? ? ? cur_num = S{last_num}.f0; %take parents
? ? ? ? ? ? ? ? if size(cur_num,1) == 0 || sum(sids1 == cur_num) == 1
? ? ? ? ? ? ? ? ? ? %the first sturcture was visited in previous iteration and it does not have a parent (cur_num is empty),
? ? ? ? ? ? ? ? ? ? % or cur_num is alreday a visited strcuture, so break the loop
? ? ? ? ? ? ? ? ? ? found = 0;
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? if cur_num == first_num%loop found, so break the loop
? ? ? ? ? ? ? ? ? ? joints = [joints; size(bids1,1)];
? ? ? ? ? ? ? ? ? ? bids1 = [[S{first_num}.f1(first_num_edges:end,:) S{first_num}.f2(first_num_edges:end-1,:)]; bids1];
? ? ? ? ? ? ? ? ? ? sids1 = [sids1;first_num];
? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? joints = [joints; size(bids1,1)];
? ? ? ? ? ? ? ? ? ? bids1 = [[S{cur_num}.f1 S{cur_num}.f2(1:end-1,:)]; bids1];
? ? ? ? ? ? ? ? ? ? sids1 = [sids1;cur_num];
? ? ? ? ? ? ? ? ? ? last_num = cur_num;
? ? ? ? ? ? ? ? end
? ? ? ? ? ? end
? ? ? ? ? ? %check joints if they confirm a loop
? ? ? ? ? ? if found == 1
? ? ? ? ? ? ? ? fJoint = 1;
? ? ? ? ? ? ? ? for j = 1:size(joints,1)
? ? ? ? ? ? ? ? ? ? jid = joints(j,1);
? ? ? ? ? ? ? ? ? ? if bids1(jid,2) ~= bids1(jid+1,1)
? ? ? ? ? ? ? ? ? ? ? ? fJoint = 0;
? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? if cur_num == first_num && fJoint == 1 && bids1(1,1) == bids1(end,2)
? ? ? ? ? ? ? ? ? ? bcount = bcount + 1;
? ? ? ? ? ? ? ? ? ? bids{bcount} = bids1;
? ? ? ? ? ? ? ? ? ? sids{bcount} = sids1;
? ? ? ? ? ? ? ? ? ? plot(X(bids1(:,1),1),X(bids1(:,1),2),'-c', 'linewidth', 2); hold on;
? ? ? ? ? ? ? ? end
? ? ? ? ? ? end
? ? ? ? end
? ? ? ? end%if bigWholeFound == 1?
? ? end
? ? bndryin{bn} = bids;
end
end
??3?參考文獻(xiàn)
部分理論來源于網(wǎng)絡(luò),如有侵權(quán)請聯(lián)系刪除。文章來源:http://www.zghlxwxcb.cn/news/detail-630106.html
[1]M. Awrangjeb, "Using point cloud data to identify,trace, and regularize the outlines of buildings" International Journal of Remote Sensing, Volume 37, Issue 3, February 2016, pages 551-579;文章來源地址http://www.zghlxwxcb.cn/news/detail-630106.html
??4 Matlab代碼、數(shù)據(jù)、文章講解
到了這里,關(guān)于【圖像處理】從點(diǎn)云數(shù)據(jù)中提取邊界(識別和追蹤)(Matlab代碼實(shí)現(xiàn))的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!