What Does a Computer Actually See?
You are standing on a bridge deck during a routine structural inspection. You pull out your phone and snap a photograph of a hairline crack running along the concrete surface. To you, the image is immediately meaningful — you see the crack, the surrounding concrete texture, the shadow patterns, the rebar staining. You understand context, depth, and urgency.
But to a computer, that same photograph is none of those things. There is no "crack," no "concrete," no "shadow." There is only a rectangular grid of numbers — thousands upon thousands of them — each representing a tiny square of colour or brightness. Understanding this fundamental truth is the first step toward understanding how AI can learn to see and interpret images the way we do.
This sub-chapter introduces the concept of images as data — the foundational idea upon which all computer vision and image-based AI is built. Before we can discuss convolutional neural networks, object detection, or crack classification, we must first understand what an image actually is to a computer: a structured array of numerical values.
We will explore how pixels encode brightness and colour, how images are represented as multi-dimensional arrays (tensors), how resolution and colour channels affect data size, and why all of this matters for civil engineering applications like drone imagery analysis, thermal scanning, and automated defect detection.
This sub-chapter assumes basic familiarity with the concepts from Chapters 1–3. No programming experience is required, but comfort with the idea of data represented as numbers (from Chapter 1) and basic matrix concepts will be helpful. We build everything from first principles.
Pixels: The Atoms of Every Digital Image
The word "pixel" comes from "picture element." A pixel is the smallest addressable unit of a digital image — a single dot of colour or brightness. Every digital photograph, satellite image, or thermal scan you have ever seen is composed entirely of pixels arranged in a rectangular grid.
Think of it like a mosaic. Stand close to a mosaic wall and you see individual tiles of different colours. Step back and those tiles merge into a recognisable picture. Digital images work the same way: each pixel is a tile, and the grid of tiles forms the image.
Pixels are like survey grid points. When a geotechnical engineer conducts a site investigation, they often lay out a regular grid across the site and take measurements at each grid point — soil type, bearing capacity, moisture content. Each grid point captures a single, localised measurement. Collectively, the grid of measurements forms a complete picture of the site conditions.
A digital image works identically. Each pixel is a "measurement point" that records the light intensity (brightness or colour) at that specific location. The denser the grid (higher resolution), the more detailed the picture — just as a finer survey grid reveals more about the site.
Pixel Values: Numbers Between 0 and 255
Each pixel stores a numerical value that represents brightness or colour intensity. For a grayscale (black-and-white) image, each pixel holds a single number ranging from 0 to 255:
The 0–255 Scale
- 0 = pure black (no light, no brightness)
- 128 = medium grey (halfway between black and white)
- 255 = pure white (maximum brightness)
Why 255? Because pixel values are stored as 8-bit unsigned integers. With 8 bits, you can represent 28 = 256 distinct values, ranging from 0 to 255. This gives 256 shades of grey — more than enough for the human eye to perceive smooth gradients.
Consider a very small 4×4 grayscale image. It would be stored as a grid of 16 numbers, each between 0 and 255. A dark region might contain values like 12, 18, 20, while a bright region might contain 230, 240, 245. The computer does not know what these numbers mean — it simply stores them. Meaning is something we (or an AI model) must impose.
When you photograph a crack in concrete, the crack appears dark against a lighter background. In pixel terms, the crack region has low pixel values (dark) while the surrounding concrete has higher pixel values (lighter). An AI model learns to detect cracks by recognising these patterns of contrast in the numerical grid — it never "sees" a crack the way you do.
Grayscale vs Colour Images
Not all images carry the same amount of information per pixel. The simplest images are grayscale — each pixel stores a single number representing brightness. But most photographs we work with are colour images, and they store significantly more data.
Grayscale: One Number Per Pixel
A grayscale image has a single channel. Each pixel is described by exactly one value (0–255). Grayscale images are common in engineering contexts: X-ray inspection images, certain types of thermal imagery, and older photographic documentation are often grayscale.
For a grayscale image of size 100×100 pixels, the total data is 100 × 100 = 10,000 numbers. Simple, compact, and efficient.
Colour: Three Numbers Per Pixel (RGB)
A colour image uses the RGB colour model. Each pixel stores three numbers instead of one:
The RGB Colour Model
- R (Red) — intensity of the red component (0–255)
- G (Green) — intensity of the green component (0–255)
- B (Blue) — intensity of the blue component (0–255)
By mixing these three primary colours at different intensities, any visible colour can be approximated. For example:
(255, 0, 0)= pure red(0, 255, 0)= pure green(0, 0, 255)= pure blue(255, 255, 0)= yellow (red + green)(255, 255, 255)= white (all channels max)(0, 0, 0)= black (all channels zero)(128, 128, 128)= neutral grey
For a 100×100 colour image, the data is 100 × 100 × 3 = 30,000 numbers — three times more data than the equivalent grayscale image. Each pixel now carries three independent measurements of light intensity, one for each colour channel.
Grayscale vs colour is like single-parameter vs multi-parameter site testing. A grayscale image records one measurement per pixel (brightness), just like measuring only bearing capacity at each grid point. A colour image records three measurements per pixel (R, G, B), like simultaneously measuring bearing capacity, moisture content, and density at every grid point.
More channels mean more information — but also more data to process, store, and analyse. This trade-off between richness and computational cost is central to image-based AI.
RGB Channels: Three Layers of Information
A colour image can be thought of as three separate grayscale images stacked on top of each other — one for red, one for green, and one for blue. Each of these layers is called a channel. When displayed together, they produce the full-colour image.
Decomposing an Image into Channels
Imagine you have a photograph of a construction site with an orange safety barrier, green vegetation, and a blue sky. If you extracted only the Red channel, the orange barrier would appear bright (high values), the vegetation moderate, and the sky dark. In the Green channel, vegetation appears brightest. In the Blue channel, the sky dominates.
Each channel highlights different features of the same scene. This decomposition is exactly what convolutional neural networks exploit — they learn which channel patterns correspond to specific objects, textures, or defects.
Understanding channels is essential for civil engineering AI applications. Thermal cameras, for instance, often produce single-channel images where pixel values represent temperature rather than visible light. Multispectral drone imagery may have 5, 10, or even more channels, each capturing a different wavelength of light. The principle is always the same: each channel is a 2D grid of numbers encoding one type of measurement.
Beyond RGB: Special Channels in Engineering
Engineering Image Types and Their Channels
| Image Type | Channels | CE Application |
|---|---|---|
| Standard photo | 3 (R, G, B) | Site documentation, crack detection |
| Grayscale photo | 1 (intensity) | X-ray inspection, simplified processing |
| Thermal image | 1 (temperature) | Heat loss analysis, moisture detection |
| RGBA image | 4 (R, G, B, Alpha) | Overlays, transparency masks |
| Multispectral | 5–12+ | Vegetation health, material classification |
| Depth map | 1 (distance) | LiDAR surveys, 3D reconstruction |
Resolution and Image Size
An image's resolution describes the number of pixels along its width and height. A 1920×1080 image has 1,920 columns and 1,080 rows of pixels, totalling 2,073,600 pixels (approximately 2 megapixels).
Resolution directly determines data volume. Higher resolution means more pixels, more numbers, and more data to store and process:
Data Size Calculation
The formula for raw image data size is straightforward:
Data Size = Width × Height × Channels × Bytes per channel
Examples for a single 8-bit-per-channel image:
- 640 × 480 grayscale: 640 × 480 × 1 = 307,200 bytes (~300 KB)
- 1920 × 1080 colour (RGB): 1920 × 1080 × 3 = 6,220,800 bytes (~5.9 MB)
- 4000 × 3000 colour (drone photo): 4000 × 3000 × 3 = 36,000,000 bytes (~34.3 MB)
These are raw, uncompressed sizes. Formats like JPEG compress this data significantly, but AI models typically work with the full, uncompressed pixel values.
In civil engineering AI, resolution is a double-edged sword. Higher resolution captures finer details — essential for detecting hairline cracks or subtle corrosion. But higher resolution also means dramatically more data, requiring more memory, more processing power, and longer training times. Finding the right balance is a critical engineering decision.
A 12-megapixel drone photo captures extraordinary detail, but feeding it directly into a neural network is usually impractical. Instead, engineers typically resize images to a standard dimension (e.g., 224 × 224 or 512 × 512) or use a sliding window approach to analyse the full image in smaller patches.
The Image as a 3D Tensor (H × W × C)
In machine learning, an image is represented as a 3-dimensional array called a tensor. This is simply a fancy name for a block of numbers organised along three axes:
The Three Dimensions of an Image Tensor
- H (Height) — the number of pixel rows (vertical extent)
- W (Width) — the number of pixel columns (horizontal extent)
- C (Channels) — the number of colour or measurement channels (1 for grayscale, 3 for RGB, etc.)
A 1920×1080 colour photograph is a tensor of shape
(1080, 1920, 3)
— 1,080 rows, 1,920 columns, and 3 colour channels. Every
single value in this tensor is an integer between 0 and 255.
The tensor representation is powerful because it turns images into pure numerical data that mathematical operations can manipulate. Addition, subtraction, multiplication, convolution — all become applicable once the image is a tensor. This is the bridge between photography and computation, between visual inspection and automated analysis.
An image tensor is like a multi-storey building floor plan. Imagine a building where each floor has the same grid layout of rooms (H rows × W columns). Each floor represents a different measurement — floor 1 records temperature in each room, floor 2 records humidity, floor 3 records noise level. The entire building (all floors stacked) is the tensor.
Similarly, an RGB image has three "floors" (channels). Floor 1 records red intensity at every pixel, floor 2 records green, floor 3 records blue. The complete stack of floors is the 3D image tensor — a compact, structured representation of all the visual information.
Visualising the Tensor Shape
Here is how different image types map to tensor dimensions:
Common Tensor Shapes
| Image Description | Tensor Shape (H,W,C) | Total Values |
|---|---|---|
| Tiny icon (grayscale) | (28, 28, 1) | 784 |
| Small patch (colour) | (64, 64, 3) | 12,288 |
| Standard AI input (colour) | (224, 224, 3) | 150,528 |
| Full HD photo (colour) | (1080, 1920, 3) | 6,220,800 |
| Drone photo (colour) | (3000, 4000, 3) | 36,000,000 |
Images in Civil Engineering Practice
Now that we understand how computers represent images as numbers, let us connect this to the real-world scenarios where civil engineers encounter image data. Understanding the data format is critical because it determines what information is available for AI models to learn from.
Structural Inspection Photos
Routine inspections of bridges, tunnels, dams, and buildings generate thousands of photographs. Each photo is a high-resolution RGB tensor. AI models trained on these images can learn to detect cracks, spalling, delamination, corrosion staining, and other defects automatically. The critical insight is that these defects manifest as specific patterns of pixel values — a crack is a narrow band of dark pixels against lighter surroundings; corrosion staining is a region where red channel values are disproportionately high.
Drone Imagery
Unmanned aerial vehicles (UAVs) capture images from perspectives that are difficult or dangerous for human inspectors. Drone images of construction sites, bridge decks, or building facades are typically very high resolution (12–48 megapixels), producing massive tensors. Processing these images for AI analysis often requires dividing them into smaller, manageable patches — a technique called tiling or windowing .
Thermal Imaging
Thermal cameras capture infrared radiation and produce images where pixel values represent temperature rather than visible light. These are typically single-channel images. Civil engineers use thermal imaging to detect heat loss through building envelopes, locate moisture ingress (wet areas cool differently), find delamination in bridge decks (subsurface voids trap air, creating temperature differences), and monitor concrete curing temperatures.
Regardless of the source — smartphone camera, industrial drone, thermal sensor, or multispectral scanner — the fundamental representation is always the same: a tensor of numbers. The dimensions and ranges may differ, but the structure is consistent. Once you understand images as tensors, you can apply AI techniques to any type of imaging data.
Demo 1: Pixel Explorer
This interactive demo lets you see the numerical values behind individual pixels. The canvas displays a simulated image region (representing a concrete surface with a dark "crack"). Hover over any cell to inspect its grayscale value. Click Zoom In to see a magnified view of a small area, revealing the numbers that define each pixel.
Hover over the grid to see pixel values. Click Zoom In to magnify a region.
How Images Encode Engineering Information
With the pixel-level understanding from the demo, let us now examine how meaningful engineering information is encoded in these pixel values. This is the bridge between "images are numbers" and "AI can learn from images."
Contrast Encodes Boundaries
When adjacent pixels have very different values, it indicates an edge or boundary. A crack in concrete creates a sharp contrast — dark pixels (the crack) next to lighter pixels (the concrete). AI models learn to detect these rapid changes in pixel values as potential features of interest.
Texture Encodes Surface Condition
The statistical distribution of pixel values across a region encodes texture. Smooth concrete has relatively uniform pixel values. Rough, spalled concrete has highly variable values. Corroded steel has a characteristic mottled pattern of reds and browns. These texture patterns are captured entirely in the numbers.
Colour Encodes Material Properties
The relative intensities of R, G, and B channels encode colour, which often reveals material properties. Rust staining produces elevated red channel values. Algae growth produces elevated green values. Efflorescence (white mineral deposits) produces uniformly high values across all channels. AI models learn these colour signatures from the tensor data.
From Pixels to Patterns: The Learning Pipeline
The journey from raw pixel data to automated defect detection follows a clear pipeline:
- Capture — take a photograph (create the tensor)
- Pre-process — resize, normalise pixel values (scale 0–255 to 0–1)
- Feed to model — pass the tensor to a neural network
- Extract features — model learns edges, textures, shapes from pixel patterns
- Classify / detect — model outputs a prediction (crack / no crack, severity level, etc.)
Every step depends on the image being a well-structured numerical tensor. This is why understanding images as data is foundational.
Demo 2: RGB Channel Separator
This demo simulates a construction site image and separates it into its Red, Green, and Blue channels. Notice how different objects appear brighter or darker in each channel depending on their colour. Use the buttons to switch between the combined view and individual channels.
Showing combined RGB image. Use buttons to isolate individual channels.
Normalisation: Preparing Images for AI
Raw pixel values (0–255) are integers, but neural networks work best with small floating-point numbers. Before feeding images to a model, we typically normalise the pixel values — a simple but essential pre-processing step.
Common Normalisation Approaches
- Min-max scaling: divide all values by 255 to map the range to [0, 1]. A pixel value of 128 becomes 0.502.
- Mean subtraction + scaling: subtract the mean pixel value of the dataset and divide by the standard deviation. This centres the data around zero with unit variance.
- Channel-wise normalisation: apply mean subtraction and scaling independently to each RGB channel, using statistics computed across the training dataset (e.g., ImageNet means: R=0.485, G=0.456, B=0.406).
Why does normalisation matter? Neural networks use gradient descent to learn. When input values are very large (like 0–255), the gradients can become unstable, making training slow or erratic. Normalised values (0–1 or centred around zero) keep the gradients well-behaved, leading to faster and more reliable training.
Normalisation is like converting units before structural analysis. If you mix forces in kilonewtons with dimensions in millimetres and densities in tonnes per cubic metre, numerical methods can struggle with the vastly different scales. Engineers routinely normalise their units — working in consistent SI units or non-dimensionalising equations — to ensure numerical stability. Image normalisation serves exactly the same purpose.
Key Takeaways
What You Should Remember
- A digital image is a rectangular grid of pixels, where each pixel stores one or more numerical values representing brightness or colour intensity.
- Grayscale pixels hold one value (0–255); colour pixels hold three values (R, G, B), each 0–255.
- An image is stored as a 3D tensor with shape (Height × Width × Channels).
- Resolution (number of pixels) directly determines data size and the level of detail captured.
- Engineering features like cracks, corrosion, and temperature variations are encoded as patterns of pixel values — contrast, texture, and colour signatures.
- Normalisation (scaling pixel values) is essential before feeding images to neural networks.
- The tensor representation is universal — it applies to standard photos, thermal images, drone imagery, and multispectral scans alike.
Civil Engineering Application: Drone & Camera Inspection Imagery
Every structural inspection photo — from drone flyovers of bridges to close-up concrete scans — is stored as a grid of numbers (pixels). Understanding this is critical because:
Image Resolution Matters
A 12MP drone camera produces 4000×3000 pixel images. At 1mm/pixel resolution from 5m altitude, you can detect cracks as narrow as 0.3mm — critical for bridge deck condition ratings (NBI scale 0-9).
RGB Channels in Damage Detection
Cracks appear dark across all 3 channels (R≈G≈B≈20-50). Rust stains show high Red (R>150) but low Blue (B<80). Efflorescence (white deposits) has R≈G≈B>200. CNNs learn these patterns automatically.
Real Dataset Example
The SDNET2018 dataset contains 56,000+ images of concrete bridge decks, walls, and pavements at 256×256 pixels. Each image is a 256×256×3 tensor — exactly the "image as data" concept. CNNs process these to classify crack vs. no-crack.
Test Your Understanding
Answer the following questions to check your grasp of the core concepts covered in this sub-chapter.
A 640 × 480 RGB image has how many total numerical values in its tensor representation?
In a grayscale image, a pixel with value 0 represents:
A thermal image from a building envelope survey is typically:
What is the tensor shape of a 1920×1080 colour photograph?