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
Sounds like you want a Hough transform. See the OpenCV tutorial: https://docs.opencv.org/3.4.0/d9/db0/tutorial_hough_lines.html
If you're pretty confident in the color of the lines you want to detect, you might want to transform the color per-pixel beforehand.
Disclaimer: This is a classical low-level computer vision algorithm. I don't know how the kids are doing it these days.