Convolution confusion

31 views
Skip to first unread message

Stewart Wadsworth

unread,
Jun 28, 2024, 3:12:46 PM6/28/24
to ArrayFire Users
Not sure what I'm missing. I thought I was doing something pretty simple:

I have a "mono16" image on the host.
make it into an array.
Convert to f32.
Do some scaling.
Make a kernel.
convolve.
display.

uint8_t* data = exsting array containing 1080*1920 uint16_t's
af::array raw(1080, 1920, (uint16_t*)data);
raw = raw.as(f32);
raw /= std::numeric_limits<uint16_t>::max();
raw *= 10;
af::array kernel = af::gaussianKernel(5, 5, 200.0f, 200.0f);
af::array out = af::convolve(raw, kernel);

display(out); 

I wasn't able to get the af::Window stuff working so I'm using ROS2 Image topic instead. The display works fine for everything up to the convolve. The convolve seems to be the problem. I was careful to make sure the data types all line up so I don't think it's that?

I'm expecting a "smoother" version of the input but I'm getting a strange tiling effect. Like 5 overlapped ghosted offset copies of the original. When I make the kernel 3x3 instead I get 3 overlapped copies.

What am I missing?? Thanks!
Reply all
Reply to author
Forward
0 new messages