Skip to content

Instantly share code, notes, and snippets.

@santhalakshminarayana
Last active September 27, 2019 14:46
Show Gist options
  • Save santhalakshminarayana/8a4b3831bdd5ade1ac4e9e35b4b86f73 to your computer and use it in GitHub Desktop.
Save santhalakshminarayana/8a4b3831bdd5ade1ac4e9e35b4b86f73 to your computer and use it in GitHub Desktop.
Medium:Imagetopdf draw closest rectangle
#Draw closest four sided shape around maximum contour which is our
#area of interest in image
approx_cont=[]
for ind in range(len(images_read)):
epsilon=0.02*cv2.arcLength(image_conts[ind][max_area_conts[ind]],True)
approx=cv2.approxPolyDP(image_conts[ind][max_area_conts[ind]],epsilon,True)
approx_cont.append(np.squeeze(approx))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment