Hexagon vs square

I apologize in advance as I suspect the answer may be far easier than I realize. But I’m very new to this.
I have a project where I’d like to use an H7 as a machine vision system. I have sockets traveling around a radius that will come into view of the H7. What I would like to do is trigger an output if the socket is upside down. (square up). And trigger a second output if the socket is right side up. (hexagon pointed up). I’ve been attempting with the find squares, circles, and or, keypoints. To no avail. Any assistance would be greatly appreciated.

Use the find_line_segments() method. Then constrain the roi for the find_line_segments algorithm to where you expect the object to be.

Then, count the number of returned line segments and threshold the returned line segments for only ones that are quite strong.

You should end up with 4 line segments or 6 depending side.

Just run the find_line_segments() demo to get started. Its under feature detection.

Thank you. I’ll get on that. I very much appreciate the nudge in the correct direction.