I have an OpenCV script that can pull out the shape of different objects in an image. For example, here is the output from one script where it calculated the outline of 4 different shapes[enter image description here and here is the original image enter image description here I want to automatically identify if one of the objects is different from the others. In the given example, the object in the bottom right is smaller than the others, so it is an anomaly. In some cases there will be no anomalies. I am trying to figure out the best way to do this. What I'm thinking is that I can calculate the width and height of each object. Then I can calculate the average width and height. Then if any of the objects are more than 10% off the average height or width I could mark them as anomalies.

This seems like a janky / hardcoded solution though so I am wondering if there is a better way to do this?

  • $\begingroup$ How do you define an anomaly ? In your example it's only about the size but could the form, position, color or other element play a role to identify an anomaly ? If your problem is only about finding the (eventual) element with a different size I would think that your solution is good, the question would then be "how to find the good ratio ?". $\endgroup$ – kirua Feb 4 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.