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

[1.1.17] Python wrapper: Can't set pixel format with enum type #5

Open
sjrodahl opened this issue Aug 4, 2023 · 1 comment
Open

Comments

@sjrodahl
Copy link

sjrodahl commented Aug 4, 2023

Calling vz_cam.VZ_SetColorPixelFormat(VzPixelFormat.VzPixelFormatGray8) with any of the VzPixelFormat enum values fails with message:

  File "......./API/VzenseDS_api.py", line 145, in VZ_SetColorPixelFormat
    return self.vz_cam_lib.VZ_SetColorPixelFormat(self.device_handle, pixelFormat)
ctypes.ArgumentError: argument 2: TypeError: Don't know how to convert parameter 2

Passing it as an integer instead works.

See MWE below.

from API.VzenseDS_api import VzenseTofCam
from API.VzenseDS_enums import VzPixelFormat


def main():
    vz_cam = VzenseTofCam()
    ip = "<cam_ip_addr>"
    ret = vz_cam.VZ_OpenDeviceByIP(bytes(ip, 'utf-8'))
    if not ret == 0:
        print("No camera found")
    ret = vz_cam.VZ_SetColorPixelFormat(VzPixelFormat.VzPixelFormatGray8)
    if not ret == 0:
        print("Failed setting pixel format")
        return 1
    return 0

if __name__ == "__main__":
    main()

Running on linux x86_64 with Nebula Version: 1.1.17.834828436

I Couldn't find anything related in the release notes, but please let me know if updating will solve this issue.

@Neal-Shen
Copy link
Collaborator

only the VzPixelFormatBGR888 and VzPixelFormatRGB888 is for color

For the API VZ_SetColorPixelFormat,in VzenseDS_api.py:

def VZ_SetColorPixelFormat(self,pixelFormat=VzPixelFormat.VzPixelFormatBGR888):
return self.vz_cam_lib.VZ_SetColorPixelFormat(self.device_handle, pixelFormat)

call the API
vz_cam.VZ_SetColorPixelFormat() or vz_cam.VZ_SetColorPixelFormat(VzPixelFormat.VzPixelFormatBGR888.value) or vz_cam.VZ_SetColorPixelFormat(3)

if call the vz_cam.VZ_SetColorPixelFormat(VzPixelFormat.VzPixelFormatBGR888), should chanage the define
def VZ_SetColorPixelFormat(self,pixelFormat=VzPixelFormat.VzPixelFormatBGR888):
return self.vz_cam_lib.VZ_SetColorPixelFormat(self.device_handle, pixelFormat.value)

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

No branches or pull requests

2 participants