3

我有两个vx_imagesrcdst我需要从中获取每个像素src vx_image并进行一些操作并将其设置为dstvx 图像。

vx_image src;
vx_image dst;

我找不到执行此操作的正确文档。我可以知道该怎么做吗?

谢谢你。

4

2 回答 2

2
 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);
  }
于 2017-07-14T04:54:57.850 回答
1

规范中有一节“主机内存数据对象访问模式”:https ://www.khronos.org/registry/OpenVX/specs/1.2/html/page_design.html#sec_host_memory

它显示了访问不同数据对象(包括图像)的示例。

于 2017-07-13T16:16:12.447 回答