A contour fitting method based on spine features in Hough space

By combining the improved Hough space algorithm with machine learning, the problems of high label cost and poor robustness in library spine recognition were solved, achieving efficient and accurate spine detection and recognition.

CN120599272BActive Publication Date: 2025-10-31JILIN UNIVERSITY
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511096403.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-06
Publication Date
2025-10-31
Estimated Expiration
2045-08-06

AI Technical Summary

Technical Problem

Existing technologies for library spine recognition suffer from problems such as high labeling costs, low efficiency of manual inventory, insufficient robustness of traditional computer vision, long time consumption for dataset annotation, and large differences in model performance, especially poor recognition performance in complex lighting and gap environments.

Method used

An improved Hough space algorithm is used for line segment accumulation, angle selection, and line segment merging. Combined with machine learning algorithms, the accurate identification of spine features is achieved through dataset creation and training.

Benefits of technology

It significantly reduces the burden of manual annotation, improves the specificity and robustness of the dataset, and achieves high-precision spine detection in complex environments. The recall rate and F1 score are significantly improved, and the recognition accuracy reaches 99.31%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120599272B_ABST
    Figure CN120599272B_ABST
Patent Text Reader

Abstract

This invention proposes a contour fitting method based on spine features in Hough space, relating to the field of image recognition technology. The method involves loading a spine image and obtaining a set of line segments through line detection. For all line segments in the set, an improved Hough space algorithm is used to transform the line segments from discrete to continuous linear. Line segments with center coordinates within a preset range are retained. The distance between the two endpoints of line segments with angles within a desired range and the two endpoints of the currently traversed line segments is calculated. If the distance is within a threshold range, the line segment is added to the dictionary. The endpoints of each line segment in the dictionary are extracted, and the x-coordinates of the intersection points of all fitted line segments are calculated. Line segments with the same direction are selected, and the intersection points that meet the conditions are combined into the vertices of a quadrilateral. The vertex coordinates of all rectangles are saved. The labeled dataset and the spine image are trained using a machine learning algorithm to predict the spine image, thus completing the segmentation and recognition of the spine image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention proposes a contour fitting method based on spine features in Hough space, which relates to the field of image recognition technology. Background Technology

[0002] In recent years, artificial intelligence technology has ushered in its third wave of development, with machine learning methods, represented by deep learning, achieving breakthroughs in the field of computer vision. In object detection, model architectures have continuously evolved, from two-stage algorithms based on region proposals such as Faster R-CNN and Mask R-CNN to single-stage detection algorithms represented by the YOLO series and SSD. With the iterative upgrades of the NVIDIA CUDA architecture and the introduction of dedicated computing units such as Tensor Cores, coupled with the maturity of distributed training technologies, the training efficiency of complex deep neural networks such as ResNet-152 and EfficientNet has been improved by orders of magnitude. Of particular note is the innovative application of the Transformer architecture in the vision field (such as VisionTransformer), which achieves more powerful feature extraction capabilities through self-attention mechanisms. These technological advancements provide a solid algorithmic foundation for image recognition tasks.

[0003] In the field of intelligent library management, existing spine recognition technology faces three major technical bottlenecks: First, RFID-based solutions require attaching a special tag to each book, and the cost of purchasing and maintaining tags for millions of books can reach several million yuan, and there is also the problem of recognition failure caused by tag detachment; Second, manual inventory methods are inefficient and cannot meet the daily operation and maintenance needs of large libraries; Third, traditional computer vision methods lack robustness in real-world scenarios such as complex lighting and perspective distortion.

[0004] It is worth noting that deep learning-based solutions exhibit unique advantages: they can adapt to diverse environments and be trained under various conditions, enhancing robustness. Furthermore, when faced with the problem of gaps between books, traditional algorithms may also identify gaps as books, causing errors.

