This application discloses a method and
system for mobile document
edge detection and correction based on semantic segmentation, comprising: acquiring a document image to be processed and camera parameters, and obtaining a document foreground
mask using a semantic segmentation model; performing contour detection and convex
hull processing on the document foreground
mask, and selecting the candidate contour with the highest comprehensive
score for multi-threshold polygon approximation to obtain a
quadrilateral; restoring the four points of the
quadrilateral to the original image coordinate
system to obtain ordered corner points; validating the ordered corner points and calculating the original
pixel aspect ratio; calculating the
horizontal and vertical vanishing points, and calculating the perspective shortening coefficients in the width and height directions; calculating the restored physical
aspect ratio, and performing
perspective transformation to obtain a corrected rectangular document image. This application can stably detect document edges and output ordered corner points, and at the same time restore the true physical
aspect ratio of the paper through vanishing points and
focal length compensation, making the perspective correction results more accurate.