Extracting photon-number information from superconducting nanowire single-photon detectors traces via mean-derivative projection