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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ubuntu-version: ["20.04", "22.04"]
ubuntu-version: ["latest"]
steps:
- name: Check out code
uses: actions/checkout@v2
Expand All @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ubuntu-version: ["20.04"]
ubuntu-version: ["latest"]
steps:
- name: Check out code
uses: actions/checkout@v2
Expand Down
37 changes: 32 additions & 5 deletions 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.17.2. For
This repository contains python code samples for Zivid SDK v2.18.0. For
tested compatibility with earlier SDK versions, please check out
[accompanying releases].

Expand All @@ -27,12 +27,13 @@ tested compatibility with earlier SDK versions, please check out
- **Capture**
- [Quick Capture Tutorial]
- [Capture Tutorial]
- [GPU Access Tutorial]
- [Point Cloud Capture Process]
- [2D Image Capture Process]
- [2D + 3D Capture Strategy]
- [File Camera]
- [Projector]
- **Maintenance**
- **Maintenance and Prevention**
- [Infield Correction]
- [Warm-up]
- [Firmware Update]
Expand Down Expand Up @@ -71,6 +72,10 @@ from the camera can be used.
- [capture_with_settings_from_yml] - Capture images and point
clouds, with and without color, from the Zivid camera with
settings from YML file.
- [connect] - Connect to a Zivid camera using the different
available methods.
- [create_file_camera_from_zdf_with_diagnostics] - Capture a frame
with diagnostics enabled and create a file camera from it.
- **advanced**
- [capture_2d_and_3d] - Capture 2D and 3D with the Zivid camera.
- [capture_and_print_normals] - Capture Zivid point clouds, compute
Expand All @@ -82,9 +87,11 @@ from the camera can be used.
and Zivid SDK, then list cameras and print camera info and state
for each connected camera.
- [camera_user_data] - Store user data on the Zivid camera.
- [capture_with_diagnostics] - Capture point clouds, with color,
from the Zivid camera, with default settings and diagnostics
enabled.
- [capture_with_diagnostics] - Capture a 2D+3D frame and a 2D frame
from the Zivid camera with diagnostics enabled.
- [check_health] - Poll the camera health check from a separate
thread while capturing in the main thread, printing the statuses
and values every second.
- [context_manager_with_zivid] - Sample showing how to use a context
manager with Zivid Application and safely return processed data.
- [firmware_updater] - Update firmware on the Zivid camera.
Expand Down Expand Up @@ -139,12 +146,24 @@ from the camera can be used.
convert it to OpenCV format, then extract and visualize depth map.
- [downsample][1] - Downsample point cloud from a ZDF file.
- [gamma_correction] - Capture 2D image with gamma correction.
- [mask_point_cloud] - Read point cloud data from a ZDF file, apply
a binary mask, and visualize it.
- **visualization**
- [capture_vis_3d_in_loop] - Capture point clouds, with color,
from the Zivid camera, and visualize them in a loop.
- [capture_vis_3d_in_loop_with_keypress_exit] - Capture point
clouds, with color, from the Zivid camera, and visualize them in
a loop. Press 'q' to exit.
- **cuda**
- [capture_and_process_image_with_cupy_on_cuda] - Demonstrate GPU
interop with CuPy: wrap a Zivid GPU image buffer as a CuPy array
without copying it through CPU memory.
- [capture_and_render_point_cloud_with_opengl_on_cuda] -
Demonstrate GPU point cloud rendering with CUDA-OpenGL interop:
capture a Zivid point cloud, copy it device-to-device
- [capture_and_segment_image_with_pytorch_on_cuda] - Demonstrate
zero-copy GPU interop between Zivid and PyTorch/CuPy by feeding
a Zivid 2D image into a third-party
- **transform**
- [get_checkerboard_pose_from_zdf] - Read point cloud data of a
Zivid calibration board from a ZDF file, estimate the
Expand Down Expand Up @@ -312,6 +331,7 @@ Zivid Samples are distributed under the [BSD license].
[image]: https://www.zivid.com/hubfs/softwarefiles/images/zivid-generic-github-header.png
[Quick Capture Tutorial]: https://support.zivid.com/en/latest/camera/getting-started/quick-capture-tutorial.html
[Capture Tutorial]: https://support.zivid.com/en/latest/camera/academy/camera/capture-tutorial.html
[GPU Access Tutorial]: https://support.zivid.com/en/latest/camera/academy/camera/gpu-access-tutorial.html
[Point Cloud Capture Process]: https://support.zivid.com/en/latest/camera/academy/camera/point-cloud-capture-process.html
[2D Image Capture Process]: https://support.zivid.com/en/latest/camera/academy/camera/2d-image-capture-process.html
[2D + 3D Capture Strategy]: https://support.zivid.com/en/latest/camera/academy/camera/2d3d-capture-strategy.html
Expand All @@ -334,12 +354,15 @@ Zivid Samples are distributed under the [BSD license].
[capture_from_file_camera]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/basic/capture_from_file_camera.py
[capture_hdr_complete_settings]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/basic/capture_hdr_complete_settings.py
[capture_with_settings_from_yml]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/basic/capture_with_settings_from_yml.py
[connect]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/basic/connect.py
[create_file_camera_from_zdf_with_diagnostics]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/basic/create_file_camera_from_zdf_with_diagnostics.py
[capture_2d_and_3d]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/advanced/capture_2d_and_3d.py
[capture_and_print_normals]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/advanced/capture_and_print_normals.py
[adapt_settings_for_flickering_ambient_light]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/adapt_settings_for_flickering_ambient_light.py
[camera_info]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/camera_info.py
[camera_user_data]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/camera_user_data.py
[capture_with_diagnostics]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/capture_with_diagnostics.py
[check_health]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/check_health.py
[context_manager_with_zivid]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/context_manager_with_zivid.py
[firmware_updater]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/firmware_updater.py
[frame_info]: https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/frame_info.py
Expand All @@ -365,8 +388,12 @@ Zivid Samples are distributed under the [BSD license].
[create_depth_map]: https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/create_depth_map.py
[1]: https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/downsample.py
[gamma_correction]: https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/gamma_correction.py
[mask_point_cloud]: https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/mask_point_cloud.py
[capture_vis_3d_in_loop]: https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/visualization/capture_vis_3d_in_loop.py
[capture_vis_3d_in_loop_with_keypress_exit]: https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/visualization/capture_vis_3d_in_loop_with_keypress_exit.py
[capture_and_process_image_with_cupy_on_cuda]: https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/cuda/capture_and_process_image_with_cupy_on_cuda.py
[capture_and_render_point_cloud_with_opengl_on_cuda]: https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/cuda/capture_and_render_point_cloud_with_opengl_on_cuda.py
[capture_and_segment_image_with_pytorch_on_cuda]: https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/cuda/capture_and_segment_image_with_pytorch_on_cuda.py
[get_checkerboard_pose_from_zdf]: https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/transform/get_checkerboard_pose_from_zdf.py
[transform_point_cloud_from_millimeters_to_meters]: https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/transform/transform_point_cloud_from_millimeters_to_meters.py
[transform_point_cloud_via_aruco_marker]: https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/transform/transform_point_cloud_via_aruco_marker.py
Expand Down
2 changes: 1 addition & 1 deletion continuous-integration/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR=$(realpath "$SCRIPT_DIR/..")
SOURCE_DIR=$(realpath "$ROOT_DIR/source")

