Biological section line drawing detection method and device, computer equipment and storage medium

By drawing lines and rotating matches on biological slice images, identifying and analyzing multiple slice images, the problem of low detection accuracy in the prior art is solved, and more efficient biological slice image detection is achieved.

CN119599867APending Publication Date: 2025-03-11CHINAINSTRU & QUANTUMTECH (HEFEI) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411684796.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

The prior art is difficult to effectively identify and analyze multiple biological slice images, resulting in low detection accuracy.

Method used

By obtaining the original image of the biological slice, drawing lines are performed to determine the line drawing area image to be detected, and rotating the detection template and the line drawing area image at multiple rotation angles to obtain a match score. Determine the target slice image based on the score extreme value and setting conditions, and output its slice position information.

Benefits of technology

The detection accuracy of biological slice images is improved, and multiple slice images can be more efficiently identified and analyzed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119599867A_ABST
    Figure CN119599867A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a biological section line drawing detection method and device, computer equipment and a storage medium, and relates to the technical field of image processing. The method comprises the following steps: acquiring a biological slice original image comprising a plurality of slice images, drawing lines on the biological slice original image, and determining a line drawing area image according to the drawn lines; equally selecting a plurality of rotation angles in the rotation angle interval, and performing rotation matching on the detection template and the line drawing area image based on the plurality of rotation angles to obtain a plurality of matching scores; if a score extreme value in the plurality of matching scores meets a first matching condition, determining an optimal slice image corresponding to the score extreme value in the line drawing area image as a target slice image, and outputting slice position information; and otherwise, under the condition that the rotation angle interval meets the interval reduction condition, reducing the rotation angle interval so as to select a plurality of new rotation angles in the reduced rotation angle interval for continuing rotation matching. Therefore, the detection accuracy of the biological section image can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present specification relate to the field of image processing technology, and specifically to a method, device, computer equipment and storage medium for detecting lines in biological slices. Background Art

[0002] Biological slice images refer to images obtained by observing and photographing thin slices of biological samples through a microscope. They can be used for education, scientific research, medical diagnosis and treatment, etc., and have wide applications and importance in biology, medicine or other related fields. When multiple biological slices need to be further observed and analyzed, in order to improve observation efficiency or facilitate data analysis, sometimes multiple slice images are taken and put on one image for collection and sorting, and then further observation and analysis are carried out in a unified manner.

[0003] However, it is difficult to identify and analyze multiple slice images in related technologies, and the accuracy of biological slice detection needs to be improved. Summary of the invention

[0004] In view of this, multiple embodiments of this specification are dedicated to providing a biological slice line detection method, device, computer equipment and storage medium to improve the detection accuracy of biological slice images.

[0005] The embodiment of the present specification provides a method for detecting lines of biological slices, the method comprising: obtaining an original image of a biological slice, wherein the original image of the biological slice comprises a plurality of slice images; drawing lines on the original image of the biological slice, and determining a line area image to be detected according to the line drawing; selecting a plurality of rotation angles equally in a rotation angle interval, and performing rotation matching between a detection template and the line area image based on the plurality of rotation angles, so as to obtain a plurality of matching scores corresponding to the plurality of rotation angles one by one; wherein the matching score can represent the matching degree between the detection template and the best slice image in the line area image at the corresponding rotation angle, and the best slice image refers to the line area image. The slice image in the domain image that best matches the detection template; if the extreme score among the multiple matching scores meets the first matching condition, the best slice image corresponding to the extreme score in the line area image is determined as the target slice image, and the slice position information of the target slice image is output; otherwise, when the rotation angle interval meets the interval reduction condition, the rotation angle interval is reduced to select multiple new rotation angles in the reduced rotation angle interval for continuing the rotation matching; wherein, the rotation angle interval meets the interval reduction condition, which means that the angle interval between any two adjacent rotation angles among the multiple rotation angles in the rotation angle interval is greater than the minimum unit interval.

[0006] In some embodiments, the method further includes: when the score extreme value does not satisfy the first matching condition and the rotation angle interval does not satisfy the interval reduction condition, if the score extreme value satisfies the second matching condition, then the optimal slice image corresponding to the score extreme value in the line area image is determined as the target slice image, and the slice position information of the target slice image is output.

[0007] In some embodiments, a higher matching score indicates a lower matching degree; the first matching condition includes being less than or equal to a first set score, and the second matching condition includes being less than or equal to a second set score; wherein the first set score is less than the second set score.

[0008] In some embodiments, narrowing the rotation angle interval includes: determining the narrowed rotation angle interval based on adjacent angles of the rotation angle corresponding to the extreme score value, wherein the adjacent angle includes at least one of the multiple rotation angles.

[0009] In some embodiments, the drawn line is a straight line segment; determining the drawn line area image to be detected based on the drawn line includes: determining a first vector based on the coordinates of each of the two endpoints of the drawn line; determining a second vector based on the coordinates of any one of the two endpoints and the coordinates of any pixel point in the original image of the biological slice; calculating the vector inner product of the first vector and the second vector; when the vector inner product is greater than or equal to 0, if the distance between the pixel point and the drawn line is less than or equal to a first specified distance threshold, taking the pixel point as a pixel point in the drawn line area image; when the vector inner product is less than 0, if a specified multiple of the modulus value of the second vector is greater than a second specified distance threshold, taking the pixel point as a pixel point in the drawn line area image.

