Skip to content

Commit

Permalink
Samples: Automatic updates to public repository
Browse files Browse the repository at this point in the history
Remember to do the following:
    1. Ensure that modified/deleted/new files are correct
    2. Make this commit message relevant for the changes
    3. Force push
    4. Delete branch after PR is merged

If this commit is an update from one SDK version to another,
make sure to create a release tag for previous version.
  • Loading branch information
csu-bot-zivid committed Jul 5, 2024
1 parent 19cae6b commit e526f11
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Python samples

This repository contains python code samples for Zivid SDK v2.12.0. For
This repository contains python code samples for Zivid SDK v2.13.1. For
tested compatibility with earlier SDK versions, please check out
[accompanying
releases](https://github.com/zivid/zivid-python-samples/tree/master/../../releases).
Expand Down
2 changes: 1 addition & 1 deletion continuous-integration/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function install_www_deb {
rm -r $TMP_DIR || exit
}

install_www_deb "https://downloads.zivid.com/sdk/releases/2.12.0+6afd4961-1/u${VERSION_ID:0:2}/zivid_2.12.0+6afd4961-1_amd64.deb" || exit
install_www_deb "https://downloads.zivid.com/sdk/releases/2.13.0+99a4ce9e-1/u${VERSION_ID:0:2}/zivid_2.13.0+99a4ce9e-1_amd64.deb" || exit

python3 -m pip install --upgrade pip || exit
python3 -m pip install --requirement "$ROOT_DIR/requirements.txt" || exit
Expand Down
8 changes: 4 additions & 4 deletions source/applications/advanced/auto_2d_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,10 @@ def _print_poor_pixel_distribution(rgb: np.ndarray) -> None:
black_and = np.sum(np.logical_and(np.logical_and(rgb[:, :, 0] == 0, rgb[:, :, 1] == 0), rgb[:, :, 2] == 0))

print("Distribution of saturated (255) and black (0) pixels with final settings:")
print(f"Saturated pixels (at least one channel): {saturated_or}\t ({100*saturated_or/total_num_pixels:.2f}%)")
print(f"Saturated pixels (all channels):\t {saturated_and}\t ({100*saturated_and/total_num_pixels:.2f}%)")
print(f"Black pixels (at least one channel):\t {black_or}\t ({100*black_or/total_num_pixels:.2f}%)")
print(f"Black pixels (all channels):\t\t {black_and}\t ({100*black_and/total_num_pixels:.2f}%)")
print(f"Saturated pixels (at least one channel): {saturated_or}\t ({100 * saturated_or / total_num_pixels:.2f}%)")
print(f"Saturated pixels (all channels):\t {saturated_and}\t ({100 * saturated_and / total_num_pixels:.2f}%)")
print(f"Black pixels (at least one channel):\t {black_or}\t ({100 * black_or / total_num_pixels:.2f}%)")
print(f"Black pixels (all channels):\t\t {black_and}\t ({100 * black_and / total_num_pixels:.2f}%)")


def _plot_image_with_histogram(rgb: np.ndarray, settings_2d: zivid.Settings2D) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def generate_hand_eye_dataset(app: zivid.application, robot: Item, targets: List
save_directory = _generate_directory()
image_and_pose_iterator = 1
while not image_and_pose_iterator > num_targets:
print(f"Capturing calibration object at robot pose {num_targets-len(targets)}")
print(f"Capturing calibration object at robot pose {num_targets - len(targets)}")
_capture_one_frame_and_robot_pose(
robot,
camera,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def _path_list_creator(
file_path = path / f"{file_prefix_name}{str(num).zfill(number_of_digits_zfill)}{file_suffix_name}"
list_of_paths.append(file_path)

next_file_path = path / f"{file_prefix_name}{str(num+1).zfill(number_of_digits_zfill)}{file_suffix_name}"
next_file_path = path / f"{file_prefix_name}{str(num + 1).zfill(number_of_digits_zfill)}{file_suffix_name}"

if not next_file_path.exists():
return list_of_paths
Expand Down Expand Up @@ -162,7 +162,7 @@ def _main() -> None:
list_of_open_3d_point_clouds = []
for data_pair_id in range(number_of_dataset_pairs):
# Updating the user about the process status through the terminal
print(f"{data_pair_id} / {number_of_dataset_pairs} - {100*data_pair_id / number_of_dataset_pairs}%")
print(f"{data_pair_id} / {number_of_dataset_pairs} - {100 * data_pair_id / number_of_dataset_pairs}%")

# Reading point cloud from file
frame = zivid.Frame(list_of_paths_to_hand_eye_dataset_point_clouds[data_pair_id])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def _get_robot_base_to_calibration_board_transform(
Returns:
robot_base_to_calibration_board_transform: A 4x4 numpy array containing the calibration board pose in the robot base frame
Raises:
ValueError: If an invalid calibration type is selected
"""
if user_options.eih:
print("Loading current robot pose")
Expand All @@ -75,12 +78,14 @@ def _get_robot_base_to_calibration_board_transform(
robot_base_to_calibration_board_transform = (
robot_base_to_flange_transform @ flange_to_camera_transform @ camera_to_calibration_board_transform
)
if user_options.eth:
elif user_options.eth:
robot_base_to_camera_transform = load_and_assert_affine_matrix(user_options.hand_eye_yaml)

robot_base_to_calibration_board_transform = (
robot_base_to_camera_transform @ camera_to_calibration_board_transform
)
else:
raise ValueError("Invalid calibration type. Please choose either eye-in-hand or eye-to-hand.")

return robot_base_to_calibration_board_transform

Expand Down
7 changes: 3 additions & 4 deletions source/applications/point_cloud_tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ tutorial see:
[**Introduction**](#Introduction) |
[**Frame**](#Frame) |
[**Point**](#Point-Cloud) |
[**Transform**](#Transform) |
[**Downsample**](#Downsample) |
[**Normals**](#Normals) |
[**Visualize**](#Visualize) |
Expand Down Expand Up @@ -148,7 +147,7 @@ In terms of memory allocation, there are two ways to copy data:
- A user can pass a pointer to a pre-allocated memory buffer, and the
Zivid SDK will copy the data to the pre-allocated memory buffer.

## Transform
-----

You may want to
[transform](https://support.zivid.com/latest//academy/applications/transform.html)
Expand Down Expand Up @@ -230,10 +229,10 @@ The size of normals is equal to the size of the input point cloud.

Having the frame allows you to visualize the point cloud.

No source available for {language\_name} You can visualize the point
No source available for {language\_name}You can visualize the point
cloud from the point cloud object as well.

No source available for {language\_name} For more information, check out
No source available for {language\_name}For more information, check out
[Visualization
Tutorial](https://support.zivid.com/latest/academy/applications/visualization-tutorial.html),
where we cover point cloud, color image, depth map, and normals
Expand Down
2 changes: 1 addition & 1 deletion source/camera/basic/capture_tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ frame.save(data_file_ply)

We can get 2D color image from a 3D capture.

No source available for {language\_name} 2D captures also produce 2D
No source available for {language\_name}2D captures also produce 2D
color images.

([go to
Expand Down
2 changes: 1 addition & 1 deletion source/camera/info_util_other/firmware_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _main() -> None:
zivid.firmware.update(
camera,
progress_callback=lambda progress, description: print(
f'{progress}% : {description}{("","...") [progress < 100]}'
f'{progress}% : {description}{("","...")[progress < 100]}'
),
)
else:
Expand Down
2 changes: 1 addition & 1 deletion source/camera/maintenance/correct_camera_in_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _main() -> None:

print(
"If written to the camera, this correction can be expected to yield a dimension accuracy error of",
f"{accuracy_estimate.dimension_accuracy()*100:.3f}% or better in the range of z=[{accuracy_estimate.z_min():.3f}, {accuracy_estimate.z_max():.3f}] across the full FOV.",
f"{accuracy_estimate.dimension_accuracy() * 100:.3f}% or better in the range of z=[{accuracy_estimate.z_min():.3f}, {accuracy_estimate.z_max():.3f}] across the full FOV.",
"Accuracy close to where the correction data was collected is likely better.",
)

Expand Down
2 changes: 1 addition & 1 deletion source/camera/maintenance/verify_camera_in_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _main() -> None:
print(f"Successful measurement at {detection_result.centroid()}")
camera_verification = zivid.experimental.calibration.verify_camera(infield_input)
print(
f"Estimated dimension trueness error at measured position: {camera_verification.local_dimension_trueness()*100:.3f}%"
f"Estimated dimension trueness error at measured position: {camera_verification.local_dimension_trueness() * 100:.3f}%"
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _main() -> None:
print(f"Successful measurement at {detection_result.centroid()}")
camera_verification = zivid.experimental.calibration.verify_camera(infield_input)
print(
f"Estimated dimension trueness error at measured position: {camera_verification.local_dimension_trueness()*100:.3f}%"
f"Estimated dimension trueness error at measured position: {camera_verification.local_dimension_trueness() * 100:.3f}%"
)


Expand Down

0 comments on commit e526f11

Please sign in to comment.