University › Artificial Intelligence and Data Science › Computer Vision
Image Formation
Compute image coordinates in perspective projection from focal length and depth; use the thin-lens equation to relate object and image distances.
Learning Outcomes
- In perspective projection, the image coordinate can be calculated based on focal length and depth.
- Can solve the relationship between object and image distance using the thin lens equation.
- It can calculate the raw memory size of an image from the number of pixels, number of channels and bit depth.
- It can explain the difference between sampling and quantization, along with the artificial effects they create.
Topic Explanation
Physical basis of light, surfaces and images
An image is formed when light reflects off objects in a scene and reaches a sensor. Light is a narrow band of the electromagnetic spectrum to which the human eye is sensitive, covering wavelengths between approximately 400 and 700 nanometers. Light falling on a surface follows one of three paths: some of it is absorbed, some of it passes through, and some of it is reflected back. It is the reflected light that reaches the sensor; Therefore, what we see is not the object itself, but the way the surface reflects light. The same surface looks different under different lighting; because the perceived brightness is the product of the reflectivity of the surface and the illumination falling on it.
Reflection varies between two extreme cases. In ideal diffuse reflection, the incoming light is distributed equally in all directions, so the surface appears the same brightness from every angle. In ideal specular reflection, light is reflected in a single direction and brightness is perceived only from a certain point of view. Real surfaces often show a mixture of the two. This distinction determines how the texture and gloss of an object are modeled; The optical system, which is the first link in the image creation chain, collects exactly this reflected light beam and carries it to a plane.
The sensor behind the optical system converts the incoming photon flux into electrical charge, which is then converted into a numerical value. The conversion has two steps: first the light intensity is converted into a continuous electrical signal, then this signal is sampled, quantized and converted to a number. A digital image is thus a doubly abstracted representation of a physical event. Understanding this chain allows interpreting what a brightness value in an image means and what factors affect it.
Pinhole camera and perspective projection
The simplest model of image creation is the hole camera. Let's consider an opaque box with a small hole: lights from the stage opposite the hole pass through the hole and hit the back surface of the box. Since only a single ray passing through the hole can reach the back surface from each scene point, an inverted and reduced copy of the scene is created on the surface. This setup does not require focus adjustment; Points at every distance are drawn with the same sharpness. However, since the amount of light passing through the hole is very low, the resulting image is dark.
Perspective projection is the mathematical equivalent of this geometric relationship. The point where a ray passing through the camera center intersects the image plane is determined by the position of the point in the scene and its distance from the camera. From similar triangles, the horizontal coordinate in the image plane is equal to the ratio of the focal length multiplied by the scene coordinate to the depth. This relationship explains why distant objects appear smaller: as depth increases, the same physical size takes up less space in the image. As the depth approaches zero, the projection cannot be determined; That's why a valid operating range is defined in camera models.
Focal length is the distance between the hole and the image plane and determines the field of view. Short focal length covers a wide angle; A large scene is packed into a small sensor. A long focal length magnifies a narrow angle, making distant details clear. The size of the image plane and the focal length together determine which part of the scene enters the frame. The inverting effect of perspective projection is the most characteristic feature of the through-hole camera model and is corrected by the sensor reading order in real cameras.
Thin-lens model and focusing
The low light efficiency of the hole camera has been replaced by the lens system. The lens collects the light from a large surface at a single point, creating a bright and clear image. In the thin lens approach, the lens is assumed to have zero thickness and the incoming rays are refracted in the lens plane. Rays coming from a point on the optical axis of the lens converge at another point on the optical axis after the lens. The location of this junction depends on the distance of the object from the lens.
The thin lens equation gives the relationship between object distance, image distance, and focal length. Focal length is the distance of the lens to the point where parallel rays converge. When the object distance changes, the plane in which the clear image is formed also changes; If the sensor is not placed in this plane, the image will be blurry. The process of focusing is adjusting the distance between the lens and the sensor to achieve this exact match. Magnification is expressed as the ratio of the image distance to the object distance, and a negative sign indicates that the image is inverted.
Aperture is an adjustable opening at the front of the lens and controls the amount of light entering the system. A wide aperture lets in more light but increases the blurring of out-of-focus areas; narrow aperture keeps a wider range clear. The depth range that is considered clear is called depth of field. This effect forms the basis for choices such as blurring the background in portrait shots or keeping the entire scene clear. The lens model solves the problem of light efficiency while preserving the geometry of the aperture camera.
Sampling and quantization: turning the continuous into numbers
The image drawn by the lens onto the sensor plane is continuous in space and brightness. In a digital system, this image must be transformed in two steps. The first step is sampling: the continuous plane is read at selected points at specified intervals. The arrangement of these points forms the pixel grid of the image. As the sampling interval becomes smaller, more detail is captured, but the amount of data also increases rapidly. The selected range directly determines the horizontal and vertical resolution of the image.
Sampling theory says that for correct recovery the sampling frequency should be at least twice the highest spatial frequency contained in the signal. If this condition is not met, high-frequency details appear as false low frequencies; This phenomenon is called aliasing or aliasing. In images, this occurs when fine lines appear as wavy or erratic patterns. Properly smoothing the image before sampling avoids this error by reducing high frequencies. Therefore, optical low-pass filters and software smoothing are used together in the capture chain.
The second step is quantization: the continuous brightness value of each sample is rounded down to one of a finite number of levels. The number of levels is determined by the bit depth; An eight-bit system has two hundred and fifty-six levels. As the number of bits increases, tone transitions become smoother, but memory and processing load increases. The small difference due to quantization is called quantization noise. Sampling limits spatial detail, quantization limits luminance detail; Together they determine the information capacity of the digital image.
Structure and representation of a digital image
A digital image is a two-dimensional array of numbers consisting of rows and columns. Each element of the array represents a pixel and indicates the light intensity at that location. The value of the pixel generally varies between zero and maximum; Zero indicates darkness, the highest value indicates brightness. Image size is expressed as the total number of pixels multiplied by the number of rows and columns. When the same physical scene is captured at a higher resolution, the number of pixels increases and each pixel represents a smaller area.
In grayscale images, each pixel carries a single brightness value. In color images, each pixel consists of more than one value; these values are called color channels. In a display using three channels, three numbers are stored for each pixel, and the total memory requirement is three times that of a grayscale image. The number of channels, bit depth, and number of pixels combine to determine the raw data size of the image. This size creates direct costs in both storing and processing the image.
The neighborhood relationship between pixels forms the basis of image processing operations. The horizontal, vertical and diagonal neighbors of a pixel define the local properties of that pixel. Structures such as edges, textures and corners arise from value differences between neighboring pixels. The coordinate system generally considers the upper left corner as the starting point; The column index increases to the right and the row index increases downwards. This representation allows the image to be treated as both a matrix and a signal.
Factors affecting image quality
The image obtained with a real camera has various deviations from the ideal model. Chief among these is noise. Noise is caused by reasons such as temperature of the sensor, instability of the reading circuit or low number of photons in low light. The randomness of the photons causes the brightness values to be scattered around the expected value. As the noise level increases, low-contrast details are lost and the reliability of subsequent processing decreases.
Blurring is another common effect. Objects that are out of focus, moving scene elements, or imperfections in the optical system cause a loss of sharpness in the image. Out-of-focus blur occurs when a point spreads over a small area at the sensor; Motion blur is the trace of the object's displacement during exposure. In both cases, high spatial frequencies are attenuated and edges are softened. Sharpening operations applied to remove blurring should be done carefully as they may also magnify noise.
Lighting and exposure also determine image quality. Underexposure causes loss of detail in dark areas, and overexposure causes saturation of bright areas. Dynamic range is the ratio between the darkest and brightest values that can be captured simultaneously in a scene. If the sensor's dynamic range is smaller than the scene, either shadows or highlights will be clipped. Contrast is the degree to which brightnesses differ from each other, and it becomes difficult to distinguish objects in low-contrast images. All of these factors directly affect the end product of the rendering chain.
Summary and next steps
The image creation chain consists of four main links: the light reflected from the scene, the optical system that collects the light, the sensor that converts the light into an electrical signal, and the sampling and quantization that converts the signal into digital values. Each link provides a foundation upon which subsequent transactions are built. Perspective projection determines the position and size of objects; The lens model controls clarity and brightness; sampling limits spatial detail, quantization limits luminance detail.
Understanding this chain not only explains how the image is formed, but also allows to distinguish the source of errors seen in the image. Blurring may be optical or motion-induced; aliasing arises from sampling inadequacy, while banding arises from quantization constraint. In the following sections, it will be discussed how the color information of this digital image is represented and what operations can be performed on it.
Key Points
- Image is the transfer of light reflected by surfaces to a plane by the optical system.
- The through-hole camera produces an inverted and reduced image; Does not require focus adjustment.
- In projection, image size is directly proportional to focal length and inversely proportional to depth.
- Sampling spatial resolution determines quantization luminance resolution.
- Eight-bit quantization provides two hundred and fifty-six brightness levels.
Worked Examples
Worked Example
Worked Example
Worked Example
Worked Example
Worked Example
Common Mistakes
- Mistaking the brightness in the image for the direct color of the object and overlooking the effect of illumination.
- Thinking that the field of view expands as the focal length increases.
- Thinking that the memory requirement decreases as the bit depth increases.
- Trying to solve blurriness only with software sharpening.
Tips
- As the hole gets smaller, the image becomes sharper but the light decreases; In real cameras, this balance is established with the lens.
- If the Nyquist condition is not met, high frequencies appear falsely as low frequencies.
- Aperture affects not only brightness but also depth of field.
- A pixel is not an area, but a sample point that represents that area.
Practice Questions
- 1. What is the basic physical event that creates an image?
- 2. Which type of surface is where the reflected light is distributed equally in all directions?
- 3. Perceived brightness depends on the product of which two factors?
- 4. What is the most distinctive feature of the image formed in the hole camera?
- 5. What is the reason why every distant point is drawn with the same sharpness in a hole camera?
- 6. What is the most important disadvantage of the hole-punch camera?
- 7. In perspective projection, the image coordinate is inversely proportional to which magnitude?
- 8. If the focal length is 50 mm, the scene coordinate is 200 mm, and the depth is 2000 mm, what is the image coordinate in mm?
- 9. How does the field of view change when focal length is increased?
- 10. What is the mathematical reason why an object appears smaller when it is farther away?
- 11. What problem does the lens system solve compared to the hole-punch camera?
- 12. What is the point where parallel rays meet in a lens called?
- 13. What three quantities does the thin lens equation relate?
- 14. If the object distance is 30 cm and the focal length is 10 cm, what is the clear image distance in cm?
- 15. What does a negative magnification on a thin lens indicate?
- 16. What exactly does the focus operation adjust?
- VOLUME 17 How is depth of field affected when the aperture is enlarged?
- 18. What is the first step in digitizing a continuous optical image?
- 19. What increases when the sampling interval is reduced?
- 20. What is the artifactual effect that occurs when the sampling frequency is insufficient?
- 21. According to the Nyquist condition, at least how many times should the sampling frequency be?
- 22. What is done before sampling to reduce aliasing?
- 23. What information does quantization limit?
- 24. How many different levels does 8 bit depth give?
- 25. How do tonal transitions change when bit depth is increased?
- 26 What is the small brightness difference that occurs due to quantization called?
- 27 What mathematical structure represents a digital image?
- 28 What does the value of a pixel indicate?
- 29 How many bytes is the raw size of a 1024 × 768 pixel, three channel, 8-bit image?
- 30 How many values does each pixel carry in a grayscale image?
- 31 Where do row and column indexes usually start in an image?
- 32 How do structures such as edges and corners appear in an image?
- 33 What is the effect caused by the low number of photons at the sensor in low light?
- 34 When does motion blur occur?
- 35 What does dynamic range mean?
- 36 What happens as a result of overexposure?
- 37 What risk does the sharpening process used to remove blurring pose?
- 38 What do sampling and quantization together determine?
- 39 What is the main difference between a hole camera and a lens system?
- 40 What is the correct order of the rendering chain?
- 41 What size does a pixel on the sensor represent?
- 42 What causes difficulty in distinguishing in a low-contrast image?
- 43 How is the field of view affected when the focal length of a lens is shortened?
- 44. What is the relationship between bit depth and number of color levels in a digital image?
- 45. How is image resolution affected as the physical area represented by a pixel increases?
- 46. What is the function of the sensor in the image generation chain?
- 47. How is motion blur affected when exposure time is extended?
Source: Inspired by open curricula of Turkish universities; the explanation is written originally.
Kaynak: Türkiye üniversitelerinin açık ders planlarından esinlenilmiştir; anlatım özgün olarak yazılmıştır.