简体   繁体   English

OpenVX直方图

[英]OpenVX Histogram

I am trying to use OpenVX Histogram (as per Spec 1.1 ) and little puzzled in the usage part. 我正在尝试使用OpenVX直方图(按照Spec 1.1 ),在用法部分有点困惑。 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? Spec说vxHistogramNode()vx_distribution as [out] ,这是否意味着vxHistogramNode()内部创建对象? If the answer is 'Yes' than how would i pass numBins, Offset and range of my choice? 如果答案是“是”,那么我将如何传递numBins,Offset和选择的范围?

Also. 也。 how can i access the output of histogram result? 如何访问直方图结果的输出?

The out means that the node will write the result to provided data object. out表示节点将把结果写入提供的数据对象。 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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM