Example #1
0
 def get_format_list(self):
     count = ueye.UINT()
     check(ueye.is_ImageFormat(self.h_cam, ueye.IMGFRMT_CMD_GET_NUM_ENTRIES, count, ueye.sizeof(count)))
     format_list = ueye.IMAGE_FORMAT_LIST(ueye.IMAGE_FORMAT_INFO * count.value)
     format_list.nSizeOfListEntry = ueye.sizeof(ueye.IMAGE_FORMAT_INFO)
     format_list.nNumListElements = count.value
     check(ueye.is_ImageFormat(self.h_cam, ueye.IMGFRMT_CMD_GET_LIST,
                               format_list, ueye.sizeof(format_list)))
     return format_list
Example #2
0
def ueye_get_image_formats(hcam):
    fcnt = ueye.UINT()
    cmd = ueye.IMGFRMT_CMD_GET_NUM_ENTRIES
    err = ueye.is_ImageFormat(hcam, cmd, fcnt, ueye.sizeof(fcnt))
    _throw_if_err(hcam, err)

    fl = ueye.IMAGE_FORMAT_LIST((ueye.IMAGE_FORMAT_INFO * fcnt))
    fl.nSizeOfListEntry = ueye.sizeof(ueye.IMAGE_FORMAT_INFO)
    fl.nNumListElements = fcnt
    cmd = ueye.IMGFRMT_CMD_GET_LIST
    err = ueye.is_ImageFormat(hcam, cmd, fl, ueye.sizeof(fl))
    # aufschluesseln auf human readable
    fl2 = {fi.nFormatID.value: fi for fi in fl.FormatInfo}
    ret = {}
    for k, v in sorted(fl2.items()):
        ret[k] = v.strFormatName.decode("utf-8")
    return ret