115 #define IN_FILE_NAME "${VX_TEST_DATA_PATH}/colors.bmp" 118 #define OUT_FILE_NAME "${VX_TEST_DATA_PATH}/vx_tutorial_image_histogram_out.bmp" 122 uint32_t width, uint32_t height);
137 vx_image in_image = NULL, out_image = NULL;
140 uint32_t num_bins = 256;
141 uint32_t histogram_image_width = 256;
142 uint32_t histogram_image_height = 128;
147 printf(
" vx_tutorial_image_histogram: Tutorial Started !!! \n");
211 refs,
sizeof(refs)/
sizeof(refs[0])
254 printf(
" Executing graph ...\n");
276 printf(
" Executing graph ... Done !!!\n");
298 histogram_image_width,
299 histogram_image_height);
381 printf(
" vx_tutorial_image_histogram: Tutorial Done !!! \n");
385 #define MAX_BINS (256u) 397 uint32_t width, uint32_t height)
430 uint32_t histogram_data[MAX_BINS] = {0};
440 (
void**)&histogram_data[0],
447 for(i=0; i<num_bins; i++)
449 if(histogram_data[i] > max )
450 max = histogram_data[i];
453 for(i=0; i<num_bins; i++)
455 histogram_data[i] = (uint32_t)(((
float)histogram_data[i]/max)*height + 0.5);
456 if(histogram_data[i]>height)
457 histogram_data[i] = height;
461 uint8_t *data_ptr = NULL;
484 uint32_t i, j, k, bin_width;
485 uint8_t *addr0 = NULL, *addr1 = NULL;
487 bin_width = width/num_bins;
489 for(i=0; i<num_bins; i++)
491 addr0 = data_ptr + i*bin_width;
493 for(j=0; j<height-histogram_data[i]; j++)
495 addr1 = addr0 + j*image_addr.
stride_y;
496 for(k=0; k<bin_width; k++)
502 addr0 = data_ptr + j*image_addr.
stride_y + i*bin_width;
504 for(j=0; j<histogram_data[i]; j++)
506 addr1 = addr0 + j*image_addr.
stride_y;
507 for(k=0; k<bin_width; k++)
struct _vx_image * vx_image
#define IN_FILE_NAME
Input file name.
vx_status VX_API_CALL vxReleaseDistribution(vx_distribution *distribution)
Interface to TI extension APIs.
void show_node_attributes(vx_node node)
Show attributes of previously created node.
struct _vx_distribution * vx_distribution
vx_status VX_API_CALL vxUnmapImagePatch(vx_image image, vx_map_id map_id)
void show_graph_attributes(vx_graph graph)
Show attributes of previously created graph.
#define OUT_FILE_NAME
Output file name.
vx_status VX_API_CALL vxReleaseContext(vx_context *context)
void vx_tutorial_image_histogram()
Tutorial Entry Point.
struct _vx_context * vx_context
struct _vx_reference * vx_reference
vx_status VX_API_CALL vxQueryDistribution(vx_distribution distribution, vx_enum attribute, void *ptr, vx_size size)
vx_node tivxCreateNodeByKernelEnum(vx_graph graph, vx_enum kernelenum, vx_reference params[], vx_uint32 num)
Utility function to create a node given parameter references and kernel enum.
vx_image VX_API_CALL vxCreateImage(vx_context context, vx_uint32 width, vx_uint32 height, vx_df_image color)
vx_status VX_API_CALL vxCopyDistribution(vx_distribution distribution, void *user_ptr, vx_enum usage, vx_enum user_mem_type)
vx_status VX_API_CALL vxMapImagePatch(vx_image image, const vx_rectangle_t *rect, vx_uint32 plane_index, vx_map_id *map_id, vx_imagepatch_addressing_t *addr, void **ptr, vx_enum usage, vx_enum mem_type, vx_uint32 flags)
vx_status VX_API_CALL vxWaitGraph(vx_graph graph)
vx_status VX_API_CALL vxReleaseGraph(vx_graph *graph)
vx_status VX_API_CALL vxSetReferenceName(vx_reference ref, const vx_char *name)
vx_distribution VX_API_CALL vxCreateDistribution(vx_context context, vx_size numBins, vx_int32 offset, vx_uint32 range)
void show_image_attributes(vx_image image)
Show attributes of previously created image.
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.
vx_graph VX_API_CALL vxCreateGraph(vx_context context)
vx_status VX_API_CALL vxVerifyGraph(vx_graph graph)
vx_status VX_API_CALL vxScheduleGraph(vx_graph graph)
vx_context VX_API_CALL vxCreateContext()
struct _vx_graph * vx_graph
vx_status VX_API_CALL tivxExportGraphToDot(vx_graph graph, const char *output_file_path, const char *output_file_prefix)
Export graph representation as DOT graph file.
vx_status VX_API_CALL vxReleaseNode(vx_node *node)
vx_status tivx_utils_save_vximage_to_bmpfile(const char *filename, vx_image image)
Save data from image object to PNG file.
struct _vx_node * vx_node
vx_status VX_API_CALL vxReleaseImage(vx_image *image)
vx_context VX_API_CALL vxGetContext(vx_reference reference)
vx_image convert_distribution_to_image(vx_distribution distribution, uint32_t width, uint32_t height)
Convert distribution given as input to image.
vx_status VX_API_CALL vxGetStatus(vx_reference reference)