0

I need to detect a specific shape that I generate from a Image in a bigger Image.

Here is an Example of that: enter image description here

For Explanation: I have a picture of 2 identical Parts, but one Part is flipped upside down. Now I want to detect the Orientation of the Parts via Python. The tricky part is, that the parts that I want to detect can sometimes lay a little bit different on the image.

What I already tried:

  • Multi Score Template Matching
  • Multi Scale Template Matching
  • Feature Matching
  • Depth analysis

Note that The angle, in which the photo is taken of the sample image and the to detect parts will be the same eventually.

I think the most discrete feature is the orientation of the gaps in the part. If they are pointing upwards the sample is in the TOP position but if they are pointing down, the sample is in BOTTOM position. Do you guys have any leads as to how I can do that? Is there a Way in OpenCV?

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36

1 Answers1

1

The centroid of the black pixels appears higher (relative to the longest diametric line of the shape) in the images labelled "top" and lower (relative to that line) in the images labelled "bottom".

Maybe do some analysis of the moments with cv2.moments().

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • Ok, I tried it out and it looks like this is unfortunatley not the case... the centroid if the black pixels is still the same – Moritz Pfennig Mar 01 '23 at 18:07