1

我正在尝试使用 OpenVX 直方图(根据Spec 1.1)并且在使用部分几乎没有困惑。我的理解是这样的(请纠正我):

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说vxHistogramNode()需要vx_distribution as [out],这是否意味着在vxHistogramNode()内部创建对象?如果答案是“是”,那么我将如何通过我选择的 numBins、Offset 和范围?

还。如何访问直方图结果的输出?

4

1 回答 1

1

out意味着节点会将结果写入提供的数据对象。因此,您将对象传递给节点,运行图表,然后读取结果:

// 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);
于 2017-07-27T16:18:50.210 回答