FIG. 10 illustrates an example of adapting a transmission frequency used for image capture by an ultrasonic fingerprint sensor according to temperature, to obtain a constant wavelength, according to an embodiment. The ultrasonic sensor has a temperature of ?10 degrees Celsius during capture of image 1000 and has a temperature of 25 degrees Celsius during capture of image 1010. At ?10 degrees Celsius, the material of the contact layer allows for transmission of an ultrasonic signal at 6000 meters per second, while at 25 degrees Celsius, the material of the contact layer allows for transmission of an ultrasonic signal at 5600 meters per second. By using a transmission frequency of 53.5 MHz during the capture of image 1000 and using a transmission frequency of 50 MHz during the capture of image 1010, the resulting wavelengths of the transmitted waves are the same, and an output image with the same interference pattern can be generated. If the acoustic speed of sound of contact layer material is known as a function of temperature, then the correct frequency to obtain the same interference pattern can be calculated for each temperature. This same technique can be applied to any temperature and transmission frequency, allowing for the generation of a constant interference pattern at all output images for the same ultrasonic sensor, regardless of temperature. The temperature may be obtained from a temperature embedded in the sensor or in other parts of the device (e.g., temperature sensor 480). Where a constant interference pattern is generated at all output images, an constant interference pattern correction can be applied to any output image, to account for the impact of the interference pattern on the output image. The image is then corrected for the interference pattern. In some embodiments, a captured fingerprint image is corrected using a previously captured background image when no finger was present on the sensor. This type of background image without a finger present may also be referred to as a darkfield image. The background image or darkfield image may be captured at a first temperature and then stored for use and correction at a later time. If at this later time a fingerprint image is captured at a different second temperature, and the fingerprint image needs to be corrected using the background image captured at the first temperature, the frequency during the fingerprint capture may be adapted to account for the difference between the first and second temperature.