TIOVX User Guide
|
Go to the source code of this file.
Macros | |
#define | IN_FILE_NAME "${VX_TEST_DATA_PATH}/colors.bmp" |
Input file name. | |
#define | OUT_FILE_NAME "${VX_TEST_DATA_PATH}/vx_tutorial_image_crop_roi.bmp" |
Output file name. | |
Functions | |
vx_image | load_image_from_handle_from_file (vx_context context, char *filename, vx_bool convert_to_gray_scale, tivx_utils_bmp_image_params_t *imgParams) |
Load image from handle from file. More... | |
void | vx_tutorial_image_crop_roi () |
Tutorial Entry Point. More... | |
Crop a rectangular region from an image
In this tutorial we learn the below concepts,
To include OpenVX interfaces include below file
To include utility APIs to read and write BMP file include below file
Follow the comments in the function vx_tutorial_image_crop_roi() to understand this tutorial
As part of this tutorial, we create few utility functions as listed below. These functions will be used in subsequent tutorials to load and save images.
Utility function | Description |
---|---|
load_image_from_handle_from_file() | Loads an image data object from handle from file |
Definition in file vx_tutorial_image_crop_roi.c.
vx_image load_image_from_handle_from_file | ( | vx_context | context, |
char * | filename, | ||
vx_bool | convert_to_gray_scale, | ||
tivx_utils_bmp_image_params_t * | imgParams | ||
) |
Load image from handle from file.
context | [in] Context |
filename | [in] BMP filename, MUST have extension of .bmp |
convert_to_gray_scale | [in] vx_true_e: Converts RGB values in BMP file to 8b grayscale value and copies them to image object vx_false_e: Retains RGB values from BMP file and copies them to image object |
bmp_file_context | [in] BMP file context |
- Create image from handle.
Creates a reference to image object that was externally allocated
Definition at line 253 of file vx_tutorial_image_crop_roi.c.
void vx_tutorial_image_crop_roi | ( | ) |
Tutorial Entry Point.
- Define objects that we wish to create in the OpenVX application.
A vx_context object is defined which is used as input parameter for all subesquent OpenVX object create APIs
- Create OpenVX context.
This MUST be done first before any OpenVX API call. The context that is returned is used as input for subsequent OpenVX APIs
- Show image attributes.
Follow the comments in show_image_attributes() to see how image attributes are queried and displayed.
- Create image from region of interest.
Creates an image from another image given a rectangle
- Save image object to bitmap file OUT_FILE_NAME.
Follow the comments in tivx_utils_save_vximage_to_bmpfile() to see how data in vx_image object is accessed to store pixel values from the image object to BMP file OUT_FILE_NAME
- Release image object.
Since we are done with using this image object, release it
- Release context object.
Since we are done using OpenVX context, release it. No further OpenVX API calls should be done, until a context is again created using vxCreateContext()
Definition at line 124 of file vx_tutorial_image_crop_roi.c.