The OpenVX Specification  dba1aa3
Object: Threshold

Detailed Description

Defines the Threshold Object Interface.

Typedefs

typedef struct _vx_threshold * vx_threshold
 The Threshold Object. A thresholding object contains the types and limit values of the thresholding required.
 

Enumerations

enum  vx_threshold_attribute_e {
  VX_THRESHOLD_TYPE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_THRESHOLD << 8)) + 0x0,
  VX_THRESHOLD_INPUT_FORMAT = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_THRESHOLD << 8)) + 0x7,
  VX_THRESHOLD_OUTPUT_FORMAT = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_THRESHOLD << 8)) + 0x8
}
 The threshold attributes. More...
 
enum  vx_threshold_type_e {
  VX_THRESHOLD_TYPE_BINARY = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_THRESHOLD_TYPE << 12)) + 0x0,
  VX_THRESHOLD_TYPE_RANGE = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_THRESHOLD_TYPE << 12)) + 0x1
}
 The Threshold types. More...
 

Functions

vx_status VX_API_CALL vxCopyThresholdOutput (vx_threshold thresh, vx_pixel_value_t *true_value_ptr, vx_pixel_value_t *false_value_ptr, vx_enum usage, vx_enum user_mem_type)
 Allows the application to copy the true and false output values from/into a threshold object. More...
 
vx_status VX_API_CALL vxCopyThresholdRange (vx_threshold thresh, vx_pixel_value_t *lower_value_ptr, vx_pixel_value_t *upper_value_ptr, vx_enum usage, vx_enum user_mem_type)
 Allows the application to copy thresholding values from/into a threshold object with type VX_THRESHOLD_TYPE_RANGE. More...
 
vx_status VX_API_CALL vxCopyThresholdValue (vx_threshold thresh, vx_pixel_value_t *value_ptr, vx_enum usage, vx_enum user_mem_type)
 Allows the application to copy the thresholding value from/into a threshold object with type VX_THRESHOLD_TYPE_BINARY. More...
 
vx_threshold VX_API_CALL vxCreateThresholdForImage (vx_context context, vx_enum thresh_type, vx_df_image input_format, vx_df_image output_format)
 Creates a threshold object and returns a reference to it. More...
 
vx_threshold VX_API_CALL vxCreateVirtualThresholdForImage (vx_graph graph, vx_enum thresh_type, vx_df_image input_format, vx_df_image output_format)
 Creates an opaque reference to a threshold object without direct user access. More...
 
vx_status VX_API_CALL vxQueryThreshold (vx_threshold thresh, vx_enum attribute, void *ptr, vx_size size)
 Queries an attribute on the threshold object. More...
 
vx_status VX_API_CALL vxReleaseThreshold (vx_threshold *thresh)
 Releases a reference to a threshold object. The object may not be garbage collected until its total reference count is zero. More...
 
vx_status VX_API_CALL vxSetThresholdAttribute (vx_threshold thresh, vx_enum attribute, const void *ptr, vx_size size)
 Sets attributes on the threshold object. More...
 

Enumeration Type Documentation

The Threshold types.

Enumerator
VX_THRESHOLD_TYPE_BINARY 

A threshold with only 1 value.

VX_THRESHOLD_TYPE_RANGE 

A threshold with 2 values (upper/lower). Use with Canny Edge Detection.

Definition at line 1053 of file vx_types.h.

The threshold attributes.

Enumerator
VX_THRESHOLD_TYPE 

The value type of the threshold. Read-only. Use a vx_enum parameter. Will contain a vx_threshold_type_e.

VX_THRESHOLD_INPUT_FORMAT 

The input image format the threshold was created for. Read-only. Use a vx_enum parameter. Will contain a vx_df_image_e.

VX_THRESHOLD_OUTPUT_FORMAT 

The output image format the threshold was created for. Read-only. Use a vx_enum parameter. Will contain a vx_df_image_e.

Definition at line 1063 of file vx_types.h.

Function Documentation

