We propose a ghost imaging (GI) denoising method based on connected-region labeling (CRL) technique, named CRLGI, to reduce the noise interference from the environment, and improve the quality of imaging. In the scheme, a maximum labeled connected component is searched by using line-by-line scan algorithm in each binary speckle pattern, and the area whose number of pixels is smaller than that of the maximum labeled connected component is deleted to eliminate the noise in every speckle pattern. Then these optimized speckle patterns are illuminated on an unknown object. A bucket detector without any spatial resolution is used to collect the light transmitted through or reflected from the object. Finally, the image of the object can be reconstructed by the correlation between the optimized speckle patterns and corresponding bucket values. The simulations show that the proposed scheme has a better denoising effect, especially in the noise varying complex environment. For Gaussian, salt & pepper, speckle, Poisson noise environment, the images reconstructed by CRLGI scheme are improved than those recovered by traditional GI scheme.