separated openCV into new function