transformation parameter estimation using robusfit()
2 次查看(过去 30 天)
显示 更早的评论
I want to use matlab function robusfit for calculating transformation parameters. I have set of matched points from sift, X = [x1,y1 ....xn,yn] and y = [x1,y1....xn,yn]. How do i use the function for it?
Thanks in advance.
2 个评论
Tom Lane
2013-4-30
I don't understand. It looks like you are saying that X and y are the same. In general, if X is a matrix of predictors (inputs) and y is a vector of responses (outputs), you would use robustfit(X,y).
采纳的回答
Tom Lane
2013-5-30
I should have realized what you meant at first. I don't know much about image registration, but perhaps this will have some analogy to what you want. Let me start with a set of points in two dimensions.
>> xy1 = rand(20,2);
Now I generate another set of points from these by linear transformation plus a little bit of noise in both the x and y coordinates.
>> xy2 = xy1 * [2 -1;3 -.5];
>> xy2(:,1) = xy2(:,1)+10;
>> xy2(:,2) = xy2(:,2)-5;
>> xy2 = xy2 + randn(size(xy2))/100;
I can use backslash to recover the additive and multiplicative constants.
>> B = [ones(20,1) xy1]\xy2
B =
10.0014 -4.9991
1.9839 -1.0092
3.0116 -0.4919
If my data had outliers I might prefer robust fitting. Here's how I can compute a robust estimate of the two columns of coefficients above.
>> robustfit(xy1,xy2(:,1))
ans =
10.0024
1.9831
3.0106
>> robustfit(xy1,xy2(:,2))
ans =
-4.9992
-1.0083
-0.4932
Sorry if this bears no relation to what you want.
4 个评论
Tom Lane
2013-5-30
The robust function adds a constant term automatically, and you'll notice that I included a column of "ones" in the backslash expression. So in both cases (first row of B, first entries on robustfit) you should see that the estimates are close to the 10 and -5 I added. That's what I meant by the "additive constants."
You should see that the remaining part of B is close to the [2 -1;3 -.5] transformation matrix I used. That's what I meant by the "multiplicative constants."
You could reverse this and go backwards from xy2 to xy1 if you want.
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!