I'm programming morphological opening and it's returning the result that's the same as the input image. Am I misunderstanding the explanation of it? My code is:
Var x, y;
Func limit, erosion, dilation;
ImageParam input(type_of<uint8_t>(), 2);
Param<int> dimension;
RDom r(-1 * dimension / 2, dimension, -1 * dimension / 2, dimension);
limit = BoundaryConditions::repeat_edge(input);
erosion(x, y) = argmin(r, limit(x + r.x, y + r.y), "erosion")[2];
dilation(x, y) = argmax(r, erosion(x + r.x, y + r.y), "dilation")[2];
erosion.compute_root();
dilation.vectorize(x, 4).parallel(y);
Target target = get_host_target();
target.set_feature(Target::NoRuntime, true);
dilation.compile_to_static_library(path, { input,dimension }, target);