2
$\begingroup$

I am trying to implement a box detection algorithm. In my pipeline, I start with image warping to simulate a frontal view of the shelf containing the boxes (assuming boxes are straight in that compartment). This then facilitates filtering extracted edges (ex. Canny) to only keep strictly horizontal and vertical edges. Once there I get something like this:

enter image description here

As a human being it is easy to say that there is almost a rectangle where the box is, even two rectangles, one for the box cover. This is not because you see the box image in the background, even with edges only it is obvious. Here is the edge only image:

enter image description here

I am trying to come up with some kind of operator that scans all the image and returns the best fitting rectangles.

Best fitting here means:

  • The rectangle model has a high relative number of red pixels on its edges (let's say 80% or so) Cross-Correlation maybe?
  • The ratio between length and width should be bigger than 0.5.
  • (Optional) The inside of the rectangle should be 80% empty or so

There could also be a tolerance parameter for the rectangle model, where red pixels in an area of +/- tolerance are also considered to belong to the rectangle being tested.

As scanning all different rectangles sizes at all different image position is computationally not realistic, what would be an efficient approach to solve this problem? My intuition is screaming "Convolution" at me but I am not sure how to model that case.

EDIT: Here is the original image

enter image description here

$\endgroup$
  • $\begingroup$ can you post the original image? $\endgroup$ – Tolga Birdal Feb 16 '17 at 21:10
  • $\begingroup$ I added it, but would that add something? $\endgroup$ – Mehdi Feb 17 '17 at 9:47

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.