apply median filter and save captured and P2I image