필터 지우기
필터 지우기

image stitching: ideas to solve singular or badly scaled matrix

조회 수: 3 (최근 30일)
Mona Mahboob Kanafi
Mona Mahboob Kanafi 2015년 2월 2일
댓글: Dima Lisin 2015년 2월 18일
I'm trying to do image mosaicing according to this example of MATLAB:
My images are captured in an approximate vertical column. What the code does, is to find all the transformation with respect to the first image. i.e. :
tforms(n).T = tforms(n-1).T * tforms(n).T;
Then, it starts stitching (warping) the images based on the obtained transformations above. The code works well when stitching 3-4 images. But starts to give this popular warning after that! I'm trying to stitch about 25 images and with the start of this warning the images are not stitched properly:
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.679189e-08.
> In affine2d>affine2d.get.Tinv at 339
In affine2d>affine2d.transformPointsInverse at 214
In imwarp>remapAndResampleGeneric2d at 248
In imwarp>remapPointsAndResample at 188
In imwarp at 173
Could anyone suggest how to solve this problem? From physical point of view, this procedure must work, but how to fix this mathematical shortcoming? To give you an idea of the resulting error, here you can see one ill-conditioned transformation matrix and the final mosaic:
1.0e+03 *
0.0010 -0.0000 0
0.0000 0.0010 0
-0.0592 -5.8776 0.0010

채택된 답변

Dima Lisin
Dima Lisin 2015년 2월 3일
Hi Mona,
the problem here is that each time the transformation is estimated, errors are introduced. These errors accumulate, which is why the stitching works for a few images, but not for 25.
One thing you can try to improve the mosaic, is to start from the middle image, rather than from the first one. Let's say you have 7 images. First build a mosaic using images 4, 5, 6, and 7. Then build a mosaic using images 4, 3, 2, and 1. Then stitch the two mosaics. This way, in both mosaics you are not moving two far from the starting image, so you should have a smaller error.
The other alternative is to use the Optimization Toolbox to do a global optimization over the transformations to minimize the geometric errors.
  댓글 수: 2
Mona Mahboob Kanafi
Mona Mahboob Kanafi 2015년 2월 18일
Thanks a lot for your explanation and hints! :)
Dima Lisin
Dima Lisin 2015년 2월 18일
You are most welcome. And here is another hint, as long as there is enough overlap, try using fewer images. What I mean is that if you can throw out every other image in your sequence, and there is still enough overlap between the images, you may get a better result. There will be fewer transformations, which should reduce the accumulated error.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by