A spatial filter for an imaging system comprising an image sensor and an optical system having a pupil plane, the spatial filter being intended to be placed in the pupil plane or in a plane optically conjugated with the pupil plane, the spatial filter having a profile with a symmetry of revolution about an optical axis of the optical system, the spatial filter including about 60 to about 80 phase rings with binary phase-shiftings between π and 2π, the spatial filter forming a phase mask in the pupil plane adapted to modify a contrast map and/or a phase map of the imaging system over a focusing depth domain (P) and over a useful range of spatial frequencies ([−fc;
- fc]), the contrast map representing the module of the optical transfer function (FTO) of the optical system combined with the spatial filter, as a function of the spatial frequency (f), and on of the focusing defect (Ψ), respectively the phase map representing the phase of the optical transfer function (FTO) of the optical system combined with the spatial filter as a function of the spatial frequency (f) and of the focusing defect (Ψ), the spatial filter when placed in the pupil plane or in a plane optically conjugated with the pupil plane of the imaging system providing a value of longitudinal extension (|P|) of the focusing depth domain (P) higher by a multiplication factor at least equal to 10, than the geometrically calculated focusing depth (PM) of said imaging system without said spatial filter.