Solved the while problem and added the return correctly. OpenCV functions pending