The purpose of this lab is to gain experience working with the Python bindings for OpenCV.
$ python cv_demo.pyNote that this file is not a ROS node. This is pure python code that can be executed without starting ROS.
find_reddest_pixel
according to the docstring. You should complete this function by
creating a nested for loop to access all pixels in the image. Note
that you will need to convert the pixel values to integers.
They are stored in the image as 8-bit unsigned integers. Performing
arithmetic on 8-bit unsigned integers will always result in 8-bit
unsigned integers.
find_reddest_pixel_fast
according to the docstring. You should complete this function without
any loops. (This OpenCV method will be helpful: cv2.minMaxLoc The completed function should
be much faster than the previous version.
mark_red.py
that displays a black and white version
of the camera image, where all red pixels are white, and all non-red
pixels are black. The examples in
the
Image Thresholding Tutorial are likely to be useful.
Submit your completed version of detect_red.py through Canvas.