Project Overview

An automated image processing system developed for the Department of Plant and Agroecosystem Sciences at UW-Madison to analyze corn kernel characteristics. This tool processes images of corn kernels to automatically:

  • Count individual kernels
  • Locate kernel centroids
  • Detect kernel apexes
  • Classify kernel types (red or white crowned)

Background

Agricultural research often requires precise measurement of kernel characteristics across large sample sizes. Manual analysis is time-consuming and can introduce human error. This automated system provides consistent, rapid analysis of corn kernel images to support research in plant genetics and crop development.

Kernel feature diagram

Diagram showing key features to detect: the centroid (center of mass) and apex (pointed end) of each kernel

Example of centroid and apex detection

Example of the ground truth for one sample showing kernel count, centroid and apex locations

The system not only detects these geometric features but also classifies kernels based on their crown type - either red-crowned or white-crowned:

Red kernel example White kernel example

Examples of red-crowned (left) and white-crowned (right) kernels

These measurements and classifications are crucial for:

  • Tracking kernel development and morphology
  • Analyzing genetic traits across different corn varieties
  • Supporting large-scale agricultural research studies

Results & Performance

MetricValueClass Rank
Kernel Counting Error Rate1.4%19th
Avg Centroid Detection Error3.13 pixels6th
Avg Apex Detection Error15.21 pixels2nd
Classification Error Rate5.4%15th
Final Score94.4/100-

Methodology

1. Kernel Detection & Counting

The system uses a multi-step image processing pipeline:

  1. Image preprocessing with Wiener filtering and binarization
  2. Morphological operations to separate connected kernels
  3. Component analysis for kernel counting

Key steps:

binImg = Binarize[img];
filteredImg = WienerFilter[binImg, 100];
fillImg = FillingTransform[filteredImg];
erodeImg = Opening[fillImg, DiskMatrix[20]];

2. Feature Extraction

Centroid Detection

  • Uses component measurements to find center of mass
  • Achieves accuracy within 3.13 pixels on average

Centroid detection visualization

Apex Detection

  • Identifies the furthest point from centroid using convex hull analysis
  • Average error of 15.21 pixels

Apex detection results

3. Kernel Classification

The system classifies kernels into red or white crowned categories:

Red kernel template White kernel template

Classification process:

  1. Template matching against reference kernels
  2. Color channel analysis
  3. Distance-based classification

Results visualization: Classification results

Code

Check out the GitHub repository for the complete code and documentation.