gpt4 book ai didi

openvx - 从 vx_image 设置和获取数据

转载 作者:行者123 更新时间:2023-12-02 09:28:17 29 4
gpt4 key购买 nike

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

vx_image src;
vx_image dst;

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

谢谢。

最佳答案

 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);
}

关于openvx - 从 vx_image 设置和获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45080883/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com