Ancient book bobbin leaf image splicing method and system based on crow's feet and edition core constraint
Through the ancient book tube leaf image stitching method based on crow's foot and page center constraints, the crow's foot features and page center constraints are used to align and transform images, which solves the problems of low efficiency and strong subjectivity of traditional stitching, and realizes efficient and accurate ancient book tube leaf image stitching.
Patent Information
- Application Number
- CN202510751515.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-09-09
AI Technical Summary
Traditional methods are inefficient and highly subjective in stitching images of cotyledon leaves in ancient books, and fail to fully utilize the structural characteristics of crow's feet, resulting in inaccurate stitching.
An image stitching method for ancient book tube leaves based on crow's foot and page center constraints is proposed. The crow's foot feature samples are extracted, a feature library is constructed, and crow's foot feature points are matched. The upper and lower bounding box positions are combined to construct the objective function and solve the optimal homography matrix for geometric alignment and thin plate spline transformation.
It significantly improves the efficiency and accuracy of image stitching of ancient book tube leaves, reduces the risk of mismatching, achieves seamless stitching, avoids subjective bias caused by human intervention, and complies with the principle of authenticity in ancient book restoration.
Smart Images

Figure CN120612232A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image splicing, and in particular to a method and system for splicing images of ancient book tube leaves based on crow's feet and page center constraints. Background Art
[0002] Image stitching technology in the digital processing of ancient cotyledon leaves is the core link in achieving high-precision digitization of ancient books and documents. Due to the particularity of traditional cotyledon leaf binding, a single leaf forms two sides after being folded in half. A single shot can only obtain an image of one side of the cotyledon leaf. During the digital processing process, the double-sided images need to be manually merged to restore the complete double-sided image and text information. Traditional stitching technology mainly targets images with overlapping areas. It uses feature point matching methods such as SIFT and SURF to achieve feature alignment of adjacent images, and combines the RANSAC algorithm to eliminate matching errors and ensure accurate overlap of image and text seams. However, cotyledon leaf images do not have overlapping areas. Manual stitching relies on experience to locate features such as crow's feet and frame, which is inefficient and highly subjective. The crow's feet feature is unique and is located in the middle seam of the cotyledon leaf. It has geometric symmetry and can be used as a natural alignment mark, but existing technologies have not fully utilized its structural characteristics.
[0003] In response to the above technical problems, the present invention proposes a method and system for splicing images of ancient book tube leaves based on crow's feet and page center constraints. Summary of the Invention
[0004] The purpose of the present invention is to address the defects of the existing technology and provide a method and system for splicing ancient book tube leaf images based on crow's feet and page center constraints.
[0005] In order to achieve the above objectives, the present invention adopts the following technical solutions: The image stitching method of ancient book cotyledons based on crow's foot pattern and page center constraint includes: S1. Extract crow's foot pattern feature samples from the middle raphe region of the cotyledon leaves in ancient books, and construct a crow's foot pattern feature library based on the crow's foot pattern feature samples; S2. Obtain the left and right leaf images of the ancient book tube leaf to be spliced, extract the crow's foot wrinkle candidate regions of the left and right leaf images respectively, match the candidate regions according to the sample feature library, and obtain the matching crow's foot wrinkle feature points in the left and right leaf images; S3. Perform upper and lower bounding box detection on the left and right leaf images respectively to obtain the upper and lower bounding box positions corresponding to the left and right leaf images; S4. Using the matched crow's feet feature points as control points, the coordinates of the corner points of the upper and lower bounding boxes are combined to construct an objective function, and the optimal homography matrix of the objective function is solved to obtain the geometric alignment of the left and right lobe images; S5. Perform thin plate spline transformation on the aligned left and right leaf images to obtain the final spliced ancient book tube leaf image.
[0006] Furthermore, the step S1 is specifically as follows: S11. Extract characteristic samples of crow's feet in the middle raphe region of cotyledons in ancient books; S12. Calculate the curvature geometry information and texture feature information of each crow's feet feature sample; S13. Build a crow's feet feature library containing geometric and texture information.
[0007] Furthermore, the calculation method of the curvature geometric information in step S12 includes calculating the crow's feet contour point sequence The discrete curvature is calculated point by point and expressed as: ;
[0008] Among them, k i Represents curvature sequence information; det() represents the pixel matrix determinant; p i Indicates the pixel coordinates of the current contour point; p i-1 Indicates the pixel coordinates of the previous contour point; p i+1 Indicates the pixel coordinates of the next contour point; i indicates the current contour point.
[0009] Furthermore, the matching of the candidate areas according to the sample feature library in step S2 is specifically as follows: calculating the curvature geometric information and texture feature information in the crow's feet candidate area, performing similarity calculation between the texture feature information in the crow's feet candidate area and the texture feature information of the crow's feet feature sample, and performing similarity calculation between the curvature geometric information in the crow's feet candidate area and the curvature geometric information of the crow's feet feature sample.
[0010] Furthermore, the similarity calculation between the texture feature information in the crow's feet candidate region and the texture feature information of the crow's feet feature sample is expressed as: ;
[0011] Among them, S represents the similarity result of texture feature information; α represents the weight coefficient; HOG sim represents the similarity of the directional gradient histogram; e represents a natural constant; θ L represents the rotation transformation angle of the left lobe crow's feet feature; θ R represents the rotation transformation angle of the crow's feet feature on the right lobe; The similarity calculation between the curvature geometric information in the crow's feet candidate region and the curvature geometric information of the crow's feet feature sample further includes: optimizing the curvature geometric information in the crow's feet candidate region using a loss function, which is expressed as: ;
[0012] Where L represents the loss value; n represents the total number of vertices in the contour sequence; Represents the curvature geometric information of the i-th contour point on the left lobe; Represents the curvature geometric information of the i-th contour point of the right lobe.
[0013] Furthermore, the step S3 is specifically as follows: S31. Performing enhancement processing on the horizontal edges corresponding to the upper and lower borders of the left and right leaf images to obtain enhanced left and right leaf images; S32. Statistically enhancing the horizontal edge density of the left and right leaf images in the height direction, and obtaining the positions of the upper and lower borders of the left and right leaf images based on the horizontal edge density; S33. Optimize the geometric constraints of the upper and lower border positions; S34. Calculate the intersection position between the crow's feet center line of the left and right lobe images and the upper and lower borders after geometric optimization, and determine whether the center line deviates from the center by more than a threshold based on the intersection position.
[0014] Furthermore, in step S4, the objective function is constructed, which is expressed as: ;
[0015] Among them, H represents the homography matrix; N represents the total number of vertices in the contour sequence; p i Represents the contour vertex; represents the vertex of the corrected target contour; λ represents the weight coefficient; j represents any one of the four page frame angle points; b j Indicates the j-th corner point of the page center border; Indicates the corner points of the target page frame after correction.
[0016] Furthermore, the method for locating the coordinates of the frame corner points in step S4 is: Based on the morphological closing operation, the upper and lower bounding boxes corresponding to the left and right leaf images are detected to obtain the complete border outline of the text center. The improved Hough transform algorithm is used to detect the straight line positions of the text center border outline. Based on the detected straight line positions, the coordinates of the four corner points of the text center border are determined through the corner response function.
[0017] Furthermore, the step S5 specifically includes: S51. The crow's feet feature point obtained in step S2 is used as the main control point; S52. The coordinates of the four corner points of the border of the page determined in step S4 are used as auxiliary control points; S53. Assign weights to the main control points and the auxiliary control points respectively, and construct an energy function based on the main control points, the auxiliary control points and the corresponding weights, which is composed of the weighted sum of the control point matching errors and the bending energy term. The optimal transformation parameters in the energy function are calculated by inverting the radial basis function matrix to achieve nonlinear deformation compensation for the aligned left and right leaf images, and obtain the final spliced ancient book tube leaf image.
[0018] Correspondingly, we also provide an ancient book tube leaf image stitching system based on crow's foot pattern and page center constraints, including: A construction module is used to extract crow's foot pattern feature samples from the middle suture area of the cotyledon leaves of ancient books, and to construct a crow's foot pattern sample feature library based on the crow's foot pattern feature samples; An extraction module is used to obtain the left and right leaf images of the ancient book tube leaf to be spliced, extract the crow's foot wrinkle candidate regions of the left and right leaf images respectively, match the candidate regions according to the sample feature library, and obtain the matching crow's foot wrinkle feature points in the left and right leaf images; The detection module is used to detect the upper and lower bounding boxes of the left and right lobe images respectively to obtain the upper and lower bounding box positions corresponding to the left and right lobe images; The solution module is used to use the matched crow's feet feature points as control points, combine the coordinates of the border corner points in the upper and lower bounding box positions to construct the objective function, and solve the optimal homography matrix of the objective function to obtain the geometric alignment of the left and right lobe images; The transformation module is used to perform thin plate spline transformation on the aligned left and right leaf images to obtain the final spliced ancient book tube leaf image.
[0019] Compared with the existing technology, the present invention solves the core problem in the splicing of ancient book tube leaves through targeted design. Different from the conventional method that relies on general image features, this technology is the first to use the crow's foot structure as the reference alignment mark, making full use of its natural mid-seam symmetry characteristics, and significantly reducing the risk of mismatching in highly similar texture scenes. By integrating the multimodal matching mechanism of geometric curvature and texture gradient features, combined with the dual optimization strategy of upper and lower frame space constraints, the robustness of the registration under complex damage conditions is effectively improved. The nonlinear deformation compensation algorithm is further introduced to break through the limitations of the traditional rigid transformation model, accurately repair the geometric distortion caused by paper wrinkles or scanning distortion, and achieve a seamless splicing effect. The full-process intelligent design not only greatly improves the processing efficiency, but also avoids the subjective deviation of manual intervention through data-driven objective alignment criteria, strictly adheres to the principle of authenticity in the restoration of ancient books, and provides innovative technical means for the intelligent and efficient splicing of ancient book tube leaves in the digital processing process. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 This is a flow chart of the method for splicing images of ancient book cotyledons based on crow's feet and page center constraints provided in Example 1; Figure 2This is a sample diagram of some crow's feet wrinkles in the existing crow's feet wrinkle feature library provided in Example 1; Figure 3 This is the original image of the left and right leaves of the ancient book tube to be spliced together provided in Example 1; Figure 4 This is a flow chart of the method for detecting the upper and lower borders of bobbin leaves provided in Example 1; Figure 5 This is a flow chart of generating a seamlessly spliced cotyledon leaf image provided in Example 1; Figure 6 This is a diagram of the left and right leaves of an ancient book tube to be spliced, as provided in Example 1. DETAILED DESCRIPTION
[0021] The following describes the embodiments of the present invention through specific examples. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.
[0022] The purpose of the present invention is to address the defects of the existing technology and provide a method and system for splicing ancient book tube leaf images based on crow's feet and page center constraints. Example
[0023] This embodiment provides a method for splicing ancient book leaf images based on crow's feet and page center constraints. Figure 1 Shown, including: S1. Extract crow's foot pattern feature samples from the middle raphe region of the cotyledon leaves in ancient books, and construct a crow's foot pattern feature library based on the crow's foot pattern feature samples; S2. Obtain the left and right leaf images of the ancient book tube leaf to be spliced, extract the crow's foot wrinkle candidate regions of the left and right leaf images respectively, match the candidate regions according to the sample feature library, and obtain the matching crow's foot wrinkle feature points in the left and right leaf images; S3. Perform upper and lower bounding box detection on the left and right leaf images respectively to obtain the upper and lower bounding box positions corresponding to the left and right leaf images; S4. Using the matched crow's feet feature points as control points, the coordinates of the corner points of the upper and lower bounding boxes are combined to construct an objective function, and the optimal homography matrix of the objective function is solved to obtain the geometric alignment of the left and right lobe images; S5. Perform thin plate spline transformation on the aligned left and right leaf images to obtain the final spliced ancient book tube leaf image.
[0024] In step S1, crow's foot wrinkle feature samples are extracted from the mid-seam area of the cotyledon leaves of ancient books, and a crow's foot wrinkle sample feature library is constructed based on the crow's foot wrinkle feature samples.
[0025] like Figure 2 Shown are some crow's feet sample images in the existing crow's feet feature library.
[0026] Step S1 is specifically as follows: S11. Extract characteristic samples of crow's feet in the middle raphe region of cotyledons in ancient books; S12. Calculate the curvature geometry information and texture feature information of each crow's feet feature sample; S13. Build a crow's feet feature library containing geometric and texture information.
[0027] In this embodiment, the crow's foot wrinkle features of the middle seam area of the cotyledon leaves of the existing ancient books are extracted by manual calibration as samples and saved. Then, the curvature geometric information and the histogram of oriented gradients (HOG) texture feature information of each sample are calculated. The calculation method can be implemented by the existing method. Then, a crow's foot wrinkle sample feature library is constructed based on the calculated curvature geometric information and texture feature information. The method for generating curvature geometric information includes the following steps: n}Calculate the discrete curvature k point by point i , that is, the curvature of each point is the geometric information, which can be expressed as: ;
[0028] Among them, k i Indicates curvature sequence information; det() represents the pixel matrix determinant, and samples with curvature standard deviation σ<0.3 are retained in the database; p i Indicates the pixel coordinates of the current contour point; p i-1 Indicates the pixel coordinates of the previous contour point; p i+1 Indicates the pixel coordinates of the next contour point; i indicates the current contour point.
[0029] In step S2, the left and right leaf images of the ancient book tube to be spliced are obtained, and candidate crow's foot wrinkle regions are extracted from each of the left and right leaf images. The candidate regions are then matched against the sample feature library. If a match is found, the matching crow's foot wrinkle feature points in the left and right leaf images are obtained. If a match is not found, manual splicing is performed.
[0030] like Figure 3The figure shows the original image of the left and right leaves of an ancient book tube to be spliced together. This embodiment extracts candidate crow's foot wrinkle regions from the left and right leaf images, and calculates the curvature geometry information and texture feature information in the candidate crow's foot wrinkle regions for each leaf, obtaining the curvature geometry information of the candidate crow's foot wrinkle regions and the texture feature information of the candidate crow's foot wrinkle regions. The similarity between the texture feature information in the candidate crow's foot wrinkle regions and the texture feature information of the crow's foot wrinkle feature samples in step S1 is then calculated, and the similarity between the curvature geometry information in the candidate crow's foot wrinkle regions and the curvature geometry information of the crow's foot wrinkle feature samples in step S1 is also calculated, obtaining texture similarity and curvature similarity.
[0031] In this embodiment, the left and right leaf images of the ancient book tube to be spliced do not need to be pre-cut with black background and overlapping edges of the tube leaves. Figure 6 shown.
[0032] In this example, matching crow's feet features are searched within a limited selectable area within the cotyledon leaf images to improve matching search speed. The selectable area for the left leaf image is limited to the original [width-width / 8, width] and [height / 4, height / 2], while the selectable area for the right leaf image is limited to the original [0, width / 8] and [height / 4, height / 2]. Width and height are the width and height pixel dimensions of the original image, respectively.
[0033] The calculation method of texture similarity is expressed as: ;
[0034] The weight coefficient α of texture features and geometric features is expressed as: ;
[0035] Among them, S represents the similarity result of texture feature information; α represents the weight coefficient; HOG sim represents the similarity of the directional gradient histogram; e represents a natural constant; θ L represents the rotation transformation angle of the left lobe crow's feet feature; θ R Represents the rotation transformation angle of the right lobe crow's feet feature.
[0036] In this embodiment, the stitching of cotyledon leaf images is an important part of the ancient book image processing process. From scanning, cropping, stitching, and OCR, manual participation is required. Image degradation or corrosion is also manually judged here, and the weight coefficient is manually adjusted to achieve a stitching result that meets production requirements, thereby realizing dynamic adjustment of the image degradation degree. When a wormhole or tear defect is detected, the lower limit of α is set to 0.5.
[0037] The left lobe contour points after the curvature similarity transforms the feature map into a translation and rotation transformation , calculate the curvature of the crow's feet feature of the left lobe; in order to maintain the consistency of curvature, the contour points of the right lobe do not need to be rotated or translated, but are determined by the loss function, so the curvature of the original contour points of the right lobe is , calculated by optimizing the curvature consistency loss function, the loss function is expressed as: ;
[0038] Where L represents the loss value; the total number of vertices in the contour sequence; i represents any vertex in the sequence; Represents the curvature geometric information of the i-th contour point on the left lobe; Represents the curvature geometric information of the i-th contour point of the right lobe.
[0039] In step S3, upper and lower bounding box detection is performed on the left and right leaf images respectively to obtain the upper and lower bounding box positions corresponding to the left and right leaf images.
[0040] Locate the upper and lower bounding boxes of the tube blades to provide spatial constraints for splicing alignment. Figure 4 As shown, the detection of the upper and lower borders of the bobbin leaf includes the following steps: S31. Perform enhancement processing on the horizontal edges corresponding to the upper and lower borders of the left and right leaf images respectively to obtain enhanced left and right leaf images.
[0041] The horizontal edge enhancement processing of this embodiment combines direction-adaptive threshold adjustment, morphological closing operation repair, and precise direction screening to effectively improve the detection accuracy of the upper and lower borders in the image of the cotyledon leaf of the ancient book, and provides reliable spatial constraint information for accurate image stitching. Specifically: Directionally adaptive thresholding technology analyzes pixel intensity variations in different directions within an image and dynamically adjusts the threshold to enhance horizontal edge features. For the image of the left and right leaves of an ancient book tube in this example, the horizontal border lines typically correspond to the upper and lower boundaries of the tube leaves. These lines can become blurred or broken due to erosion, scanning noise, or binding damage.
[0042] To address the aforementioned blurring or fragmentation issues, this embodiment grayscales the left and right lobe images separately to simplify computation. A direction-sensitive operator (such as a one-dimensional Gaussian filter scanning horizontally) is then used to calculate the horizontal gradient response of each pixel. Based on the statistical properties of the gradient response (such as the mean and standard deviation), a threshold is dynamically determined, preserving significant horizontal changes (such as the start and end points of the border) while suppressing subtle vertical changes.
[0043] Morphological closing involves performing a dilation followed by an erosion operation. Its purpose is to fill small gaps in edges and connect broken lines while preserving the overall direction of the lines. This is particularly important for repairing broken borders caused by wrinkles in the paper, insect damage, or human damage during scanning.
[0044] This example uses a 1×15 horizontal structuring element (kernel) for closing operations. This 1×15 kernel is chosen because it covers enough horizontally to connect most broken border segments, while only covering a single pixel vertically, minimizing interference with vertical features. The dilation operation expands the line by finding the maximum pixel value within the kernel's area, while the erosion operation removes isolated noise points by finding the minimum pixel value.
[0045] After the above processing, the image still contains edge information in various directions. In order to accurately extract the horizontal border, it is necessary to further filter out the edges that are dominant in the horizontal direction.
[0046] Use the Canny edge detection algorithm to obtain edge pixels in the image. The Canny algorithm effectively detects significant edges in an image through a dual-thresholding method and non-maximum suppression. Subsequently, for each detected edge pixel, its normal direction is calculated (i.e., the direction of the edge is perpendicular to the direction of the fastest grayscale change). The edge direction is determined through geometric transformations (such as the Hough transform) or by directly calculating the gradient direction histogram. Edge pixels whose normal direction θ lies in the interval [-10°, 10°] are retained. These pixels correspond to dominant horizontal edges, while edge pixels in other directions are discarded, resulting in clear horizontal border candidate regions.
[0047] S32. Calculate the horizontal edge density of the left and right lobe images in the height direction after the statistical enhancement process, and obtain the positions of the upper and lower borders of the left and right lobe images according to the horizontal edge density.
[0048] The upper and lower borders of this embodiment are located by statistically analyzing horizontal edge density and weighted clustering to effectively extract the upper and lower borders of the cotyledon leaf image, providing precise spatial constraints for subsequent stitching. Specifically: Horizontal edge density reflects the distribution of horizontal edge pixels within each row of an image. The upper and lower borders of the left and right lobes of a bobbin typically appear as high-density regions of continuous horizontal edge pixels. By calculating the horizontal edge density along the image height (i.e., vertical direction), we can quickly locate these high-density regions and preliminarily determine candidate locations for the upper and lower borders.
[0049] In this embodiment, the left and right leaf images processed in step S31 are scanned row by row and the number of horizontal edge pixels in each row is counted. The statistical results are normalized to the interval [0, 1] to form an edge density histogram. The peak areas in the histogram correspond to the locations of the upper and lower borders of the left and right leaf images. To reduce the influence of noise, the histogram can be smoothed using a Gaussian filter.
[0050] The upper and lower borders of cotyledons are usually long and continuous horizontal line segments. By extracting these long and continuous horizontal line segments and merging similar line segments using a clustering algorithm, the main border line can be extracted more accurately.
[0051] Horizontal line segments are extracted from the image using methods such as line segment detection based on the Hough transform or direct scanning. These line segments consist of a series of continuous horizontal edge pixels. For each extracted horizontal line segment, its length and continuity (e.g., pixel connectivity between the start and end points of the segment) are calculated. Length reflects the coverage of the line segment, and continuity reflects the completeness of the line segment. Line segments are weighted based on their length and continuity. Longer, continuous segments are weighted higher, while shorter or discontinuous segments are weighted lower. Clustering algorithms such as DBSCAN or K-means are used to cluster the weighted horizontal line segments. Clustering uses the start and end point coordinates of the line segments as feature vectors, and the weights are combined to form a distance metric. Through clustering, similar line segments are merged into clusters, each representing a candidate for a primary border line. From each cluster, the line segment with the highest weight is selected as the representative line segment of the cluster. Alternatively, the line segments in the cluster are fitted (e.g., linearly) to obtain a smoother, more accurate border line. Finally, the upper and lower borders of the image are determined based on their upper and lower positional relationships.
[0052] S33. Perform geometric constraint optimization on the positions of the upper and lower borders. The specific implementation is as follows: S331. Parallelism constraint. After alignment, the corresponding bounding boxes of the left and right leaves remain parallel:
[0053]
[0054] in, The slopes of the upper border of the left leaf, the upper border of the right leaf, the lower border of the left leaf, and the lower border of the right leaf, respectively. is the tolerance threshold, in this embodiment .
[0055] S332. Equidistant constraint. The spacing between the left and right leaf borders remains equal:
[0056] in, The coordinates of the corner points of the left leaf bottom border, left leaf top border, right leaf bottom border, and right leaf top border, respectively. is the distance difference threshold, in this embodiment Pixels.
[0057] S333. Symmetry constraints. With the center seam as the axis of symmetry, the left and right leaf border points satisfy the mirror relationship constraint: ;
[0058] ;
[0059] in, The horizontal coordinate of the left leaf upper border, the vertical coordinate of the left leaf upper border, the horizontal coordinate of the right leaf upper border, the vertical coordinate of the right leaf upper border, is the image width, is the coordinate tolerance. In this embodiment Pixels.
[0060] S34. Calculate the intersection position between the crow's feet center line of the left and right lobe images and the upper and lower borders after geometric optimization, and determine whether the center line deviates from the center by more than a threshold based on the intersection position.
[0061] The crow's foot wrinkle feature points obtained in step S2 have already determined the precise locations of the crow's feet in the left and right leaf images. However, the crow's foot seam, the axis of symmetry connecting the crow's foot wrinkle features on the left and right leaves, is typically located at the middle seam of the cotyledon. Therefore, the centering of the middle seam is verified; if the middle seam deviates from the center by more than a threshold, the upper and lower bounding box detection parameters are optimized in reverse order.
[0062] Calculate the distance between the center seam and the top and bottom borders. If the absolute value of the deviation is less than the set threshold, the center seam is considered centered; otherwise, the center seam is considered off-center.
[0063] If the center seam deviates from the center by more than a threshold, it is considered that the current upper and lower border detection results have errors and need to be reversely optimized. Specifically, by adjusting the upper and lower border detection parameters (such as the threshold for horizontal edge enhancement, the kernel size for morphological closing operations, the angle range for horizontal edge screening, etc.), the upper and lower border detection and geometric constraint optimization are re-performed until the center of the middle seam meets the requirements or the maximum number of optimization times is reached.
[0064] In this embodiment, the mid-seam deviation judgment threshold satisfies ,in Take 1-8 pixels, Set the value between 0.005 and 0.03, where W is the image width in pixels. This ensures that even with small images (small W value) or low-resolution scans, small offsets can still be effectively detected. The value of depends on the specific application scenario. In the ancient book images collected digitally at DPI=300, , used for conventional well-preserved ancient books, , used for ancient book tube leaves that are severely insect-damaged / torn.
[0065] This embodiment uses the crow's feet coordinated alignment to ensure that the center seam lines of the left and right leaf images of the tube are centered between the upper and lower frames, thereby improving the accuracy and aesthetics of the splicing result.
[0066] In step S4, the matched crow's feet feature points are used as control points, and the coordinates of the border corner points in the upper and lower bounding box positions are combined to construct the objective function, and the optimal homography matrix of the objective function is solved to obtain the geometric alignment of the left and right lobe images.
[0067] In the process of stitching ancient book tube leaf images, the dual-constraint joint optimization aims to achieve high-precision image alignment by constructing an objective function and solving the optimal homography matrix by combining the crow's foot wrinkle feature points obtained in step S2 with the coordinates of the text center border corner points at the upper and lower bounding box locations in step S3. The objective function is constructed based on the constraints of the crow's foot wrinkle feature points and the coordinates of the text center border corner points.
[0068] The coordinate constraints of the corner points of the text center frame at the upper and lower bounding box positions are as follows: the left and right leaf images are binarized, and the upper and lower bounding boxes corresponding to the left and right leaf images after binary processing are detected based on the morphological closing operation to eliminate text interference and obtain the complete text center frame outline. The improved Hough transform algorithm is used to detect the straight line position of the text center frame outline, and the coordinates of the four corner points of the text center frame are determined based on the detected straight line position through the corner response function; the angle between the constrained straight lines is 90±2°, and the corner response function is used to determine the coordinates of the four corner points of the text center frame. Determine the coordinates of the four corners, where M is the Harris matrix and k=0.04.
[0069] The objective function is constructed based on the crow's foot feature point constraints and the coordinate constraints of the center border corner points, which is expressed as: ;
[0070] Where H represents the homography matrix to be solved, which is solved by the least squares method; N represents the total number of vertices in the contour sequence; i represents any vertex in the sequence; p i Represents the contour vertex; represents the vertex of the corrected target contour; λ represents the weight coefficient; j represents any one of the four page frame angle points; b j Indicates the j-th corner point of the page center border; Indicates the corner points of the target page frame after correction.
[0071] After obtaining the optimal homography matrix H, we can use it to transform the left lobe image to align it with the right lobe image. The transformed image will satisfy the constraints of the crow's feet feature points and the corner points of the center border, thus achieving high-precision image stitching.
[0072] In step S5, the aligned left and right leaf images are transformed using thin plate splines to obtain the final spliced ancient book tube leaf image.
[0073] The left and right leaf images obtained in step S4 may be deformed, so the nonlinear deformation is eliminated by thin plate spline (TPS) transformation to generate a seamless spliced cocoon leaf image result, as shown in the following figure: Figure 5 As shown, specifically: S51. Use the crow's feet feature points obtained in step S2 as main control points.
[0074] The crow's feet feature points obtained in step S2 are the corresponding point pairs with the same geometric and texture features on the left and right lobe images. , including bifurcation points (the starting point of the branch in the crow's feet), vertices (the highest or lowest point of the contour in the crow's feet) and extreme curvature points (the points with the largest curvature on the crow's feet contour, these points are sensitive to shape changes and are suitable as feature points), which can ensure the alignment of key features.
[0075] When the left and right lobe images to be matched are in severely damaged areas (such as insect bites, tears, etc.), the crow's feet feature points may be missing or incomplete, resulting in inaccurate feature point matching. Therefore, virtual control points can be supplemented through curvature interpolation.
[0076] The curvature interpolation condition is: when the curvature difference between adjacent feature points is less than the set threshold, it is considered that the curvature of the area changes smoothly and a virtual control point can be inserted.
[0077] Interpolation point generation method: Calculate the curvature difference between adjacent feature points. If the curvature difference is less than a threshold, insert one or more virtual control points between the two feature points. The curvature values of the inserted virtual control points are obtained through linear interpolation or spline interpolation.
[0078] The matched feature points and supplemented virtual control points are used as the main control point set for subsequent TPS transformation.
[0079] S52. Use the coordinates of the four corner points of the page center frame determined in step S4 as auxiliary control points.
[0080] Get the detected upper and lower border coordinates of the page center from step S4 The upper border of the page center is sampled at an interval of 50, and a series of sampling points are obtained. The lower border of the page center is sampled at an interval of 50, and a series of sampling points q are obtained. j .
[0081] Calculate the target position of each sampling point according to the width W of the target page after splicing .
[0082] Pair the sampling points on the original center border with their corresponding target points to form auxiliary control point pairs. The auxiliary control point pairs are used as the input of the TPS transformation for subsequent deformation compensation stitching.
[0083] S53. Assign weights to the main control points and the auxiliary control points respectively, and construct an energy function based on the main control points, the auxiliary control points and the corresponding weights, which is composed of the weighted sum of the control point matching errors and the bending energy term. The optimal transformation parameters in the energy function are calculated by inverting the radial basis function matrix to achieve nonlinear deformation compensation for the aligned left and right leaf images, and obtain the final spliced ancient book tube leaf image.
[0084] Since the crow's foot feature points are key points with unique geometric structures and textures in the cotyledon leaf image, they play a decisive role in the accuracy of image stitching, so they are assigned higher weights, such as To ensure these core features are precisely aligned during the transformation process. If the crow's feet area is slightly damaged or blurred, but the feature points are still recognizable, their weight can be appropriately reduced to prevent minor deviations in local features from affecting the overall stitching effect. This requires manual or automatic judgment and adjustment based on the clarity, completeness, and matching reliability of the crow's feet feature points.
[0085] The border points of the page center mainly provide geometric structural constraints for the entire image and are crucial for maintaining the integrity and proportional relationship of the spliced image. A relatively low weight is assigned to it, such as , to balance the strength of spatial constraints and prevent the center border points from excessively influencing the stitching results and causing local feature distortion. When the center border detection results deviate or the image exhibits overall deformation, the center point weight can be appropriately increased to strengthen its constraint on the stitching results, ensuring that the center structure of the stitched image meets expectations.
[0086] The energy function consists of the weighted sum of the control point matching errors and the bending energy term, which aims to find the optimal transformation that can align the control points while maintaining the natural deformation of the image. Therefore, the energy function is expressed as:
[0087] Among them, E tps represents…; i represents…; ω i represents the weighted sum of control point matching errors, ; T represents the TPS transformation function; α represents the bending energy term, energy term Suppress excessive page deformation and perform inverse calculations using the radial basis function matrix.
[0088] This part of energy measures the degree of deviation between the transformed feature points and the target points, and the weight determines the influence of different feature points on the stitching results.
[0089] By solving the minimum value of the energy function through the optimization algorithm, the optimal TPS transformation parameters that meet the precise alignment of crow's foot features and the space constraints of the center of the page can be obtained.
[0090] The weight distribution and energy function construction method of this embodiment enables image stitching to focus on the alignment of core features while taking into account the rationality of the overall structure and the naturalness of deformation, effectively improving the quality and effect of stitching images of ancient book tube leaves.
[0091] The final ancient book cotyledon leaf is obtained according to the above method. The ancient book cotyledon leaf has the characteristics of crow's feet, which are distributed in the middle seam. The crow's feet characteristics on the left and right leaves are symmetrical.
[0092] This embodiment solves the core pain points of feature fuzziness and poor adaptability in traditional ancient book splicing by constructing a standardized crow's foot feature library and a multimodal matching mechanism. Based on the joint modeling of the geometric curvature and texture gradient of crow's feet, it breaks through the limitation of the sensitivity of a single feature to damage and achieves high-precision candidate area screening. Through the dual optimization framework of rigid feature points and frame space constraints, the global optimal transformation parameters can still be stably solved in complex deformation scenarios, significantly enhancing the algorithm's anti-interference ability; further, thin plate spline transformation is used to dynamically compensate for nonlinear distortions such as paper wrinkles and insect bites, avoiding local dislocation problems caused by traditional affine models. Example
[0093] This embodiment provides an ancient book cotyledon leaf image splicing system based on crow's foot wrinkles and page center constraints, including: A construction module is used to extract crow's foot pattern feature samples from the middle suture area of the cotyledon leaves of ancient books, and to construct a crow's foot pattern sample feature library based on the crow's foot pattern feature samples; An extraction module is used to obtain the left and right leaf images of the ancient book tube leaf to be spliced, extract the crow's foot wrinkle candidate regions of the left and right leaf images respectively, match the candidate regions according to the sample feature library, and obtain the matching crow's foot wrinkle feature points in the left and right leaf images; The detection module is used to detect the upper and lower bounding boxes of the left and right lobe images respectively to obtain the upper and lower bounding box positions corresponding to the left and right lobe images; The solution module is used to use the matched crow's feet feature points as control points, combine the coordinates of the border corner points in the upper and lower bounding box positions to construct the objective function, and solve the optimal homography matrix of the objective function to obtain the geometric alignment of the left and right lobe images; The transformation module is used to perform thin plate spline transformation on the aligned left and right leaf images to obtain the final spliced ancient book tube leaf image.
[0094] It should be noted that the ancient book tube leaf image splicing system based on crow's feet and page center constraints provided in this embodiment is similar to that in the first embodiment, and will not be described in detail here.
[0095] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the concept of the present invention. The scope of the present invention is determined by the scope of the appended claims.
Claims
1. A method for stitching ancient book cotyledon leaf images based on crow's feet and page center constraints, characterized by: include: S1. Extract crow's foot pattern feature samples from the middle raphe region of the cotyledon leaves in ancient books, and construct a crow's foot pattern feature library based on the crow's foot pattern feature samples; S2. Obtain the left and right leaf images of the ancient book tube leaf to be spliced, extract the crow's foot wrinkle candidate regions of the left and right leaf images respectively, match the candidate regions according to the sample feature library, and obtain the matching crow's foot wrinkle feature points in the left and right leaf images; S3. Perform upper and lower bounding box detection on the left and right leaf images respectively to obtain the upper and lower bounding box positions corresponding to the left and right leaf images; S4. Using the matched crow's feet feature points as control points, the coordinates of the corner points of the upper and lower bounding boxes are combined to construct an objective function, and the optimal homography matrix of the objective function is solved to obtain the geometric alignment of the left and right lobe images; S5. Perform thin plate spline transformation on the aligned left and right leaf images to obtain the final spliced ancient book tube leaf image.
2. The method for splicing ancient book cotyledon leaf images based on crow's feet and page center constraints according to claim 1 is characterized in that: The step S1 is specifically as follows: S11. Extract characteristic samples of crow's feet in the middle raphe region of cotyledons in ancient books; S12. Calculate the curvature geometry information and texture feature information of each crow's feet feature sample; S13. Build a crow's feet feature library containing geometric and texture information.
3. The method for splicing ancient book cotyledon leaf images based on crow's feet and page center constraints according to claim 2 is characterized in that: The calculation method of the curvature geometric information in step S12 includes: The discrete curvature is calculated point by point and expressed as: ; Among them, k i Represents curvature sequence information; det() represents the pixel matrix determinant; p i Indicates the pixel coordinates of the current contour point; p i-1 Indicates the pixel coordinates of the previous contour point; p i+1 Indicates the pixel coordinates of the next contour point; i indicates the current contour point.
4. The method for splicing ancient book cotyledon leaf images based on crow's feet and page center constraints according to claim 2 is characterized in that: In step S2, matching the candidate area according to the sample feature library is specifically performed as follows: calculating the curvature geometry information and texture feature information in the crow's feet candidate area, performing similarity calculation between the texture feature information in the crow's feet candidate area and the texture feature information of the crow's feet feature sample, and performing similarity calculation between the curvature geometry information in the crow's feet candidate area and the curvature geometry information of the crow's feet feature sample.
5. The method for splicing ancient book cotyledon leaf images based on crow's feet and page center constraints according to claim 4 is characterized in that: The similarity calculation between the texture feature information in the crow's feet candidate area and the texture feature information of the crow's feet feature sample is expressed as: ; Among them, S represents the similarity result of texture feature information; α represents the weight coefficient; HOG sim represents the similarity of the directional gradient histogram; e represents a natural constant; θ L represents the rotation transformation angle of the left lobe crow's feet feature; θ R represents the rotation transformation angle of the crow's feet feature on the right lobe; The similarity calculation between the curvature geometric information in the crow's feet candidate region and the curvature geometric information of the crow's feet feature sample further includes: optimizing the curvature geometric information in the crow's feet candidate region using a loss function, which is expressed as: ; Where L represents the loss value; n represents the total number of vertices in the contour sequence; Represents the curvature geometric information of the i-th contour point on the left lobe; Represents the curvature geometric information of the i-th contour point of the right lobe.
6. The method for splicing ancient book cotyledon leaf images based on crow's feet and page center constraints according to claim 1 is characterized in that: The step S3 is specifically as follows: S31. Performing enhancement processing on the horizontal edges corresponding to the upper and lower borders of the left and right leaf images to obtain enhanced left and right leaf images; S32. Statistically enhancing the horizontal edge density of the left and right leaf images in the height direction, and obtaining the positions of the upper and lower borders of the left and right leaf images based on the horizontal edge density; S33. Optimize the geometric constraints of the upper and lower border positions; S34. Calculate the intersection position between the crow's feet center line of the left and right lobe images and the upper and lower borders after geometric optimization, and determine whether the center line deviates from the center by more than a threshold based on the intersection position.
7. The method for splicing ancient book cotyledon leaf images based on crow's feet and page center constraints according to claim 1 is characterized in that: In step S4, the objective function is constructed, which is expressed as: ; Among them, H represents the homography matrix; N represents the total number of vertices in the contour sequence; p i Represents the contour vertex; represents the vertex of the corrected target contour; λ represents the weight coefficient; j represents any one of the four page frame angle points; b j Indicates the j-th corner point of the page center border; Indicates the corrected corner points of the target page border.
8. The method for splicing ancient book cotyledon leaf images based on crow's feet and page center constraints according to claim 1 is characterized in that: The method for locating the coordinates of the frame corner points in step S4 is: Based on the morphological closing operation, the upper and lower bounding boxes corresponding to the left and right leaf images are detected to obtain the complete border outline of the text center. The improved Hough transform algorithm is used to detect the straight line positions of the text center border outline. Based on the detected straight line positions, the coordinates of the four corner points of the text center border are determined through the corner response function.
9. The method for splicing ancient book cotyledon leaf images based on crow's feet and page center constraints according to claim 8, characterized in that: The step S5 specifically includes: S51. The crow's feet feature point obtained in step S2 is used as the main control point; S52. The coordinates of the four corner points of the border of the page determined in step S4 are used as auxiliary control points; S53. Assign weights to the main control points and the auxiliary control points respectively, and construct an energy function based on the main control points, the auxiliary control points and the corresponding weights, which is composed of the weighted sum of the control point matching errors and the bending energy term. The optimal transformation parameters in the energy function are calculated by inverting the radial basis function matrix to achieve nonlinear deformation compensation for the aligned left and right leaf images, and obtain the final spliced ancient book tube leaf image.
10. A splicing system based on the ancient book cotyledon leaf image splicing method based on crow's feet and page center constraints according to any one of claims 1 to 9, characterized in that: include: A construction module is used to extract crow's foot pattern feature samples from the middle suture area of the cotyledon leaves of ancient books, and to construct a crow's foot pattern sample feature library based on the crow's foot pattern feature samples; An extraction module is used to obtain the left and right leaf images of the ancient book tube leaf to be spliced, extract the crow's foot wrinkle candidate regions of the left and right leaf images respectively, match the candidate regions according to the sample feature library, and obtain the matching crow's foot wrinkle feature points in the left and right leaf images; The detection module is used to detect the upper and lower bounding boxes of the left and right lobe images respectively to obtain the upper and lower bounding box positions corresponding to the left and right lobe images; The solution module is used to use the matched crow's feet feature points as control points, combine the coordinates of the border corner points in the upper and lower bounding box positions to construct the objective function, and solve the optimal homography matrix of the objective function to obtain the geometric alignment of the left and right lobe images; The transformation module is used to perform thin plate spline transformation on the aligned left and right leaf images to obtain the final spliced ancient book tube leaf image.