[0010] In some embodiments, the rotation matching of the detection template and the line area image based on the multiple rotation angles includes: determining a recommended angle based on the coordinates of each of the two endpoints of the line; for any of the slice images in the line area image, taking a rotation angle from the multiple rotation angles as the current rotation angle in turn, rotating the detection template based on the current rotation angle and the recommended angle, and obtaining a matching score between the detection template and the line area image at the current rotation angle.

[0011] In some embodiments, the method further includes: performing a frame selection based on the original image of the biological slice to obtain the detection template; determining a template mask of the detection template based on the detection template; rotating the detection template includes: rotating the template mask corresponding to the detection template to obtain a matching score between the detection template and the line area image.

[0012] In some implementations, the method further includes: after determining the target slice image, shrinking the template mask according to a specified coefficient and covering the target slice image to reduce interference with the rotation matching in subsequent iterations.

[0013] In some embodiments, after determining the target slice image, the method further includes: obtaining a slice contour perimeter and a slice contour area of ​​the target slice image, and obtaining a template contour perimeter and a template contour area of ​​the detection template; determining a first ratio between the slice contour perimeter and the template contour perimeter, and determining a second ratio between the slice contour area and the template contour area; if the first ratio is not within a first set range and / or the second ratio is not within a second set range, determining that the target slice image is a damaged slice.

[0014] The embodiment of the present specification provides a biological slice line detection device, the device comprising: an original image acquisition module, used to acquire a biological slice original image, wherein the biological slice original image includes a plurality of slice images; a line area determination module, used to draw lines on the biological slice original image, and determine the line area image to be detected according to the lines; a rotation matching iteration module, used to equally select a plurality of rotation angles in a rotation angle interval, and rotationally match a detection template with the line area image based on the plurality of rotation angles, so as to obtain a plurality of matching scores corresponding to the plurality of rotation angles one by one; wherein the matching score can represent the matching degree between the detection template and the best slice image in the line area image at the corresponding rotation angle. degrees, the best slice image refers to the slice image in the line area image that best matches the detection template; if the score extreme value among the multiple matching scores satisfies the first matching condition, the best slice image corresponding to the score extreme value in the line area image is determined as the target slice image, and the slice position information of the target slice image is output; otherwise, when the rotation angle interval satisfies the interval reduction condition, the rotation angle interval is reduced to select multiple new rotation angles in the reduced rotation angle interval for continuing the rotation matching; wherein, the rotation angle interval satisfies the interval reduction condition, which means that the angle interval between any two adjacent rotation angles among the multiple rotation angles in the rotation angle interval is greater than the minimum unit interval.

[0015] An embodiment of the present specification provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the line detection method described in any of the above embodiments when executing the computer program.

[0016] An embodiment of the present specification provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the line detection method described in any of the above embodiments is implemented.

[0017] In multiple implementations provided in this specification, first, an original biological slice image including multiple slice images is acquired; then, lines are drawn on the original biological slice image, and a line area image to be detected is determined based on the lines; then, a plurality of rotation angles are equally selected in a rotation angle interval, and a detection template is rotationally matched with the line area image based on the plurality of rotation angles, so as to obtain a plurality of matching scores corresponding to the plurality of rotation angles, wherein the matching score can represent the matching degree between the detection template and the best slice image in the line area image at the corresponding rotation angle, and the best slice image refers to the slice image in the line area image that best matches the detection template; then, a score extreme is determined from the plurality of matching scores. value, and determine whether the extreme score meets the set first matching condition; if the extreme score meets the first matching condition, the best slice image corresponding to the extreme score in the line area image is determined as the target slice image, and the slice position information of the target slice image is output; if the extreme score does not meet the first matching condition, it is determined whether the rotation angle interval of the current round meets the interval reduction condition, and if it does, the rotation angle interval is reduced to select multiple new rotation angles in the reduced rotation angle interval for continuing the next round of rotation matching, wherein the rotation angle interval meets the interval reduction condition, indicating that the angle interval between any two adjacent rotation angles in the multiple rotation angles of the rotation angle interval is greater than the minimum unit interval. In this way, the detection accuracy of biological slice images can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A schematic diagram of a process flow of a line drawing detection method provided in an embodiment of this specification;

[0019] Figure 2 A schematic diagram of an original image of a biological slice provided in an embodiment of this specification;

[0020] Figure 3 A schematic diagram of an image of a line drawing area to be detected provided in an embodiment of this specification;

[0021] Figure 4 A schematic diagram of the corresponding relationship between the rotation angle and the matching score provided in the implementation manner of this specification;

[0022] Figure 5 A schematic diagram of a detection template and a template mask for a line drawing detection method provided in an embodiment of this specification;

[0023] Figure 6 A schematic diagram of reducing and overlaying a slice image using a template mask provided in an embodiment of this specification;

[0024] Figure 7 A schematic diagram of a complete slice image and a damaged slice image provided for an embodiment of this specification;

[0025] Figure 8 A schematic diagram of a line drawing detection device provided in an embodiment of this specification;

[0026] Fig. 9 A schematic diagram of a computer device provided for embodiments of the present specification. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the solution of this specification, the technical solution in the implementation of this specification will be clearly and completely described below in conjunction with the drawings in the implementation of this specification. Obviously, the described implementation is only a part of the implementation of this specification, not all of the implementations. Based on the implementation in this specification, all other implementations obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.

