Opencv-python about how to extract the red region of hsv across two intervals

Red is in hsv, 0: 10 and 150: 180. How to extract it?

novice, this is what I wrote, but I don"t know how to write it later. I roughly want to combine their results.
or is there a more elegant way to write it?
ask for divine guidance.

hue_image = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)

low_range1 = np.array([0, 80, 50])
high_range1 = np.array([10, 255, 220])
th1 = cv2.inRange(hue_image1, low_range1, high_range)

low_range2 = np.array([150, 20, 20])
high_range2 = np.array([180, 255, 220])
th2 = cv2.inRange(hue_image, low_range2, high_range2)

I have just encountered this problem
what I am trying is cv2.add, to solve the problem of union of two regions

Menu