从 vx_image 设置和获取数据
Set and get data from vx_image
我有两个vx_image
的src
和dst
,我需要从src
vx_image
中获取每个像素并做一些操作和将其设置为 dst
vx 图像。
vx_image src;
vx_image dst;
我找不到执行此操作的正确文档。我可以知道怎么做吗?
谢谢。
规范中有 "Host Memory Data Object Access Patterns" 部分:https://www.khronos.org/registry/OpenVX/specs/1.2/html/page_design.html#sec_host_memory
它显示了访问不同数据对象(包括图像)的示例。
foo (vx_image & vxSrcImg, vx_image vxDstImg)
{
vx_rectangle_t rect1;
vx_rectangle_t rect2;
vxGetValidRegionImage(vxSrcImg, &rect1);
vxGetValidRegionImage(vxDstImg, &rect2);
vx_imagepatch_addressing_t addr1;
vx_imagepatch_addressing_t addr2;
vx_uint8 *ptr1 = NULL;
vx_uint8 *ptr2 = NULL;
vx_uint32 plane1;
vx_uint32 plane2;
vx_status status1 = vxAccessImagePatch(vxSrcImg, &rect1, plane1, &addr1, &ptr1, VX_READ_AND_WRITE);
vx_status status2 = vxAccessImagePatch(vxDstImg, &rect2, plane2, &addr2, &ptr2, VX_READ_AND_WRITE);
int i=0;
for (i = 0; i < addr1.dim_x * addr1.dim_y; i++)
{
ptr2[i] = myPixelOperation (ptr1[i]);
}
// Rectangle needs to be commit back to the image post operation.
vx_status status3 = vxCommitImagePatch(vxSrcImg, &rect1, plane1, &addr1, &ptr1);
vx_status status4 = vxCommitImagePatch(vxDstImg, &rect2, plane2, &addr2, &ptr2);
}
我有两个vx_image
的src
和dst
,我需要从src
vx_image
中获取每个像素并做一些操作和将其设置为 dst
vx 图像。
vx_image src;
vx_image dst;
我找不到执行此操作的正确文档。我可以知道怎么做吗?
谢谢。
规范中有 "Host Memory Data Object Access Patterns" 部分:https://www.khronos.org/registry/OpenVX/specs/1.2/html/page_design.html#sec_host_memory
它显示了访问不同数据对象(包括图像)的示例。
foo (vx_image & vxSrcImg, vx_image vxDstImg)
{
vx_rectangle_t rect1;
vx_rectangle_t rect2;
vxGetValidRegionImage(vxSrcImg, &rect1);
vxGetValidRegionImage(vxDstImg, &rect2);
vx_imagepatch_addressing_t addr1;
vx_imagepatch_addressing_t addr2;
vx_uint8 *ptr1 = NULL;
vx_uint8 *ptr2 = NULL;
vx_uint32 plane1;
vx_uint32 plane2;
vx_status status1 = vxAccessImagePatch(vxSrcImg, &rect1, plane1, &addr1, &ptr1, VX_READ_AND_WRITE);
vx_status status2 = vxAccessImagePatch(vxDstImg, &rect2, plane2, &addr2, &ptr2, VX_READ_AND_WRITE);
int i=0;
for (i = 0; i < addr1.dim_x * addr1.dim_y; i++)
{
ptr2[i] = myPixelOperation (ptr1[i]);
}
// Rectangle needs to be commit back to the image post operation.
vx_status status3 = vxCommitImagePatch(vxSrcImg, &rect1, plane1, &addr1, &ptr1);
vx_status status4 = vxCommitImagePatch(vxDstImg, &rect2, plane2, &addr2, &ptr2);
}