Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyzed.sl.FLIP_MODE bug introduced in sdk 4.1 #239

Open
2 tasks done
AlbertFlorinus opened this issue Jul 30, 2024 · 0 comments
Open
2 tasks done

pyzed.sl.FLIP_MODE bug introduced in sdk 4.1 #239

AlbertFlorinus opened this issue Jul 30, 2024 · 0 comments
Labels

Comments

@AlbertFlorinus
Copy link

Preliminary Checks

  • This issue is not a duplicate. Before opening a new issue, please search existing issues.
  • This issue is not a question, feature request, or anything other than a bug report directly related to this project.

Description

With ZED SDK 4.0 flip mode works just fine and adjust for the current camera orientation (executed on Jetson Orin Nano).
On Jetson Orin NX with SDK 4.1 however this no longer works. The code still runs but it does not adjust for the orientation.

import numpy as np
import cv2
import pyzed.sl as sl

class ZedRunner:
def init(self):
self.zedcam = self.start_zed()
self.runtime_param = sl.RuntimeParameters()
self.image = sl.Mat()

def start_zed(self) -> sl.Camera:
    zed = sl.Camera()
    #if zed is upside down when calling this function, flips frame 180 degrees to adjust
    #this works on zed sdk 4.0 jetson orin nano, not sdk 4.1 jetson orin nx
    sl.FLIP_MODE(0)
    init_params = sl.InitParameters()
    init_params.camera_resolution = sl.RESOLUTION.HD720    # Use HD720 video mode for USB cameras
    init_params.camera_fps = 60                            # Set fps at 60
    err = zed.open(init_params)
    if err != sl.ERROR_CODE.SUCCESS:
        print(repr(err))
        exit(-1)
    return zed

def get_frame(self) -> np.array:
    if self.zedcam.grab(self.runtime_param) == sl.ERROR_CODE.SUCCESS:
        self.zedcam.retrieve_image(self.image, sl.VIEW.LEFT)
        frame : np.array = self.image.get_data()
        frame = frame[:,:,:-1] #remove depth channel
        return frame
    else:
        raise ValueError("Error grabbing frame")

if name == "main":
zed_runner = ZedRunner()
for i in range(30):
frame: np.array = zed_runner.get_frame()
cv2.imwrite(f"test_{i}.jpg", frame)

Steps to Reproduce

  1. install the python zed api to your environment. This bug occurs on SDK 4.1 with Jetson Orin NX but not on SDK 4.0 with Jetson Orin Nano.
  2. Orient camera upside down before running the script and don't flip it while the code is running.
  3. Inspect the saved images
    ...

Expected Result

That the image will not be upside down if even if the zed 2i is when the script is started.

Actual Result

The images are upside down.

ZED Camera model

ZED2i

Environment

This is for the Orin Nano running zed SDK 4.0 with jetpack
from cat /etc/nv_tegra_release.
R35 (release), REVISION: 4.1, BOARD: t186ref, EABI: aarch64

This is for the Orin NX running zed SDK 4.1 with jetpack
from cat /etc/nv_tegra_release.
R35 (release), REVISION: 3.1, BOARD: t186ref, EABI: aarch64

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant