iOS Determine the corners of a Business Card in realtime

后端 未结 1 1514
失恋的感觉
失恋的感觉 2020-12-31 19:55

I want to implement a business card detecting functionality like this app (https://scanbot.io). The camera should detect a business card and automatically take a picture of

相关标签:
1条回答
  • 2020-12-31 20:35

    Read about Hough Transform. With it, you can detect lines. I would urge you to detect straight lines and then find four lines that are approximately at a right angle to each other and take the rectangle with the biggest area.

    The steps would be:

    1. Edge detection using Sobel filter.
    2. Hough transform to find all straight lines in the image.
    3. Look at all parallel lines and then all lines 90 degrees to those parallel line pairs, to find possible rectangles.
    4. Pick the rectangle you like best. This could be by area, or by being best aligned to the phone, or you require that all edges are inside the visible camera image, or some other method.

    Lastly: Computer Vision is hard... don't expect easy results.

    Addendum

    I should note that step 3 above is very simple, because the angle the lines take are simply one dimension of your Hough space. So parallel lines will have in this dimension equal values, and orthogonal lines will be shifted by pi or 90 degrees.

    0 讨论(0)
提交回复
热议问题