Finding corners of a polygon represented in a 2D array
In the absolutely general case (e.g. allowing for concave hulls or darn-near-triangular shapes) this will involve some uncertainty. But since you are dealing with a restricted subclass, it's easier.
You might start with kernel convolution. Consider overlapping squares of (say) 3x3 pixels: you can design a function that tells you if the center is inside (all ones), outside (all zeros), on an edge, or at a corner, based on patterns of points.
On the other hand, you could take the "convex hull" approach: the leftmost and rightmost 1-pixels are probably corners; if several appear at the same column, take the uppermost/lowermost respectively. Using the line between them, you can tell if the bulk of 1-pixels are above, below, or on both sides of the line; this tells you where to look for the other corners.
I have a 2D array of 0's and 1's where the 1's represent the edges and inside of a quadrilateral, and 0's are everything outside. What is the best way to find the coordinates of the four corners?
I'm using Python so any libraries that can help are fine, but an algorithm in any language would be helpful as well.