[0005] There are also related problems in deep learning for book spine recognition. One is the source of the dataset. Currently, the dataset annotation mainly comes from manual annotation. There are no relevant public datasets. Annotating a large dataset requires a lot of time and manpower. The second is the training of the relevant models. Although there are many object detection algorithms, the performance of different models varies.

[0006] Existing research on book spine segmentation mainly focuses on traditional algorithms and machine learning. Traditional algorithms, such as "A Line Sorting Method with Dynamic Angle Adjustment in Book Spine Segmentation" (application number CN202210147636.3), obtain a line set through line detection, calculate the angle of each line and store it in a list; perform angle calculation, rotate the image as a whole according to the parameters of the rotated image, and simultaneously rotate the line set obtained from line detection according to these parameters to obtain a new line set, which is then sorted according to the parameters; after sorting by a sliding window, line fitting is performed. In terms of machine learning, for example, in "A Method for Spine Segmentation and Matching of Books in Naturally Placed State" (application number CN202411278130.1), a YOLOv5 network is used as the front end of the book image, and the vertical spine image is used as the network input; the Deeplab v3plus network is used as the spine segmentation network, and the Dense RA-ASPP framework in Deeplab v3plus is replaced; the Deeplab v3plus network is used as the spine segmentation network. The v3plus network incorporates a CBB module; VGG16 and FHNet are used to obtain VGG features, low-frequency features, high-frequency features, and high-low frequency fusion features of the book spine; color clustering and the feature library for book spine matching are cascaded to obtain a deep feature cascaded matching method. Y-Deeplab v3plus is used to segment book images, obtaining accurate book spine images as query images for the deep feature cascaded matching method. Deep feature extraction and matching are then performed on the query images to obtain the matching results for the book spine images. However, for the former, traditional algorithms still need to improve robustness in low light, gaps between book spines, and background noise. Single parameter adjustment is slightly insufficient in complex scenarios. For the latter, one of the problems that all machine learning algorithms need to address is dataset creation. Creating a self-built database remains a massive undertaking, and rapid book spine recognition still requires continuous research. Summary of the Invention

[0007] To address the aforementioned technical problems, this invention proposes a contour fitting method based on spine features in Hough space, comprising the following steps:

[0008] Step 1: Load the spine image and obtain the line segment set through line detection;

[0009] Step 2: For all line segments in the line segment set, use the improved Hough space algorithm to transform the line segments from discrete to continuous linear.

[0010] Step 3: Retain line segments whose center coordinates are within the preset range, calculate the distance between the two endpoints of the line segments whose angles are within the expected range and the two endpoints of the currently traversed line segments. If the distance is within the threshold range, add the line segment to the dictionary LineCategory and proceed to the next traversal.

[0011] Step 4: Extract the endpoints of each line segment from the dictionary LineCategory, add all endpoints to the plst list, and extract the points closest to and farthest from the origin in the plst list as the start and end points of the fitted line segment.

[0012] Step 5: Calculate the x-coordinates of the intersection points of all fitted line segments, filter the line segments with the same direction, and combine the intersection points that meet the conditions into the vertices of a quadrilateral.

[0013] Step 6: Traverse all quadrilaterals to obtain the four vertices of each quadrilateral, draw rectangles, save the vertex coordinates of all rectangles, construct a dataset, and label it.

[0014] Step 7: Train the labeled dataset and spine images using machine learning algorithms to predict the spine images, thus completing the segmentation and recognition of the spine images.

[0015] In a preferred embodiment, the improved Hough space algorithm includes: a line segment accumulation step, an angle filtering step, and a line segment merging and secondary filtering step.

[0016] In a preferred embodiment, the line segment accumulation step includes:

[0017] Calculate the length D of line segment i. i

[0018] ;

[0019] The length D that satisfies the following conditions i Accumulate:

[0020] .

