As a bioinspired sensor with high temporal resolution, the spiking cameras have enormous potential in real applications, yet it remains largely unknown how to improve their performance. In this study, we showed that the dynamic range of neuronal networks could be maximized jointly by critical dynamics resulting from balanced excitatory and inhibitory synaptic currents and the heterogeneity in the resting potentials of neurons in the networks. We then built a spiking camera to demonstrate that its performance, characterized by the peak signal-to-noise ratio (PSNR) and the structural similarity index measure (SSIM), could be optimized if the critical dynamics and heterogeneity were included in its core module. we argue that criticality and heterogeneity can serve as basic optimization principles of neuromorphic device design to improve their performance.