diff --git a/docs/vision/code_snippets/display_stream_with_workspace.py b/docs/vision/code_snippets/display_stream_with_workspace.py index 3d45f4df..55ef585d 100644 --- a/docs/vision/code_snippets/display_stream_with_workspace.py +++ b/docs/vision/code_snippets/display_stream_with_workspace.py @@ -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) diff --git a/docs/vision/code_snippets/undistort_and_display.py b/docs/vision/code_snippets/undistort_and_display.py index 827fc831..41a9008b 100644 --- a/docs/vision/code_snippets/undistort_and_display.py +++ b/docs/vision/code_snippets/undistort_and_display.py @@ -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 diff --git a/docs/vision/code_snippets/vision_pick.py b/docs/vision/code_snippets/vision_pick.py index c51514e8..012cd85c 100644 --- a/docs/vision/code_snippets/vision_pick.py +++ b/docs/vision/code_snippets/vision_pick.py @@ -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: diff --git a/docs/vision/image_processing_overview.rst b/docs/vision/image_processing_overview.rst index c67ff9c8..97e836bb 100644 --- a/docs/vision/image_processing_overview.rst +++ b/docs/vision/image_processing_overview.rst @@ -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`. diff --git a/examples/simple_scripts/video_stream.py b/examples/simple_scripts/video_stream.py index 0c35e88f..4de97599 100644 --- a/examples/simple_scripts/video_stream.py +++ b/examples/simple_scripts/video_stream.py @@ -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) diff --git a/examples/vision_demonstrators/1_simple_reference_conditioning.py b/examples/vision_demonstrators/1_simple_reference_conditioning.py index 74ecafe1..a202569c 100644 --- a/examples/vision_demonstrators/1_simple_reference_conditioning.py +++ b/examples/vision_demonstrators/1_simple_reference_conditioning.py @@ -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: diff --git a/pyniryo/vision/image_functions.py b/pyniryo/vision/image_functions.py index db772d01..8252ee31 100644 --- a/pyniryo/vision/image_functions.py +++ b/pyniryo/vision/image_functions.py @@ -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