How to write the coordinats from the dpsimplify function into a new data

1 次查看(过去 30 天)
Hi everyone I've got boundaries of an object. Now i'd like to simplify them with the dpsimlify(p,tol) funkction. This works great so far, i can plot it and it looks good. However when I want to write the coordinats of the simplified data into a datastring it doesn't work how I want it to work. I've got this so far:
for i = 1: length(B)
p = B{i};
tol = 3;
[ps,ix] = dpsimplify(p,tol);
plot(p(:,2),p(:,1),'k')
hold on
plot(ps(:,2),ps(:,1),'r','LineWidth',2);
legend('original polyline','simplified')
boundary(i).id = i;
boundary(i).X = ps(:,2);
boundary(i).Y = ps(:,1);
end;
When i do it like this, I get 2024 elements in the boundary data. but the length of B is just 68. Some of the elements of B are doubled in the boundary data . I hope you understand my problem and know how to fix it.
Cheers Sams

回答(1 个)

Image Analyst
Image Analyst 2014-5-19
I don't know what that function is. Perhaps you can use unique() to extract out only the unique rows.

类别

Help CenterFile Exchange 中查找有关 Octave 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by