1

I am trying to use OpenVX Histogram (as per Spec 1.1) and little puzzled in the usage part. My understanding is like this (Please correct me):

vx_size numBins = 10;
vx_uint32 offset = 10;
vx_uint32 range = 256;
// Create Object
vx_distribution vx_dist = vxCreateDistribution (Context, numBins, offset, 
range);

// Create Node
vx_status status = vxHistogramNode (context, img, vx_dist);

Spec says that vxHistogramNode() takes vx_distribution as [out], does that means vxHistogramNode() creates object internally? If the answer is 'Yes' than how would i pass numBins, Offset and range of my choice?

Also. how can i access the output of histogram result?

Milind Deore
  • 2,887
  • 5
  • 25
  • 40

1 Answers1

1

The out means that the node will write the result to provided data object. So you pass your object to the node, run the graph and then read the result:

// Create Object
vx_size numBins = 10;
vx_uint32 offset = 10;
vx_uint32 range = 256;
vx_distribution vx_dist = vxCreateDistribution (Context, numBins, offset, range);

vx_graph graph = vxCreateGraph(context);
vxHistogramNode(graph, img, vx_dist);
vxVerifyGraph(graph);

vxProcessGraph(graph);

// Read the data
vx_map_id map_id;
vx_int32 *ptr;
vxMapDistribution(vx_dist, &map_id, (void **)&ptr, VX_READ_ONLY, VX_MEMORY_TYPE_HOST, 0);
// use ptr, like ptr[0]
vxUnmapDistribution(vx_dist, map_id);
vinograd47
  • 6,320
  • 28
  • 30
  • Thanks @jet47 usually when we create any object that become `input [in]` to any API but and if it is `input and output` both then its mentioned like `[in,out]` but in case of `vxHistogramNode ()` its only `[out]` that made me confused. Another question, if i want to read data in the graph itself, so i think i need to make **customer node/kernel** isn't it? – Milind Deore Jul 27 '17 at 16:47
  • Yes, you might create your own user kernel, which can be embedded into the graph along side with built-in kernels. – vinograd47 Jul 27 '17 at 16:48
  • Thanks a ton! Appreciate your help. – Milind Deore Jul 27 '17 at 16:49