python3 -m pip install --requirement "$SCRIPT_DIR/requirements.txt" || exit
python3 -m pip install --break-system-packages --requirement "$SCRIPT_DIR/requirements.txt" || exit

pythonFiles=$(find "$SOURCE_DIR" -name '*.py' -not -path "*/ur_hand_eye_calibration/3rdParty*")

Expand Down
2 changes: 1 addition & 1 deletion continuous-integration/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
black==24.1.0
flake8==7.0.0
flake8-annotations==3.0.1
flake8-annotations==3.2.0
pylint==3.0.3
darglint==1.8.1
7 changes: 3 additions & 4 deletions continuous-integration/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ function install_www_deb {
rm -r $TMP_DIR || exit
}

install_www_deb "https://downloads.zivid.com/sdk/releases/2.17.2+440b2367-1/u${VERSION_ID:0:2}/zivid_2.17.2+440b2367-1_amd64.deb" || exit
install_www_deb "https://downloads.zivid.com/sdk/releases/2.17.2+440b2367-1/u${VERSION_ID:0:2}/zivid-genicam_2.17.2+440b2367-1_amd64.deb" || exit
install_www_deb "https://downloads.zivid.com/sdk/releases/2.18.0+1b44dbef-1/u${VERSION_ID:0:2}/zivid-opencl_2.18.0+1b44dbef-1_amd64.deb" || exit
install_www_deb "https://downloads.zivid.com/sdk/releases/2.18.0+1b44dbef-1/u${VERSION_ID:0:2}/zivid-genicam_2.18.0+1b44dbef-1_amd64.deb" || exit

