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 <inline-formula><tex-math id="M1">\begin{document}$ l $\end{document}</tex-math><alternatives><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M1.jpg"/><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M1.png"/></alternatives></inline-formula>). Owing to the complementarity of the two patterns, the sum of the corresponding measurements should be a constant (marked by <inline-formula><tex-math id="M2">\begin{document}$ u $\end{document}</tex-math><alternatives><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M2.jpg"/><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M2.png"/></alternatives></inline-formula>). When dynamic occlusion appears, the value of <inline-formula><tex-math id="M3">\begin{document}$ u $\end{document}</tex-math><alternatives><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M3.jpg"/><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M3.png"/></alternatives></inline-formula> will fluctuate significantly, so we choose <inline-formula><tex-math id="M4">\begin{document}$ u $\end{document}</tex-math><alternatives><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M4.jpg"/><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M4.png"/></alternatives></inline-formula> 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 <inline-formula><tex-math id="M5">\begin{document}$ u $\end{document}</tex-math><alternatives><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M5.jpg"/><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M5.png"/></alternatives></inline-formula>. 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 <inline-formula><tex-math id="M6">\begin{document}$ l $\end{document}</tex-math><alternatives><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M6.jpg"/><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M6.png"/></alternatives></inline-formula> corresponding to <inline-formula><tex-math id="M7">\begin{document}$ u $\end{document}</tex-math><alternatives><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M7.jpg"/><graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="3-20221918_M7.png"/></alternatives></inline-formula> 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.