[0028] The implementation manner of this specification provides a scenario example of a line detection method for a biological slice. In this scenario example, in order to improve the observation and analysis efficiency of multiple biological slices, multiple biological slice images captured and collected can be arranged and distributed on one image, and the image can be used as the original image of the biological slice for centralized observation or rapid comparison. In this way, the process can be simplified or further observation and analysis can be performed on the original image of the biological slice based on a unified standard, thereby improving the analysis efficiency of multiple biological slices.

[0029] In this scenario example, the biological slice original image may include a slice image area and a non-slice image area, and the slice image area may refer to any slice image of multiple slice images on the biological slice original image. Exemplarily, the multiple slice images may be arranged and distributed in an orderly or disorderly manner on the biological slice original image. Exemplarily, the morphology, shape or outline of any slice image of the multiple slice images may be any polygon or irregular shape. Exemplarily, the area or perimeter of any two slice images of the multiple slice images may be the same or different.

[0030] In this scenario example, multiple slice images on the biological slice original image may be difficult to identify, which will make it difficult to observe and analyze a single slice image or a slice image contained in a specified area or a partial area. Therefore, in order to quickly identify any slice image in the biological slice original image, a line drawing area image to be detected can be determined by drawing a line on the biological slice original image. For a biological slice original image, the shapes and contours of the multiple slice images contained are often similar. Therefore, the line drawing area image to be detected can be rotated and matched by the detection template to identify a single slice image. In this way, the detection efficiency and accuracy of the biological slice can be improved, and the area detection of the biological slice original image can also be realized. In addition, the detection results can be sorted and displayed.

[0031] This specification provides a method for detecting line drawing in a biological slice. Figure 1 , Figure 1 This is a flow chart of a biological slice line detection method provided by this embodiment. This embodiment provides method operation steps as shown in the flow chart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one execution method among many step execution sequences, and does not represent the only execution sequence. When the actual system or server product is executed, it can be executed in sequence or in parallel (for example, in a parallel processor or multi-threaded processing environment) according to the method shown in the embodiment. Specifically, Figure 1 As shown, the line drawing detection method may include the following steps.

[0032] Step S110: acquiring an original biological slice image, wherein the original biological slice image includes a plurality of slice images.

[0033] Specifically, the slice image region of the biological slice original image may be composed of one or more slice images, and the multiple slice images may be arranged in an orderly or disorderly manner in the slice image region of the biological slice original image, and may be arranged with a small overlap area. As an example, see Figure 2 The multiple slice images on the biological slice original image can be arranged linearly. As an example, the multiple slice images can be grouped and arranged horizontally or vertically. For example, they can be arranged according to Figure 2 Arranged and distributed as shown.

[0034] Step S120: drawing lines on the original image of the biological slice, and determining the line drawing area image to be detected according to the line drawing.

[0035] Specifically, a curve segment or a straight line segment can be drawn on the original image of the biological slice, or in other words, the line drawing can refer to a straight line segment or a curve segment, so as to determine the line drawing area image to be detected based on the line drawing. For example, the line drawing area image to be detected can be determined based on the distance between the pixel point and the line drawing in the original image of the biological slice. In this way, the area to be detected on the original image of the biological slice can be determined based on the line drawing, and the designated area detection or partial area detection can be realized. As an example, please refer to Figure 3 Based on the direction, shape or length of the line drawing, the line drawing area image to be detected may include a slice image or not, may include a complete single slice image, may include an incomplete slice image, or may include a damaged slice image. For example, Figure 3 An object area image determined based on the object 1 and an object area image determined based on the object 2 are shown.

[0036] Of course, it can be understood that the line drawing area image to be detected may also include a non-slice image area.

[0037] Step S130: Select multiple rotation angles equally in the rotation angle range, and perform rotation matching on the detection template and the line area image based on the multiple rotation angles to obtain multiple matching scores corresponding to the multiple rotation angles, wherein the matching score can represent the matching degree between the detection template and the best slice image in the line area image at the corresponding rotation angle, and the best slice image refers to the slice image in the line area image that best matches the detection template.

[0038] In some cases, the line area image may include a slice image or not, or may include a damaged or incomplete slice image, or may include one or more slice images. The shapes and contours of some slice images in the line area image may be similar or dissimilar, and the shapes of some slice images may be similar but the angles of distribution on the line area image may be different. Therefore, the template can be rotated to determine whether there is a slice image in the line area image or to detect the degree of matching of the slice images.

[0039] In some other cases, since the line area image may contain multiple slice images, the detection process of performing slice image detection on the line area image may be performed through a cyclic detection, or in other words, the detection process for the line area image may include one or more slice detection rounds, so as to identify one or more slice images in the line area image through one or more slice detection rounds. Specifically, in any slice detection round, it may be performed through one or more rotation matching rounds, or in other words, any slice detection round may include one or more rotation matching rounds.

[0040] Exemplarily, taking the current rotation matching round of the current slice detection round in one or more slice detection rounds as an example, first, multiple rotation angles are equally selected in the rotation angle interval corresponding to the current rotation matching round, and then, the detection template is rotationally matched based on each rotation angle in the multiple rotation angles to obtain multiple matching scores, wherein the multiple matching scores correspond one-to-one to the multiple rotation angles, and any matching score can represent the degree of matching between the detection template and the best slice image in the line area image at the corresponding rotation angle, and the best slice image refers to the slice image in the line area image that best matches the detection template.

[0041] For example, in the current rotation matching round, assuming that the rotation angle interval is [-10, 10], and the selected multiple rotation angles are -5°, 0° and 5°, respectively, the detection template can be rotationally matched based on -5°, 0° and 5°, respectively. For example, the detection template is rotationally matched with the line drawing area image based on a rotation angle of 5°. Since there may be no slice image or one or more slice images, or there may be damaged or complete slice images in the line drawing area image, when the detection template is rotationally matched with the line drawing area image based on a rotation angle of 5°, the matching degree between the detection template rotated based on the rotation angle of 5° and each slice image in the line drawing area image can be evaluated and scored, and based on the evaluation score, the slice image with the greatest matching degree or the most matching with the detection template can be used as the best slice image, that is, the best slice image corresponding to the rotation angle of 5° in the current rotation matching round and the corresponding matching score can be determined; similarly, the best slice images and corresponding matching scores corresponding to the rotation angles of -5° and 0° in the current rotation matching round can be determined in the same way.

[0042] As an example, a lower matching score indicates a higher matching degree. As another example, a higher matching score indicates a higher matching degree, which can be set according to actual conditions.

[0043] Step S140: If the extreme score among the multiple matching scores meets the first matching condition, the best slice image corresponding to the extreme score in the line area image is determined as the target slice image, and the slice position information of the target slice image is output; otherwise, when the rotation angle interval meets the interval reduction condition, the rotation angle interval is reduced to select multiple new rotation angles in the reduced rotation angle interval for continuing the rotation matching; wherein, the rotation angle interval meets the interval reduction condition, which means that the angle interval between any two adjacent rotation angles among the multiple rotation angles in the rotation angle interval is greater than the minimum unit interval.

[0044] In some cases, for the current rotation matching round of the current slice detection round, after obtaining multiple matching scores corresponding one-to-one to the selected multiple rotation angles, the extreme score among the multiple matching scores can be judged with the set first matching condition, and based on the judgment result, it is determined whether to perform the next rotation matching round in the current slice detection round. In this way, the matching result of the current slice detection round can be obtained through the iteration of the rotation matching round, and the slice image detection of the line area image can be realized by continuing the detection process of the iterative slice detection round.

[0045] Specifically, in the current rotation matching round of the current slice detection round, if the extreme score meets the first matching condition, the best slice image corresponding to the extreme score in the line area image can be determined as the target slice image, and the slice position information of the target slice image is output, the current slice detection round is ended, and the next slice detection round is performed. Exemplarily, the following is explained by taking the example that the lower the matching score, the higher the matching degree, that is, the extreme score can refer to the minimum score, the first matching condition can include less than or equal to the first set score, or the first matching condition can refer to less than or equal to the first set score, please refer to Figure 4 , the horizontal axis represents multiple rotation angles, and the vertical axis represents multiple matching scores. First, a minimum score value can be determined from multiple matching scores. If the minimum score value satisfies the first matching condition, or in other words, if the maximum score value is less than or equal to the first set score value, the best slice image corresponding to the minimum score value is determined as the target slice image, and the slice position information of the target slice image is output.

[0046] Exemplarily, the slice position information may include a corresponding rotation angle and corresponding coordinates.

[0047] Exemplarily, outputting the slice position information of the target slice image may refer to displaying and outputting the corresponding rotation angle and the corresponding coordinates in the slice position information of the target slice image. In addition, when displaying and outputting the corresponding rotation angle and the corresponding coordinates in the slice position information, the corresponding extreme score value may be output, so that the matching degree between the target slice image and the detection template can be represented by the corresponding extreme score value.

[0048] Specifically, in the current rotation matching round of the current slice detection round, if the score extreme value does not meet the first matching condition, it is possible to determine whether the corresponding rotation angle interval in the current rotation matching round meets the interval reduction condition. If the rotation angle interval meets the interval reduction condition, the rotation angle interval is reduced to select a new plurality of rotation angles in the reduced rotation angle interval for continuing the rotation matching, that is, to perform the next rotation matching round. Among them, the rotation angle interval meets the interval reduction condition, indicating that the angle interval between any two adjacent rotation angles in the plurality of rotation angles in the rotation angle interval is greater than the minimum unit interval. For example, assuming that the rotation angle interval is [-10, 10], and the plurality of selected rotation angles are -5°, 0° and 5° respectively, if the minimum unit interval is 1°, and the angle interval between the adjacent rotation angles in the rotation angles -5°, 0° and 5° is greater than the minimum unit interval 1°, therefore, the rotation angle interval [-10, 10] meets the interval reduction condition, that is, the interval can be reduced.

[0049] Specifically, in the current rotation matching round of the current slice detection round, if the extreme score value does not meet the first matching condition and the corresponding rotation angle interval does not meet the interval reduction condition, it can be determined whether the extreme score value meets the second matching condition. If the extreme score value meets the second matching condition, the best slice image corresponding to the extreme score value in the line area image can be determined as the target slice image, and the slice position information of the target slice image can be output, the current slice detection round is ended, and the next slice detection round is performed; if the extreme score value does not meet the second matching condition, the detection process for the line area image can be ended, that is, the rotation matching round iteration cycle and the slice detection round iteration cycle are ended.

[0050] Exemplarily, the lower the matching score, the higher the matching degree. That is, the extreme score value may refer to the minimum score value, and the second matching condition may include being less than or equal to the second set score value, or the second matching condition may refer to being less than or equal to the second set score value. If the minimum score value is less than or equal to the second set score value, the best slice image corresponding to the minimum score value is determined as the target slice image, and the slice position information of the target slice image is output, otherwise the rotation matching round iteration cycle and the slice detection round iteration cycle are terminated. Among them, the first set score value is less than the second set score value.

[0051] In the above embodiment, lines are drawn on the acquired original image of the biological slice, and the line area image to be detected is determined based on the lines. Then, based on multiple rotation angles selected in the rotation angle interval, rotation matching is performed with the line area image to obtain multiple matching scores corresponding to the multiple rotation angles. Then, the extreme score values ​​in the multiple matching scores are successively determined to determine whether they meet the first matching condition, whether they meet the interval reduction condition, and whether they meet the second matching condition. According to the determination results, slice detection rounds and rotation matching rounds are iterated and cycled. In this way, one or more slice images in the line area image can be detected, and thus the detection accuracy of the biological slice image can be improved.

[0052] In some embodiments, see Figure 5 The line drawing detection method may also include: performing frame selection based on the original image of the biological slice to obtain a detection template; and determining a template mask of the detection template according to the detection template.

[0053] Correspondingly, rotating the detection template may include: rotating the template mask corresponding to the detection template to obtain a matching score between the detection template and the slice image. In this way, the template mask may be used for rotation matching to improve the accuracy of rotation matching.

[0054] In some implementations, narrowing the rotation angle interval may include: determining a narrowed rotation angle interval based on an adjacent angle of the rotation angle corresponding to the extreme score value, wherein the adjacent angle includes at least one of the plurality of rotation angles.

[0055] As an example, the adjacent angle of any rotation angle may be other rotation angles adjacent to the rotation angle. As an example, the adjacent angle of any rotation angle may also be a critical angle of a rotation angle interval, wherein the plurality of rotation angles may include or exclude the critical angle.

[0056] Exemplarily, the rotation angle interval may refer to a radian interval, and correspondingly, the rotation angle may refer to a radian or a rotation radian. For example, the rotation angle interval may be represented as [-a, a], and the rotation angle interval [-a, a] may be converted into a radian interval [-b, b]. Then, radian -b / 2, radian 0, and radian b / 2 are selected in the radian interval [-b, b], and are used as rotation radians to rotate the detection template to perform rotation matching with the current slice image in the line area image. In this way, three matching scores corresponding to radian -b / 2, radian 0, and radian b / 2 may be obtained.

[0057] Next, the three matching scores of radian -b / 2, radian 0, and radian b / 2 are judged. If the matching score corresponding to radian 0 is the minimum value among the matching scores corresponding to radian -b / 2, radian 0, and radian b / 2, and it does not reach the set score, then according to the adjacent angles of radian 0, the arc interval that can be reduced is [-b / 2, b / 2], which means that the lowest score corresponding to the arc interval [-b, b] is located at [-b / 2, b / 2], and multiple new rotation arcs are selected in the reduced arc interval [-b / 2, b / 2] for the next round of rotation matching.

[0058] If the matching score corresponding to radian -b / 2 is the minimum value among the matching scores corresponding to radian -b / 2, radian 0, and radian b / 2, and it does not reach the set score, then according to the adjacent angles of radian -b / 2, the radian interval can be narrowed to [-b, 0], which means that the lowest score corresponding to the radian interval [-b, b] is located at [-b, 0], and new multiple rotation radians are continuously selected in the narrowed radian interval [-b, 0] for the next round of rotation matching.

[0059] If the matching score corresponding to radian b / 2 is the minimum value among the matching scores corresponding to radian -b / 2, radian 0, and radian b / 2, and it does not reach the set score, then according to the adjacent angles of radian b / 2, the radian interval can be narrowed to [0, b], which means that the lowest score corresponding to the radian interval [-b, b] is located at [0, b], and new multiple rotation radians are continuously selected in the narrowed radian interval [0, b] for the next round of rotation matching.

[0060] In the above implementation, the rotation angle range is narrowed based on the adjacent angles of the rotation angle corresponding to the extreme score value. In this way, the rotation matching between the detection template and the slice image in the line area image can be optimized, which can improve the matching efficiency and detection efficiency of the slice image.

[0061] In some implementations, taking the line on the original image of the biological slice as a straight line segment as an example, determining the line area image to be detected according to the line may include the following steps S210-S250.

[0062] Step S210: Determine a first vector according to the coordinates of the two endpoints of the drawing line.

[0063] In some cases, when determining the line drawing area image to be detected based on the line drawing on the original image of the biological slice, it can be determined based on the distance between any pixel point in the original image of the biological slice and the line drawing. However, when a perpendicular line segment is drawn through any pixel point to the straight line where the line drawing is located, the foot of the perpendicular may or may not be on the line drawing. Therefore, the line drawing area image can be determined based on the position between any pixel point and the line drawing. For example, it can be determined whether the position of any pixel point is within the range of the perpendicular line of the line drawing, so as to determine the line drawing area image to be detected according to different position conditions.

