Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/machinevisiontoolbox/BundleAdjust.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ def add_projection(

:seealso: :meth:`add_view` :meth:`add_landmark`
"""
assert len(uv) == 2, "uv must be a 2-vector"
if len(uv) != 2:
raise ValueError("uv must be a 2-vector")

edge = Observation(viewpoint, landmark, uv.flatten()) # create edge object
e = viewpoint.connect(landmark, edge=edge) # connect nodes with it
Expand Down
12 changes: 8 additions & 4 deletions src/machinevisiontoolbox/Camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ def nu(self) -> int:

:seealso: :meth:`nv` :meth:`width` :meth:`imagesize`
"""
assert self._imagesize is not None, "imagesize not set"
if self._imagesize is None:
raise ValueError("imagesize not set")
return self._imagesize[0]

@property
Expand All @@ -370,7 +371,8 @@ def nv(self) -> int:

:seealso: :meth:`nu` :meth:`height` :meth:`imagesize`
"""
assert self._imagesize is not None, "imagesize not set"
if self._imagesize is None:
raise ValueError("imagesize not set")
return self._imagesize[1]

@property
Expand All @@ -390,7 +392,8 @@ def width(self) -> int:

:seealso: :meth:`nu` :meth:`height`
"""
assert self._imagesize is not None, "imagesize not set"
if self._imagesize is None:
raise ValueError("imagesize not set")
return self._imagesize[0]

@property
Expand All @@ -410,7 +413,8 @@ def height(self) -> int:

:seealso: :meth:`nv` :meth:`width`
"""
assert self._imagesize is not None, "imagesize not set"
if self._imagesize is None:
raise ValueError("imagesize not set")
return self._imagesize[1]

@property
Expand Down
2 changes: 1 addition & 1 deletion src/machinevisiontoolbox/Sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2348,7 +2348,7 @@ def _pointcloud_to_ros_message(
"Install it with: pip install open3d "
"or pip install machinevision-toolbox-python[open3d]"
)
assert o3d is not None
assert o3d is not None

points = np.asarray(pc._pcd.points)
if points.ndim != 2 or points.shape[1] != 3:
Expand Down