Monday, 30 January 2017

c++ - Poster detection in OpenCV?



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


Answer



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.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...