DALSA相机开发--修改参数

时间:2021-08-05 17:38:54

DALSA gige相机有两种方式可以获取到相机相关参数,一个是读取相机里面的xml文件;另外一个是读取相对应的寄存器的值。

对于修改寄存器的值,有两个相应的函数:

1)GevSetFeatureValue

函数原型为:

GEV_STATUS GevSetFeatureValue(GEV_CAMEAR_HANDLE handle, const char *feature_name, int value_size, void *value);

2)GevSetFeatureValueAsString

函数原型为:

GEV_STATUS GevSetFeatureValueAsString(GEV_CAMERA_HANDLE handle, const char *feature_name,  char *value_string);

两者之间端区别在于,GevSetFeatureValue 可以配置任意类型(支持的类型)的值,并且需要手动填写类型。而GevSetFeatureValueAsString 是固定为string类型,只需要填写相对应端值即可。

还有一个更重要的区别是,GevSetFeatureValue能够配置的项在文件 cameraregdata.c 中有对应,许多项配置不了,受制于结构体

typedef struct
{
    char                featureName[FEATURE_NAME_MAX_SIZE]; // String name of feature for this register.
    UINT32              address;         // Address for accessing feature in camera (NOREF_ADDR if not in camera).
    RegAccess           accessMode;     // RO, WO, RW access allowed.
    BOOL32              available;      // True if feature is available (in camera or not) - False is not available.
    RegType             type;           // String, Float, Integer, Enum, Bit
    UINT32              regSize;        // Size of storage for register (or register set / area).
    UINT32              regStride;    // Increment between register items accessed via selector
    UINT32              minSelector;    // Minimum value for selector (corresponds to base address).
    UINT32              maxSelector;    // Maximum value for selector.
    GENIREG_VALUE       value;    // Current value (storage for features not backed by a register).
    GENIREG_VALUE       minValue;    // Minimum allowable value.
    GENIREG_VALUE       maxValue;    // Maximum allowable value.
    UINT32              readMask;       // AND Mask for read (integers only)
    UINT32              writeMask;      // AND Mask for write (integers only)
    PGENICAM_FEATURE    feature;         // Pointer to feature in feature table (future).
    char                selectorName[FEATURE_NAME_MAX_SIZE]; // String name of selector for feature.
    char                indexName[FEATURE_NAME_MAX_SIZE]; // String name of index (second selector)for feature.
} GEV_REGISTER, *PGEV_REGISTER;

中accessMode 和 available 等属性。

而 GevSetFeatureValueAsString 却能够配置 featureName存在的项,能力远远大于 GevSetFeatureValue 。