Electromagnetic Casimir stresses are of relevance to many technologies based on mesoscopic devices such as MEMS embedded in dielectric media, Casimir induced friction in nano-machinery, micro-fluidics and molecular electronics. Computation of such stresses based on cavity QED generally require numerical analysis based on a regularization process. A new scheme is described that has the potential for wide applicability to systems involving realistic inhomogeneous media. From a knowledge of the spectrum of the stationary modes of the electromagnetic field the scheme is illustrated by estimating numerically the Casimir stress on opposite faces of a pair of perfectly conducting planes separated by a vacuum and the change in this result when the region between the plates is filled with an incompressible inhomogeneous non-dispersive dielectric.