How can I correctly identify an item within a larger image, but also detect if the item is the correct orientation?
I have some machinery at work with a small sticker I am trying to detect within a larger image. I am familiar with object detection techniques based on a trained classification model, but to further complicate the matter, the following scenarios are possible and need to be identified:
- The sticker exists (correct orientation)
- The sticker exists but is inside-out
- The sticker exists but is upside-down
- The sticker exists but is inside-out AND upside-down
- The sticker does not exist in the image
Options 2,3,4, and 5 are essentially all the same outcome... I just need to label these as BAD, while option 1 is the only GOOD case.
I can't post the actual pictures I am working with, but sketched out approximations of the different sticker options. These are examples of the stickers, but keep in mind the actual images I'm working with are much less crisp... the pixelization and shadowing/lighting from a camera makes it much more difficult to identify crisp contours.
I attempted to solve this problem with template matching since I was just trying to identify the sticker in the larger image, but that proved to be a waste of my time because template matching fails miserably for all cases except 1 and 5 (I can tell reasonably well based on score thresholds whether or not the image exists). It does ok with case 2 since the overall contours being identified are then backwards and a slightly different color when compared against the correct case, but again thresholding to extract just the contours of this sticker has proved difficult.
Cases 3 and 4 are exceptionally difficult to identify as bad, since the contours almost exactly match the good case 1. The main difference is that there is a larger dead space of yellow at the top of image 1, whereas in 3 and 4 that dead space is at the bottom since they've been flipped. I was hoping to use that in my identification, but I am stumped on how to do this part.
What machine vision / image processing techniques can I used to correctly classify case 1 as good, while identifying all the others as bad?
Topic pattern-recognition object-detection image-recognition
Category Data Science