Embodiments described herein provide an ultrasonic fingerprint sensor comprising a substantially flat two-dimensional array of ultrasonic transducers and a contact layer of non-uniform thickness overlying the two-dimensional array, where the imaging operation is performed through the contact layer of non-uniform thickness. As used herein, the term “substantially” means mostly, primarily, or completely. In particular, the ultrasonic sensor described herein can operate using a two-dimensional array of ultrasonic transducers that is capable of sensing through a contact layer of uniform or non-uniform thickness without having to modify the two-dimensional array of ultrasonic transducers. Embodiments provided herein control the operating parameters of the ultrasonic fingerprint sensor to correct for the non-uniform thickness of the contact layer, generating an image. Although embodiments are described with respect to an array of ultrasonic transducers, the methods and techniques may be applied to other ultrasound sensing architectures where the control of the operating parameters of different segments of the sensors can be adjusted separately to correct for the non-uniform thickness of the contact layer. As utilized herein, a contact layer of non-uniform thickness is non-uniform with respect to the shape (e.g., non-flat) of at least a portion of the contact layer.