views:

330

answers:

1

I have a fairly simple situation. I just don't know any specific terms to search for. I have a single image, in that image I have several other images that follow a basic pattern. They are rectangles and will possibly have landmark image to base things off of. An important part, is that I need to detect rotated/mis-scaled sub-images.

Basically what I need to be able to do is split 'business cards' from a single image into properly aligned single images.

Please excuse my bad paint skills! http://yfrog.com/eaproblemjj As I am also designing the cards to be scanned I can put in whatever symbol or something that would make detection easier (as I said a landmark)

+1  A: 

If your example is representative (which I doubt for some reason) then Hough transform is your friend (google it, there are plenty of explanations and code around). With it you'll be able to detect the rectangles.

Some examples of Hough transform in C# are http://www.koders.com/csharp/fid3A88BC1FF95FCA9D6A182698263A40EE7883CF26.aspx and http://www.shedletsky.com/hough/index.html

If what actually happens is that you scan some cards, and you have some control over the process, then I'd suggest that you ensure there is no overlap between cards, and provide a contrasting background (something very different from the cards). Then any edge-detection will get you close enough to what you've drawn in your example, and after that you can use Hough transform.

Alternatively, you can implement the paper http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.59.4239 which uses Hough transform to detect rectangles directly, without edge detection.

If I did not understand your problem, or you need clarifications, please edit your question further and post a comment on this answer.

AVB
I must be having really bad luck, but I can't seem to find any example code using Hough transformation, I found the wiki article obviously, but i didn't seem to wrap my head around it.I actually won't be able to control the scanning process, except for the design of the physical cards. If this helps any, just think of me wanting to take a scanned image of a jumble of standard business cards (we can assume they are all rectangle and have a logo in the top left), and separate them into correctly orientated single cards.
Lex
The cards will be white, on a black background, and will have black text/symbols.
Lex
See the updated answer. With white on black you should be OK with nearly any method. I could not find a good explanation of Hough transform online; probably an image processing book is your best bet if you can figure it out from what's around the Internet. It's not a trivial thing, but not complicated, either.
AVB