python3 -m pip install --upgrade pip || exit
pushd "$ROOT_DIR" || exit
python3 -m pip install --requirement "./requirements.txt" || exit
python3 -m pip install --break-system-packages --requirement "./requirements.txt" || exit
popd || exit

echo Success! ["$(basename $0)"]
8 changes: 4 additions & 4 deletions modules/zividsamples/camera_verification.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import random
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Optional
from typing import Optional, Tuple

import zivid

Expand Down Expand Up @@ -33,13 +33,13 @@ class VerificationAndState:
time: datetime
info: zivid.CameraInfo

def _position(self):
def _position(self) -> Tuple[Optional[float], Optional[float], Optional[float]]:
return self.verification.position() if self.verification else (None, None, None)

def distance(self):
def distance(self) -> Optional[float]:
return self._position()[2]

def local_dimension_trueness(self):
def local_dimension_trueness(self) -> Optional[float]:
return self.verification.local_dimension_trueness() if self.verification else None

def __str__(self) -> str:
Expand Down
1 change: 0 additions & 1 deletion modules/zividsamples/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def display_pointcloud(data: Union[zivid.Frame, zivid.PointCloud, zivid.Unorgani

Args:
data: Union[zivid.Frame, zivid.PointCloud, zivid.UnorganizedPointCloud]
normals: If True, display normals as color map

"""
with zivid.visualization.Visualizer() as visualizer:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List
from typing import List, Optional

from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QApplication, QCheckBox, QGroupBox, QHBoxLayout, QPushButton, QWidget
Expand All @@ -8,7 +8,7 @@ class HandEyeCalibrationButtonsWidget(QWidget):
calibrate_button_clicked = pyqtSignal()
use_fixed_objects_toggled = pyqtSignal(bool)

def __init__(self, parent=None):
def __init__(self, parent: Optional[QWidget] = None) -> None:
super().__init__(parent)

# Define buttons
Expand All @@ -34,19 +34,19 @@ def __init__(self, parent=None):

self.setLayout(buttons_layout)

def on_calibrate_button_clicked(self):
def on_calibrate_button_clicked(self) -> None:
self.calibrate_button.setStyleSheet("background-color: yellow;")
QApplication.processEvents()
self.calibrate_button_clicked.emit()
self.calibrate_button.setStyleSheet("")

def on_use_fixed_objects_toggled(self, checked: bool):
def on_use_fixed_objects_toggled(self, checked: bool) -> None:
self.use_fixed_objects_toggled.emit(checked)

def disable_buttons(self):
def disable_buttons(self) -> None:
self.calibrate_button.setEnabled(False)

def enable_buttons(self):
def enable_buttons(self) -> None:
self.calibrate_button.setEnabled(True)

def get_tab_widgets_in_order(self) -> List[QWidget]:
Expand Down
Loading
Loading