1#!/usr/local/bin/python3
2import cv2 as cv
3import numpy as np
4
5# Load the aerial image and convert to HSV colourspace
6image = cv.imread("aerial.png")
7hsv=cv.cvtColor(image,cv.COLOR_BGR2HSV)
8
9# Define lower and uppper limits of what we call "brown"
10brown_lo=np.array([10,0,0])
11brown_hi=np.array([20,255,255])
12
13# Mask image to only select browns
14mask=cv.inRange(hsv,brown_lo,brown_hi)
15
16# Change image to red where we found brown
17image[mask>0]=(0,0,255)
18
19cv.imwrite("result.png",image)