How to do it...

To complete this recipe, the steps are as follows:

  1. First create an OpenCV window named window:
import cv2, numpy as npcv2.namedWindow('window')
  1. Create a variable that will contain the fill color value for the image. The variable is a NumPy array with three values that will be interpreted as blue, green, and red color components (in that order) from the [0, 255] range:
fill_val = np.array([255, 255, 255], np.uint8)
  1. Add an auxiliary function to call from each trackbar_callback function. The function takes the color component index and new value as settings:
def trackbar_callback(idx, value):    fill_val[idx] = value
  1. Add three trackbars into window and bind each trackbar callback to a specific color component using the Python ...

Get OpenCV 3 Computer Vision with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.