Fix in declared undistorted bounds #375
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For haz_cam and perch cam the image dimensions are 224 and 171. Yet, the undistorted dimensions are declared to be 600 and 500. There's no way this is possible, since the distortion of these narrow-field-of-view cameras is small.
Such overestimation actually causes problems. Since the distortion model is given by a polynomial, when it is applied to pixels way outside its calibrated range, weird values can result. Hence, when creating a textured 3D model with the haz_cam image I get a plausible texture, but around it there is an empty ring corresponding to no pixels, followed by a halo of junk, corresponding to 3D points not normally seen in the camera yet which had the bad luck that after being put in camera's coordinate system, normalized, and passed through the distortion polynomial, managed to receive values that actually project into the camera.
After adjusting the undistorted dimensions these problems go away.
No such problems are seen for the nav or sci camera which have more sensible choices. But even for those however the undistorted bounds are too liberal. When undistorting it is preferable to err towards cutting off valid peripheral pixels than to keep all possible pixels with extra areas where no valid pixel values exist. I won't touch those as those undistorted dimensions are not so grossly off to cause issues.