1

I'm really new in image processing, so please sorry I'm a newbie. I tried to use the squares.cpp for detecting posters (since they usually are rectangles) without using expensive feature detectors (like SIFT). Unfortunately, the results are pretty much disappointing (as it was pretty predictable, results below).

Actually I don't care that only posters are detected, since statistically the posters are the biggest (or second biggest) rectangle in the image (decent heuristic).

The last image is the result of this code using this Hough Transofrm code (which seems working even worse!).

Any idea how to improve this code?

enter image description here

[enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Community
  • 1
  • 1
justHelloWorld
  • 6,478
  • 8
  • 58
  • 138

1 Answers1

0

Are you familiar at all with hough transforms? If not, I highly recommend you read up on them here The approach I would take, since it seems like your posters contrast their backgrounds quite a bit, is as follows:

Apply canny edge detection (consider changing to a HSV color space before the edge detection if rgb edge detection gives poor results) to the images, and perform a rectangular hough transform on the results of the canny. This will extract all "rectangular" shapes from your image. From there, you can look for features within the extracted rectangles (text maybe?) in order to further verify that the rectangles that you extracted are indeed posters.

One downfall of this method is that it may not work if the picture of the posters is taken at too great of an angle, but as long as the picture is taken relatively in front of the poster, you should be fine.

bstadt
  • 146
  • 11
  • I already tried [this](http://stackoverflow.com/a/10535006/4480180) code which uses the Hough transofrmation and it seems that works even worse (I'll update the question adding the results using it)! – justHelloWorld May 27 '16 at 15:42
  • Ahh so this code is attempting to generate a rectangle from a hough line transform. The hough transformation process was generalized for any arbitrary shape in this paper: http://www.sci.utah.edu/~gerig/CS7960-S2010/handouts/Ballard-Generalized-HoughT.pdf I would try to use a specifically rectangular transform as opposed to a line transform – bstadt May 27 '16 at 15:47
  • What do you mean by "specifically rectangular transform"? Do you know any implementation? – justHelloWorld May 27 '16 at 15:52
  • 1
    you 'likely' wont be able to find a prepackaged implementation on the internet that will magically work. If you are comfortable reading papers, try this: https://www.semanticscholar.org/paper/Rectangle-Detection-based-on-a-Windowed-Hough-Jung-Schramm/1033388e99c4b9861bf3782ea0e58ceb83d2c2b2/pdf If you are not comfortable reading papers, then consider brushing up on your CV basics (maybe grab a book from O'Reilly? There is a revised openCV book from them coming out in August, but most of it can be found online already) until you learn enough about CV to utilize papers – bstadt May 27 '16 at 15:55
  • Quoting [this](http://stackoverflow.com/a/10260685/4480180) answer: "Hough transform should work well for rectangle detection IFF you can assume that the sides of the rectangle are the most prominent lines in your image. Then you can simply detect the 4 biggest peaks in hough space and you got your rectangle." This is not clearly the case since there are many other (even better defined) lines in the example pictures. So maybe Hough transform is not the right choice? – justHelloWorld May 28 '16 at 05:28
  • Updated posting the last image as hough transf result – justHelloWorld May 28 '16 at 07:53