76  Computer Vision Fundamentals

Convolutional Neural Networks built a single-filter pipeline that told two classes apart using one hand-designed edge detector. Real computer vision applications, sorting leaf photographs by disease type, screening drone imagery for the specific kind of stress a field is showing, generally need to distinguish among more than two categories, and typically combine several filters, each sensitive to a different visual property, before a classifier ever sees the result. This topic extends that pipeline into a genuine applied setting: three field conditions, distinguished not by any single filter but by a small combination of extracted visual features.

76.1 From One Filter to a Feature Set

A single convolution filter captures one specific kind of local pattern, sharp edges, in the previous topic’s example. Distinguishing more than two visually different conditions generally needs more than one such feature. Two properties, computed from a convolved and pooled image, cover a useful range of visual distinctions on their own:

  • Mean intensity: the average value across the processed image, capturing overall brightness or, in an NDVI context, overall vegetation vigor.
  • Spread (standard deviation): how much the processed image’s values vary from point to point. A uniform condition, healthy or uniformly stressed, produces a low spread; a condition with scattered, patchy damage produces a high spread even if its mean looks similar to a uniform case.

Combining features like these, rather than relying on any one of them alone, is exactly how a real multi-class computer vision pipeline works: several filters or feature extractors run in parallel, and their combined output feeds a classifier trained to weigh each feature appropriately for the specific categories at hand.

76.2 Worked Example

Twelve small synthetic field-image patches, four each of three conditions: Healthy (uniformly high NDVI), Nutrient Deficient (uniformly lowered NDVI, a diffuse yellowing pattern with no sharp boundary), and Pest Damage (high baseline NDVI with several small, scattered low-value spots, mimicking localized insect damage). The task: classify each patch into its correct condition using only mean intensity and spread as features.

76.3 Computer Vision in R

The convolution and pooling functions are the same conv2d() and maxpool2d() built from scratch in the previous topic. nnet(), from R’s recommended nnet package, handles the multi-class classification directly, since a neural network’s output layer generalizes from a single sigmoid neuron to several softmax units without changing the underlying training procedure.

76.4 Reading the Result

The extracted feature table should show a clear pattern: Healthy patches with high mean intensity and low spread, Nutrient Deficient patches with low mean intensity and also low spread (a diffuse, uniform condition), and Pest Damage patches with high mean intensity but noticeably higher spread, since the scattered damage spots create local variation a uniform image would not have. That combination, high mean but high spread, is exactly the signature no single feature could catch alone: mean intensity by itself would confuse Pest Damage with Healthy, since both have a high overall average, and only the spread feature separates them. This is the general lesson a real computer vision pipeline is built around: individual filters and statistics each capture one narrow aspect of an image, and it is the combination, learned and weighted by a classifier, that does the actual discriminating.


Summary

Concept Description
Foundations
Computer Vision as an Applied CNN Pipeline Applies the convolution-and-pooling building blocks from the previous topic to a practical classification task
From a Single Filter to a Feature Set Real vision pipelines combine several extracted properties rather than relying on any single filter's output
Mean Intensity and Spread as Features Mean intensity captures overall brightness or vigor; spread captures how patchy or uniform a condition is
Why Multiple Features Beat One A feature that separates two classes may fail on a third; combined features catch distinctions no single one can
Worked Example
Worked Example: Three Field Conditions Twelve synthetic patches split across Healthy, Nutrient Deficient, and Pest Damage conditions
Reusing conv2d() and maxpool2d() from the Previous Topic The same base-R convolution and max pooling functions built from scratch in the CNN section
Multi-Class Classification with nnet() nnet() extends naturally from binary to multi-class classification without changing the training procedure
Reading a Confusion Matrix Across Three Classes Off-diagonal entries reveal which specific pair of conditions the classifier is most likely to confuse