[0064] For example, please refer to Figure 2 , Figure 2 The drawing 1 and the drawing 2 are shown. Taking any drawing as an example, the coordinates of the two endpoints of the drawing are expressed as A[x a ,y a ] and B[x b ,y b ], then the first vector can be expressed as ab = (x b -x a ,y b -y a ).

[0065] Step S220: Determine a second vector according to the coordinates of any one of the two endpoints and the coordinates of any pixel point in the original image of the biological slice.

[0066] For example, the coordinates of any pixel point in the original image of the biological slice are expressed as O[x o ,y o ], the following is based on A[x a ,y a ] and O[x o ,y o ] to determine the second vector as an example, the second vector can be expressed as ao = (x o -x a ,y o -y a ).

[0067] Step S230: Calculate the vector inner product of the first vector and the second vector.

[0068] Exemplarily, the vector inner product of the first vector and the second vector may be determined by Formula 1.

[0069] ab·ao=((x b -x a )*(x o -x a )+(y b -y a )*(y o -y a)) Formula 1

[0070] Step S240: when the vector inner product is greater than or equal to 0, if the distance between the pixel point and the line drawing is less than or equal to a first specified distance threshold, the pixel point is regarded as a pixel point in the line drawing area image.

[0071] For example, if ab·ao≥0, then the pixel O[x o ,y o ] is within the vertical line range of the line AB, or in other words, through the pixel point O[x o ,y o ] When drawing a perpendicular line segment to the line where line AB is located, the foot of the perpendicular is on line AB. At this time, we can determine the pixel point O[x o ,y o ] is less than or equal to the first specified distance threshold. If so, the pixel point O[x o ,y o ] is determined as a pixel point in the line drawing area image. For example, the pixel point O[x o ,y o ] is set to 0. If not, the pixel point O[x o ,y o ] is not used as a pixel point in the line area image. For example, the pixel point O[x o ,y o ] is set to 1.

[0072] For an example, see Figure 3 , Figure 3 The image on the left is the line drawing area image determined based on line drawing 1. Figure 3 The right image in the middle is the image of the line area determined based on line 2. If ab·ao≥0, it can be determined that Figure 3 The middle rectangular area of ​​the line area image shown in the left image, and the Figure 3 The middle rectangular area of ​​the line area image is shown in the right image.

[0073] As an example, the first specified distance threshold may be set according to actual conditions.

[0074] As an example, the distance between a pixel point and a line can be determined by Formula 2 and Formula 3, where b=y b -y a , c = x b -x a .

[0075] d = x b *y a -x a *yb Formula 2

[0076]

[0077] Step S250: when the vector inner product is less than 0, if the specified multiple of the modulus value of the second vector is greater than the second specified distance threshold, the pixel point is regarded as a pixel point in the line drawing area image.

[0078] For example, if ab·ao<0, it means that the pixel O[x o ,y o ] is not within the vertical line range of the drawing line AB, or in other words, it passes through the pixel point O[x o ,y o ] When drawing a perpendicular line segment to the line where the drawing line AB is located, the foot of the perpendicular is not located on the drawing line AB. At this time, it can be determined whether the modulus of the second vector is greater than the second specified distance threshold. If so, the pixel point O[x o ,y o ] is determined as a pixel point in the line drawing area image. For example, the pixel point O[x o ,y o ] is set to 0. If not, the pixel point O[x o ,y o ] is not used as a pixel point in the line area image. For example, the pixel point O[x o ,y o ] is set to 1.

[0079] For an example, see Figure 3 , Figure 3 The image on the left is the line drawing area image determined based on line drawing 1. Figure 3 The image on the right is the image of the line area determined based on line 2. If ab·ao≤0, then it can be determined that Figure 3 The two end areas of the line area image shown in the left image in the middle and the Figure 3 The right image in the middle shows the two end areas of the line area image.

[0080] As an example, the modulus of the second vector may be The specified multiple may be any value between 1 and 1.5, for example, 1, 1.1, 1.2, 1.3, 1.4, or 1.5.

[0081] As an example, the second specified distance threshold may be set according to actual conditions.

[0082] As an example, the detection template may be an arbitrary polygon, and the second specified distance threshold may be determined based on the length of the longest side of the detection template. For example, the second specified distance threshold may be the product of the specified coefficient and the length of the longest side of the detection template. For example, the specified coefficient may be any value in the range of 0.1-0.8, such as 0.5, 0.6, or 0.65.

[0083] In the above implementation, by determining the line area image according to the position between any pixel point and the line, the line area image to be detected can be determined according to different position conditions, thereby improving the accuracy and efficiency of area detection.

[0084] In some embodiments, rotationally matching the detection template with the line area image based on multiple rotation angles may include: determining a recommended angle based on the coordinates of the two endpoints of the line; for any slice image in the line area image, taking a rotation angle from the multiple rotation angles as the current rotation angle in turn, rotating the detection template based on the current rotation angle and the recommended angle, and obtaining a matching score between the detection template and the line area image at the current rotation angle.

[0085] Here, rotating the detection template based on the current rotation angle and the recommended angle may refer to taking the recommended angle as the starting angle and then starting to rotate according to the current rotation angle.

