The points representing the skeleton are in the attached csv file.
How can I properly fit the skeleton in the first image?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I tried 4th, 5th & 6th order polynomial fitting using polyfit. The curve needs to be split into 8 segments (shown in different colors) after the fitting. I need the tangent slope of each colored segment.
3 Kommentare
Antworten (1)
Image Analyst
am 24 Jan. 2022
Why is it hard? Just figure out how many rows 1/8 of the total number of rows is and take those with regular indexing.
xy = rand(75, 2); % my (x,y) coordinates
[rows, columns] = size(xy);
startingRows = round(linspace(1, rows+1, 9)) % Use 9 instead of 8
endingRows = startingRows(2:end) - 1
for k = 1 : 8
fprintf('\nChunk %d had %d rows:\n', k, endingRows(k) - startingRows(k) + 1)
thisChunk = xy(startingRows(k) : endingRows(k), :)
fprintf('Chunk %d:\n', k)
% Now do something with this 1/8 chunk of the total array.
end
4 Kommentare
Image Analyst
am 24 Jan. 2022
Why did you sort the values by x? You need to sort them in order of moving along the curve of course. bwtraceboundary can do that buy you need to take only half the points because we don't want a "round trip" all the way around the blob. Or of course you could do it manually, or use bwdistgeodesic().
Find endpoints to get starting locations with bwmorph(bw, 'endpoints');
Siehe auch
Kategorien
Mehr zu Polynomials finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!