In medical applications, the detection and outlining of boundaries of organs and tumors in computed tomography (CT) and magnetic resonance imaging (MRI) images are prerequisite. A two-layer Hopfield neural network called the competitive Hopfield edge-finding neural network (CHEFNN) is presented for finding the edges of CT and MRI images. Different from conventional 2-D Hopfield neural networks, the CHEFNN extends the one-layer 2-D Hopfield network at the original image plane a two-layer 3-D Hopfield network with edge detection to be implemented on its third dimension. With the extended 3-D architecture, the network is capable of incorporating a pixel's contextual information into a pixel-labeling procedure. As a result, the effect of tiny details or noises will be effectively removed by the CHEFNN and the drawback of disconnected fractions can be overcome. Furthermore, by making use of the competitive learning rule to update the neuron states, the problem of satisfying strong constraints can be alleviated and results in a fast convergence. Our experimental results show that the CHEFNN can obtain more appropriate, more continued edge points than the Laplacian- based, Marr-Hildreth, Canny, and wavelet-based methods.