MIT BioInstrumentation Laboratory

Quantitative Optical Gas Imaging of Bovine Methane Emissions

Autonomous tracking and spatiotemporal plume segmentation in respiration chambers

Thanh Nha Nguyen, Michael Aling, Ian Hunter

Massachusetts Institute of Technology

Contact: thanhnha@mit.edu

Cows belch methane, and nobody can see it. We point a cooled infrared camera at a cow's nose, inside respiration chambers that measure the same methane independently, and built a pipeline that turns the faint, flickering plume into candidate plume regions. Seeing single eructations, rather than averages over minutes, opens the way to relating a cow's emissions to what it is doing at the moment it emits. This page walks through the work, with the videos a poster can't show.

28×
warming potential of methane compared with CO₂ over 100 years
~400 g
methane a single dairy cow emits per day
$2M
cost of one respiration chamber, the reference method
<$0.1M
cost of one optical gas imaging camera

01 · The problem

Cattle methane is large, and hard to measure

Enteric methane from cattle is one of agriculture's largest greenhouse-gas sources. Feed additives, diet changes and selective breeding can all cut a cow's methane, but testing them means measuring many animals, and measurement is the bottleneck.

More than 95% of a cow's methane leaves through its nose and mouth, by belching (eructation) and in exhaled breath. Today it is measured in sealed respiration chambers, or with an SF₆ tracer gas and a sampling halter. Each burp lasts seconds; these methods report averages over minutes to days.

TechniqueHardware costInvasivenessWhereTime resolution
Respiration chamberUp to $2M (facility)ConfinementSealed roomτ ≈ 8–10 min (air turnover)
GreenFeed (C-Lock)ModerateFeeder visitsBarn or pasture3–7 min per visit
SF₆ tracer gasModerateBolus and halterBarn or pastureHours to days
Mid-infrared optical gas imaging (this work)< $0.1M (camera)NoneChamber and barn30 frames/s, single breaths

The gap: no technology is at once non-invasive, scalable, cost-effective and usable in the animal's natural environment. Optical gas imaging could be, but commercial cameras were never specialised for cows.

Sources: IPCC AR5 WG1 Ch. 8 (2014); Bannink et al. (2011); Tseten et al. (2022); Hammond et al., Anim. Prod. Sci. 56:181 (2016), GreenFeed; Pinares-Patiño et al., GRA Technical Manual on Respiration Chamber Designs (2014). Costs are indicative.

02 · How a camera sees methane

Methane glows, faintly, at 3.3 µm

Methane absorbs and emits infrared light in a narrow band around 3.3 µm. Our camera, a FLIR GIS-320 (cooled GF320 core), images only 3.2–3.4 µm, so a cloud of methane shows up as a change in brightness against whatever is behind it.

The gas is only visible if it is at a different temperature from the background. Warm breath in front of a cooler wall adds light; gas at the wall's temperature is invisible. Every chamber therefore gets a matte black backdrop (Krylon paint, emissivity about 0.95 or higher in the mid-infrared, typical for flat black paint): it reflects almost nothing, so the camera sees the backdrop's own temperature rather than reflections of the warm cow.

Methane absorbance spectrum from HITRAN, with the camera's 3.2 to 3.4 micrometre band shaded over the strongest peak.
CH₄ absorbance (HITRAN, 297 K, 1 atm air). The camera's band (shaded) sits on the strongest absorption.
Diagram: infrared camera looking through a gas plume at a background of known emissivity and temperature.
Simplified OGI scene. Jobert et al., Sensors 26(10):3270, 2026, Fig. 4 (CC BY 4.0).

The camera measures the light that gets through the plume plus the light the plume emits. Their difference from the plain backdrop is the contrast:

\[ \Delta L_G = \underbrace{\left(1 - e^{-\alpha c_X L}\right)}_{\text{share absorbed}}\;\underbrace{\left[L_0(T_G) - L_B\right]}_{\text{temperature contrast}} \]

Here \(c_X L\) is the methane column (concentration × path length), \(\alpha\) the absorption coefficient, and \(L_0(T)\) the blackbody radiance at temperature \(T\). No methane, or gas at the backdrop's temperature, gives no contrast.

How little methane can we detect?

Move the sliders. One pixel, one frame, signal equal to noise (contrast-to-noise ratio of 1).

140 ppm
smallest detectable column 14 ppm·m