vx_threshold VX_API_CALL vxCreateThresholdForImage ( vx_context  context,
vx_enum  thresh_type,
vx_df_image  input_format,
vx_df_image  output_format 
)

Creates a threshold object and returns a reference to it.

The threshold object defines the parameters of a thresholding operation to an input image, that generates an output image that can have a different format. The thresholding 'false' or 'true' output values are specified per pixel channels of the output format and can be modified with vxCopyThresholdOutput. The default 'false' output value of pixels channels should be 0, and the default 'true' value should be non-zero. For standard image formats, default output pixel values are defined as following:

vx_threshold VX_API_CALL vxCreateVirtualThresholdForImage ( vx_graph  graph,
vx_enum  thresh_type,
vx_df_image  input_format,
vx_df_image  output_format 
)

Creates an opaque reference to a threshold object without direct user access.

Parameters
[in]graphThe reference to the parent graph.
[in]thresh_typeThe type of thresholding operation.
[in]input_formatThe format of images that will be used as input of the thresholding operation.
[in]output_formatThe format of images that will be generated by the thresholding operation.
See also
vxCreateThresholdForImage
Returns
A threshold reference vx_threshold. Any possible errors preventing a successful creation should be checked using vxGetStatus.
vx_status VX_API_CALL vxCopyThresholdValue ( vx_threshold  thresh,
vx_pixel_value_t value_ptr,
vx_enum  usage,
vx_enum  user_mem_type 
)

Allows the application to copy the thresholding value from/into a threshold object with type VX_THRESHOLD_TYPE_BINARY.

Parameters
[in]threshThe reference to the threshold object that is the source or the destination of the copy.
[in,out]value_ptrThe address of the memory location where to store the thresholding value if the copy was requested in read mode, or from where to get the thresholding value to store into the threshold object if the copy was requested in write mode.
[in]usageThis declares the effect of the copy with regard to the threshold object using the vx_accessor_e enumeration. Only VX_READ_ONLY and VX_WRITE_ONLY are supported:
  • VX_READ_ONLY means that the thresholding value is copied from the threshold object into the user memory. After the copy, only the field of the (*value_ptr) union that corresponds to the input image format of the threshold object is meaningful.
  • VX_WRITE_ONLY means the field of the (*value_ptr) union corresponding to the input format of the threshold object is copied into the threshold object.
[in]user_mem_typeA vx_memory_type_e enumeration that specifies the type of the memory referenced by value_ptr.
Returns
A vx_status_e enumeration.
Return values
VX_ERROR_INVALID_REFERENCEThe threshold reference is not actually a threshold reference.
VX_ERROR_NOT_COMPATIBLEThe threshold object doesn't have type VX_THRESHOLD_TYPE_BINARY
VX_ERROR_INVALID_PARAMETERSAn other parameter is incorrect.
vx_status VX_API_CALL vxCopyThresholdRange ( vx_threshold  thresh,
vx_pixel_value_t lower_value_ptr,
vx_pixel_value_t upper_value_ptr,
vx_enum  usage,
vx_enum  user_mem_type 
)

Allows the application to copy thresholding values from/into a threshold object with type VX_THRESHOLD_TYPE_RANGE.

Parameters
[in]threshThe reference to the threshold object that is the source or the destination of the copy.
[in,out]lower_value_ptrThe address of the memory location where to store the lower thresholding value if the copy was requested in read mode, or from where to get the lower thresholding value to store into the threshold object if the copy was requested in write mode.
[in,out]upper_value_ptrThe address of the memory location where to store the upper thresholding value if the copy was requested in read mode, or from where to get the upper thresholding value to store into the threshold object if the copy was requested in write mode.
[in]usageThis declares the effect of the copy with regard to the threshold object using the vx_accessor_e enumeration. Only VX_READ_ONLY and VX_WRITE_ONLY are supported:
  • VX_READ_ONLY means that thresholding values are copied from the threshold object into the user memory. After the copy, only the field of (*lower_value_ptr) and (*upper_value_ptr) unions that corresponds to the input image format of the threshold object is meaningful.
  • VX_WRITE_ONLY means the field of the (*lower_value_ptr) and (*upper_value_ptr) unions corresponding to the input format of the threshold object is copied into the threshold object.
