Due to the harsh underground environment during coal mining, the quality of images collected by cameras is not sufficient, and the acquired images are greatly affected by noise, affecting visual observation; to a certain extent, subsequent intelligent mining is limited. A morphological Sobel coal-rock boundary recognition algorithm is proposed according to the different gray levels of coal-rock images to solve the problem of coal image quality. First, the details of the coal and rock images are smoothly preprocessed to improve the contrast between the feature boundaries and surrounding pixels, and the gray-level adaptive threshold is applied after processing. Morphological corrosion theory is used to process the morphological structure in an image, and the corresponding boundary in the image is extracted for recognition. Compared with the boundary points identified by each algorithm, the area error of coal and rock identification is calculated by using the boundary point fitting curve. The morphological Sobel algorithm is used to calculate the identification area error of coal and rock at different angles according to the camera range. The experimental results show that the boundaries identified by the morphological Sobel algorithm have the best degree of overlap with the boundaries of the original image. The identification error area is only about 10% of the Sobel operator and Canny operator algorithm. Monitoring coal and rock specimens can enable the effective identification of coal and rock boundaries from various angles.