I compiled OpenCV for WebAssembly to apply image smoothing and other transforms to images but GaussianBlur produces a garbled image.
C++ code I’m using to blur the image
// input image RGBA
Mat image(width, height, CV_8UC4, data);
Mat rgb;
Mat blurred;
cvtColor(image, rgb, COLOR_RGBA2RGB);
GaussianBlur(rgb, blurred, Size(3, 3), 0);
Mat out;
cvtColor(blurred, out, COLOR_RGB2RGBA);
// to access the output image
uint8_t *rgba1 = (uint8_t *)malloc(out.dataend - out.data);
memcpy(rgba1, out.data, out.dataend - out.data);
I tried multiple build configurations to check if there was an error with my build but it does the same even using a prebuilt static archive for wasm https://github.com/webarkit/opencv-em/releases/tag/0.1.5