[0086] For example, the coordinates of the two endpoints of the line are represented by A[x a ,y a ] and B[x b ,y b ], calculate the angle θ between the drawing line AB and the horizontal line, and convert it into radians α. As an example, the angle θ can be determined by formula 4, and the radians α can be determined by formula 5.

[0087]

[0088] In some embodiments, see Figure 6 The line drawing detection method may further include: for any slice image in the line drawing area image, after obtaining a plurality of matching scores of the slice image corresponding to a plurality of rotation angles, shrinking the template mask according to a specified coefficient and covering the slice image. In this way, the detection efficiency can be improved and the influence on the detection of the slice image in the next slice detection round can be reduced.

[0089] In some implementations, after the target slice image is determined, the following steps S310 - S330 may also be included.

[0090] Step S310: Acquire the slice contour perimeter and slice contour area of ​​the target slice image, and acquire the template contour perimeter and template contour area of ​​the detection template.

[0091] Step S320: Determine a first ratio between the perimeter of the slice contour and the perimeter of the template contour, and determine a second ratio between the area of ​​the slice contour and the area of ​​the template contour.

[0092] Step S330: If the first ratio is not within the first setting range and / or the second ratio is not within the second setting range, the target slice image is determined to be a damaged slice.

[0093] Exemplarily, the first setting range is [0.5, 1.5], and the second setting range is [0.5, 1.5]. It can be understood that the first setting range and the second setting range can be determined according to actual conditions, and are not limited here.

[0094] For example, see Figure 7 , the complete slice image and the damaged slice image can be distinguished by marking. For example, the marking can be distinguished by different colors. The marking can also be distinguished by different shapes.

[0095] The present specification provides a biological slice line detection device. Figure 8 The line drawing detection device may include an original image acquisition module 410 , a line drawing area determination module 420 and a rotation matching iteration module 430 .

[0096] The original image acquisition module 410 is used to acquire the biological slice original image, wherein the biological slice original image includes a plurality of slice images;

[0097] The line drawing area determination module 420 is used to draw lines on the original image of the biological slice and determine the line drawing area image to be detected according to the lines;

[0098] The rotation matching iteration module 430 is used to select multiple rotation angles in equal parts in the rotation angle interval, and rotationally match the detection template with the line area image based on the multiple rotation angles to obtain multiple matching scores corresponding to the multiple rotation angles; wherein the matching score can represent the matching degree between the detection template and the best slice image in the line area image at the corresponding rotation angle, and the best slice image refers to the slice image in the line area image that best matches the detection template; if the score extreme value among the multiple matching scores meets the first matching condition, the best slice image corresponding to the score extreme value in the line area image is determined as the target slice image, and the slice position information of the target slice image is output; otherwise, when the rotation angle interval meets the interval reduction condition, the rotation angle interval is reduced to select multiple new rotation angles in the reduced rotation angle interval for continuing the rotation matching; wherein the rotation angle interval meets the interval reduction condition, which means that the angle interval between any two adjacent rotation angles in the multiple rotation angles in the rotation angle interval is greater than the minimum unit interval.

[0099] The specific functions and effects achieved by the line drawing detection device can be explained in other embodiments of this specification, and will not be repeated here. Each module in the line drawing detection device can be implemented in whole or in part by software, hardware, and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0100] The embodiments of the present specification also provide a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a computer, the computer executes the line detection method in any of the above embodiments.

[0101] The embodiments of the present specification also provide a computer program product including instructions, which, when executed by a computer, enables the computer to execute the line drawing detection method in any of the above embodiments.

[0102] The embodiment of the present specification also provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the line drawing detection method in the above embodiment is implemented.

[0103] In some embodiments, see Fig. 9 The computer device may be a terminal, and its internal structure diagram may be as follows: Fig. 9As shown. The computer device includes a processor, a memory, and a communication interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a line drawing detection method is implemented.

[0104] It should be understood that the specific examples herein are only intended to help those skilled in the art to better understand the embodiments of the present specification, rather than to limit the scope of the present invention.

[0105] It can be understood that in the various implementations of this specification, the size of the sequence number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the implementation methods of this specification.

[0106] It can be understood that the various embodiments described in this specification can be implemented individually or in combination, and the embodiments of this specification are not limited to this.

