因此,在Halide aot示例https://halide-lang.org/tutorials/tutorial_lesson_10_aot_compilation_run.html中,有这一行:
Halide::Runtime::Buffer<uint8_t> input(640, 480), output(640, 480);我的问题是,如何将图像加载到输入运行时缓冲区?
发布于 2019-08-06 07:25:13
与前面的教程加载图像的方式相同。
添加以下内容:
#include "halide_image_io.h" // for load_image and save_image然后替换
Halide::Runtime::Buffer<uint8_t> input(640, 480), output(640, 480);使用
Halide::Runtime::Buffer<uint8_t> input = Halide::Tools::load_image("path/to/input.png");
Halide::Runtime::Buffer<uint8_t> output(input.width(), input.height());如果您对保存输出感兴趣,请在错误检查之后添加以下行:
Halide::Tools::save_image(output, "path/to/output.png");请注意,在运行以下命令后,路径(如果不是绝对路径)将位于以下目录中:用于输入的Halide/tutorial/目录和用于输出的Halide/bin/build/tmp/目录:
make tutorial_lesson_10_aot_compilation_run从Halide的根目录。
发布于 2020-04-24 10:50:58
最新的语法如下:
Halide::Runtime::Buffer<float> in = Tools::load_image("image.png");
Halide::Runtime::Buffer<float> out(in.width(), in.height(),in.channels());
int error = halide_blur(in, out); //halide_blur is the function defined in aot compiled code
Tools::save_image(out, output.png");https://stackoverflow.com/questions/57347036
复制相似问题