####################################################################################################
# Target tracking based on color space conversion
def lmc_cv_colorspaces_object_tracking():
"""
The functionality : Target tracking based on color space conversion .
"""
video = lmc_cv.VideoCapture(lmc_cv.samples.findFile("box.mp4", False, False))
while True:
# take each frame
_, frame = video.read()
# convert BGR to HSV
hsv = lmc_cv.cvtColor(frame, lmc_cv.COLOR_BGR2HSV)
# define range of yellow color in HSV
lower_yellow = np.array([0, 120, 0])
upper_yellow = np.array([50, 255, 255])
# threshold the HSV image to get only yellow colors
mask = lmc_cv.inRange(hsv, lower_yellow, upper_yellow)
# Bitwise-AND mask and original image
res = lmc_cv.bitwise_and(frame, frame, mask=mask)
# Display images
lmc_cv.imshow('frame', frame)
lmc_cv.imshow('mask', mask)
lmc_cv.imshow('result', res)
# Waiting for user interaction
if ord('q') == (lmc_cv.waitKey(200) & 0xFF):
break
# Destruction of the window
lmc_cv.destroyAllWindows()