A novel detection method combining gradient magnitude with confidence measure was established to detect eggshell crack. Images of brown eggshell crack were acquired to obtain ROI edge map using the edge detector proposed. Then, images of the boundary of brown eggs were extracted with a maximum margin algorithm. Finally, crack images were extracted with reference to edge map and images of the boundary of eggs. Three typical images of eggshell crack were analyzed and compared among the improved edge detection algorithm and traditional edge detectors including log operator, sobel operator and canny operator. The results showed that the established method overcame the adverse effect brought from the fixed threshold and had a better performance with an advantage over the traditional edge detectors in effectively suppressing the influence of the noise and detecting weak edges.