The flowcharts below present the Camera Tampering Detection algorithm based on the Motion Detection sample to adopt more image processing algorithms for implementation.
The graph consists of Image scaling (optional), ConvertColor, CannyEdge, Background subtraction MOG2, Dilate, Erode, Dilate and Connected component labeling nodes. The graph consumes an RGB format image and produces a label image and an array of bounding rectangles of detected moving objects.
Optional image scaling can scale down the size of the input image to save computations for subsequent processing. It can significantly improve performance without obvious loss in accuracy.
CannyEdge is a general image processing method for edge detection in a grey scale image. This is why you need to convert color space of the source images into grey scale for further processing. After extracting the edge information of the corresponding images, you can quantize and utilize it as an evaluation reference. With this reference, the next step is to fine-tune a threshold to decide whether the tampering behavior occurred or not. Finally, the program might send out an alarm. This figure illustrates the whole Camera Tampering Detection algorithm:
OpenCV might have functions with similar functionality. However, this sample uses the Camera Tampering Detection algorithm due to simplicity of code and future GPU implementation.
The figure below presents the complete OpenVX* graph. See
camera_tampering.cpp to find code for the following operations:
- creation of
- creation of all non-virtual data objects;
- the main loop for processing an input video file, frame-by-frame;
- creation of all virtual data objects;
- population of the graph with nodes to build the pipeline presented in this flowchart:
In the code flow, Camera Tampering Detection precedes Motion Detection for each frame. The figure below illustrates combination of these two algorithms into one process: