added median.cpp for median filtering