黎明前的探索:计算机视觉的古典时代
1966年的夏天,麻省理工学院的一群年轻研究者收到了一个看似简单的任务:用暑假的时间赋予计算机"看"的能力。这个被称为"夏季视觉项目"(Summer Vision Project)的倡议,在当时看起来或许只是一个雄心勃勃的学生实验。然而,它却无意间拉开了计算机视觉(Computer Vision)作为独立学科的序幕。在接下来的半个多世纪里,这个领域经历了从萌芽、挣扎、积累到最终迎来深度学习革命的漫长历程。在深度学习的光芒照亮计算机视觉之前,那些在"古典时代"里默默耕耘的研究者们,用他们的智慧和执着,为这个领域奠定了难以撼动的基石。本章将带领读者穿越时光,回到那个计算资源匮乏、理论工具简陋却充满探索激情的年代,去认识那些塑造了现代计算机视觉雏形的先驱思想和方法。
The summer of 1966 marked an auspicious beginning. A group of young researchers at the Massachusetts Institute of Technology received what seemed like a straightforward assignment: give computers the ability to "see" during the summer months. This initiative, dubbed the "Summer Vision Project," may have appeared to be merely an ambitious student experiment at the time. However, it inadvertently inaugurated computer vision as an independent discipline. Over the subsequent half-century, this field would undergo a lengthy journey from萌芽、挣扎、积累 to ultimately welcoming the deep learning revolution. Before deep learning illuminated the landscape of computer vision, those researchers laboring in the "classical era" quietly laid an unshakeable foundation with their wisdom and dedication. This chapter will transport readers back through time to that era of scarce computational resources and rudimentary theoretical tools yet abundant exploratory passion, to encounter the pioneering ideas and methods that shaped the nascent contours of modern computer vision.
从"看见"开始:一门学科的诞生
The Birth of a Discipline: Beginning with "Seeing"
理解计算机视觉的古典时代,我们首先需要厘清一个根本性的哲学问题:什么是"看见"?当人类睁开眼睛,复杂的视觉系统在一瞬间完成了对世界的解析——光影、轮廓、深度、运动、语义——所有这些信息如同魔法般被提取出来。然而,这个看似本能的过程,实际上是自然界亿万年演化的杰作,也是人类认知系统最精密的组成部分之一。当工程师试图在冰冷的机器上复现这一过程时,他们才真正意识到人类视觉系统的复杂性远超想象。
To understand the classical era of computer vision, we must first clarify a fundamental philosophical question: What is "seeing"? When humans open their eyes, our complex visual system instantaneously accomplishes the parsing of the world—light and shadow, contours, depth, motion, semantics—extracting all this information as if by magic. Yet this seemingly instinctive process is actually a masterpiece of hundreds of millions of years of natural evolution and one of the most sophisticated components of the human cognitive system. When engineers attempted to reproduce this process on cold, unfeeling machines, they truly realized that the complexity of human visual systems far exceeded imagination.
MIT的"夏季视觉项目"虽然最终未能如其发起人所愿在短短一个夏天内解决视觉问题,但它播下的种子却在后来生根发芽。项目的核心人物Seymour Papert在总结这次尝试时承认,他们大大低估了这项任务的难度。这个诚实的反思,后来成为计算机视觉领域的一种共识:视觉不是单一的问题,而是一系列相互关联的子问题的集合,每一个问题本身都足够困难。
Although MIT's "Summer Vision Project" ultimately failed to solve the visual problem in a single summer as its initiators had hoped, the seed it planted took root in subsequent years. The project's key figure, Seymour Papert, honestly reflected that they had vastly underestimated the difficulty of the task. This candid reflection later became a consensus within the computer vision community: vision is not a single problem but a collection of interrelated sub-problems, each sufficiently difficult on its own.
这个认识促使后来的研究者采取了一种更为务实的策略:与其试图一次性解决"整体视觉",不如将视觉任务分解为若干可管理的步骤。边缘检测(Edge Detection)、角点检测(Corner Detection)、区域分割(Region Segmentation)等技术,正是在这种分解策略下诞生的。研究者们意识到,如果无法让机器"理解"一幅图像,至少可以先让它们"提取"图像中的基本结构信息。
This understanding prompted subsequent researchers to adopt a more pragmatic strategy: rather than attempting to solve "overall vision" in one fell swoop, it was better to decompose visual tasks into several manageable steps. Edge detection, corner detection, region segmentation, and similar techniques emerged precisely under this decomposition strategy. Researchers realized that if they couldn't make machines "understand" an image, they could at least first enable them to "extract" basic structural information from images.
边缘检测:视觉世界的基本语法
Edge Detection: The Basic Grammar of the Visual World
在所有图像处理技术中,边缘检测或许是最具基础性意义的一项。如果我们将图像比作一首由像素编织而成的交响乐,那么边缘就是这首交响乐的基本旋律线——它勾勒出物体的轮廓,定义着形状的边界,传递着视觉场景中最核心的结构信息。难怪著名计算机视觉研究者David Marr会如此评价边缘检测的重要性:"边缘是图像中信息最丰富的特征之一,它们几乎捕获了视觉场景的全部本质。"
Among all image processing techniques, edge detection is perhaps the most fundamentally significant. If we compare an image to a symphony woven from pixels, then edges are the basic melodic lines of this symphony—they outline objects, define shape boundaries, and convey the most core structural information of visual scenes. No wonder renowned computer vision researcher David Marr so highly praised edge detection: "Edges are among the most information-rich features in images, capturing almost the entire essence of visual scenes."
边缘检测的数学基础,建立在对图像强度(Intensity)变化的分析之上。在一个理想的无噪声世界中,边缘对应于图像强度函数的突变点。然而,现实世界是残酷的:所有真实图像都不可避免地受到各种噪声的干扰,这些噪声往往会在图像中产生虚假的不连续性,使得简单的梯度计算变得不可靠。因此,早期的边缘检测算法必须同时解决两个问题:准确检测真实的边缘,以及有效抑制噪声产生的虚假响应。
The mathematical foundation of edge detection rests upon analyzing changes in image intensity. In an ideal, noise-free world, edges correspond to sudden discontinuities in the intensity function. However, the real world is merciless: all real images inevitably suffer from various noise interferences, which often produce false discontinuities in images, rendering simple gradient calculations unreliable. Therefore, early edge detection algorithms had to simultaneously solve two problems: accurately detecting genuine edges and effectively suppressing false responses caused by noise.
Sobel算子与Prewitt算子:卷积的力量
The Sobel and Prewitt Operators: The Power of Convolution
在1968年前后, Irwin Sobel和Stanley Prewitt分别独立提出了两种至今仍被广泛使用的边缘检测算子。这两种算子的核心思想是利用有限差分来近似图像强度函数的梯度。在数学上,图像$I(x,y)$在点$(x,y)$处的梯度向量定义为:
$$\nabla I = \left( \frac{\partial I}{\partial x}, \frac{\partial I}{\partial y} \right)$$
梯度的方向指向图像强度增长最快的方向,而梯度向量的模长则量化了这个变化的剧烈程度:
$$|\nabla I| = \sqrt{\left( \frac{\partial I}{\partial x} \right)^2 + \left( \frac{\partial I}{\partial y} \right)^2}$$
Around 1968, Irwin Sobel and Stanley Prewitt independently proposed two edge detection operators that remain widely used today. The core idea of both operators involves using finite differences to approximate the gradient of the image intensity function. Mathematically, the gradient vector of image $I(x,y)$ at point $(x,y)$ is defined as:
$$\nabla I = \left( \frac{\partial I}{\partial x}, \frac{\partial I}{\partial y} \right)$$
The gradient's direction points toward the direction of fastest intensity increase, while the gradient vector's magnitude quantifies the intensity of this change:
$$|\nabla I| = \sqrt{\left( \frac{\partial I}{\partial x} \right)^2 + \left( \frac{\partial I}{\partial y} \right)^2}$$
在实际计算中,由于图像是离散的,我们需要用差分来近似偏导数。Sobel算子使用两个3×3的卷积核:
$$G_x = \begin{pmatrix} -1 & 0 & +1 \\ -2 & 0 & +2 \\ -1 & 0 & +1 \end{pmatrix}, \quad G_y = \begin{pmatrix} -1 & -2 & -1 \\ 0 & 0 & 0 \\ +1 & +2 & +1 \end{pmatrix}$$
In practical computation, since images are discrete, we need to approximate partial derivatives using differences. The Sobel operator employs two 3×3 convolution kernels:
$$G_x = \begin{pmatrix} -1 & 0 & +1 \\ -2 & 0 & +2 \\ -1 & 0 & +1 \end{pmatrix}, \quad G_y = \begin{pmatrix} -1 & -2 & -1 \\ 0 & 0 & 0 \\ +1 & +2 & +1 \end{pmatrix}$$
这两个核分别检测水平方向和垂直方向的边缘。Sobel算子相比简单的差分方法具有一个重要的优势:中心加权(Center-weighting)机制。具体而言,水平核$G_x$的中间行使用系数2而非1,这意味着中心像素周围的邻域对梯度计算有更大的贡献。这种设计使得Sobel算子在一定程度上具有平滑效果,从而对噪声更加鲁棒(Robust)。
These two kernels respectively detect horizontal and vertical edges. Compared to simple difference methods, the Sobel operator has an important advantage: the center-weighting mechanism. Specifically, the middle row of the horizontal kernel $G_x$ uses coefficient 2 instead of 1, meaning that the neighborhood around the center pixel contributes more to the gradient calculation. This design gives the Sobel operator a smoothing effect to some extent, making it more robust to noise.
Prewitt算子则采用了不同的策略,其卷积核为:
$$G_x = \begin{pmatrix} -1 & 0 & +1 \\ -1 & 0 & +1 \\ -1 & 0 & +1 \end{pmatrix}, \quad G_y = \begin{pmatrix} -1 & -1 & -1 \\ 0 & 0 & 0 \\ +1 & +1 & +1 \end{pmatrix}$$
The Prewitt operator adopts a differ