This is an idealised bound, not a measured detection rate. For a thin plume (\(\alpha c_X L \ll 1\)) and a small temperature difference \(\Delta T = T_G - T_B\), the contrast above becomes linear, \(\Delta I \approx k\, c_X L\, \Delta T\), with \(k\) the camera's response to methane in this band. Setting \(\Delta I\) equal to the measured pixel noise σ = 0.62 counts (≈ 15 mK per frame) with σ/k ≈ 290 ppm·m·K gives \((c_X L)_{\min} = (\sigma/k)/\Delta T\). Real detection needs a margin above noise and loses contrast as the breath cools; averaging over frames and neighbouring pixels, as the pipeline does below, gains some back.

03 · First look

In a working dairy barn

Before going into chambers, we took a portable OGI rig to Fairvue Farms, a family-owned dairy in Woodstock, Connecticut, to see whether a camera could pick out a cow's breath at the feed bunk.

What a cow burp looks like

Infrared, frame differencing. Methane appears as bright, flickering puffs at the cows' noses.
Visible light, same feed bunk. No visual or audible cue. As the farm manager put it: "I've never seen a cow burp."

The barn showed we can see plumes and behaviour. It could not tell us how much methane each plume carries. For that we needed a reference that measures the same cow at the same time: a respiration chamber.

04 · Into the respiration chamber

A camera inside the reference instrument

A respiration chamber is a sealed stall with a known air flow; analysers measure the methane in the air leaving it. We installed the camera inside chambers at Cornell University and at AgResearch Grasslands in New Zealand, so camera and chamber watch the same cow at the same time.

Cornell University

The first camera package, mounted on the chamber wall:

  • FLIR GIS-320 OGI camera (thermal / methane and visible)
  • Intel RealSense camera (depth and visible)
  • Gremsy T7 gimbal for remote pointing
  • Jetson computer and 5 TB drive for recording, streaming and networking
  • HDMI transmitter for close-range wireless viewing; Digilent board and RC receiver for gimbal commands

The cow either lies down or stands at the trough, so the backdrop has to cover both views.

AgResearch Grasslands, New Zealand

Chamber stall seen from the camera, with the resting and eating zones outlined.
The two places a cow spends its time: resting / ruminating and eating.

Here the camera package hangs from the chamber's frame above the stall, looking down on both zones. To follow the cow between them, the camera later moved onto a rail.

The camera package with gimbal mounted above the stall, looking down.
Camera package above the stall

A camera on a rail that follows the nose

9× speed. The camera rides a ceiling rail between the resting and eating zones.

For the last four trial days the camera rode a motorised ceiling rail (Arduino, stepper motor and limit switches) between the two zones. The cows tolerated it well, since it is quiet and slow, though some got curious and came within 4 inches of the lens.

An Intel NUC finds a stripe of livestock marking paint (tail paint) on the cow's nose bridge 15 times a second and steers the gimbal to keep the nose in frame, with PD control and a dead zone so the camera doesn't chase every twitch. Everything is run from a web page over a Tailscale VPN, from a laptop or a phone, day and night.

The web controller. Tracking on: the red circle follows the paint on the nose.
Tracker view of a cow with pink paint on its nose, very close to the camera.
A curious cow, up close to the camera
Block diagram: FLIR camera, RealSense, gimbal and rail connect to the Intel NUC on site, which connects over Tailscale VPN to laptops, phones and cloud storage.
Remote control and data path. In the chamber → on site → anywhere. Tap to enlarge.

How the rig evolved between the trials

Computer
Jetson
→ Intel NUC
Gimbal control
RC receiver + PPM emulation
→ MAVLink, direct
Viewing
HDMI transmitter, RTSP stream
→ web app on any device
Tracking
manual
→ automatic (tail paint)
Camera position
fixed
→ motorised rail

05 · Finding usable footage

Most footage breaks the still-scene assumption

The pipeline treats anything slower than about half a second as background and anything faster as possible gas (the filter in §06). That only works when the camera is still, the cow is in profile, and the backdrop is behind its nose.

The best case: still camera, cow in profile

30 Jan, 06:44. Nose against the black backdrop.
31 Jan, 21:22. Rails and chain behind the head.

Even here, the raw image is dominated by the warm head and the rails; the plume is too faint to see. Making it visible is the job of the next section.

Everything else

Camera follows the head: every edge changes
Head and chain swing: motion looks like gas
Cow walks out: nothing to measure
Cow fills the frame: no backdrop

How much of 53 hours is usable?

Automatic screening of every recording, then a manual pose review. Hover or tap a bar for its share of the total.

About 6% of the recording is usable as is. The pipeline's first job is finding those stretches.

06 · Making the plume visible

A selective filter, then a windowed RMS

A breath plume changes the image by about a count; the camera's noise is 0.6 counts. Three steps separate the two: follow the slow background, average the noise away while letting fast changes through, and measure how much each pixel flickers.