[in]user_mem_typeA vx_memory_type_e enumeration that specifies the type of the memory referenced by lower_value_ptr and upper_value_ptr.
Returns
A vx_status_e enumeration.
Return values
VX_ERROR_INVALID_REFERENCEThe threshold reference is not actually a threshold reference.
VX_ERROR_NOT_COMPATIBLEThe threshold object doesn't have type VX_THRESHOLD_TYPE_RANGE
VX_ERROR_INVALID_PARAMETERSAn other parameter is incorrect.
vx_status VX_API_CALL vxCopyThresholdOutput ( vx_threshold  thresh,
vx_pixel_value_t true_value_ptr,
vx_pixel_value_t false_value_ptr,
vx_enum  usage,
vx_enum  user_mem_type 
)

Allows the application to copy the true and false output values from/into a threshold object.

Parameters
[in]threshThe reference to the threshold object that is the source or the destination of the copy.
[in,out]true_value_ptrThe address of the memory location where to store the true output value if the copy was requested in read mode, or from where to get the true output value to store into the threshold object if the copy was requested in write mode.
[in,out]false_value_ptrThe address of the memory location where to store the false output value if the copy was requested in read mode, or from where to get the false output value to store into the threshold object if the copy was requested in write mode.
[in]usageThis declares the effect of the copy with regard to the threshold object using the vx_accessor_e enumeration. Only VX_READ_ONLY and VX_WRITE_ONLY are supported:
  • VX_READ_ONLY means that true and false output values are copied from the threshold object into the user memory. After the copy, only the field of (*true_value_ptr) and (*false_value_ptr) unions that corresponds to the output image format of the threshold object is meaningful.
  • VX_WRITE_ONLY means the field of the (*true_value_ptr) and (*false_value_ptr) unions corresponding to the output format of the threshold object is copied into the threshold object.
[in]user_mem_typeA vx_memory_type_e enumeration that specifies the type of the memory referenced by true_value_ptr and false_value_ptr.
Returns
A vx_status_e enumeration.
Return values
VX_ERROR_INVALID_REFERENCEThe threshold reference is not actually a threshold reference.
VX_ERROR_INVALID_PARAMETERSAn other parameter is incorrect.
vx_status VX_API_CALL vxReleaseThreshold ( vx_threshold thresh)

Releases a reference to a threshold object. The object may not be garbage collected until its total reference count is zero.

Parameters
[in]threshThe pointer to the threshold to release.
Postcondition
After returning from this function the reference is zeroed.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors; any other value indicates failure.
VX_ERROR_INVALID_REFERENCEthresh is not a valid vx_threshold reference.
vx_status VX_API_CALL vxSetThresholdAttribute ( vx_threshold  thresh,
vx_enum  attribute,
const void *  ptr,
vx_size  size 
)

Sets attributes on the threshold object.

Parameters
[in]threshThe threshold object to set.
[in]attributeThe attribute to modify. Use a vx_threshold_attribute_e enumeration.
[in]ptrThe pointer to the value to which to set the attribute.
[in]sizeThe size of the data pointed to by ptr.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors; any other value indicates failure.
VX_ERROR_INVALID_REFERENCEthresh is not a valid vx_threshold reference.
vx_status VX_API_CALL vxQueryThreshold ( vx_threshold  thresh,
vx_enum  attribute,
void *  ptr,
vx_size  size 
)

Queries an attribute on the threshold object.

Parameters
[in]threshThe threshold object to set.
[in]attributeThe attribute to query. Use a vx_threshold_attribute_e enumeration.
[out]ptrThe location at which to store the resulting value.
[in]sizeThe size of the container to which ptr points.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors; any other value indicates failure.
VX_ERROR_INVALID_REFERENCEthresh is not a valid vx_threshold reference.