[0021] in, The sum of all line segments satisfying the condition represents the total length, where δ is the Dirac function, which is only valid when... and The value is 1 at this time. and Let x and y be the x and y coordinates of the two endpoints of line segment i, and n represent the total number of line segments. Let be the distance from the origin to line segment i in Hough space. Let be the angle between line segment i and the horizontal axis in Hough space; This represents the distance from the line to the origin. The angle between the line and the horizontal axis.

[0022] In a preferred embodiment, the angle selection step includes:

[0023] Calculate the slope K of the line segment, and then convert the slope K into an angle using the arctangent function. If the angle The sine value is greater than If the angle exceeds the allowed range, skip the current processing step and continue to judge the next line segment.

[0024] In a preferred embodiment, the line segment merging and secondary filtering steps include:

[0025] set up A line set represents the set of line segments in the parameter space Hough_space, which combines all line segments that satisfy rule F. Updated to Line set,

[0026] .

[0027] Wherein, rule F represents the filtering method. The line set satisfies the condition that the straight-line distance from the two endpoints of the line segment to the target is less than a pre-set threshold. line segments ;

[0028] For the updated The operation is performed on each line segment in the line set to obtain the final fitted line segment set. :

[0029]

[0030] in The fitted line segment is the preset value. The length is , From coordinates Composition, in which It is all line segments in the line set The coordinates closest to the origin. It is all line segments in the line set The coordinates furthest from the origin.

[0031] In a preferred embodiment, in step 2, line segments with the same center point and angle are stored in the dictionary LineCategory, and the lengths of line segments with the same center point and angle are stored in Hough_space.

[0032] In a preferred embodiment, in step 3, all elements in Hough_space are traversed to obtain the length of the line segments. Then, all line segments are filtered according to a preset filterThr length, retaining the center coordinates of the line segments. exist Line segments within the range.

[0033] Compared with the prior art, the present invention has the following beneficial technical effects:

[0034] This invention aims to accelerate the creation of self-built libraries by starting with dataset production. Different libraries and book placement environments are different, and datasets can be unique. However, dataset production is very cumbersome. Therefore, we start with traditional algorithms to help accelerate dataset production, and then use machine learning to identify book spines in images and obtain the coordinates of the identified book spines to complete the segmentation and extraction of book spines in images.

[0035] By expanding and optimizing the Hough space, and taking into account factors such as angle and length filtering, and combining visualization tools to accelerate dataset construction, the burden of manual annotation is greatly reduced. Furthermore, by combining with machine learning algorithms, the specificity and robustness of the dataset are improved, resulting in more accurate spine detection. Attached Figure Description

[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0037] Figure 1 This is a flowchart of the spine contour detection method of the present invention;

[0038] Figure 2 Flowchart for implementing the extended Hough transform;

[0039] Figure 3 This is a schematic diagram illustrating the actual usage process;

[0040] Figure 4 This is a schematic diagram of line detection in an image;

[0041] Figure 5 This is a schematic diagram of the linear filtering range. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0043] In the accompanying drawings of specific embodiments of the present invention, in order to better and more clearly describe the working principle of each component in the system and show the connection relationship of each part in the device, only the relative positional relationship between each component is clearly distinguished. It does not constitute a limitation on the signal transmission direction, connection sequence, or size, dimension, and shape of each part within the component or structure.

[0044] Example 1

[0045] Traditional image feature detection methods mainly rely on the Hough transform algorithm, which is an image feature detection method based on a parameter space voting mechanism. Its core idea is to map lines in the image space to a parameter space (such as the angle-radius space in polar coordinates) and use an accumulator to count peak values ​​to locate the lines.

[0046] Specifically, for any point (x, y) in the image space, the parameter space equation of the traditional image feature detection method is:

[0047]

[0048] in, This represents the distance from the line to the origin. The maximum distance from the straight line to the origin. The angle between the line and the horizontal axis.

[0049] The parameter space is discretized, an accumulator matrix is ​​constructed, and the number of collinear points is counted to determine the candidate line c. The Hough transform has a certain degree of robustness to noise and local occlusion.

