restructuring the imgbilateralfilter