MPS Convolution Borders?

Hello


I'm trying to use the MPS framework to blur and image, my depth map for example.


I want to specify that only valid depth values should be blurred and not any values beyond the actual depth values.

How do I achieve that?


For example if I have the depth image of a cube in the center of the screen. When blurring, I don't want the edges of the cube blurred with the background.


Can someone please let me know if there is a way to do that?


Thanks!

Priyamvad

Ok, it looks like I need a Bilateral Filter instead of a Gaussian filter to do this.


"A Better Gaussian Filter"

http://people.csail.mit.edu/sparis/bf_course/slides08/03_definition_bf.pdf

You could also use a guided filter to do edge-preserving smoothing:


https://developer.apple.com/documentation/metalperformanceshaders/mpsimageguidedfilter

I'm interested in using MPSImageGuidedFilter but haven't found any sample code on how to use it. It's API is quite different from all the other unary filters or binary filters in MPS. Any pointers?

MPS Convolution Borders?
 
 
Q