Skip to content
Closed
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
2 changes: 1 addition & 1 deletion docs/vision/code_snippets/display_stream_with_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
img_compressed = robot.get_img_compressed()
# Uncompressing image
img_raw = vision.uncompress_image(img_compressed)
# Undistorting
# Undistorting (on Ned2, needed only for versions < v5.8.3-b62)
img_undistort = vision.undistort_image(img_raw, mtx, dist)
# Trying to find markers
workspace_found, res_img_markers = vision.debug_markers(img_undistort)
Expand Down
2 changes: 1 addition & 1 deletion docs/vision/code_snippets/undistort_and_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
img_compressed = robot.get_img_compressed()
# Uncompressing image
img_raw = uncompress_image(img_compressed)
# Undistorting
# Undistorting (on Ned2, needed only for versions < v5.8.3-b62)
img_undistort = undistort_image(img_raw, mtx, dist)

# - Display
Expand Down
2 changes: 1 addition & 1 deletion docs/vision/code_snippets/vision_pick.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def process(niryo_robot):
else: # Home made image processing
img_compressed = niryo_robot.get_img_compressed()
img = vision.uncompress_image(img_compressed)
img = vision.undistort_image(img, mtx, dist)
img = vision.undistort_image(img, mtx, dist) # on Ned2, needed only for versions < v5.8.3-b62
# extracting working area
im_work = vision.extract_img_workspace(img, workspace_ratio=1.0)
if im_work is None:
Expand Down
4 changes: 4 additions & 0 deletions docs/vision/image_processing_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ To undistort the raw image, we use :meth:`~pyniryo.vision.image_functions.undist
which needs to be called with the parameters given by Ned through
:meth:`~pyniryo.api.tcp_client.NiryoRobot.get_camera_intrinsics`.

.. note::
On Ned2 since v5.8.3-b62, undistortion is done on robot's side before being sent.
This step is then not needed anymore if your robot's version is >= v5.8.3-b62

Once, we have both raw & undistorted images, we can concatenate them in order
to display them in once with :meth:`~pyniryo.vision.image_functions.concat_imgs`.
Finally, we display the image :meth:`~pyniryo.vision.image_functions.show_img`.
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_scripts/video_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def video_stream(niyro_robot: NiryoRobot):
img_compressed = niyro_robot.get_img_compressed()
# Uncompressed image
img_raw = vision.uncompress_image(img_compressed)
# Undistorted
# Undistorted (on Ned2, needed only for versions < v5.8.3-b62)
img_undistorted = vision.undistort_image(img_raw, mtx, dist)
# Trying to find markers
workspace_found, res_img_markers = vision.debug_markers(img_undistorted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def process(niryo_robot: NiryoRobot):
else: # Home made image processing
img_compressed = niryo_robot.get_img_compressed()
img = vision.uncompress_image(img_compressed)
img = vision.undistort_image(img, mtx, dist)
img = vision.undistort_image(img, mtx, dist) # on Ned2, needed only for versions < v5.8.3-b62
# extracting working area
im_work = vision.extract_img_workspace(img, workspace_ratio=1.0)
if im_work is None:
Expand Down
2 changes: 2 additions & 0 deletions pyniryo/vision/image_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ def undistort_image(img, mtx, dist):
"""
Use camera intrinsics to undistort raw image

NOTE: On Ned2 since v5.8.3-b62, undistortion is done on robot's side before being sent.

:param img: Raw Image
:type img: numpy.array
:param mtx: Camera Intrinsics matrix
Expand Down
Loading