Single-pixel imaging (SPI) system modulates the object with a series of patterns, records the corresponding measurements of a bucket detector and forms an image by the algorithm of compressed sensing. In this process, if other objects enter into the field of view of SPI, the accuracy of measurement will be seriously affected, and the quality of the reconstructed image will decrease. Owing to the randomness of the reflectivity and shape of the occlusion, it is difficult to effectively separate the disturbed part from the bucket detector signal. To solve this problem, we propose a self-check method based on the characteristics of Hadamard matrix, that is, using the measurement values of bucket detector to verify the correctness of signal. Usually when using the Hadamard matrix as the measurement matrix in SPI, it is divided into complementary positive pattern and negative pattern. The measurements of these two patterns are subtracted to form the image (the difference value marked by
$ l $
). Owing to the complementarity of the two patterns, the sum of the corresponding measurements should be a constant (marked by
$ u $
). When dynamic occlusion appears, the value of
$ u $
will fluctuate significantly, so we choose
$ u $
as the standard to judge whether an occlusion appears. In order to reduce the influence of other factors (such as system noise or fluctuation of the illumination) in the imaging process, we further propose a dynamic occlusion removal method based on the statistical histogram of the values of
$ u $
. We first find the position of the maximum value in the histogram, and then expand from this position to both sides of the histogram. We calculate the area of the expanded region, and stop the expansion when this area is greater than the threshold. Then the
$ l $
corresponding to
$ u $
in the expanded region is the measured value without interference. Experiments show that this method can retain the undisturbed signals of the bucket detector and significantly improve the quality of the reconstructed image. This method is simple and effective, and it is also suitable for general imaging scenes. More importantly, it does not need to introduce additional patterns for verification, which effectively promotes the practical process of single pixel imaging technology.