[0050] The Hough Transform relies on line detection algorithms, but in practical applications, images often contain short and broken lines after line segment extraction, making it impossible to form a complete and continuous spine border. Furthermore, traditional line segment fitting methods struggle to handle interference from spine text and edge jaggedness. Simply relying on angle fitting may result in parallel but not overlapping lines after extension, while fitting only the distance between line segments leads to unstable angles, causing overall angle deviation with each fitting iteration. Additionally, the traditional Hough Transform uses binary voting, giving equal weight to various line segments, which creates significant interference in the Hough Space. In spine images, texture noise (such as page edges and light reflection) generates numerous spurious peaks, increasing the false detection rate. The large parameter space also leads to significant memory consumption and computation time increases, making it difficult to meet real-time requirements. This high-dimensional computational overhead severely hinders the application of the Hough Transform in large-scale datasets and real-time processing scenarios.

[0051] To address the aforementioned issues, this invention proposes an improved Hough space algorithm based on focus optimization. By expanding and optimizing the Hough space, and considering factors such as angle and length filtering, and combining it with visualization tools to accelerate dataset construction, the algorithm significantly reduces the burden of manual annotation. Furthermore, by combining it with machine learning algorithms, the algorithm enhances the specificity and robustness of the dataset, achieving more accurate spine detection.

[0052] The improved Hough space algorithm based on focusing optimization of this invention specifically includes:

[0053] (1) Segment accumulation

[0054] When accumulating line segments in an image, smaller noisy line segments are ignored, while the influence of long spine border line segments is enhanced, thus making the spine boundary more prominent.

[0055]

[0056]

[0057] in, The result represents the weighted summation of all line segments in Hough space, and the total length of all line segments satisfying the above conditions is also represented. Hough space is a space containing all line segments in Hough space. Let be the parameter space of the coordinate axes, and δ be the Dirac function, which is only valid when... and The value is 1. That is, the length D of line segment i is only 1 when the parameters of line segment i satisfy the above conditions. i Only then will it be included in the accumulation.

[0058] in, Let x and y be the x and y coordinates of one endpoint of the line segment. Let x and y be the coordinates of the other endpoint of the line segment. Let i be the length of line segment i, and n represent the total number of line segments. Let be the distance from the origin to line segment i in Hough space. Let be the angle between line segment i and the horizontal axis in Hough space; This represents the distance from the line to the origin. Let Hough_space be the angle between the line and the horizontal axis, where Hough_space is a coordinate system. This is the parameter space for the coordinate axes.

[0059] Since the spine border lines are mostly parallel, the parameter space Hough_space accumulates the length of the parallel lines as a weight, and filters the line segments by selecting the length, filtering out the interference of short line segments, so that the main direction of the spine still presents a more significant peak in the Hough space, reflecting the direction priority of the spine.

[0060] (2) Angle selection:

[0061] Adjusting the angle reduces background texture interference and improves the robustness of recognition.

[0062] Given that most books in the library are placed vertically, the Hof space needs to be designed to accommodate them. Figure 5 The line segments within the blue area shown are filtered.

[0063] This can be achieved through the following steps:

[0064] Calculate the slope K between two points: Given the coordinates of two points, calculate the slope of the line connecting them.

[0065] The slope is calculated as follows: the difference between the vertical coordinates is used as the denominator, and the difference between the horizontal coordinates is used as the numerator. Note that the slope direction may be negative.

