4

I'm looking for a method to detect quadrilateral based on grayscale images like this.

enter image description here enter image description here

The actual solution I've made is based on HoughLines and has two problems:

  • As it is a parametric method, small changes on the input image gives me two different rectangles.
  • The outputs are not precise as the borders of the rectangle in the input image is thick.

enter image description here enter image description here

Can you recommend me another method to do this ? I'm actually looking at this article but it seems to be a slow method.

Ghilas BELHADJ
  • 13,412
  • 10
  • 59
  • 99
  • When a quad is found, disable pixel checking of its neighbouthood pixels with a max range. That range should be greater than that thickness. But this wouldn't detect one of two squares touching each other. Did you consider GPGPU for that article? – huseyin tugrul buyukisik Nov 08 '16 at 15:01
  • I have done this in C# but for essentially perfect rectangles and yours seem a bit messy, However the general idea was to find all the lines in the image, match them up to find corners and then join corners together so you have the rectangles, works surprisingly well for my situation but may be too simple for yours – TheLethalCoder Nov 08 '16 at 15:05
  • @huseyintugrulbuyukisik That's what I'm actually doing: filtering "similar" lines returned by HoughLines. For GPGPU I cannot, my application is designed for mobile devices. – Ghilas BELHADJ Nov 08 '16 at 15:11
  • @TheLethalCoder It works for me too when the rectangles are well drawn. thank you – Ghilas BELHADJ Nov 08 '16 at 15:11
  • Try [this](http://stackoverflow.com/a/34379766/2571705). To binarize, you can apply a threshold, or use Canny. You may not need to apply a morphological filter. From the two samples you have provided, seem the internal contours should work. – dhanushka Nov 11 '16 at 01:36

0 Answers0