102 #define IN_FILE_NAME "${VX_TEST_DATA_PATH}/colors.bmp" 105 #define OUT_FILE_NAME "${VX_TEST_DATA_PATH}/vx_tutorial_image_load_save_out.bmp" 124 printf(
" vx_tutorial_image_load_save: Tutorial Started !!! \n");
158 printf(
" Loaded image of dimensions %d x %d\n", width, height);
193 printf(
" vx_tutorial_image_load_save: Tutorial Done !!! \n");
197 void ascii_file_read(
char *filename,
int num_elements,
void* buffer,
vx_enum data_type){
201 int nbytes =
sizeof(float);
202 char* buff = malloc(nbytes);
206 printf(
"FAILED ALLOCATING MEMORY\n");
212 char* delim =
" \n\t,";
223 ptr_file = fopen(filename,
"r");
225 printf(
"FAILED READING FILE\n");
232 while(fgets(buff, nbytes, ptr_file) > 0){
234 for(token = strtok(buff, delim); token != NULL; token = strtok(NULL, delim)){
235 val = strtod(token, NULL);
260 if (i >= num_elements){
265 if (i >= num_elements){
279 ascii_file_read(filename, rows*cols, mat, data_type);
295 printf(
"Saving pyramid object...\n");
296 for (index=0; index<levels; index++){
298 char img_filename[1000] =
"";
299 strcat(img_filename, filename);
302 char img_index[16] =
"";
303 sprintf(img_index,
"%d.bmp", index);
304 strcat(img_filename, img_index);
305 printf(
"New filename: %s", img_filename);
struct _vx_image * vx_image
vx_status VX_API_CALL vxQueryImage(vx_image image, vx_enum attribute, void *ptr, vx_size size)
vx_status VX_API_CALL vxCopyMatrix(vx_matrix matrix, void *user_ptr, vx_enum usage, vx_enum user_mem_type)
vx_status VX_API_CALL vxReleaseContext(vx_context *context)
struct _vx_context * vx_context
#define OUT_FILE_NAME
Output file name.
struct _vx_pyramid * vx_pyramid
void vx_tutorial_image_load_save()
Tutorial Entry Point.
vx_image tivx_utils_create_vximage_from_bmpfile(vx_context context, const char *filename, vx_bool convert_to_gray_scale)
Create a image data object given BMP filename as input.
#define IN_FILE_NAME
Input file name.
vx_context VX_API_CALL vxCreateContext()
vx_status tivx_utils_save_vximage_to_bmpfile(const char *filename, vx_image image)
Save data from image object to PNG file.
vx_status VX_API_CALL vxReleaseImage(vx_image *image)
vx_image VX_API_CALL vxGetPyramidLevel(vx_pyramid pyr, vx_uint32 index)
struct _vx_matrix * vx_matrix
vx_matrix VX_API_CALL vxCreateMatrix(vx_context c, vx_enum data_type, vx_size columns, vx_size rows)