Skip to content

Commit

Permalink
give warning for undefined behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
astraw committed Sep 3, 2015
1 parent 863965b commit be0e58c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@

- Properties on `CameraModel` (e.g. `cam.M`) are deprecated and will
be removed in a future release.

- Intrinsic parameter matrix is normalized upon loading in
`CameraModel._from_parts`, which is called by most constructors.

- If an input calibration has a non-normalized P matrix and a
rectification matrix, a warning is given as this case is not well
tested and the behavior should be considered undefined.

## Bugfixes

- Mirroring and flipping cameras with skew, distortion, and
Expand Down
9 changes: 8 additions & 1 deletion pymvg/camera_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,14 @@ def _from_parts(cls,
if np.allclose(rect,np.eye(3)):
rect = None

P = P/P[2,2] # normalize
denom = P[2,2]
if denom != 1.0:
if rect is not None:
warnings.warn(
'A non-normalized P matrix and a rectification matrix were '
'supplied. This case is not well tested and the behavior '
'should be considered undefined.')
P = P/denom # normalize
result = cls(name, width, height, _rquat, camcenter, P, K, distortion, rect)
return result

Expand Down

0 comments on commit be0e58c

Please sign in to comment.