A new approach is proposed to detect edges based on an artificial neural network (ANN). Some elementary continuous and discontinuous functions interpolated in the polynomial space and their continuity are used as the training sets to train a back propagation neural network containing two hidden layers. The ANN edge detector is used to detect the edges in an image and the locations of discontinuity in the hybrid fifth order Compact-WENO nonlinear (Hybrid) scheme for solving hyperbolic conservation laws with solutions containing both discontinuous and complex fine scale structures. Several classical examples in the image processing show that the ANN edge detector can capture an edge accurately with fewer grid points than the classical multi-resolution analysis. Furthermore, as oppose to the MR analysis, the ANN edge detector is robust with no problem dependent parameter, in addition to being accurate and efficient. The performance of the Hybrid scheme with the ANN edge detector is demonstrated with several one- and two-dimensional benchmark examples in the shallow water equations and Euler equations.