[0066] Convert the slope to the corresponding angle. Based on the slope K between the two points, use the arctangent function ( Convert it to angle Form, so as to make angles Determining the range.

[0067] Calculate the sine of the angle: Further calculate the sine of the angle.

[0068] Set angle Sine threshold In order to make angles The screening process requires first setting a reasonable sine threshold value. This is used to define the boundary range for subsequent judgment conditions. The specific value of Value can be optimized according to actual needs, and Value is a value less than 1.

[0069] Determine if a line segment meets the angle filtering criteria: If the sine of the obtained angle is greater than... If the angle exceeds the allowed range, skip the current processing step and continue to judge the next line segment.

[0070] (3) Segment merging and secondary filtering:

[0071] To address the jagged edges appearing on adjacent book edges during book arrangement, adjacent short and broken lines are merged into the main boundary line to reduce gap interference. The initially selected long line segments undergo secondary filtering to remove short lines and background texture interference, ensuring the accuracy of the final detection results.

[0072] Filtering out line segments further reduces the influence of background and other factors, but the line segments of the spine are still discrete. To address this, line segment merging and secondary filtering are proposed. This step compares the Euclidean distances from the endpoints of approximately parallel straight lines to the target line, and then compares the fitted line segments with the total length again, retaining those with Euclidean distances less than a certain value. And the fitted line segment length / total length is less than The line ( and All are preset thresholds.

[0073] set up A line set represents lines in the parameter space Hough_space, merging all line segments that satisfy rule F. Updated to Line set,

[0074]

[0075] Wherein, rule F represents the filtering method. The line set satisfies the condition that the straight-line distance from the two endpoints of the line segment to the target is less than a pre-set threshold. line segments and joined Line concentration.

[0076] For the updated Perform operations on each line segment in the line set. Depend on The coordinates of the minimum and maximum distances from all points in the line set to the origin. Composition, in which yes All line segments in the line set The coordinates closest to the origin yes All line segments in the line set The coordinates farthest from the origin:

[0077]

[0078] in As a preset value, This is the final set of fitted line segments. The fitted line segments are then processed... length Make a judgment based on the sum of the lengths of the total discrete state line segments. In comparison, considering that the line segments may not be parallel during near-line segment detection and the total length may not be absolutely equal, but the length should also be within a certain range, a threshold is set in advance for judgment, which has a good effect.

[0079] The above operations complete the secondary filtering, thereby transforming the line segments from discrete to continuous, and thus fitting the spine border.

[0080] Since OpenCV extracts mostly short and broken lines, a single Hough transform cannot effectively filter this noise, often misidentifying short broken lines such as text on the spine as borders. Therefore, this invention, based on the Hough transform formula, introduces a length-weighted mechanism to effectively enhance the suppression of short broken lines, thereby achieving specific adjustments to spine detection and improving overall recognition performance.

[0081] Testing was conducted on a self-built database to evaluate precision, recall, and F1 score. Precision was most concentrated around 68%, and even under extremely complex conditions such as poor lighting and low resolution, the precision distribution did not fall below 55%. For some simple scenarios, precision values ​​could exceed 90%, even achieving complete recognition. Compared to precision, recall was more concentrated, ranging from 75% to 85%. The F1 score also exhibited an upward skewed distribution, with a peak value near 80%, far exceeding the average, indicating that no extreme outliers significantly affected the overall performance evaluation. The YOLOv8 model obtained through machine learning achieved a spine recognition accuracy of 99.31%, essentially achieving complete spine recognition.

[0082] Example 2

[0083] like Figure 1 The flowchart shown is for the spine contour detection of the present invention, which includes two parts: dataset creation steps and model training steps.

[0084] I. Dataset creation steps, specifically including the following steps:

[0085] Step 1: Load the spine image and obtain the line segment set through line detection.

[0086] Load an image in grayscale, obtain a set of line segments through line detection, and calculate the length and angle of each line segment.

[0087] Step 2: Apply the improved Hough space algorithm to focus on optimizing all line segments in the line segment set, thus completing the transformation of the line segments from discrete to continuous.

[0088] The improved algorithm based on focus optimization in Example 1 is applied to all line segments, transforming them from two-dimensional coordinates to parameter space. Line segments with the same center point and angle are stored in the dictionary LineCategory, and the lengths of line segments with the same center point and angle are stored in the parameter space Hough_space.

[0089] Step 3: Retain line segments whose center coordinates are within the preset range. Calculate the distance between the two endpoints of the line segment whose angle is within the expected range and the two endpoints of the currently traversed line segment. If the distance is within the threshold range, add the line segment to the dictionary LineCategory.

[0090] Sort the Hough_space by its key value, retaining the longest line segments, and then sort all line segments by length. Iterate through all elements in the Hough_space, first obtaining the length of each line segment, and then filtering all line segments according to a preset filterThr length (set based on pixel values), retaining only the center coordinates of each line segment. exist Line segment filtering is implemented within the specified range.

[0091] The angle value of the line segment obtained from the first filtering is calculated, and it is determined whether the angle is within the expected range. If it is within the expected range, the distance between the two endpoints of this line segment and the endpoints of the currently traversed line segment is calculated. If the distance is within the threshold... If the line segment is within the specified range, add it to the dictionary LineCategory, and then proceed to the next iteration.

[0092] Step 4: Extract the endpoints of each line segment from the dictionary LineCategory, add all endpoints to the plst list, and then extract the points in the plst list that are closest to and farthest from the origin as the start and end points of the fitted line segments.

[0093] Merge segment groups by grouping segments that have duplicates together. Iterate through each `lines` in the segment group and check if it contains a segment. If it does, iterate through each segment `l` and extract its endpoints. and The endpoints are added to the `plst` list, and the Euclidean distance of each line segment `l` is calculated. The length `D` of each line segment is accumulated into the variable `dis`, where `dis` is the sum of the lengths of all elements. `plst` is sorted according to Euclidean distance, so the first element in the sorted list is the point closest to the origin, and the last element is the point farthest from the origin.

[0094] Then extract These can serve as the start and end points of the fitted line segment. Calculation The Euclidean distance between these two points is used as the maximum possible length of the fitted line segment. A straight line is fitted to these points, and the angle of the line is obtained, which is then converted into the slope and center point coordinates in two-dimensional space.

[0095] judge Does it exceed the threshold? If the threshold is exceeded Then join in , Storage length The set, and update Dictionary for calculating line segments and And use them as keys to store the endpoints of the fitted line segments.

[0096] Traverse the newly obtained line segments, using the longest fitted line segment as a reference, and retain those with lengths greater than the longest length. (Set threshold) line segments. Traverse all line segments and judge the distance from the two endpoints of other lines to this line. If the average distance from the two endpoints to this line segment is less than the threshold, the line is considered a short line and deleted, while irrelevant long line segments are kept.

[0097] Step 5: Calculate the x-coordinates of the intersection points of all lines, then sort them and take adjacent line segments one by one. Filter the line segments with similar directions to ensure that they are parallel or approximately parallel, and combine the intersection points that meet the conditions to form the vertices of a quadrilateral.

[0098] Step 6: Traverse all quadrilaterals, obtain the four vertices of each quadrilateral using the minimum bounding rectangle algorithm, draw a rectangle, fine-tune the rectangle using the visualization interface to better align it with the spine of the book, and save the coordinates of all rectangle vertices in clockwise order, while adding label_name and label_index to construct the dataset annotation.

[0099] Step 7: Train the labeled dataset and spine images using machine learning algorithms to predict the spine images, thus completing the spine image segmentation and recognition.

[0100] The labeled dataset and images are fed into the YOLOv8 machine learning algorithm for training, and the weights after training are obtained.

[0101] The trained weights are used to predict the image using the YOLOv8 model, detect the spine in the image, and obtain the spine's bounding box (label_name, normalized coordinates of the four vertices). This data is then used to segment the spine image, and the Baidu PaddlePaddle algorithm is used to recognize the spine content, thus completing the spine recognition.

[0102] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0103] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0104] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.

