How to use vxuHistogram()


#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 = vxuHistogram (context, img, vx_dist);

Spec says that vxuHistogram() takes vx_distribution as [out], does that means vxuHistogram() 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? Any sample code would be really helpful.


#2

vxuHistogram() is vxHistogram()


#3

No vxuHistogram() does NOT create the vx_distribution object internally; vxuHistogram populates the histogram information inside of the vx_distribution object that you have already created and pass to it. Your code is correct to setup the vx_distribution before passing it to the vxuHistogram function.

After calling vxuHistogram, you can access the result histogram using either vxCopyDistribution() into a user allocated buffer, or vxMapDistribution() to get access to the framework-allocated pointer where the histogram is located.

      • Updated - - -

Same answer for vxu and vx versions, except in vxHistogram(), this only creates the node. You will need more code to create a graph and process the graph.