How to write the coordinats from the dpsimplify function into a new data
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Image Analyst
on 19 May 2014
I don't know what that function is. Perhaps you can use unique() to extract out only the unique rows.
0 Comments
See Also
Categories
Find more on Octave in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!