Issues with Panorama stitching "The specified transformation matrix is not valid because it is singular to working precision."

11 Ansichten (letzte 30 Tage)
For this problem, I've imported my own image file with about 10 pictures into the code for the panorama stitching demo to experiment.
I have not changed the code aside for "buildingDir = fullfile('name of my file') and I've been getting an issue with my code telling me "The specified transformation matrix is not valid because it is singular to working precision". This happens in step 2 of the code when it is attempting to to get the tform matrix. I'm not entirely sure why this is happening and this always happens when I use at least 4 or more images. I think I have an idea of why this problem is occuring but I'm not entirely confident with my thought. Can someone please explain to me why this problem is occuring and ways to fix it?

Antworten (1)

Vinayak Choyyan
Vinayak Choyyan am 7 Feb. 2023
Bearbeitet: Vinayak Choyyan am 7 Feb. 2023
Hello Alexander Yuan,
As per my understanding, you are using the “Feature Based Panoramic Image Stitching” example and changed the input images to some of your own. This resulted in an error "The specified transformation matrix is not valid because it is singular to working precision" on the line
tforms(n) = estgeotform2d(matchedPoints, matchedPointsPrev,...
'projective', 'Confidence', 99.9, 'MaxNumTrials', 2000);
The warning message/error "The specified transformation matrix is not valid because it is singular to working precision" is displayed when one tries to perform an inverse on a singular matrix. A matrix that has no inverse is singular. A square matrix is singular only when its determinant is exactly zero. Inverse function would be internally used within ‘estgeotform2d()’.
I tried out the example and I was able to reproduce the error at my end. In both the cases below, as also mentioned in the example, I gave custom images taken with an uncalibrated smart phone camera by sweeping the camera from left to right along the horizon, as input to the code. Here is what I tried:
  • I took 6 images of a landscape, which were taken by making small horizontal movement like in the example. This resulted in a successful generation of a panorama.
  • I took 6 images of my desk, which were taken by making large horizontal movement. This resulted in smaller overlaps and gave the error "The specified transformation matrix is not valid because it is singular to working precision". It also warns “Warning: Maximum number of trials reached. Consider increasing the maximum distance or decreasing the desired confidence.”
I would suggest you could retry the code with images having greater overlap and fewer distortion or use the Camera Calibrator to reduce the distortion in images. I hope this helps resolve the issue you are facing.
Please refer the following documentations to read more on the functions mentioned above:

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by