Tutorial: Lens Effects
The camera's lens allows light to focus on the internal photo sensor. The better quality the lens, the sharper and more vibrant the photo.
An ideal lens would be a parabolic arc that is perfectly smooth and curved. However, this degree of accuracy increases the lens thickness, weight, and manufacturing costs. To keep weight and costs low, many cameras use a stepped approach. The Fresnel lens uses a flat surface with a series of beveled steps that approximate the desired parabolic curve. This makes the lens thinner, lighter, and cheaper to manufacture. Although this is not a perfect parabolic curve, any distortion (from a lens with small enough beveled edges) will probably not be noticeable.
Aside from perfect parabolic curves and Fresnel lenses, a third option uses inexpensive lenses, such as a flat lens, a lens with a mild parabolic bend, or a Fresnel lens with few beveled steps. These lenses introduce distortions as the light is received by the sensor. However, the camera can apply post-sensor corrections in the firmware, camera driver, or camera application. This "fix it later" solution is very common for smartphones, as well as some point-and-shoot cameras.
Lens Effects and Forensics
Distortions before the light hits the sensor are usually not detectable by pixel or compression-level analysis. Instead, detection requires evaluating the photo's content. Although there are methods to analyze the image and detect blurriness, visual curvature, and chromatic aberration, these techniques are not widely used. In particular, distinguishing the bend of a curved object from a lens curvature can be difficult to automate. And some distortions, such as a wide-angle or fish-eyed lens, may be intentional.
However, non-uniform noise patterns are sometimes detectable through signal analysis. For example:
- Post-sensor alterations: The camera's sensor introduces high frequency noise over the entire image. Post-sensor alterations redistribute the high frequency noise so that it is not spread uniformly.
- Photon focusing: Lens distortions can emphasize photons on certain portions of the sensor. This can alter high frequencies along the distortion's edges. The edges can be emphasized (made visible) or de-emphasized (making the non-edge centers stand out).
Both of these types of high frequency noise alterations are detectable by a variety of signal analysis techniques. These alterations even impact the JPEG compression rate and can be detected by error level analysis (
ELA).
Macro Structures and JPEG Encoding
JPEG encodes images using a grid. The grid is typically 8x8 pixels, but can be 16x16, 8x16, or 16x8 pixels. Regardless of the grid size, each JPEG grid cell is encoded independently. When you see distortions from JPEG encoding, the distortions are limited to the JPEG grid. With alterations that are highlighted by ELA, the size of the detection is limited to the size of the JPEG grid; an alteration that is contained in only one grid cell will not impact adjacent grids.
Photon focusing and post-sensor corrections are applied before the image is JPEG encoded. These lense effects generate visible grid-like structures that are larger than the JPEG 16x16 grid. (When viewing the full-sized ELA image, you probably won't notice these structures.) A macro structure's grid may be square, or warped (with curves). These lens effects typically looks like a fuzzy set of lines in a grid structure.
Macro Structures and Alterations
When these macro structures are present, they span the entire image. However, depending on the type of lens effect distortion, it may fade out across some parts of the image. If the picture is altered, then the alterations will disrupt the macro structures. (You won't see the grid passing though the altered area.) This disruption can allow an analyst to determine the areas of the picture that were digitally altered.
Macro Structures and Availability
These macro structures are not always present or easily detectable. Even if they appear in one photo, they may not appear in every photo. The factors that impact the appearance of these structures are based on the focus settings:
- Auto-applied. The camera (firmware, drivers, or software) can automatically determine when to apply any post-sensor corrections. Two photos taken back-to-back with the same camera may receive different auto-correction settings; one picture could be corrected while another is not.
- Intensity. Some photos require more corrections than others. A photo with a low-intensity correction may not have a noticeable macro structure.
- Post-processing. Pictures that are sharpened, including Adobe Photoshop's auto-sharpening when any JPEG is saved, will have stronger macro structures than camera-original images. However, scaling the image smaller (removing high frequency noise) can completely remove these macro structures.
- Symmetry. Because the macro structures are related to the lens, they are always symmetrical. The top will have the same structure as the bottom, and the left will have the same structure as the right. If a picture is cropped (but not resized enough to remove the macro structures), then the macro structure will appear off-center. If there is enough of the macro structure present to identify the center of the structure, then an analyst can identify the center of the photo-original picture.
Because JPEG encoding removes high frequency noise, viral pictures, images re-distributed through social media (e.g., Facebook and Twitter), and post-processed photos almost never contain lens effect artifacts.
Sample Macro Structures
Different cameras generate different types of macro structures. The examples below show the most common structures. Next to each grid is a sample ELA result that displays the macro structure. These sample structures came from photos uploaded to the public FotoForensics site. (Click on any of the ELA images to view the full analysis page.)
Macro Structure: Grid
The grid macro structure is typically seen with Android devices running 6.x or later. The density of the grid varies based on the focal distance; a tight grid means a closer focal point. The grid may not be present over extreme coloring (solid colors, dark shadows, bright lights, etc.).
Macro Structure: Warp
The warp pattern is one of the most common lens effects. It's been seen with Canon, Kodak, Leica, Nikon, Samsung, and other brands. Depending on the lens settings, it could be described as a 'barrel', 'pincushion', or 'mustache' distortion.
The center of the warp effect should be in the center of the photo (sample 1). In sample 2, the picture has been cropped. Although the lens effect is not centered, you can identify where the center is located and how much of the image was cropped off the original picture's right and bottom edges.
The density and scale of the warp effect is dependent on the focus settings. Sometimes it only appears over the center or edges (sample 1), while other times it is visible over the entire image (sample 2). The very center of the warped area appears as concentric rings; if the camera hyperfocuses on the center, then only the rings may appear -- with or without a faint grid pattern (sample 3).
Macro Structure: Multiple Warp
A single lens distortion will only generate a single warp pattern. However, multiple lens distortions can generate pairs of ring patterns. The pairs of warp patterns can be symmetrical (samples 1 and 2) or rotated (sample 3) around the photo center. In some cases, the pairs of warped rings may not be contained in the photo (sample 4). These multiple warp patterns typically come from standalone cameras that have complex lenses (Canon, Olympus, Ricoh, Nikon, etc.); it is not from your typical smartphone devices with a simple focus mechanism.
Macro Structure: Sheer and Rotate
iOS devices (iPhone, iPad, etc.) include a photo editor that permits cropping and rotating photos. The rotation often generates a rotated or sheered grid effect. The amount of tilt depends on the amount of rotational correction; the tilt can be significant (sample 1), or very subtle (sample 2). A horizontal and vertical grid usually denotes an Android device, but a rotated or sheered grid is almost always from an iOS device.
Sample #3 has metadata that claims to come from a Xiaomi Android camera (model 2014813, also known as the Xiaomi Redmi 2 Pro). However, the lens effect identifies the photo as being from an iOS device and not an Android. This picture is a forgery; the photo was altered and the metadata from the iOS device was replaced with metadata from a Xiaomi Android camera. (The lens effect is also not present over the large sticker on the hard drive, denoting a large alteration.)
Macro Structure: Android Dots
While not technically a lens effect, early Androids (up through Android 5.x) had a bug in the default JPEG library that was used by many applications. Any save after post-processing could introduce a high frequency impulse over the 8x8 grid. The 'dots' may not appear over edits, uniformly colored areas, or 8x8 grids that lack high frequencies. If you see this pattern, it means that the picture was post-processed on an older Android device.
Although the specific JPEG library is found in Android 4.x and 5.x, some vendors mix-and-match versions. Your Android 6.x or 7.x device may be using an Android 5.x JPEG library. In addition, some applications ship with their own copy of the buggy JPEG library.
Macro Structure: Independence
The lens effect macro structure is independent of the image contents. For example, the following picture of a computer monitor has a visible moiré pattern. The moiré pattern appears as a series of complex wave patterns in the white screen because the monitor's pixel elements do not perfectly align with the camera's sensor elements. (Don't see it? Look closely for fine vertical gray lines in the middle and a ringing pattern on the photo-right edge.)
In contrast, the ELA for the image shows a very different lens effect pattern: a barrel warp. The warp is independent of the monitor's moiré pattern. It is also not visible along the black border due to the low contrast and post-processing (the image was cropped since the warp is not centered).
Caveats
While lens effects can be very useful when they are present, they are rarely present in photos.
- Not all cameras generate lens effects.
- For cameras that generate lens effects, they do not always generate them and the distortion patterns may not be detectable.
- Lens effects may not be visible over the entire image. In some cases, the grid lines taper off until they are no longer noticeable. Other times, in-camera processing, such as auto-exposure or auto-color correction, can remove the lens artifacts over a portion of the picture.
- Anything that removes high-frequency noise can remove these lens effects. This includes scaling and saving at a low quality. Pictures that have been virally distributed will almost never retain lens effect artifacts.
- A low-quality JPEG often has a visible JPEG grid. A grid pattern that is 8x8 pixels, 16x16 pixels, 8x16, or 16x8 is caused by the JPEG compression and not by lens effects. Do not confuse a 16x16 grid with an android lens effect grid. (Lens effects are large and blurry. JPEG grids are small, exactly 8x8, 16x16, etc. and have edges that are 1 pixel wide.)
Lens effects are caused by high-frequency noise that is not uniformly distributed over the picture. These artifacts should be detectable by many different signal and compression analysis algorithms. These patterns often denote a camera-original or near-camera-original photo.