Hi,
I'm want to extract street signs from photographs and deskew them, but I don't know where to begin.
Deskewing I believe is the easy part once the borders are detected?
Here're a few sample images: http://imgur.com/a/uESgY
This one especially seems to be the most challenging: http://imgur.com/x7dylYS
I'd really appreciate any help. Thanks!
Detecting borders and Deskew
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Detecting borders and Deskew
What is your IM version and platform? Please alway provide that.
From your images, it will be very hard to detect the boundary of the sign, since the background color in places is very close. You could try -hough-lines. Then find the major lines from the sign and get the intersections. See viewtopic.php?f=4&t=25476
For deskewing, see -deskew. Or get the 4 bounding corners and use +distort perspective to rectify the image to a proper orthogonal rectangle.
From your images, it will be very hard to detect the boundary of the sign, since the background color in places is very close. You could try -hough-lines. Then find the major lines from the sign and get the intersections. See viewtopic.php?f=4&t=25476
For deskewing, see -deskew. Or get the 4 bounding corners and use +distort perspective to rectify the image to a proper orthogonal rectangle.
Re: Detecting borders and Deskew
ebr4him@mac ~> convert -version
Version: ImageMagick 6.9.6-2 Q16 x86_64 2016-10-11 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
Version: ImageMagick 6.9.6-2 Q16 x86_64 2016-10-11 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
Re: Detecting borders and Deskew
Would converting it black & white and inverting the colors help?fmw42 wrote: From your images, it will be very hard to detect the boundary of the sign, since the background color in places is very close. You could try -hough-lines. Then find the major lines from the sign and get the intersections. See viewtopic.php?f=4&t=25476
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Detecting borders and Deskew
No, I doubt that would help, since the sign color and background color are close whether color or grayscale or black and white.Would converting it black & white and inverting the colors help?
My best guess would be to do several fuzzy floodfills for each region in your sign and say make those white, then make the rest black.
Re: Detecting borders and Deskew
Aha, so the signs are always just two colors: green & red. There's black for some signs, and blue for handicap. Only the black is an issue.
So you're saying floodfill those regions and then discard the rest?
So you're saying floodfill those regions and then discard the rest?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Detecting borders and Deskew
I do not know that for a fact. But some of those colors may be nearly the same as the background.Aha, so the signs are always just two colors: green & red. There's black for some signs, and blue for handicap. Only the black is an issue.
Not discard. Just make it so that the outer regions of the sign are distinct from the background. Then you can do hough lines to find the boundary of the sign and then intersect the lines to get the corners. Then use the corner points to do a perspective transform to rectify the sign to orthogonal rectangle (right angles) so as to deskew.So you're saying floodfill those regions and then discard the rest?