I am doing some bone segmentation whereas the result of this segmentation is points placed in a circular pattern around this bone. However as it is taken using a qCT scan, there is quite a lot noise (from e.g. flesh) on the points that i have. So the overall problem is how to remove this noise.
What I am doing at the moment is to transform it into polar coordinates on the shifted data, such that I get data on the distance from the center of the bone to the point depending on the angle.
[THETA,RHO] = car2pol(N(1,:),N(2,:),center); [THETA, id] = unique(THETA);
Once I have those data I make a high order (30) polynomial regression, which removes the noise nicely and yields a nice smooth curve.
[p,~,mu] = polyfit(THETA,RHO,30); RHO = polyval(p,THETA,,mu);
Whereafter I transform it back into cartesian coordinates:
[x,y] = pol2car(THETA,RHO,center);
My only problem here is the start and end point are not necessarily the same point after the regression, which they should be. So my question is, can you make some type of constrained polynomial regression, where I can enforce that the y-value of the first point have have the same value as the y-value of the other end point? Or are there any other way to do this?