October 2018
Intermediate to advanced
472 pages
10h 57m
English
We need to create a mask that can detect the specific color spectrum; let's say red in our case. Now we will create two masks that will be performing feature extraction using the color values and the brightness factors:
# filter by colormin_red = np.array([0, 100, 80])max_red = np.array([10, 256, 256])mask1 = cv2.inRange(image_blur_hsv, min_red, max_red)# filter by brightnessmin_red = np.array([170, 100, 80])max_red = np.array([180, 256, 256])mask2 = cv2.inRange(image_blur_hsv, min_red, max_red)# Concatenate both the mask for better feature extractionmask = mask1 + mask2
Following is how our mask looks:

Read now
Unlock full access