imguidedfilter function performs edge-preserving
smoothing on an image, using the content of a second image, called
a guidance image, to influence the filtering.
The guidance image can be the image itself, a different version of
the image, or a completely different image. Guided image filtering
is a neighborhood operation, like other filtering operations, but
takes into account the statistics of a region in the corresponding
spatial neighborhood in the guidance image when calculating the value
of the output pixel.
If the guidance is the same as the image to be filtered, the structures are the same—an edge in original image is the same in the guidance image. If the guidance image is different, structures in the guidance image will impact the filtered image, in effect, imprinting these structures on the original image. This effect is called structure transference.