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

이 섹션에서는 실행 중에 LUT에 내용을 쉽게 채우는 방법에 대한 예제를 확인할 수 있습니다. 이 방법은 struct FieldParameterAccess를 기반으로 합니다. struct FieldParameterAccess 및 함수 Fg_setParameterWithType() 에 대한 설명은 Basler 프레임그래버 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);