[0107] Unless otherwise specified, all technical and scientific terms used in the embodiments of this specification have the same meaning as those generally understood by those skilled in the art of the technical field of this specification. The terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the scope of this specification. The term "and / or" used in this specification includes any and all combinations of one or more related listed items. The singular forms of "a", "above", and "the" used in the embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0108] It can be understood that the processor of the embodiment of this specification can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method implementation can be completed by the hardware integrated logic circuit or software instructions in the processor. The above processor can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiment of this specification can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of this specification can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor are combined and executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0109] It is understood that the memory in the embodiments of this specification may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (programmable ROM, PROM), an erasable programmable read-only memory (erasablePROM, EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory may be a random access memory (RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0110] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this specification.

[0111] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method implementation methods and will not be repeated here.

[0112] The above is only a specific implementation of this specification, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in this specification, which should be included in the protection scope of this specification. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for detecting line drawing in biological sections, characterized in that: The method comprises: Acquire a biological slice original image, wherein the biological slice original image includes a plurality of slice images; Drawing lines on the biological slice original image, and determining a line drawing area image to be detected according to the line drawing; A plurality of rotation angles are equally selected in the rotation angle interval, and the detection template is rotationally matched with the line area image based on the plurality of rotation angles to obtain a plurality of matching scores corresponding to the plurality of rotation angles one by one; wherein the matching scores can represent the matching degree between the detection template and the best slice image in the line area image at the corresponding rotation angle, and the best slice image refers to the slice image in the line area image that best matches the detection template; If the extreme score among the multiple matching scores satisfies the first matching condition, the best slice image corresponding to the extreme score in the line area image is determined as the target slice image, and the slice position information of the target slice image is output; otherwise, when the rotation angle interval satisfies the interval reduction condition, the rotation angle interval is reduced to select multiple new rotation angles in the reduced rotation angle interval for continuing the rotation matching; wherein, the rotation angle interval satisfies the interval reduction condition, which means that the angular interval between any two adjacent rotation angles among the multiple rotation angles in the rotation angle interval is greater than the minimum unit interval.

2. The method according to claim 1, characterized in that The method further comprises: When the extreme score does not satisfy the first matching condition and the rotation angle interval does not satisfy the interval reduction condition, if the extreme score satisfies the second matching condition, the best slice image corresponding to the extreme score in the line area image is determined as the target slice image, and the slice position information of the target slice image is output; wherein, the higher the matching score, the lower the matching degree; the first matching condition includes being less than or equal to a first set score, and the second matching condition includes being less than or equal to a second set score; wherein, the first set score is less than the second set score.

3. The method according to claim 2, characterized in that The reducing the rotation angle interval includes: The reduced rotation angle interval is determined based on the adjacent angles of the rotation angle corresponding to the extreme score value, wherein the adjacent angles include at least one of the plurality of rotation angles.

4. The method according to claim 2, characterized in that: The line drawing is a straight line segment; and determining the line drawing area image to be detected according to the line drawing includes: Determine a first vector according to the coordinates of the two endpoints of the drawing line; Determine a second vector according to the coordinates of any one of the two endpoints and the coordinates of any pixel point in the original image of the biological slice; Calculate the vector inner product of the first vector and the second vector; When the vector inner product is greater than or equal to 0, if the distance between the pixel point and the line drawing is less than or equal to a first specified distance threshold, the pixel point is used as a pixel point in the line drawing area image; When the inner product of the vector is less than 0, if the specified multiple of the modulus value of the second vector is greater than a second specified distance threshold, the pixel point is used as a pixel point in the line drawing area image.

5. The method according to claim 2, characterized in that: The performing rotation matching between the detection template and the line drawing area image based on the multiple rotation angles includes: Determining a recommended angle based on the coordinates of the two endpoints of the drawn line; For any of the slice images in the line area image, a rotation angle among the multiple rotation angles is taken as a current rotation angle in turn, and the detection template is rotated based on the current rotation angle and the recommended angle to obtain a matching score between the detection template and the line area image at the current rotation angle.

6. The method according to claim 5, characterized in that The method further comprises: Perform frame selection based on the original image of the biological slice to obtain the detection template; Determining a template mask of the detection template according to the detection template; The rotating the detection template includes: rotating the template mask corresponding to the detection template to obtain a matching score between the detection template and the line drawing area image.

7. The method according to claim 2, characterized in that After determining the target slice image, the method further includes: Acquire the slice contour perimeter and the slice contour area of ​​the target slice image, and acquire the template contour perimeter and the template contour area of ​​the detection template; Determining a first ratio between the slice contour perimeter and the template contour perimeter, and determining a second ratio between the slice contour area and the template contour area; If the first ratio is not within a first setting range and / or the second ratio is not within a second setting range, it is determined that the target slice image is a damaged slice.

8. A biological slice line detection device, characterized in that: The device comprises: An original image acquisition module, used for acquiring an original image of a biological slice, wherein the original image of the biological slice includes a plurality of slice images; A line drawing area determination module, used for drawing lines on the biological slice original image, and determining a line drawing area image to be detected according to the lines; A rotation matching iteration module is used to equally select a plurality of rotation angles in a rotation angle interval, and rotationally match the detection template with the line drawing area image based on the plurality of rotation angles to obtain a plurality of matching scores corresponding to the plurality of rotation angles one by one; wherein the matching score can represent the matching degree between the detection template and the best slice image in the line drawing area image at the corresponding rotation angle, and the best slice image refers to the slice image in the line drawing area image that best matches the detection template; if the score extreme value among the plurality of matching scores meets the first matching condition, the best slice image corresponding to the score extreme value in the line drawing area image is determined as the target slice image, and the slice position information of the target slice image is output; otherwise, when the rotation angle interval meets the interval reduction condition, the rotation angle interval is reduced to select a plurality of new rotation angles in the reduced rotation angle interval for continuing the rotation matching; wherein the rotation angle interval meets the interval reduction condition, which means that the angle interval between any two adjacent rotation angles among the plurality of rotation angles in the rotation angle interval is greater than the minimum unit interval.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the line detection method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the line drawing detection method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Slice adjusting quantity determining method, slice scanning area determining method, slice adjusting quantity determining device, slice scanning area determining device, equipment and medium

    CN120431347A

  • Verification method and device, electronic equipment and storage medium

    CN120431348A