I'd like to detect a horizontal and vertical edge in images such as this one to form a new coordinate system:enter image description here
The desired edges are shown in red. The object shown is a printed circuit board. Because the PCB comes in different orientations, using the new coordinate system would allow me to extract features on the PCB that are consistent across all images. This is for a machine learning application.
I wonder what is the easiest way to build this coordinate system (and getting the origin point). Are there any tools in OpenCV that makes this easy?
Thanks