在本節中,您將找到一個範例,展示如何在執行階段輕鬆地以內容 Fill LUT。此方法基於結構 FieldParameterAccess。結構 FieldParameterAccess 與 函數 Fg_setParameterWithType() 的相關文件可在 Basler Framegrabber API 文件中找到。
範例實作:
此結構 FieldParameterAccess 允許以靈活的方式存取任何類型的陣列 Property。同時支援範圍存取與單一值存取。
範例:
# include <fgrab_struct.h>
struct FieldParameterAccess singleaccess;
struct FieldParameterAccess rangeaccess;
使用 Framegrabber API 將內容 Fill LUT:
-
定義 LUT 內容的值
範例:
uint64_t primes[7] = { 1, 2, 3, 5, 7, 11, 13 }; uint32_t answer = 42; -
設定單一值存取或範圍存取:
-
FieldParameterAccess:: vtype:設定所包含資料的類型
-
FieldParameterAccess:: index:設定範圍中的第一個索引
-
FieldParameterAccess:: count:設定範圍的值計數
-
根據所包含資料類型的數值範圍:FieldParameterAccess:: p_double、p_int32_t、p_int64_t、p_uint32_t 或 puint64_t
範例:
// set up single value access singleaccess.vtype = FG_PARAM_TYPE_UINT32_T; singleaccess.index = 17; singleaccess.count = 1; singleaccess.p_uint32_t = &answer; // set up range access rangeaccess.vtype = FG_PARAM_TYPE_UINT64_T// every data value is an uint64_t rangeaccess.index = 0; rangeaccess.count = 7; rangeaccess.p_uint64_t = primes;
-
-
將內容寫入 applet operator LUT
使用函數 Fg_setParameterWithType() 將內容寫入 applet Operator LUT。
範例:

-
將 LUT 內容寫入編譯硬體 applet 中的對應 LUT Operator
對於如上方螢幕截圖所示具有兩個 LUT Operator 的 VisualApplets 設計結構,您可以將 LUT 內容寫入編譯硬體 applet 中的對應 LUT Operator:
retCode += Fg_setParameterWithType(fg, Fg_getParameterIdByName(fg, "Device1_Process0_LUT0 _LUTcontent"), &singleaccess, 0, FG_PARAM_TYPE_STRUCT_FIELDPARAMACCESS); retCode += Fg_setParameterWithType(fg, Fg_getParameterIdByName(fg, "Device1_Process0_LUT1 _LUTcontent"), &rangeaccess, 0, FG_PARAM_TYPE_STRUCT_FIELDPARAMACCESS);

上一頁

