clean the code and move the openCV functions inside detection_functions.c