The conventional edge detection encounters limitations in practical applications due to its low imaging quality.By contrast, the edge detection encounters based on ghost imaging can achieve a high signaltonoise ratio for the edge imaging of object. Accordingly, this paper proposes a computational ghost imaging based on the edge detection using the Scharr operator. The Scharr operator has low computational complexity, enhancing its effectiveness for image processing.Hence, a new set of speckle functions is generated by applying the Scharr operator to speckle. When the Scharr operator template is applied to speckle movement, information will miss along a certain direction in edge extraction results. To address this problem, a new operator template is generated by converting the positive and negative values of the operator template. Thus, a new illumination speckle is created by applying the newly generated operator template to the moving speckle, thereby obtaining complete information along all directions in the edge detection results. Additionally, based on the basic method of computational ghost imaging, edges of unknown images are extracted theoretically and experimentally. The simulation and experimental results show that the proposed method can obtain complete and clear edges of the tested object.