In free space, $I_\nu$ is conserved
along a ray:
$$ {d I_\nu \over d s} = 0 ,$$
where lower-case $s$ is the coordinate on the ray from the source at $s
= 0$ to the observer at $s = s_{\rm o}$. What happens when there
is an intervening medium
between $s_{\rm in}$ and
$s_{\rm out}$?

Think of the ray as a beam of photons,
or light particles, some of which
may be destroyed (absorbed) by the medium, so their energies are lost
from the ray. The infinitesimal probability $dp_\nu$ of being absorbed
(e.g.,
hitting an absorbing particle in the cloud) in an infinitesimally thin
slab of thickness $ds$ is proportional to $ds$: $dp_\nu= \kappa_\nu
ds$. This (frequency dependent) constant of proportionality
$$\bbox[border:3px blue solid,7pt]{\kappa_\nu \equiv {dp_\nu \over
ds}}\rlap{\quad \rm {(2B1)}}$$
is
called the linear
absorption
coefficient, and its
dimension is inverse length. For
example, $\kappa_\nu = 1 {\rm ~m}^{-1}$ means that over some small
distance along the ray, $\Delta s = 10^{-3}$ m say, the fraction
$\kappa_\nu \Delta s = 1 {\rm ~m}^{-1} \times 10^{-3} {\rm ~m} =
10^{-3}$ of the photons will be absorbed. In this simple
macroscopic model, we didn't concern
ourselves with the microscopic physical processes by which photons are
absorbed. This is like the ideal gas model, which describes the
macroscopic properties of a gas without going into the microscopic
details about
how individual gas molecules behave.
The fractional energy lost to
absorption in the infinitesimal
distance $ds$ along
the ray is
$$ {d I\nu \over I_\nu} = -dp_\nu = -\kappa_\nu ds \rlap{\rm\quad
~(absorption~only)}$$
Integrating both sides of this equation over the absorbing path
$$\int_{s_{\rm in}}^{s_{\rm out}} {d I_\nu \over I_\nu} = -\int_{s_{\rm
in}}^{s_{\rm out}} \kappa_\nu(s')ds' = \ln I_\nu \big|_{s_{\rm
in}}^{s_{\rm out}}$$
$$\ln[I_\nu(s_{\rm out})] - \ln[I_\nu(s_{\rm in})] = - \int_{s_{\rm
in}}^{s_{\rm out}} \kappa_\nu (s') ds'$$ $$I_\nu(s_{\rm out}) =
I_\nu(s_{\rm in}) \times \exp\biggl[ -\int_{s_{\rm in}}^{s_{\rm out}}
\kappa_\nu(s')ds'\biggl]$$
The (dimensionless) quantity
$$\bbox[border:3px blue solid,7pt]{\tau_\nu \equiv \int_{s_{\rm
out}}^{s_{\rm in}} -\kappa_\nu(s') ds'}\rlap{\quad \rm {(2B2)}}$$
is called the optical
depth or opacity
(also, $d\tau = -\kappa_\nu\ ds$) of the absorber. If $\tau \ll 1$ the
absorber is said to be optically
thin; if $\tau \gg 1$ it is
optically thick. Note
the
direction of the path integration from the source to the observer is
such that $\tau_\nu > 0$ for an
absorber. Thus
$$I_\nu(s_{\rm out}) = I_\nu( s_{\rm in}) \times \exp (-\tau_\nu)$$
The intervening medium may also
generate, or emit, photons,
again by some unspecified microscopic process. In any small volume
($ds
d\sigma$) of space, the probability per unit time of emitting a photon
having frequency $\nu$ into the solid angle $d \Omega$ is proportional
to that volume:
$$P_{\rm em} \propto ds d\sigma d\Omega$$
The emission
coefficient
$\epsilon_\nu$ is defined so
that
$$\bbox[border:3px blue solid,7pt]{\epsilon_\nu \equiv {dI_\nu \over
ds}}\rlap{\quad \rm {(2B3)}}$$
in the absence of absorption. The dimensions of $\epsilon_\nu$
follow from its definition; they are W m$^{-3}$ Hz$^{-1}$ sr$^{-1}$.
Thus considering both emission and
absorption, we get the equation
of radiative transfer
$$\bbox[border:3px blue solid,7pt]{{d I_\nu \over ds} = -\kappa_\nu
I_\nu + \epsilon_\nu}\rlap{\quad \rm {(2B4)}}$$
Since we have not yet specified
anything about the emission and
absorption processes, $\kappa_\nu$ and $\epsilon_\nu$ might seem to be
independent. However, they are not independent in thermodynamic
equilibrium
(TE). In TE, matter and radiation are in equilibrium
at the same temperature $T$. Equilibrium radiation at temperature $T$
is isotropic and has a blackbody spectrum. One source of blackbody
radiation is a cavity
with a small hole. The radiation emerging from the hole is independent
of the wall material (e.g., wood with green paint, shiny copper, gray
concrete, etc.) or any absorbing material (e.g., gas, dust, fog, etc.)
inside the cavity.

Thermal radiation from a cavity
depends only on its temperature and is independent of both the material
used to make the cavity walls and the contents of the cavity.
Likewise, radiation emitted by the walls and emerging from the hole
is independent of the wall material and microscopic physics. Kirchoff
proved this statement by a thought experiment:

Consider two cavities at the same temperature $T$ whose windows are connected by a narrow-band passive (meaning, no energy is needed for it to work) filter passing only frequencies $\nu$ to $\nu + d\nu$. Radiation can carry no net power from one cavity to the other, lest one cavity cool down and the other heat up. Cooling one and heating the other would violate the second law of thermodynamics because the two cavities at different temperatures could be used to drive a heat engine.
In (full) thermodynamic equilibrium
(TE) at temperature $T$,
$${d I_\nu \over ds} = 0 {\rm ~and~} I_\nu = B_\nu(T)$$
so
$${d I_\nu \over ds} = 0 = -\kappa_\nu B_\nu (T) + \epsilon_\nu$$
yielding
Kirchoff's law
for a sytem in TE:
$$\bbox[border:3px blue solid,7pt]{{\epsilon_\nu (T) \over \kappa_\nu
(T
)} = B_\nu(T)}\rlap{\quad \rm {(2B5)}}$$
Although Kirchoff's law was derived for a system in thermodyamic equilibrium, its applicability is not limited to blackbody radiation in full thermodynamic equilibrium. It also applies in the case of local thermodynamic equilibrium (LTE). Proof: Note that $B_\nu (T)$ is a function of the radiation temperature $T$ only and does not depend on the microscopic properties of the radiating/absorbing material. In contrast, both $\epsilon_\nu( T)$ and $\kappa_\nu (T)$ depend only on the material properties of the cavity (e.g., whether the walls are made of copper or concrete) and on the temperature of that material, but they do not depend on the radiation field or its temperature. Thus the emission and absorption coefficients of all materials obey Kirchoff's law, even if $\tau \ll 1$.
Thus Kirchoff's law is true if the emitting/absorbing material is in thermal equilibrium (has a well-defined temperature $T$), even if it is not in equilibrium with the radiation field: $I_\nu \ne B_\nu(T)$. This situation defines local thermodyamic equilibrium (LTE). For example, most of the Earth's atmosphere is in LTE . It has a well-defined gas temperature $T \sim 300$ K) measureable with an ordinary thermometer, but it is in a nonequilibrium radiation field ($T \sim 5800$ K sunlight during the day, the cold dark sky at night, plus anisotropic emission from the ground) distinctly different from a black body at the gas temperature.
Kirchoff's law is not intuitively familiar to us because the optical brightness of room-temperature ($T \sim 300$ K) objects in our environment is nearly zero since $h \nu / k T \gg 1$. Thus, a glass of water might absorb 10% of the sunlight passing through it but not emit any detectable light because 10% of the optical brightness of a room-temperature blackbody is nearly zero. A familiar illustration of Kirchoff's law is a charcoal fire with flames and glowing coals. The infrared (heat) radiation from the black coals is much more intense than that of the even hotter but nearly transparent flames.
Kirchoff's law is very important at
radio wavelengths, though,
because $h \nu / k T \ll 1$. This point is illustrated by
emission/absorption through the Earth's
atmosphere.
At high ($\nu > 10$ GHz) radio frequencies, absorption by the Earth's atmosphere may be large enough to affect the accuracy of flux-density measurements. The usual way radio astronomers measure the amount of absorption is to measure the change in atmospheric emission at different angles from the zenith (the zenith is the direction straight up) and hence different amounts of absorption. The celestial sky above the atmosphere is relatively cold, so the "background'' emission above the atmosphere can be ignored. Then they use Kirchoff's law to calculate the zenith opacity of the (roughly isothermal) atmosphere at frequency $\nu$ from its kinetic (thermometer) temperature $T_{\rm A}$ and its radio brightness. The atmosphere is not in full thermodyamic equilibrium, but it is in local thermodynamic equilibrium (LTE).

Procedure: Tip the radio telescope, measure $I_{\nu}$ as a function of
the
zenith
angle $z$, the angle
between the zenith (vertical) and the incoming ray. Practical
complications include:
Brightness temperature is a practical way to specify brightness because radio telescopes are often calibrated by absorbers or "loads" of known temperature and because the temperature of a radio source is frequently a quantity of physical interest. However, be careful not to confuse brightness temperature with "real" physical temperature. They might be equal for an opaque $\tau \gg 1$ source, but the brightness temperature of a semitransparent thermal source (like the Earth's atmosphere) will always be less than its kinetic temperature.
The observed output from the radio
telescope might vary with $z$ like this:

To understand and interpret these
observations, we start with the
radiative transfer equation
$${d I_\nu \over d S} = -\kappa_\nu I_\nu +
\epsilon_\nu$$
Since the atmosphere is in LTE, we can eliminate the
unknown $\epsilon_\nu$ using Kirchoff's law: $$\epsilon_\nu =
\kappa_\nu B_\nu(T_{\rm A})~,$$
where $T_{\rm A}$ is the kinetic
temperature of the atmosphere as measured by an ordinary thermometer.
$${ 1 \over \kappa_\nu} {d I_\nu \over ds} = {-d I_\nu \over d \tau} =
-I_\nu + B_\nu (T_{\rm A})$$
Multiply both sides of this differential
equation by $\exp(-\tau)$ and integrate along the ray in the telescope
beam from the top of the atmosphere to the ground. Let $\tau_{\rm
A}(z)$ be the total optical depth of the atmosphere along the ray at
zenith angle $z$. Then
$$\int_0^{\tau_{\rm A}} e^{-\tau} {d I_\nu
\over d \tau} d \tau = \int_0^{\tau_{\rm A}} [I_\nu - B_\nu(T_{\rm A})]
e^{-\tau} d\tau$$
Integrate the left side by parts:
$$e^{-\tau} I_\nu
\vert_0^{\tau_{\rm A}} - \int_0^{\tau_{\rm A}} -e^{-\tau} I_\nu\ d \tau
=
\int_0^{\tau_{\rm A}} I_\nu\ e^{-\tau} d\tau - B_\nu(T_{\rm A})
\int_0^{\tau_{\rm A}} e^{-\tau} d \tau$$
$$I_\nu(\tau = \tau_{\rm A})
e^{-\tau_{\rm A}} - I_\nu(\tau = 0) = B_\nu(T_{\rm A}) (e^{-\tau_{\rm
A}} - 1)$$
$$I_\nu(\tau = 0) = ( 1 - e^{-\tau_{\rm A}}) B_\nu(T_{\rm
A})$$
Since the brightness of emission above the atmosphere is
relatively low at high radio frequencies, we can ignore $I_\nu(\tau =
\tau_{\rm A}) \approx 0$. The path length through a
plane-parallel atmosphere is proportional to ${\rm sec}\, z$ so at any
zenith angle $z$,
$$\tau_{\rm A} = \tau_{\rm Z}\, {\rm
sec}\, z$$
where $\tau_{\rm Z} \equiv \tau_{\rm A} ( z = 0)$ is the
zenith opacity of the atmosphere above the radio telescope.
$$I_\nu =
[1 - \exp(-\tau_{\rm Z}\, {\rm sec} \, z)]{2 k T_{\rm A} \nu^2 \over
c^2}$$
$$T_{\rm b} = {I_\nu c^2 \over 2 k \nu^2} = T_{\rm A} \biggl[1 -
\exp (-\tau_{\rm Z}\,{\rm sec}\,z)\biggr]$$
Example: In Green Bank, in freezing
weather ($T_{\rm A} = 273$ K),
the zenith opacity $\tau_{\rm z} \approx 0.1$ at $\nu = 90$ GHz. Thus
we expect that the brightness temperature of the atmosphere will vary
with $z$ according to
$$T_{\rm b} \approx 273\,{\rm K}\, \biggl[ 1 -
\exp ( -\tau_{\rm Z}\, {\rm sec}\,z)\biggr]$$
By fitting the observed
brightness temperatures to this equation, we can deduce $\tau_{\rm z}$
and hence the opacity at any zenith angle.
Green Bank $T_{\rm A} =
273$ K, $\nu = 90$ GHz, $\tau_{\rm z} \approx 0.1$:
$z$(deg)
sec($z$) $T_{\rm b}$
(K)
| 0 |
1.00 |
26.0 |
| 30 |
1.15 |
29.8 |
| 45 |
1.41 |
36.0 |
| 60 |
2.00 |
49.5 |
A photon striking an opaque
($\tau \gg 1$) body is either absorbed or reflected. Define the absorption
coefficient $a_\nu$ as
the probability that an incident photon of frequency $\nu$ will be
absorbed. Thus $a_\nu$ = 1 for a black body. Define the reflection
coefficient $r_\nu$ as
the probability that an incident photon of frequency $\nu$ will
be reflected. Since each photon is either absorbed or reflected by an
opaque body, $a_\nu + r_\nu = 1$.
Next imagine an opaque body surrounded
by a filter passing frequencies in the range $\nu$ to $\nu + d \nu$ in
a
cavity in thermodynamic equilibrium at some temperature $T$.

In
equilibrium, the spectral power absorbed per unit area, $P_{\rm a}$,
must equal
the power emitted per unit area.
$$P_{\rm a} = a_\nu \int B_\nu \cos \theta d \Omega$$
$$P_{\rm a} = a_\nu \int_{\phi = 0}^{2\pi} \int_{\theta=0}^{\pi/2}
B_\nu \cos\theta \sin\theta d \theta d \phi$$
$$P_{\rm a} = a_\nu 2 \pi B_\nu \int_0^{\pi/2} \cos \theta \sin \theta
d \theta$$
$$P_{\rm a} = a_\nu \times \pi B_\nu$$
Define the
spectral
emissivity $e_\nu$ as the spectral power
emitted per unit area by the opaque body divided by the spectral power
emitted
per unit area by a blackbody of the same temperature: $P_{\rm e} = \pi
B_\nu \times e_\nu$. Then $P_{\rm a} = P_{\rm e}$ implies
$$\bbox[border:3px blue solid,7pt]{e_\nu = a_\nu = 1 -
r_\nu}\rlap{\quad \rm {(2B7)}}$$
This is just another form of Kirchoff's
law. It implies that the
brightness temperature $T_{\rm b}$ of an opaque body in LTE at physical
temperature $T$ is given by
$$T_{\rm b}(\nu) = a_\nu T = (1 - r_\nu)
T$$
Since $a \le 1$, $T_{\rm b} \leq T$. A perfect reflector ($r = 1$)
will always have $T_{\rm b} = 0$; that is, it does not emit.
Example: The special paint used on the surface of the Green Bank Telescope (GBT) exploits this form of Kirchoff's law to perform three separate functions simultaneously. It is white in the visible portion of the spectrum to reflect sunlight ($T \approx 5800$ K) because differential solar heating would expand and deform the reflector. It is black in the mid-infrared so that the GBT ($T \approx 300$ K) can cool itself efficiently by reradiation. It is transparent at radio wavelengths so that it neither absorbs incoming radio waves nor emits thermal noise at radio wavelengths.

Temperature
differences across the GBT
reflector caused by differential solar heating would deform the surface
and degrade its performance. A special paint that is white at
visible wavelengths, black in the mid-infrared, and transparent at
radio wavelengths keeps the surface cool and does not harm performance
at radio wavelengths.
Image
credit