Color filter array recovery using a threshold-based variable number of gradients | Synapse