The following PyImageSearch has a good step by step guide on how to install OpenCV in RPi Raspbian Jessie.

How to Install OpenCV 3.4.0 with Python 3 on Raspberry Pi 3 was also helpful in adding more details.

Notes

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D BUILD_opencv_java=OFF \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_EXTRA_MODULES_PATH=/home/pi/CODE/OpenCV/opencv_contrib-3.4.1/modules \
    -D WITH_CUDA=OFF \
    -D BUILD_TESTS=OFF \
    -D BUILD_PERF_TESTS= OFF \
    -D BUILD_EXAMPLES=ON ..

# Remove unused packages
sudo apt-get purge minecraft-pi sonic-pi

# Clean up
sudo apt-get clean && sudo apt-get autoremove

Resources:

https://www.pyimagesearch.com/2015/02/23/install-opencv-and-python-on-your-raspberry-pi-2-and-b/ https://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/ https://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/