How to extract the value of v out of hsv inside polyline


How to extract the value of v out of hsv inside polyline
or Is there a way to put 4 pairs of coordinate values?

please, post TEXT, not images of it, thank you.

Thank you for your interest in the matter

import numpy as np
import cv2
from shapely.geometry import Point, LineString, Polygon

img = cv2.imread('dark.jpeg')
img = cv2.resize(img, (416, 416), interpolation=cv2.INTER_LINEAR)
img1 = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
roi = [[253,253],[263,193],[144,184],[159,265]]

roi = [tuple(l) for l in roi]

pts1 = np.array([[253,223],[263,163],[144,154],[159,235]], np.int32)
pts2 = pts1.reshape((-1,1,2))
pts3 = cv2.polylines(img, [pts2], True, (255,255,255),1)
#pts3 = Polygon([[253,223],[263,163],[144,154],[159,235]])
hsv = cv2.cvtColor(pts3, cv2.COLOR_BGR2HSV)

h1,s1,v1 = cv2.split(hsv)
h2,s2,v2 = cv2.split(img1)

#h1,s1,v1 = cv2.split(hsv)

#polygon_roi = Polygon(roi)
#cv2.imshow(polygon_roi)
cv2.imshow('img', hsv)
cv2.waitKey()
cv2.destroyAllWindows()
print(np.mean(v1))
print(np.mean(v2))

I’d appreciate it if you could let me know if there is a way to use polygons.