EDSDK:无法设置“kEdsPropID_ImageQuality”属性

问题描述 投票:0回答:1

当我设置 kEdsPropID_Evf_OutputDevice 属性时成功

EdsUInt32 device;
    if (err == EDS_ERR_OK)
    {
        // Get the current output device.
        err = EdsGetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0, sizeof(device), &device);
    }

    if (err == EDS_ERR_OK)
    {
        // Set the PC as the current output device.
        device |= kEdsEvfOutputDevice_PC;

        // Set to the camera.
        err = EdsSetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0, sizeof(device), &device);
    }

但设置kEdsPropID_ImageQuality时失败

if (err == EDS_ERR_OK)
    {
        EdsUInt32 ImageQuality;
        switch (GLOBAL->getCameraImageQuality())
        {
        case 0:
            ImageQuality = EdsImageQuality_SJF;
            break;
        case 1:
            ImageQuality = EdsImageQuality_MJF;
            break;
        case 2:
            ImageQuality = EdsImageQuality_LJF;
            break;
        default:
            break;
        }
        err = EdsSetPropertyData(camera, kEdsPropID_ImageQuality, 0, sizeof(ImageQuality), &ImageQuality);
    }

我打电话的地方是不是打错了?

c++ edsdk canon-sdk
1个回答
0
投票

我发现问题了! 我使用的相机型号不支持代码中传递的枚举值!

if (err == EDS_ERR_OK)
{
    EdsUInt32 ImageQuality;
    switch (GLOBAL->getCameraImageQuality())
    {
    case 0:
        ImageQuality = EdsImageQuality_S3JF;
        break;
    case 1:
        ImageQuality = EdsImageQuality_S2JF;
        break;
    case 2:
        ImageQuality = EdsImageQuality_S1JF;
        break;
    case 3:
        ImageQuality = EdsImageQuality_MJF;
        break;
    case 4:
        ImageQuality = EdsImageQuality_LJF;
        break;
    default:
        break;
    }
    err = EdsSetPropertyData(camera, kEdsPropID_ImageQuality, 0, sizeof(ImageQuality), &ImageQuality);
}

更换即可!

© www.soinside.com 2019 - 2024. All rights reserved.