We use Markov random fields to improve the output of the thinned Sobel edge detector, applied to images compressed using the JPEG technique. JPEG compression saves a lot of file space, however it introduces correlated errors into the images. This is exactly a circumstance for which our recently developed double neighborhood MRFs are suited (Milun and Sher, 1992a). Double neighborhood MRFs are constructed by sampling from pairs of original images together with noisy imagery. Thus we create a probability density function for pairs of neighborhoods across both images. This models the noise within the MRF probability density function without having to make assumptions about its form. This provides an easy way to generate Markov random fields for annealing or other relaxation methods. We train the double neighborhood MRF on true edge-maps and edge-maps generated as output of a Sobel edge detector (Duda and Hart, 1973) on compressed images. Our method improves the generated edge-maps as veri..