Abstract Occupational Safety and Health (OHS) is very important in the mining industry which is prone to accident risks. Automatic detection of violations through CCTV streaming with the concept of a perimeter area is needed to prevent accidents. The purpose of this research is to create a violation detection system without re-modeling training that can adapt to different objects and regions. The proposed violation detection model includes four computational steps, namely (i) data reading, (ii) data pre-processing, (iii) object detection, and (iv) object tracking and violation detection. The computer vision technique uses the SIFT (Scale Invariant Feature Transform) algorithm and heuristics implemented with OpenCV. We used five CCTV video recordings of mining operations as examples. The results showed an average precision of 61.14%, a precision of 80.41%, and a recall of 69.38%. The average computation time of the model is 0.3 seconds per frame with heuristics that allow the model to be used in real-time. The model can be widely used in various fields and locations without having to retrain the model to improve OHS in the mining industry and other sectors with similar risks. This study will contribute to the development of a flexible, fast, and real-time automatic detection system.