2

I am trying to detect how many boxes in an image with given logo 'N' for example. How can i approach this problem. My main goal is to count each different product using opencv. So far I tried template matching with 'N' logo. enter image description here

used this to count below. enter image description here

From my example with haar cascade classifier training with different cascade models. enter image description here enter image description here

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
Inan
  • 31
  • 4
  • Have you tried canny and dilate and find countours? – Josip Juros Mar 17 '22 at 08:06
  • @JosipJuros OP wants to match the logo and then count. How does contouring helps in this case ? – balu Mar 17 '22 at 08:07
  • @balu How does it not, with the right parameters, doing len(findcountours) gives him the number of logos. since logos are boxes, and they would lit up nicely using countours. – Josip Juros Mar 17 '22 at 08:09
  • @balu And no he isnt trying to match them, The question is how to count, he tried template matching and it didnt work. Read the question. – Josip Juros Mar 17 '22 at 08:10
  • @JosipJuros OP says >> how many boxes in an image with given logo 'N' – balu Mar 17 '22 at 08:11
  • @balu In both his examples all boxes have the same logo. So we dont know if ever there will be a case where they are other non N logos. We dont have that information so we cant confirm it. With the information given my comments stands valid. – Josip Juros Mar 17 '22 at 08:12
  • @balu And for template matching or a NN classifier its much better to extract each countour (box) as its separate image wwhile creating the learning and training dataset. I know what im talking about buddy. – Josip Juros Mar 17 '22 at 08:15
  • 1
    @JosipJuros " for template matching or a NN classifier its much better to extract each countour (box) as its separate image wwhile creating the learning and training dataset. " Had this been your first comment, I would not have asked . – balu Mar 17 '22 at 08:22
  • @JosipJuros N logos does not important if we can find each product box. I tried "canny and dilate and find countours" with no luck. I cannot detect all lines between products. My sample was this one https://stackoverflow.com/questions/65717860/extract-boxes-from-sudoku-in-opencv – Inan Mar 17 '22 at 08:25

0 Answers0