[0105] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. The databases involved in the embodiments provided in this application can include at least one of relational and non-relational databases. Non-relational databases can include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application can be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0106] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0107] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A contour fitting method based on spine features in Hough space, characterized in that, Includes the following steps: Step 1: Load the spine image and obtain the line segment set through line detection; Step 2: For all line segments in the line segment set, use the improved Hough space algorithm to transform the line segments from discrete to continuous linear. Step 3: Retain line segments whose center coordinates are within the preset range, calculate the distance between the two endpoints of the line segments whose angles are within the expected range and the two endpoints of the currently traversed line segments. If the distance is within the threshold range, add the line segment to the dictionary LineCategory and proceed to the next traversal. Step 4: Extract the endpoints of each line segment from the dictionary LineCategory, add all endpoints to the plst list, and extract the points closest to and farthest from the origin in the plst list as the start and end points of the fitted line segment. Step 5: Calculate the x-coordinates of the intersection points of all fitted line segments, filter the line segments with the same direction, and combine the intersection points that meet the conditions into the vertices of a quadrilateral. Step 6: Traverse all quadrilaterals to obtain the four vertices of each quadrilateral, draw rectangles, save the vertex coordinates of all rectangles, construct a dataset, and label it. Step 7: Train the labeled dataset and spine images using machine learning algorithms to predict the spine images, thus completing the segmentation and recognition of the spine images. The improved Hough space algorithm includes: a line segment accumulation step, an angle filtering step, and a line segment merging and secondary filtering step. The line segment accumulation step includes: Calculate the length D of line segment i. i ; The length D that satisfies the following conditions i Accumulate: ; in, The sum of all line segments satisfying the condition represents the total length, where δ is the Dirac function, which is only valid when... and The value is 1 at this time. and Let x and y be the x and y coordinates of the two endpoints of line segment i, and n represent the total number of line segments. Let be the distance from the origin to line segment i in Hough space. Let be the angle between line segment i and the horizontal axis in Hough space; This represents the distance from the line to the origin. The angle between the line and the horizontal axis.