Block diagram: camera frames feed a temporal filter that tracks the background; the change from background goes through a selective temporal filter and a spatial filter, then an RMS over 0.5 s gives the activity A(x,t).
Grey: adapted from Jobert et al., Sensors 26(10):3270, 2026, Fig. 12 (CC BY 4.0). Maroon: our addition. Tap to enlarge.
  1. 1
    Follow the background. An exponential temporal filter remembers about half a second (at 30 frames/s):
    \[ I^*_t = p_0\, I_t + (1 - p_0)\, I^*_{t-1}, \qquad p_0 = \tfrac{1}{15} \]
  2. 2
    Average noise, pass gas. The change from the background is filtered again, but its averaging switches off when a change is too big to be noise. A sigmoid gate in noise units sets the switch at 2σ:
    \[ \delta I^*_t = K * \Big[\, p\,(I_t - I^*_{t-1}) + (1-p)\,\delta I^*_{t-1} \Big], \qquad p = p_0 + \frac{1 - p_0}{1 + e^{-3(|\Delta|/\sigma - 2)}} \]
    where \(K\) is a 1-pixel blur and \(\Delta\) the change since the last output.
  3. 3
    Measure the flicker. Turbulent eddies break a plume into puffs, so one pixel's column both shifts and flickers. The RMS over a 0.5 s window keeps both; camera noise averages to zero and adds only a fixed σ²:
    \[ A(x,t) = \sqrt{\operatorname{mean}_{0.5\,\text{s}}\big(\delta I^{*2}\big)}, \qquad A^2 = \underbrace{\big(\operatorname{mean}\,\delta I^*\big)^2}_{\text{shift}} + \underbrace{\operatorname{var}\,\delta I^*}_{\text{fluctuation}} \]
Gate p versus change in noise units, with the histogram of gas-free noise for sigma 0.614 and 0.48 counts.
σ sets where the switch sits. We measured σ = 0.614 counts on gas-free footage. Frame differencing reads 0.48 (22% low) because consecutive frames share noise (ρ₁ = 0.38); at that value 11% of noise trips the gate instead of 5%. This σ, the raw pixel noise, only places the gate. Activity is measured in units of σout, the gas-free level of the windowed RMS itself (about 0.12 counts on the release footage, 0.2 on cow clips), and the thresholds in §08 are multiples of σout.
One pixel's filter output, its 0.5 second mean and its 0.5 second RMS, with gas off and with a 0.4 percent methane release.
One pixel, gas off vs 0.4% release. The 0.5 s RMS rises from 0.12 to 1.1 counts when gas is on.

Controlled releases (0.4% methane): the windowed RMS detects 34% of gas pixels, against 15% from single frames at the same false-alarm rate (2.4×). 59% of the extra signal is in the fluctuation term. The full-trial analysis uses a 1 s window, which gives 3.4× (50% vs 15%) on the same release.

One clip through the pipeline

31 Jan, 21:22, 18 s. (1) Raw counts: the warm head dominates. (2) Change from background: a plume streams from the nose, buried in pixel noise. (3) Selective denoise: the noise is averaged away, the plume stays. (4) Activity, 0.5 s RMS in noise units: the plume stands out, but so do the moving head and the rails that reflect it.

07 · Masking what isn't gas

A moving cow and shiny rails both look like gas

Raw frame next to its activity map without masks: the moving warm head and the rails reflecting it light up as strongly as gas.
Left: raw counts. Right: activity with no masks. The cow moves: the head is far warmer than the backdrop, so every small movement is a large change at its edges. Metal reflects: rails and the chain mirror the warm cow and flicker as the head moves. The filter flags any fast change, so we remove pixels we know are not gas before measuring.

Cow mask: temperature

Pixels hotter than the clip's cow threshold (an Otsu split of its median frame). Cleaned up, holes filled, then grown by 8 px so the moving edge stays inside. The figures show the first version, which kept only the largest hot region; the pipeline now keeps every hot piece of at least 25 px, because a bar close to the camera can cut the cow in two.

Rail and chain mask: shape

A Hessian ridge filter (Jerman 2016, σ = 1–3 px) finds long, thin, bright lines. Kept if ≥ 40 px long, ≤ 15 px wide and warmer than their surroundings; grown 6 px for the chain's swing. Rails are found first, so a warm rail touching the cow is not swallowed into the cow mask.

Four panels: raw counts, cow mask with 8 pixel margin, ridge filter response, and the rail and chain mask.
Raw counts → cow (hot) + 8 px margin → ridge filter response → rails and chain.

Masks in action

