Basler Framegrabber API를 사용하여 LUT에 콘텐츠 Fill하기

이 섹션에서는 런타임 중에 LUT를 콘텐츠로 손쉽게 채우는 방법을 예제를 통해 설명합니다. 이 방법은 FieldParameterAccess 구조체를 기반으로 합니다. struct FieldParameterAccess 및 function Fg_setParameterWithType()에 대한 문서는 Basler Framegrabber API 문서에서 확인할 수 있습니다.

구현 예제:

이 FieldParameterAccess 구조체를 사용하면 유연한 방식으로 모든 유형의 배열 파라미터에 액세스할 수 있습니다. 범위 액세스와 단일 값 액세스가 모두 가능합니다.

예:

                
# include <fgrab_struct.h>
					
struct FieldParameterAccess singleaccess;
					
struct FieldParameterAccess rangeaccess; 
 	
				

Basler Framegrabber API를 사용하여 LUT에 콘텐츠를 채우려면:

  1. LUT 콘텐츠의 값 정의

    예:

    					 
    uint64_t primes[7] = { 1, 2, 3, 5, 7, 11, 13 }; 
     					
    uint32_t answer = 42; 
     				
    					
  2. 단일 값 액세스 또는 범위 액세스 설정:

    1. FieldParameterAccess:: vtype: 포함된 데이터의 유형 설정

    2. FieldParameterAccess:: index: 범위의 첫 번째 인덱스 설정

    3. FieldParameterAccess:: count: 범위의 값 개수 설정

    4. 포함된 데이터의 유형에 따른 값 범위: 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; 
     				 
    				
  3. 콘텐츠를 애플릿 오퍼레이터 LUT에 쓰기

    Fg_setParameterWithType() 함수를 사용하여 콘텐츠를 Operator LUT 애플릿에 씁니다.

    예:

  4. 컴파일된 하드웨어 애플릿의 해당 LUT 오퍼레이터에 LUT 콘텐츠 쓰기

    위 스크린샷과 같이 두 개의 LUT 오퍼레이터가 있는 VisualApplets 디자인 구조의 경우, 컴파일된 하드웨어 애플릿의 해당 LUT 오퍼레이터에 LUT 콘텐츠를 다음과 같이 쓸 수 있습니다:

    				
    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);