Post

Bitmap Images in Computer Vision

Bitmap Images in Computer Vision

🖼️ What Is a Bitmap Image?

A bitmap image represents an image as a grid of pixels,
where each pixel stores explicit intensity or color values.

Key properties:

  • Discrete spatial sampling
  • Discrete intensity values
  • Direct memory mapping

In computer vision, bitmap images are treated as numerical matrices.


📐 Bitmap as a Matrix

A bitmap image of size \(H \times W\) can be written as:

  • Single-channel:
    \(I \in \mathbb{R}^{H \times W}\)

  • Multi-channel:
    \(I \in \mathbb{R}^{H \times W \times C}\)

Where:

  • height \(H\)
  • width \(W\)
  • number of channels \(C\)

⚫ Grayscale Image (1 Channel)

Representation

Each pixel stores one intensity value.

\[I(x,y) \in [0, 255]\]

(8-bit grayscale)

Example

1
2
0   → black
255 → white

Characteristics

  • Simple
  • Memory efficient
  • Most classical CV algorithms operate on grayscale

Typical Usage

  • Edge detection
  • Thresholding
  • Geometry (Hough, LSM)

🎨 Multi-Channel Images

3-Channel (RGB / BGR)

Each pixel has three values:

\[I(x,y) = [R, G, B]\]

Each channel: \(R, G, B \in [0, 255]\)

Characteristics

  • Encodes color information
  • Higher memory cost
  • Often converted to grayscale for processing

Typical Usage

  • Visualization
  • Color-based segmentation
  • Feature extraction

🧠 N-Channel Images (General Case)

In computer vision, channels are not limited to color.

\[I(x,y) = [c_1, c_2, \dots, c_N]\]

Examples:

  • RGB → 3 channels
  • RGBA → 4 channels
  • Hyperspectral → dozens or hundreds of channels
  • Feature maps in CNNs

🌈 Common Channel Types

ChannelsMeaningUsage
GrayIntensityGeometry, filtering
RGBColorVisualization
HSVHue/SaturationColor segmentation
DepthDistance3D vision
NormalSurface orientation3D reconstruction
FeatureLearnedDeep learning

📦 Memory Layout (Important)

Interleaved (HWC)

1
[R G B][R G B][R G B]

Planar (CHW)

1
2
3
RRR...
GGG...
BBB...

Layout matters for:

  • Performance
  • SIMD / GPU access
  • Library compatibility

🔢 Bit Depth

Pixel values can have different precision:

Bit DepthRange
1-bit0–1
8-bit0–255
16-bit0–65535
FloatReal values

Higher bit depth:

  • More dynamic range
  • Higher memory cost

⚖️ Grayscale vs Multi-Channel

AspectGrayscaleMulti-Channel
MemoryLowHigh
SpeedFastSlower
InformationIntensity onlyRich
CV usageCore algorithmsSpecialized tasks

🧠 Practical Insight

In classical computer vision:

1
2
3
4
5
6
7
Input (RGB)
   ↓
Convert to Grayscale
   ↓
Statistics / Geometry
   ↓
Decision

Color is often auxiliary, not primary.


🎯 Takeaway

Bitmap images are structured numeric data, not pictures.

Understanding:

  • Channels
  • Bit depth
  • Memory layout

is essential for:

  • Performance
  • Correct processing
  • Algorithm design 🚀
This post is licensed under CC BY 4.0 by the author.