使用渲染脚本的摄像机图像的镜像对称性

问题描述 投票:0回答:1

[我想拍摄一个输入图像并产生一个关于中心轴对称的输出,即关于中心垂直轴从右向左反射。

如何使用渲染脚本实现?

示例输入图像:enter image description here

示例输出图像:enter image description here

renderscript android-renderscript
1个回答
0
投票

您可以编写一个内核,以通过图像的左半部分调用它(通过LaunchOptions),然后执行类似的操作:

  int imageWidth;
  rs_allocation inputImage;

  <yourReturnType> RS_KERNEL mirror(<yourImageType> in, uint32_t x, uint32_t y){
      return rs_GetElementAt(inputImage, imageWidth - x, y);
  }

您应该能够直接覆盖输入的图像,因为您只读取图像的一侧,而只写入另一侧。

© www.soinside.com 2019 - 2024. All rights reserved.