2. The contour fitting method based on spine features in Hough space according to claim 1, characterized in that, The angle selection step includes: Calculate the slope K of the line segment, and convert the slope K into an angle using the arctangent function. If the angle The sine value is greater than If the angle exceeds the allowed range, skip the current processing step and continue to judge the next line segment.

3. The contour fitting method based on spine features in Hough space according to claim 1, characterized in that, The segment merging and secondary filtering steps include: set up A line set represents the set of line segments in the parameter space Hough_space, which combines all line segments that satisfy rule F. Updated to Line set, , Wherein, rule F represents the filtering method. The line set satisfies the condition that the straight-line distance from the two endpoints of the line segment to the target is less than a pre-set threshold. line segments ; For the updated The operation is performed on each line segment in the line set to obtain the final fitted line segment set. : , in The fitted line segment is the preset value. The length is , From coordinates Composition, in which It is all line segments in the line set The coordinates closest to the origin. It is all line segments in the line set The coordinates furthest from the origin.

4. The contour fitting method based on spine features in Hough space according to claim 1, characterized in that, In step 2, line segments with the same center point and angle are stored in the dictionary LineCategory, and the lengths of line segments with the same center point and angle are stored in Hough_space.

5. The contour fitting method based on spine features in Hough space according to claim 4, characterized in that, In step 3, all elements in Hough_space are traversed to obtain the length of the line segments. Then, all line segments are filtered according to the preset filterThr length, retaining the center coordinates of the line segments. exist Line segments within the range.

Citation Information

Patent Citations

  • Line sorting method for dynamically adjusting angle in spine segmentation

    CN114494270A

  • Spine segmentation and matching method for books in natural placement state

    CN119251495A

  • Automatic book counting method based on spine image characteristics and spatial filtering

    CN104182934A

  • Rectangular fitting-based grabbed data set automatic generation method

    CN112926503A