I have a numpy arary of numpy arrays of (x,y) points that make up a filled polygon.
[[ 441 455]
[ 442 455]
[ 443 455]
...
[1737 1444]
[1738 1444]
[1739 1444]]
I need to find the corners of this polygon. How would one go about this?
Context: I'm using detectron2 for instance segmentation, and I received back a tensr of prediction masks, showing whether each pixel is representing the object or not. After some manipulation with numpy, I transformed this into a numpy array of numpy arrays representing all coordinates that are representing the polygon.
outputs = predictor(im)
outputnump = outputs["instances"].pred_masks.numpy()
ind1 = np.nonzero(outputnump[0])
ind = np.insert(ind1[0],np.arange(len(ind1[0])),ind1[1])
#ind = np.flip(ind,[1])
ind_len_div2 = int(len(ind)/2)
ind = ind.reshape(ind_len_div2,2)