Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Detect boxes on shelf Android OpenCV

Hi all, i'll repost here a question posted on StackOverflow (without real responses), I'll hope i'll be luckier here!

I'm developing an Android app that recognizes, from a store shelf image, all the boxes (products) present on the shelf.

My approach so far is the following:

  1. grayscale
  2. bilateral filter (or GaussianBlur, but I've found that using bilateral filter is better to preserve edges)
  3. adaptive threshold
  4. dilate (don't know if it's necessary)
  5. canny
  6. findContours

So, if the source image is simple, (like a b/w drawing of a shelf and some boxes) it can detect them, but with real images of shelves it isn't working.

The main problem is that single boxes have different "foreground" colors and logos, and my steps detect also all the edges of the "inner" box (i.e., the colours inside the edges of the box) and gives me totally nosense results. For simplicity I'll show belows my intermediate results and the source image:

1) source

source

2) grayscale

filter

3) filtered (gaussianBlur in this case)

adaptive

4) adaptive threshold

image description

5) dilation

image description

6) canny

image description

As you can see, because I cannot remove the foreground of each box, also all the edges given by the logos or text come into play and noises my results.

How can I overcome this problem?

My ony idea is trying to "remove" or decolouring the inner boxes, but i don't konw how to do it! Thanks to all!

P.S. please don't reply with links relative to the already tried tutorials found on this website. They didn't helped me solving the probem. Thanks!

Detect boxes on shelf Android OpenCV

Hi all, i'll repost here a question posted on StackOverflow (without real responses), I'll hope i'll be luckier here!

I'm developing an Android app that recognizes, from a store shelf image, all the boxes (products) present on the shelf.

My approach so far is the following:

  1. grayscale
  2. bilateral filter (or GaussianBlur, but I've found that using bilateral filter is better to preserve edges)
  3. adaptive threshold
  4. dilate (don't know if it's necessary)
  5. canny
  6. findContours

So, if the source image is simple, (like a b/w drawing of a shelf and some boxes) it can detect them, but with real images of shelves it isn't working.

The main problem is that single boxes have different "foreground" colors and logos, and my steps detect also all the edges of the "inner" box (i.e., the colours inside the edges of the box) and gives me totally nosense results. For simplicity I'll show belows my intermediate results and the source image:

1) source

source

2) grayscale

filter

3) filtered (gaussianBlur in this case)

adaptive

4) adaptive threshold

image description

5) dilation

image description

6) canny

image description

As you can see, because I cannot remove the foreground of each box, also all the edges given by the logos or text come into play and noises my results.

How can I overcome this problem?

My ony idea is trying to "remove" or decolouring the inner boxes, but i don't konw how to do it! Thanks to all!

P.S. please don't reply with links relative to the already tried tutorials found on this website. They didn't helped me solving the probem. Thanks!

EDIT:

A possible solution to that specific image could be (is really raw in this example cause i've done it manually ;) ): image description

And this app has to detect boxes and cans possibly, because ithout perspective (i.e. assume that I have images in front of the shelf), cans are viewed as boxes.

Detect boxes on shelf Android OpenCV

Hi all, i'll repost here a question posted on StackOverflow (without real responses), I'll hope i'll be luckier here!

I'm developing an Android app that recognizes, from a store shelf image, all the boxes (products) present on the shelf.

My approach so far is the following:

  1. grayscale
  2. bilateral filter (or GaussianBlur, but I've found that using bilateral filter is better to preserve edges)
  3. adaptive threshold
  4. dilate (don't know if it's necessary)
  5. canny
  6. findContours

So, if the source image is simple, (like a b/w drawing of a shelf and some boxes) it can detect them, but with real images of shelves it isn't working.

The main problem is that single boxes have different "foreground" colors and logos, and my steps detect also all the edges of the "inner" box (i.e., the colours inside the edges of the box) and gives me totally nosense results. For simplicity I'll show belows my intermediate results and the source image:

1) source

source

2) grayscale

filter

3) filtered (gaussianBlur in this case)

adaptive

4) adaptive threshold

image description

5) dilation

image description

6) canny

image description

As you can see, because I cannot remove the foreground of each box, also all the edges given by the logos or text come into play and noises my results.

How can I overcome this problem?

My ony idea is trying to "remove" or decolouring the inner boxes, but i don't konw how to do it! Thanks to all!

P.S. please don't reply with links relative to the already tried tutorials found on this website. They didn't helped me solving the probem. Thanks!

EDIT:

A possible solution to that specific image could be (is really raw in this example cause i've done it manually ;) ): image description

And this app has to detect boxes and cans possibly, because ithout perspective (i.e. assume that I have images in front of the shelf), cans are viewed as boxes.