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개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!