(1) Masks on the raw frame: white outline is the cow plus its 8 px margin, blue is rails and chain. (2) The saturated head and the flickering rails sit almost entirely under the masks. (3) Masked activity: about half the image is removed, and what remains is mostly the plume below the nose.
Top: masks on the raw frame (white: cow + 8 px, blue: rails and chain). Middle: what the masks cover. Bottom: masked activity, mostly the plume below the nose.

Some activity still leaks at the moving head's edge, just outside the 8 px margin. The pipeline now keeps a pixel masked for 15 frames (0.5 s) after the cow leaves it, because the background filter still remembers the warm head there.

08 · From activity to plume regions

Connecting the plume in space and time

  1. 1
    Grow where activity ≥ 2σout (about 1 in 1,000 gas-free values).
  2. 2
    Seed where activity ≥ 3σout (about 1 in a million), in cores of ≥ 5 px.
  3. 3
    Connect in space and time, (x, y, t), so a plume is one 3D object.
  4. 4
    Keep regions with a seed that touch the outlet: a 10 px circle where the plume leaves the nose, clicked once per clip in review.
  5. 5
    Measure each region: start, duration, peak, area and reach.

Two thresholds do what one can't. A high seed threshold means a region is almost never pure noise; a lower growing threshold lets each region spread to the plume's faint edges. Requiring the region to touch the nostril outlet rejects leftover clutter elsewhere in the frame.

(1) Thresholds: grow ≥ 2σ, seed ≥ 3σ. (2) Plume regions touching the outlet (circle). In this 18 s, one region, the plume, lasts the whole stretch. Region results are preliminary while artifact rejection is refined.
Top: thresholds, grow ≥ 2σ and seed ≥ 3σ. Bottom: the plume region touching the outlet (circle). One region lasts the whole 18 s. Region results are preliminary while artifact rejection is refined.

09 · Next: lining up with the chamber

Every burp, against the chamber's smoothed view

The camera sees each burp as it happens. The chamber mixes all of them into its air, which is replaced over several minutes, so it sees a smoothed sum. Both should account for the same methane.

A burp of mass \(m\) raises a well-mixed chamber of volume \(V\) by \(m/V\) at once; the air flow \(Q\) then washes it out with time constant \(\tau = V/Q\). Flow times the area under the chamber's curve gives back the methane:

\[ \Delta C(t) = \frac{m}{V}\, e^{-t/\tau}, \qquad \int Q\, \Delta C\, dt = m \]

Here \(\Delta C\) is a mass concentration: a reading in ppm times the density of methane (0.716 g/L at STP).

Our chamber. The AgResearch chamber holds \(V\) = 15.8 m³ with an air flow of about 1.9 m³/min, so \(\tau = V/Q \approx\) 8.4 min. Fitting the decay after each door closure gives 9.5 min for CO₂ and 9.8 min for CH₄. A burp that lasts seconds is spread over about ten minutes in the chamber's record.

Illustration: an hour of burps, as the chamber would see it

Simulated, not measured, in arbitrary units. Change the chamber's air turnover time and watch the peaks blur while the totals stay balanced.

Methane belched
–
=
Carried out by the air
–
+
Still in the chamber at 60 min
–

The trial so far

Chamber methane over the trial days with bars showing when the camera was recording, when the cow was in frame with the camera still, and the usable clips.
Chamber CH₄ every 30 s across the trial (two cows), with camera coverage. 53 h recorded over the same days; the cow is in frame with the camera still for 10 h; 3.2 h of good pose so far, spread across both cows and day and night.
Chamber methane on the night of 30 January between 00:26 and 02:36, with usable clips and plume regions marked below.
One night, clip by clip. 30 Jan, 00:26–02:36: 34 usable minutes of candidate plume regions against chamber CH₄ between 60 and 115 ppm. Preliminary: regions are not yet merged into eructation events, and rejecting head-motion and reflection artifacts is ongoing.

Next steps

  1. 1
    Line up the clocks. Check the camera–chamber time offset.
  2. 2
    Respect the chamber's lag. Its air takes about 9 minutes to turn over (measured 8.4–9.8 min), so compare totals over windows of at least one turnover, not single breaths.
  3. 3
    Rate vs production. Events per measured minute against the chamber's methane production (flow × CH₄ rise) in the same windows.
  4. 4
    Timing. Do bursts of strong events come before chamber rises?
  5. 5
    Behaviour, event by event. Because the camera sees single eructations as they happen, emissions can be lined up with what the cow is doing at that moment: eating, ruminating, lying down or standing, head position. Chamber and tracer methods average over minutes to days and cannot make that link. This is the next analysis, not yet a result.