Syntax

  

PXL_RETURN_CODE PxLSetFeature (

  HANDLE  hCamera,

  U32     featureId,

  U32     flags,

  U32     numParams,

  float const * pParams );

 

Description


This function sets the value and flags of the selected camera feature.  


  • hCamera is the camera handle.  This value is returned by PxLInitialize.


  • featureId is the feature ID.  For a list of the possible values, see PixeLINKTypes.h or feature types.


  • flags are the properties to be set for the feature.  Feature flags are defined in the file PixeLINKTypes.h.  


Note : Exactly one of the following flags must be set when the function is called


  • FEATURE_FLAG_MANUAL—The application is controlling the feature by sending parameters to the camera.


  • FEATURE_FLAG_AUTO—Ask the camera to automatically control the feature continuously.  No intervention by the user is possible.


  • FEATURE_FLAG_OFF—The feature is disabled.  The exact effect of turning a feature OFF depends on the camera and the specific feature.


  • FEATURE_FLAG_ONEPUSH—The camera sets the feature only once and then returns to manual operation. This flag will be cleared by the camera when the operation is finished.


  • numParams is the number of parameters in the pParams array


  • pParams is the pointer to the array of values for the feature.


Usage 

 

  U32 flags = 0;
  U32 numParams = 1;
  float* params;
  PXL_RETURN_CODE rc;

  // Determine the number of parameters
  // So that we can read the current parameters and flags

  rc = PxLGetFeature(hCamera, FEATURE_SHUTTER, &flags, &numParams, NULL);
  
  params = (float *)malloc(sizeof(float)*numParams);
  
  // Read the current flags and parameter setting
  rc = PxLGetFeature(hCamera, FEATURE_SHUTTER, &flags, &numParams, params);

  // Select a new exposure value.
  params[0] = 0.0001;

  rc = PxLSetFeature(hCamera, FEATURE_SHUTTER, FEATURE_FLAG_MANUAL, numParams, params);
  if (!API_SUCCESS(rc)) {
    // Error handling here.
  }

 

dotNET Usage


float[] newExposure = new float[1];
newExposure[0] = 0.0034;

ReturnCode rc = Api.SetFeature(hCamera, Feature.Shutter, FeatureFlags.Manual, 1, newExposure);

if(!Api.IsSuccess(rc)) {

   //Error handling here

}


Comments, Restrictions and Limitations


Features


Features are camera dependent.  The PxLGetCameraFeatures function should be used to identify the presence and range of all features present in the camera.


When using this function, remember to review the error return codes.  Setting a value out of range, setting an unsupported flag or accessing an unsupported feature will cause an error.  See PxLGetErrorReport.


The following features can only be set if the stream state is turned off (STOP_STREAM) or paused (PAUSED_STREAM).  See PxLSetStreamState.


  • FEATURE_LOOKUP_TABLE
  • FEATURE_FRAME_RATE
  • FEATURE_PIXEL_FORMAT
  • FEATURE_PIXEL_ADDRESSING
  • FEATURE_TRIGGER
  • FEATURE_ROI
  • FEATURE_IMAGER_CLK_DIVISOR 



Using PxLSetFeature with descriptors


PxLSetFeature can change the settings of any custom descriptors that are in use.  Custom descriptors are managed using the advanced functions.


Note that if all descriptors are in focus at once (rather than just a single descriptor), calling PxLSetFeature will set the properties in all descriptors simultaneously.