Zoom coefficient determination method and related device, security inspection machine and storage medium

By detecting the boundary point pixel coordinates of the object to be measured in the security inspection machine and loading the calibration scale line sequence, the scaling coefficient of the security inspection machine at the object to be measured is solved, and the problem of insufficient reliability of the scaling coefficient and inability to take into account the imaging differences of different positions in the prior art is solved, and more accurate and reliable measurement of object size is achieved.

CN120070599AActive Publication Date: 2025-05-30IFLYTEK (SUZHOU) TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510543013.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-28
Publication Date
2025-05-30
Estimated Expiration
2045-04-28

AI Technical Summary

Technical Problem

When detecting object sizes, the scaling coefficients are insufficient, and the differences in the security machine when imaging at different locations are not taken into account.

Method used

By detecting the pixel coordinates of the boundary point in the scanned image of the object to be measured, loading the sequence of tick lines obtained based on the calibration ruler in advance, finding the scale lines adjacent to the boundary point, and calculating the scaling coefficient of the security checking machine when imaging the object to be measured.

Benefits of technology

It improves the reliability of the scaling coefficient, and takes into account the differences in the imaging of the security machine at different locations during the security inspection process, ensuring the accuracy of size measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120070599A_ABST
    Figure CN120070599A_ABST
Patent Text Reader

Abstract

The invention discloses a zoom coefficient determination method, a related device, a security inspection machine and a storage medium, and the method comprises the steps: responding to a first scanning image of a to-be-detected object of the security inspection machine, detecting a first pixel coordinate of an upper boundary point of the to-be-detected object in the first scanning image, and loading a scale line sequence; wherein the scale line sequence is obtained by detecting a second scanning image of the calibration ruler based on the security inspection machine in advance, and the scale line sequence comprises second pixel coordinates of scale lines on the calibration ruler; searching a scale line adjacent to the boundary point in a scale line sequence based on the first pixel coordinate and the second pixel coordinate to obtain a first scale index; and based on the first scale index, the physical spacing between the adjacent scale lines on the calibration ruler and the pixel spacing between the boundary points, obtaining the zoom coefficient of the security inspection machine during imaging at the to-be-detected object. According to the scheme, the reliability of the zoom coefficient can be improved, and the difference of the security inspection machine in imaging at different positions is considered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of security inspection image processing, and particularly to a method for determining a scaling factor, related devices, an X-ray security inspection machine, and a storage medium. Background Art

[0002] With the rapid development of transportation such as passenger transportation and freight transportation, X-ray security inspection machines have gradually become one of the standard configurations in places such as subways, airports, and logistics to help detect objects passing through the inspection, such as whether they are illegal objects, object sizes, and so on.

[0003] Generally speaking, in order to detect the size of an object, the scaling factor during the imaging of an X-ray security inspection machine is essential. In the prior art, the scaling factor built into the X-ray security inspection machine at the time of factory production is generally read, or a general scaling factor is calibrated before formal use. For the former method, since the built-in scaling factor is directly used, its reliability cannot be ensured. For the latter method, although the reliability can be ensured to a certain extent through parameter calibration, the general scaling factor cannot take into account the differences in imaging at different positions of the X-ray security inspection machine. Therefore, the scaling factors calibrated by the above two methods cannot ensure the accuracy of subsequent size measurement based on them. In view of this, how to improve the reliability of the scaling factor and take into account the differences in imaging at different positions of the X-ray security inspection machine has become an urgent problem to be solved. Summary of the Invention

[0004] The main technical problem to be solved by the present application is to provide a method for determining a scaling factor, related devices, an X-ray security inspection machine, and a storage medium, which can improve the reliability of the scaling factor and take into account the differences in imaging at different positions of the X-ray security inspection machine.

[0005] To solve the above technical problem, a first aspect of the present application provides a method for determining a scaling factor, including: in response to a first scanned image of a to-be-detected object by an X-ray security inspection machine, detecting a first pixel coordinate of an upper boundary point of the to-be-detected object on the first scanned image, and loading a scale line sequence; wherein, the scale line sequence is pre-detected based on a second scanned image of a calibration ruler by the X-ray security inspection machine, and the scale line sequence includes second pixel coordinates of scale lines on the calibration ruler; finding a scale line adjacent to the boundary point in the scale line sequence based on the first pixel coordinate and the second pixel coordinates, to obtain a first scale index; and obtaining a scaling factor of the X-ray security inspection machine when imaging at the to-be-detected object based on the first scale index, a physical distance between adjacent scale lines on the calibration ruler, and a pixel distance between boundary points.

[0006] To solve the above technical problems, the second aspect of the present application provides a zoom factor determination device, including: a detection and loading module, an index search module, and a coefficient calculation module. The detection and loading module is configured to, in response to a first scanned image of an object to be measured by an X-ray security scanner, detect the first pixel coordinates of the upper boundary point of the object to be measured in the first scanned image, and load a scale line sequence; wherein the scale line sequence is pre-detected based on a second scanned image of a calibration ruler by the X-ray security scanner, and the scale line sequence includes the second pixel coordinates of the scale lines on the calibration ruler. The index search module is configured to search for the scale line adjacent to the boundary point in the scale line sequence based on the first pixel coordinates and the second pixel coordinates to obtain a first scale index. The coefficient calculation module is configured to obtain the zoom factor when the X-ray security scanner images at the object to be measured based on the first scale index, the physical distance between adjacent scale lines on the calibration ruler, and the pixel distance between the boundary points.

[0007] To solve the above technical problems, the third aspect of the present application provides an electronic device, at least including a memory and a processor coupled to each other. The memory stores at least program instructions, and the processor is configured to execute the program instructions to implement the zoom factor determination method in the first aspect above.

[0008] To solve the above technical problems, the fourth aspect of the present application provides an X-ray security scanner, at least including the electronic device in the third aspect above.

[0009] To solve the above technical problems, the fifth aspect of the present application provides a computer-readable storage medium, storing program instructions that can be run by a processor, and the program instructions are used to implement the zoom factor determination method in the first aspect above.

[0010] In the above solution, in response to the first scanned image of the object to be detected by the security inspection machine, the first pixel coordinates of the upper boundary point of the object to be detected in the first scanned image are detected, and a scale line sequence is loaded. The scale line sequence is pre-detected based on the second scanned image of the calibration ruler by the security inspection machine, and the scale line sequence includes the second pixel coordinates of the scale lines on the calibration ruler. Then, based on the first pixel coordinates and the second pixel coordinates, the scale line adjacent to the boundary point is searched in the scale line sequence to obtain the first scale index. Furthermore, based on the first scale index, the physical distance between adjacent scale lines on the calibration ruler, and the pixel distance between the boundaries, the scaling coefficient when the security inspection machine images at the object to be detected is obtained. Therefore, on the one hand, calibrating the scaling coefficient through the calibration ruler can improve the reliability of the scaling coefficient compared with directly using the built-in scaling coefficient. On the other hand, combining the scale line sequence and the upper boundary point of the object to be detected in the first scanned image can calibrate the scaling coefficient of the security inspection machine at the object to be detected according to the actual position of the object to be detected when calibrating the scaling coefficient. Compared with using a general scaling coefficient, the difference in imaging at different positions of the security inspection machine can be taken into account during the security inspection process. Therefore, the reliability of the scaling coefficient can be improved, and the difference in imaging at different positions of the security inspection machine can be taken into account. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 is a schematic flowchart of an embodiment of the method for determining the scaling coefficient of the present application; Figure 2a is a schematic diagram of the effect of an embodiment of the first scanned image of the present application; Figure 2b is a schematic diagram of the effect of an embodiment of the second scanned image of the present application; Figure 2c is a partial schematic diagram of an embodiment of performing edge detection on the second scanned image of the present application; Figure 2d is a partial schematic diagram of another embodiment of performing edge detection on the second scanned image of the present application; Figure 2e is a schematic diagram of the effect of an embodiment of the first curve and the second curve of the present application; Figure 2f is a schematic diagram of the effect of another embodiment of the first scanned image of the present application; Figure 3 is a schematic framework diagram of an embodiment of the device for determining the scaling coefficient of the present application; Figure 4 is a schematic framework diagram of an embodiment of the electronic device of the present application; Figure 5 is a schematic framework diagram of an embodiment of the security inspection machine of the present application; Figure 6 is a schematic framework diagram of an embodiment of the computer-readable storage medium of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0012] The solution of the embodiment of the present application will be described in detail below with reference to the accompanying drawings of the specification.

[0013] In the following description, specific details such as specific system architectures, interfaces, and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the present application.

[0014] The terms "system" and "network" are often used interchangeably herein. The term "and / or" herein merely describes an association relationship between associated objects and indicates that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the fragment " / " herein generally represents an "or" relationship between the front and rear associated objects. Furthermore, "plurality" herein means two or more than two.

[0015] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of an embodiment of the method for determining the scaling factor of the present application. Specifically, it may include the following steps: Step S11: In response to the first scanned image of the object to be detected by the security inspection machine, detect the first pixel coordinates of the upper boundary point of the object to be detected in the first scanned image, and load the scale line sequence.

[0016] In the embodiments of the present disclosure, the scale line sequence is pre-detected based on the second scanned image of the calibration ruler by the security inspection machine, and the scale line sequence includes the second pixel coordinates of the scale lines on the calibration ruler. That is to say, before the security inspection machine inspects the object to be detected, the calibration ruler can be placed in the security inspection machine first to obtain the second scanned image of the calibration ruler by the security inspection machine, and then detection can be performed based on the second scanned image to obtain the scale line sequence. As a possible example in the actual application process, the light source of the security inspection machine may be an X-ray. Then, in order to improve the clarity of scanning the calibration ruler as much as possible, the calibration ruler can be a lead ruler or an X-ray developing ruler such as a radiopaque marking ruler. The specific type of the calibration ruler is not limited herein. It should be noted that after the scale line sequence is detected, the security inspection machine can save the scale line sequence. Then, when an object to be detected passes through the inspection and the size of the object to be detected needs to be measured by the scanned image of the object to be detected, the saved scale line sequence can be loaded. Of course, during this process, the calibration ruler does not need to be placed on the security inspection machine anymore to avoid affecting the security inspection due to the placement of the calibration ruler on the security inspection machine.

[0017] In an implementation scenario, the calibration ruler can be specifically placed on the security inspection channel (such as a belt) of the security inspection machine. Considering that the security inspection channel of the security inspection machine is usually long and narrow, that is, it has a large length in its traveling direction, and is usually relatively short in the direction perpendicular to the traveling direction, the calibration ruler can be perpendicular to the traveling direction of the security inspection channel. Or, as another possible implementation method, the calibration ruler can also be parallel to the traveling direction of the security inspection channel. The placement direction of the calibration ruler is not limited here. In addition, when the calibration ruler is placed on the security inspection channel, it can be placed as close as possible to the light source, such as relative to the light source, or it can also be appropriately deviated from the light source. The placement position of the calibration ruler is not limited here either.

[0018] In an implementation scenario, the object to be measured can include but is not limited to any possible object during passing the inspection, such as bottles, bags, boxes, notebooks, etc. The specific type of the object to be measured is not limited here.

[0019] In an implementation scenario, the boundary points can include: on the target direction of the first scanned image, the first boundary point and the second boundary point on the object to be measured, and the target direction can be the placement direction of the calibration ruler on the security inspection channel. Please refer to Figure 2a , Figure 2a which is a schematic diagram of the effect of an embodiment of the first scanned image of this application. As Figure 2a shown, taking the direction perpendicular to the traveling direction as the target direction as an example, after the security inspection machine scans and images the object to be measured to obtain the first scanned image, the first scanned image can be subjected to target detection to obtain the target area of the object to be measured in the first scanned image (such as Figure 2a shown by the dotted rectangle in). As a possible example, the target area can be the smallest circumscribed rectangle enclosing the object to be measured. On this basis, the pixel points located on the boundary of the target area in the target direction can be selected, which are the first boundary point (such as Figure 2a P1 in) and the second boundary point (such as Figure 2a P2 in). Of course, Figure 2a shown is only a possible example of the boundary points in the actual application process, and other possible situations will not be exemplified one by one here. In addition, for the convenience of description, the first boundary point P1 and the second boundary point P2 will be used as examples later, and the first pixel coordinates of the first boundary point P1 will be denoted as [U o1 , V o1 , and the first pixel coordinates of the second boundary point will be denoted as [U o2 , V o2 , where U represents the abscissa and V represents the ordinate.

[0020] In an implementation scenario, as a possible implementation method, in order to detect the scale line sequence based on the second scanned image, edge detection can be directly performed on the second scanned image to obtain the scale pixel coordinates at different heights in the extending direction of the calibration ruler. Please refer to Figure 2b , Figure 2b which is a schematic diagram of the effect of an embodiment of the second scanned image of the present application. As Figure 2b shown, by performing edge detection on the second scanned image, a total of 10 scale lines at different height values from top to bottom can be obtained. Then, for each scale line, the pixel coordinates of the intersection points between it and the boundary line of the calibration ruler can be taken as the scale pixel coordinates at the corresponding height. Exemplarily, Figure 2b the scale line sequence in r can be denoted as P r1 ,V r1 ,[U r2 ,V r2 ,…,[U r10 ,V r10 , where U represents the abscissa and V represents the ordinate. Of course, Figure 2b is only a possible example of the second scanned image. For example, the calibration ruler in the second scanned image may also be different from Figure 2b shown with scale lines only on one side, and scale lines may also be present on both sides. Other possible situations are not exemplified one by one here. It should be noted that for the specific process of edge detection, the technical details of edge detection operators such as Canny can be referred to and will not be elaborated here.

[0021] In another implementation scenario, different from the above-mentioned implementation, as another possible implementation, due to factors such as imaging interference, edge detection is performed on the second scanned image, and it may be impossible to obtain complete scale lines at certain height values ​​(for example, there may be breakpoints, etc.). After edge detection is performed on the second scanned image, edge information at different height values ​​of the calibration ruler in the extension direction can be obtained first. It should be noted that the edge information may include but is not limited to information such as the width and density of the detected edge line (hereinafter referred to as edge width and edge density, respectively). On this basis, at least one height value can be screened based on the edge information at each height value to obtain a first line sequence, and the first line sequence includes scale pixel coordinates at the height value that are suspected to be scale lines, so that a number of second line sequences can be intercepted from the first line sequence based on the coordinate interval between adjacent scale pixel coordinates in the first line sequence, and then a number of second line sequences can be selected and sequentially combined based on the first number of scale pixel coordinates in the number of second line sequences and the second number of scale lines on the calibration ruler as a scale line sequence, or continued to be added on the basis of the number of second line sequences to obtain a scale line sequence. In the above method, at least one height value is firstly selected according to the edge information at different height values ​​to obtain a first line sequence, and then a number of second line sequences are intercepted from the first line sequence according to the coordinate interval between the coordinates of adjacent scale pixels in the first line sequence. Finally, according to the number of scale lines on the calibration ruler and the number of scale pixel coordinates in the second line sequences, a scale line sequence is obtained by combining or adding different methods, which can eliminate the adverse effects of imaging interference on the detection of the scale line sequence as much as possible.

[0022] In a specific implementation scenario, please refer to Figure 2c , Figure 2c is a partial schematic diagram of an embodiment of performing edge detection on the second scanned image of the present application. Specifically, Figure 2c The following is only an example of a partial situation of calibrating the ruler after edge detection in the presence of interference. Figure 2c As shown, in the presence of imaging interference, after edge detection is performed on the second scanned image, different situations may be presented, such as Figure 2c At the highest and second highest height values, the edge line is disconnected; or, Figure 2c At the third and fourth highest heights, the edge line is not only disconnected, but also misaligned; or, Figure 2c At the lowest height value, the edge line may not exist in the above two situations, but be complete and without disconnection or dislocation. Figure 2c The situations shown are just some possible examples of edge detection when there is imaging interference. Other possible situations will not be given one by one here. Figure 2d , Figure 2dIt is a partial schematic diagram of another embodiment for performing edge detection on the second scanned image of this application. As Figure 2d shown, in the actual application process, due to possible differences in the imaging algorithms of the security inspection machines themselves, the distribution of the scale lines of the calibration ruler in the second scanned images of different security inspection machines may also vary. As Figure 2d shown in the leftmost figure of Figure 2d , the scale lines maintain their uniform distribution on the calibration ruler, or, as Figure 2d shown in the middle and rightmost figures of

[0023] , the scale lines do not maintain their uniform distribution on the calibration ruler but show a non-uniform distribution from sparse to dense. Of course, Figure 2d shown is merely several possible situations of the scale line distribution after being scanned by the security inspection machine in the actual application process, and other possible situations will not be exemplified one by one here.

[0023] In a specific implementation scenario, as described above, the edge information may include the edge width and the edge density. Among them, the edge width at any height value represents the sum of the widths of the detected edge lines at that height value, and the edge density at any height value represents the ratio of the sum of the aforementioned widths to the distance between the outermost ends of the detected edge lines at that height value. For the sake of easy understanding, first in combination with Figure 2c , an explanation of the two is given. As Figure 2c shown, for the edge lines detected at the highest height value in Figure 2c , a total of 4 edge lines, so the edge width at this height value is the sum of the widths of these 4 edge lines. When calculating the edge density at this height value, the distance between the left end point of the leftmost edge line and the right end point of the rightmost edge line can be calculated first, and then the ratio of the sum of the aforementioned widths to this distance can be calculated to obtain the edge density at this height value. It can be seen from this that the fewer disconnections, the higher the edge density. For example, Figure 2c the edge densities at the two highest and the second highest height values are lower than the edge densities at the other three height values. On this basis, based on the edge widths at each height value, a first curve representing the distribution of the edge width with respect to the height value can be obtained, and based on the edge densities at each height value, a second curve representing the distribution of the edge density with respect to the height value can be obtained. Please refer to Figure 2e , Figure 2e is an effect schematic diagram of an embodiment of the first curve and the second curve of this application. As Figure 2e shown in the left figure of Figure 2eThe figure shown is only a possible example of the first curve and the second curve in the actual application process, and does not limit the distribution of the first curve and the second curve accordingly. For example, the ordinates (i.e., edge widths) of the peak points in the first curve may not be exactly the same, and the ordinates (i.e., edge densities) of the peak points in the second curve may not be exactly the same, and no further examples will be given here. After obtaining the first curve and the second curve, at least one height value that is the peak of the curve on both the first curve and the second curve can be screened to obtain the first line sequence. For example, each height value can be traversed in turn. If the height value is the peak of the curve in the first curve and also the peak of the curve in the second curve, then the height value can be used as the ordinate of the calibrated pixel coordinate. It should be noted that the abscissa of the calibrated pixel coordinate can be uniformly set to the abscissa of the calibration scale boundary line (such as Figure 2b the left boundary line in the vertical direction of the calibration scale in

[0024] In a specific implementation scenario, after obtaining the first line sequence, considering the influence of factors such as imaging algorithms in the actual application process, the calibration lines may have Figure 2d the different distribution situations shown in the figure, then several second line sequences can be intercepted from the first line sequence based on the coordinate intervals between adjacent calibrated pixel coordinates in the first line sequence. It should be noted that the coordinate intervals between adjacent calibrated pixel coordinates in the same second line sequence are respectively within the same numerical range. Exemplarily, the specific setting of the numerical range can be determined according to the actual situation of the calibration scale and the imaging algorithm. For example, when the interval between adjacent calibration lines on the calibration scale itself is relatively large and the scaling effect of the imaging algorithm on the part far from the light source is relatively large, the numerical range can also be set relatively large, and the corresponding numerical range is also larger the farther away from the light source. In addition, in the same second line sequence, for different groups of adjacent calibrated pixel coordinates, the interval difference between the coordinate intervals can be lower than a preset threshold. Exemplarily, the specific value of the preset threshold can be determined according to the actual situation of the imaging algorithm. For example, when the scaling effect of the imaging algorithm on the part far from the light source is relatively large, the preset threshold can also be set relatively large, and the corresponding preset threshold is also larger the farther away from the light source. Please continue to refer to Figure 2d As a possible example, as shown in the leftmost figure in Figure 2d , through the above method, a second line sequence (i.e., Figure 2d the part shown by the dotted line box in the leftmost figure in can be intercepted; or, as another possible example, asFigure 2d The middle figure in Figure 2d shows that in the above-mentioned manner, the first and second second-line sequences can be intercepted (as shown by the dashed box in the middle figure in Figure 2d ); or, as another possible example, as shown in the rightmost figure in Figure 2d , in the above-mentioned manner, a second-line sequence can be intercepted (as shown by the dashed box in the rightmost figure in Figure 2d ). Of course, Figure 2d only shows several possible examples of intercepting the second-line sequence in the actual application process, and other possible situations will not be listed one by one here. Through the above setting method, it is possible to ensure that the distribution of the scale pixel coordinates in each second-line sequence is relatively stable as much as possible.

[0025] In a specific implementation scenario, the first quantity of the scale pixel coordinates in several second-line sequences and the second quantity of the scale lines on the calibration ruler may be equal or unequal. For example, the first quantity of the scale pixel coordinates in several second-line sequences may be less than the second quantity of the scale lines on the calibration ruler; or, the first quantity of the scale pixel coordinates in several second-line sequences may be equal to the second quantity of the scale lines on the calibration ruler. Generally speaking, after the above screening, intercepting and other operations, it is unlikely that the first quantity of the scale pixel coordinates in several second-line sequences is more than the second quantity of the scale lines on the calibration ruler. However, if this situation occurs, as a possible example, the scale pixel coordinates in the second-line sequence can be further selected as candidate pixel coordinates respectively, and the coordinate quality of the candidate pixel coordinates can be measured (the measurement method can refer to the following description and will not be elaborated here), and then the candidate pixel coordinates can be excluded one by one in the order from high to low coordinate quality until the first quantity of the scale pixel coordinates in several second-line sequences is equal to the second quantity of the scale lines on the calibration ruler. Of course, this is also only a possible example of further screening the second-line sequence in the actual application process, and other possible methods will not be listed one by one here. Anyway, when the first quantity of the scale pixel coordinates in several second-line sequences is equal to the second quantity of the scale lines on the calibration ruler, several second-line sequences can be sequentially combined as the scale line sequence. Please refer to Figure 2d , as shown in the leftmost figure in Figure 2d , when the first quantity of the scale pixel coordinates in the second-line sequence is 10 and the second quantity of the scale lines on the calibration ruler is also 10, this second-line sequence can be used as the scale line sequence. Of course, Figure 2dThe leftmost figure shown in is only one possible scenario where the first quantity is equal to the second quantity during the actual application process, and other possible scenarios will not be exemplified one by one here. It should be noted that the coordinate quality of the candidate pixel coordinates represents the possibility of the actual existence of scale lines at the candidate pixel coordinates. That is to say, the higher the coordinate quality of the candidate pixel coordinates, the higher the possibility of the actual existence of scale lines at the candidate pixel coordinates; conversely, the lower the coordinate quality of the candidate pixel coordinates, the lower the possibility of the actual existence of scale lines at the candidate pixel coordinates.

[0026] In a specific implementation scenario, when the first quantity of the scale pixel coordinates in a number of second line sequences is less than the second quantity of the scale lines on the calibration ruler, the scale pixel coordinates in the first line sequence that are not intercepted into the second line sequence can be selected as candidate pixel coordinates, and candidate pixel coordinates can be added based on the coordinate quality of the candidate pixel coordinates on the basis of the number of second line sequences to obtain a scale line sequence. It should be noted that when adding candidate pixel coordinates on the basis of the number of second line sequences, the termination condition can be that the first quantity of the scale pixel coordinates added to the second line sequence is equal to the second quantity. The following will respectively give exemplary descriptions from three aspects: the coordinate quality, the addition method when the number of sequences of the number of second line sequences is more than one (as shown in the middle figure in ), and the addition method when the number of sequences of the number of second line sequences is only one (as shown in the rightmost figure in ). It can be understood that the following exemplary descriptions are only possible implementation examples during the actual application process. For example, the measurement method of the coordinate quality may not be limited to the implementation method described below, and the addition method of the candidate pixel coordinates may also not be limited to the implementation method described below, and all possible methods will not be exemplified one by one here. Figure 2d as shown in the middle figure in , Figure 2d as shown in the rightmost figure in .

[0027] In a specific implementation scenario, to measure the coordinate quality of candidate pixel coordinates, the first edge width, the first edge density, the on-line edge scale width, and the off-line edge scale width can be obtained based on the edge information at the height value corresponding to the candidate pixel coordinates. It should be noted that for the specific meanings of the first edge width and the first edge density, reference can be made to the relevant descriptions of "edge width" and "edge density" mentioned above, which will not be elaborated here. Here, the specific meanings of the "on-line edge scale width" and the "off-line edge scale width" are respectively supplemented and described. In the actual application process, the edge line detected at any height value may not only have the situation of edge line disconnection, but also the situation of edge line misalignment. The "on-line edge scale width" at any height value is the width value of the uppermost edge line detected at that height value, and the "off-line edge scale width" at any height value is the width value of the lowermost edge line detected at that height value. If there is no misalignment of the edge line detected at a certain height value, the "on-line edge scale width" and the "off-line edge scale width" at that height value can be the same. Please continue to refer to Figure 2c , such as Figure 2c the edge line detected at the third height value from top to bottom in Figure 2cThe edge line detected at the 4th height value from top to bottom, where the 2nd edge line is the bottommost edge line at this height value, and the width value of this edge line is the "bottom edge scale width" at this height value. Additionally, for the second line sequence, median statistics can be performed based on the edge information at the height values corresponding to the respective scale pixel coordinates in the second line sequence to obtain the first median width, the first median density, the upper edge median width, and the lower edge median width. It can be understood that the "first median width" is the median of the "first edge width" at the height values corresponding to the respective scale pixel coordinates in the second line sequence, the "first median density" is the median of the "first edge density" at the height values corresponding to the respective scale pixel coordinates in the second line sequence, the "upper edge median width" is the median of the "upper edge scale width" at the height values corresponding to the respective scale pixel coordinates in the second line sequence, and the "lower edge median width" is the median of the "lower edge scale width" at the height values corresponding to the respective scale pixel coordinates in the second line sequence. Based on this, the coordinate quality of the candidate pixel coordinates can be obtained based on the absolute difference between the first edge width and the first median width, the absolute difference between the first edge density and the first median density, the absolute difference between the upper edge scale width and the upper edge median width, and the absolute difference between the lower edge scale width and the lower edge median width. For example, the above four absolute differences can be summed to obtain the coordinate quality. It should be noted that the lower the specific value of the coordinate quality, the higher the coordinate quality, that is, the higher the possibility that there is a real scale line at the candidate pixel coordinates. Conversely, the higher the specific value of the coordinate quality, the lower the coordinate quality, that is, the lower the possibility that there is a real scale line at the candidate pixel coordinates. For ease of description, the coordinate quality val_line of the candidate pixel coordinates can be expressed as: val_line = abs(lineWidth - Median(linesStableWidth)) + abs(lineDensity - Median(linesStableDensity)) + abs(lineUeWidth - Median(linesStableUeWidth)) + abs(lineDeWidth - Median(linesStableDeWidth)) In the above formula, lineWidth represents the first edge width, lineDensity represents the first edge density, lineUeWidth represents the upper edge scale width of the line, lineDeWidth represents the lower edge scale width of the line, Median(linesStableWidth) represents the first median width, Median(linesStableDensity) represents the first median density, Median(linesStableUeWidth) represents the upper edge median width of the line, Median(linesStableDeWidth) represents the lower edge median width of the line, and abs represents taking the absolute value. In the above manner, by comparing the candidate pixel coordinates with the overall second line sequence from four aspects: edge width, edge density, the width of the upper edge of the line, and the width of the lower edge of the line, the coordinate quality of the candidate pixel coordinates is measured, which helps to evaluate the possibility of the actual existence of scale lines at each candidate pixel coordinate as accurately as possible.

[0028] In a specific implementation scenario, when the number of several second line sequences is more than one, the scale pixel coordinates in the first line sequence that are not intercepted into the second line sequence and are located between the second line sequences can be selected as the first candidate coordinates. Please refer to Figure 2d the middle figure. There are 2 second line sequences in total (as shown by the dotted boxes in the figure). There are 3 scale pixel coordinates that are not intercepted into the second line sequence and are located between the second line sequences, so these 3 scale pixel coordinates can be used as the first candidate coordinates. Of course, Figure 2d the above shows only one possible example in the actual application process, and other possible situations will not be exemplified one by one here. For example, there may be other numbers or other positions of scale pixel coordinates between the second line sequences. On this basis, predictions can be made based on the coordinate intervals between the scale pixel coordinates in several second line sequences to obtain the first predicted coordinates where scale lines are suspected to exist between several second line sequences. For example, in the area between two adjacent second line sequences, at a position close to a certain second line sequence, taking the coordinate interval between the scale pixel coordinates in this second line sequence as the standard, the first predicted coordinates where scale lines are suspected to exist can be determined; or, in the area between two adjacent second line sequences, taking the average value of the coordinate intervals between the scale pixel coordinates in these two second line sequences as the standard, the first predicted coordinates where scale lines are suspected to exist can be determined. Please continue to refer to Figure 2dMiddle figure. According to the coordinate intervals between the scale pixel coordinates in the two second line sequences shown by the dashed boxes in the figure, two first predicted coordinates where scale lines are suspected to exist can be predicted between these two second line sequences (i.e., the dashed lines indicate that scale lines are suspected to exist here). After obtaining the first predicted coordinates where scale lines are suspected to exist between several second line sequences, first candidate coordinates whose coordinate quality meets the preset conditions can be further selected within the preset range of the first predicted coordinates and added to the several second line sequences to obtain a scale line sequence. It should be noted that the addition can be terminated as long as the latest added first quantity is equal to the second quantity. Similarly to the aforementioned preset threshold, the preset range can be determined according to the actual situation of the imaging algorithm. For example, when the imaging algorithm has a relatively large scaling effect on the area far from the light source, the preset range can also be set appropriately larger, and the corresponding preset range is relatively larger the farther away from the light source. Or, the preset range can also be set as a fixed interval (e.g., between 0 pixels and N pixels). In addition, the preset condition can be set such that the coordinate quality is not inferior to the preset quality. When calculating the coordinate quality in the measurement method described above, the preset condition can be set as a specific numerical value of the coordinate quality not higher than the quality threshold. That is, the first candidate coordinates can be screened based on the principle of being as close as possible to the first predicted coordinates and having as good coordinate quality as possible. Please continue to refer to Figure 2d Middle figure. According to the above method, the first and third first candidate coordinates between these two second line sequences can be screened out (i.e., the first and third solid lines between the second line sequences shown by the two dashed boxes indicate that scale lines are definitely present), and added between these two second line sequences to obtain a scale line sequence. Of course, Figure 2d The middle figure shown is only a possible example when the number of sequences of several second line sequences is more than one. Other possible situations will not be exemplified one by one here. In the above method, when the number of sequences of several second line sequences is more than one, the scale pixel coordinates in the first line sequence that are not intercepted into the second line sequence and are located between the second line sequences are selected as the first candidate coordinates. Based on the coordinate intervals between the scale pixel coordinates in the several second line sequences, the first predicted coordinates where scale lines are suspected to exist between the several second line sequences are predicted. Then, first candidate coordinates whose coordinate quality meets the preset conditions are selected within the preset range of the first predicted coordinates and added to the several second line sequences to obtain a scale line sequence, which can screen the first candidate coordinates based on the principle of being as close as possible to the first predicted coordinates and having as good coordinate quality as possible.

[0029] In a specific implementation scenario, when the number of sequences of several second line sequences is only one, the scale pixel coordinates in the first line sequence that are not intercepted into the second line sequence and are located before and after the second line sequence can be selected as the second candidate coordinates. Please refer to Figure 2dIn the rightmost figure, there is 1 second-line sequence (as shown by the dashed box in the figure). Before it, there are 3 scale pixel coordinates that are not intercepted into the second-line sequence, so these 3 scale pixel coordinates can be used as second candidate coordinates. After it, there are also 3 scale pixel coordinates that are not intercepted into the second-line sequence, so these 3 scale pixel coordinates can also be used as second candidate coordinates. Of course, Figure 2d The above shows only one possible example in the actual application process, and other possible situations will not be exemplified one by one here. For example, there may be other numbers or other positions of scale pixel coordinates before and after the second-line sequence. On this basis, prediction can be made based on the coordinate intervals between the scale pixel coordinates in the second-line sequence to obtain second predicted coordinates where scale lines are suspected to exist before and after the second-line sequence. It should be noted that for the method of obtaining the second predicted coordinates, reference can be made to the relevant description of the aforementioned first predicted coordinates, which will not be elaborated here. Please continue to refer to Figure 2d In the rightmost figure, according to the coordinate intervals between the scale pixel coordinates in the second-line sequence shown by the dashed box in the figure, 3 first predicted coordinates where scale lines are suspected to exist (i.e., the dashed lines indicate that there are suspected scale lines here) can be predicted before this second-line sequence, and 2 second predicted coordinates where scale lines are suspected to exist (i.e., the dashed lines indicate that there are suspected scale lines here) can be predicted after this second-line sequence. After obtaining the second predicted coordinates where scale lines are suspected to exist before and after the second-line sequence, second candidate coordinates can be selected within the preset range of the second predicted coordinates as third candidate coordinates. It should be noted that for the setting method of the preset range, reference can be made to the aforementioned relevant description, which will not be elaborated here. Please continue to refer to Figure 2d In the rightmost figure, for before the second-line sequence, 3 second candidate coordinates at the solid lines can be selected as third candidate coordinates, and for after the second-line sequence, the second candidate coordinates at the first solid line from the bottom and the third solid line from the bottom can be selected as third candidate coordinates. Of course, Figure 2d The above shows only one possible example in the actual application process, and other possible situations will not be exemplified one by one here. After screening out the third candidate coordinates, they can be fused (such as taking the average value) based on the third candidate coordinates and their coordinate qualities with respect to the third candidate coordinates between them and the second-line sequence to obtain a new coordinate quality for the third candidate coordinates. For the sake of description, the third candidate coordinates, their coordinate qualities, and the new coordinate quality can be represented in matrix form as:

[0030] In the above formula, linesMaybe represents a matrix formed by the third candidate coordinates, their coordinate qualities, and the new coordinate qualities. The first column in this matrix represents the indices of the third candidate coordinates. Negative numbers indicate that the third candidate coordinates are before the second line sequence, and positive numbers indicate that the third candidate coordinates are after the second line sequence. The absolute value of this column represents the index distance to the first tick pixel coordinate in the second line sequence (for negative numbers) or the index distance to the last tick pixel coordinate in the second line sequence (for positive numbers). The second column in this matrix represents the third candidate coordinates, the third column represents the coordinate qualities of the third candidate coordinates, and the fourth column represents the new coordinate qualities of the third candidate coordinates. Exemplarily, for the third candidate coordinates before the second line sequence, their new coordinate quality v -i can be expressed as:

[0031] Similarly, for the third candidate coordinates after the second line sequence, their new coordinate quality v j can be expressed as:

[0032] After obtaining the new coordinate quality of the third candidate coordinates, based on the new coordinate quality of the third candidate coordinates, the third candidate coordinates and the third candidate coordinates between them and the second line sequence can be selected and added to a plurality of second line sequences to obtain a tick line sequence. Exemplarily, for each of the third candidate coordinates before the second line sequence, the third candidate coordinate with the best new coordinate quality can be selected, and the third candidate coordinate and the third candidate coordinates between it and the second line sequence are added to the second line sequence together. For each of the third candidate coordinates after the second line sequence, the third candidate coordinate with the best new coordinate quality can be selected, and the third candidate coordinate and the third candidate coordinates between it and the second line sequence are added to the second line sequence together, and then the tick line sequence can be obtained. It should be noted that, as a possible example, during this addition process, the constraint condition that the new first quantity is equal to the second quantity can also be followed, that is, the addition can be terminated when it is found that the new first quantity is equal to the second quantity during the addition process. In the above manner, when the number of sequences of a plurality of second line sequences is only one, the tick pixel coordinates in the first line sequence that are not intercepted into the second line sequence and are located before and after the second line sequence are selected as the second candidate coordinates, and based on the coordinate intervals between the tick pixel coordinates in the second line sequence, a prediction is made to obtain a plurality of second predicted coordinates where tick lines are suspected to exist before and after the second line sequence, and then the second candidate coordinates are selected within the preset range of the second predicted coordinates as the third candidate coordinates. Thus, based on the coordinate quality of the third candidate coordinates and the third candidate coordinates between them and the second line sequence, a fusion is performed to obtain the new coordinate quality of the third candidate coordinates. Furthermore, based on the new coordinate quality of the third candidate coordinates, the third candidate coordinates and the third candidate coordinates between them and the second line sequence are selected and added to a plurality of second line sequences to obtain a tick line sequence, which can accurately supplement coordinates for the second line sequence as much as possible when the number of sequences of a plurality of second line sequences is only one.

[0033] In yet another implementation scenario, different from the foregoing implementation, as another possible implementation, in order to be as compatible as possible with security inspection machines of different brands and models, it is also possible to traverse different values of processing parameters in sequence before performing edge detection on the second scanned image to obtain edge information at different height values in the extension direction of the calibration scale, and the processing parameters may include edge detection parameters. After performing image processing on the second scanned image with a certain value of the processing parameters, the above-mentioned processing steps of "performing edge detection on the second scanned image to obtain edge information at different height values in the extension direction of the calibration scale" and subsequent steps can be executed to obtain a scale line sequence under the current value of the processing parameters. Thus, based on the sequence quality of each scale line sequence under different values, a scale line sequence can be selected as the scale line sequence for loading into the security inspection machine. Furthermore, by cycling through different values of the processing parameters and measuring the sequence quality for security inspection machines of different brands and models, it helps to be as compatible as possible with security inspection machines of different brands and models during the process of obtaining the scale line sequence.

[0034] In a specific implementation scenario, as a possible example, the Canny operator can be used for edge detection. In this case, the edge detection parameters are the Canny parameters, that is, different values of the Canny parameters can be traversed. As another possible example, before edge detection, the second scanned image can also be filtered first, that is, the processing parameters can also include image filtering parameters. Exemplarily, when Gaussian kernels are used for image filtering, the image filtering parameters are the Gaussian kernel matrices, that is, different values of the Gaussian kernel matrices can be traversed. That is to say, if there are M values for the Canny parameters and N values for the Gaussian kernel matrices, the above-mentioned processing steps of "performing edge detection on the second scanned image to obtain edge information at different height values in the extension direction of the calibration scale" and subsequent steps need to be executed M * N times in a loop, and a scale line sequence can be obtained correspondingly after each loop execution.

[0035] In a specific implementation scenario, in order to measure the sequence quality of the scale line sequence, the second edge width and the second edge density can be obtained based on the edge information at the height values corresponding to the respective scale pixel coordinates in the scale line sequence. It should be noted that for the specific meaning of the "second edge width", reference can be made to the relevant description of the "first edge width" above, and for the specific meaning of the "second edge density", reference can be made to the relevant description of the "first edge density" above, which will not be elaborated here. Similarly to the above-mentioned measurement of coordinate quality, median statistics can also be performed based on the edge information at the height values corresponding to the respective scale pixel coordinates in the scale line sequence to obtain the second median width and the second median density. It should be noted that for the specific meaning of the "second median width", reference can be made to the relevant description of the "first median width" above, and for the specific meaning of the "second median density", reference can be made to the relevant description of the "second median density" above, which will not be elaborated here. In addition, two differences can be performed based on the respective scale pixel coordinates in the scale line sequence to obtain a number of pixel coordinate difference values. For example, a difference can be calculated between adjacent scale pixel coordinates in the scale line sequence to obtain a number of first difference values, and then a difference can be calculated between adjacent coordinate difference values to obtain a number of second difference values, which can be used as the pixel coordinate difference values. On this basis, the sequence quality of the scale line sequence can be obtained based on the average of the absolute differences between each second edge width and the second median width, the average of the absolute differences between each second edge density and the second median density, and the absolute average of a number of pixel coordinate difference values. For the sake of convenience of description, the sequence quality val can be expressed as: val = Mean(abs(lines_width - Median(lines_width))) + Mean(abs(lines_density - Median(lines_density))) + Mean(abs(diff(diff(lines_p)))) In the above formula, lines_width represents the second edge width, Median(lines_width) represents the second median width, lines_density represents the second edge density, Median(lines_density) represents the second median density, and diff(diff(lines_p) represents the pixel coordinate difference value. In addition, Mean represents taking the average value, and abs represents taking the absolute value.

[0036] In a specific implementation scenario, the scale line sequence with the best sequence quality can be selected as the scale line sequence for loading into the security inspection machine.

[0037] In yet another implementation scenario, different from the foregoing implementation manner, as another possible implementation manner, before image processing, the boundary lines of the calibration ruler in the second scanned image may also be detected, so that the four vertices of the calibration ruler can be obtained. Furthermore, based on the vertex coordinates of the calibration ruler, the perspective transformation of the second scanned image can be performed, so that the short side of the calibration ruler in the second scanned image after transformation is horizontal and the long side is vertical (i.e., Figure 2b as shown by the calibration ruler in

[0038] . After that, a processing flow similar to the foregoing implementation manner can be adopted to obtain the scale line sequence. Different from the foregoing implementation manner, after the scale line sequence is obtained, a transformation method inverse to the foregoing perspective transformation needs to be adopted to convert the scale pixel coordinates in the scale line sequence to the original image coordinate system. The scale line sequence after conversion is the scale line sequence finally loaded by the security inspection machine.

[0039] It should be noted that the above four examples are only several possible ways to obtain the scale line sequence. In actual application, one of the implementation manners can be selectively adopted according to the actual situation to obtain the scale line sequence. Of course, other ways to obtain the scale line sequence are not limited herein, and no further examples will be given.

[0040] Specifically, as described above, the boundary points may include: on the target direction of the first scanned image, the first boundary point and the second boundary point on the object to be measured. The target direction is the placement direction of the calibration ruler in the security inspection channel. For details, please refer to Figure 2a and the relevant descriptions, which will not be elaborated herein. For the first scale index corresponding to any boundary point, the second pixel coordinate of the scale line to which the first scale index belongs is not greater than the first pixel coordinate of the boundary point, and the scale line to which the first scale index belongs is closest to the boundary point. For the convenience of description, the first scale index rF1 corresponding to the first boundary point can be expressed as:

[0041] In the above formula, Pr[:,1] represents the pixel coordinate value of the second pixel coordinate in the scale line sequence in the target direction, P1[1] represents the pixel coordinate value of the first boundary point in the target direction, and np.where is a function used to return the element indices that meet the given conditions (i.e., the conditions attached in the brackets).

[0042] Similarly, the first scale index rF2 corresponding to the second boundary point can be expressed as:

[0043] In the above formula, P2[1] represents the pixel coordinate value of the second boundary point in the target direction. For the specific meanings of other parameters, please refer to the previous formula and will not be elaborated here. Please refer to Figure 2f , Figure 2f which is a schematic diagram of the effect of another embodiment of the first scanned image of this application. As Figure 2f shown, for the convenience of understanding the implementation process of the embodiments of the present disclosure, Figure 2f not only shows the object to be measured, but also shows the scale line sequence. However, it can be understood that in the actual application process, the scale line sequence is not included in the first scanned image. Continuing with Figure 2f shown as an example, for the first boundary point P1, the corresponding first scale index can be: the second pixel coordinate of the scale line to which it belongs is not greater than the first boundary point P1 and the scale line to which it belongs is closest to the first boundary point P1, that is, the first scale index r2; similarly, for the second boundary point P2, the corresponding second scale index can be: the second pixel coordinate of the scale line to which it belongs is not greater than the second boundary point P2 and the scale line to which it belongs is closest to the second boundary point P2, that is, the first scale index r8. Of course, Figure 2f shown is only a possible example in the actual application process, and other possible situations will not be exemplified one by one here.

[0044] Step S13: Based on the first scale index, the physical distance between adjacent scale lines on the calibration ruler, and the pixel distance between boundary points, obtain the scaling factor when the security inspection machine images at the object to be measured.

[0045] In an implementation scenario, as a possible implementation manner, when the accuracy requirement for the scaling factor is relatively loose, the product of the absolute difference of the first scale index and the physical distance can be obtained as the first distance, and then the ratio of the first distance to the pixel distance can be obtained as the scaling factor. It should be noted that the absolute difference of the first scale index is the absolute difference between the first scale indices of the aforementioned first boundary point and the second boundary point, and the pixel distance between the boundary points is the pixel distance between the aforementioned first boundary point and the second boundary point (more precisely, the pixel distance in the target direction). For the convenience of description, the scaling factor λ can be expressed as:

[0046] In the above formula, rF1 represents the first scale index corresponding to the first boundary point, rF2 represents the first scale index corresponding to the second boundary point, D r represents the physical distance between adjacent scale lines on the calibration ruler, V o1 represents the pixel coordinate value of the first boundary point in the target direction, V o2 represents the pixel coordinate value of the second boundary point in the target direction, fabs(V o1 -V o2)That is, it represents the pixel pitch between the first boundary point and the second boundary point.

[0047] In another implementation scenario, different from the foregoing implementation manner, as another possible implementation manner, when the accuracy requirement for the scaling factor is relatively strict, after obtaining the first scale index, the difference between the first pixel coordinate and the second pixel coordinate of the first scale index can be obtained as the first difference, and the difference between the second pixel coordinate of the reference scale index and the second pixel coordinate of the first scale index can be obtained as the second difference, and the reference scale index is the next scale index of the first scale index. On this basis, the ratio of the first difference to the second difference can be obtained as the additional scale index of the first scale index. It should be noted that the additional scale index is a floating-point value. After obtaining the additional scale index, the scaling factor when the security inspection machine images the object to be measured can be obtained based on the first scale index, the additional scale index, the physical pitch, and the pixel pitch.

[0048] In a specific implementation scenario, specifically, the difference between the first pixel coordinate and the second pixel coordinate of the first scale index in the target direction can be obtained as the first difference, and the difference between the second pixel coordinate of the reference scale index and the second pixel coordinate of the first scale index in the target direction can be obtained as the second difference. Then, based on the ratio of the first difference to the second difference, the additional scale index of the first scale index can be obtained. Specifically, for the first boundary point, the additional scale index rI1 corresponding to its first scale index rF1 can be expressed as:

[0049] In the above formula, V o1 represents the first pixel coordinate of the first boundary point (more specifically, the pixel coordinate value of the first pixel coordinate of the first boundary point in the target direction), Pr[rF1,1] represents the second pixel coordinate of the first scale index (more specifically, the pixel coordinate value of the second pixel coordinate of the first scale index in the target direction), and Pr[rF1+1,1] represents the second pixel coordinate of the reference scale index (more specifically, the pixel coordinate value of the second pixel coordinate of the reference scale index in the target direction). Please refer to Figure 2f , for the first boundary point P1, the difference between the pixel coordinate value of P1 in the vertical direction and the pixel coordinate value of the second pixel coordinate of its corresponding first scale index r2 in the vertical direction can be obtained, that is Figure 2f the pixel length of the line segment P3r2 in Figure 2fThe pixel length of the middle line segment r3r2, and the floating-point value of the ratio of the two is the additional scale index corresponding to the first boundary point P1 and the first scale index r2. Similarly, for the second boundary point, the additional scale index rI2 corresponding to its first scale index rF2 can be expressed as:

[0050] In the above formula, V o2 represents the first pixel coordinate of the second boundary point (more specifically, the pixel coordinate value of the first pixel coordinate of the second boundary point in the target direction), Pr[rF2,1] represents the second pixel coordinate of the first scale index (more specifically, the pixel coordinate value of the second pixel coordinate of the first scale index in the target direction), and Pr[rF2+1,1] represents the second pixel coordinate of the reference scale index (more specifically, the pixel coordinate value of the second pixel coordinate of the reference scale index in the target direction). Please refer to Figure 2f For the first boundary point P2, the difference between the pixel coordinate value of P2 in the vertical direction and the pixel coordinate value of the second pixel coordinate of its corresponding first scale index r8 in the vertical direction can be obtained, that is Figure 2f the pixel length of the middle line segment P4r8, and the difference between the pixel coordinates of the second pixel coordinate of the first scale index r8 and the second pixel coordinate of the reference scale index r9 in the vertical direction can be obtained, that is Figure 2f the pixel length of the middle line segment r9r8, and the floating-point value of the ratio of the two is the additional scale index corresponding to the second boundary point P2 and the first scale index r8.

[0051] In a specific implementation scenario, after obtaining the additional scale index of the first scale index, the second scale index can be obtained based on the first scale index and the additional scale index of the first scale index. For example, the second scale index can be obtained by adding the additional scale index of the first scale index to the first scale index. On this basis, the product of the absolute difference of the second scale index and the physical distance can be obtained as the second distance, and the ratio of the second distance to the pixel distance can be obtained as the scaling factor. For the sake of description, the scaling factor can be expressed as:

[0052] In the above formula, rF1+rI1 represents the second scale index corresponding to the first boundary point, and rF2+rI2 represents the second scale index corresponding to the second boundary point. For the specific meanings of the remaining parameters, please refer to the relevant descriptions in the foregoing formula, which will not be elaborated here.

[0053] It should be noted that the above examples are only two possible implementation examples for obtaining the scaling factor. Other possible methods are not limited herein and will not be exemplified one by one. In addition, since the object to be measured is placed in the security inspection channel, the scaling factor actually reflects the imaging scaling between the channel layer and the image layer. Exemplarily, the larger this value is, the more severely the object is scaled in the image compared to its actual size, and the smaller this value is, the less severely the object is scaled in the image compared to its actual size.

[0054] In the above solution, in response to the first scanned image of the object to be measured by the security inspection machine, the first pixel coordinates of the upper boundary point of the object to be measured in the first scanned image are detected, and a scale line sequence is loaded. The scale line sequence is pre-detected based on the second scanned image of the calibration scale by the security inspection machine, and the scale line sequence includes the second pixel coordinates of the scale lines on the calibration scale. Then, based on the first pixel coordinates and the second pixel coordinates, the scale line adjacent to the boundary point is found in the scale line sequence to obtain the first scale index. Furthermore, based on the first scale index, the physical distance between adjacent scale lines on the calibration scale, and the pixel distance between the boundaries, the scaling factor when the security inspection machine images the object to be measured is obtained. Therefore, on the one hand, calibrating the scaling factor through the calibration scale can improve the reliability of the scaling factor compared to directly using the built-in scaling factor. On the other hand, combining the scale line sequence and the upper boundary point of the object to be measured in the first scanned image can calibrate the scaling factor of the security inspection machine at the position of the object to be measured according to the actual position of the object to be measured when calibrating the scaling factor. Compared with using a general scaling factor, it can take into account the differences in imaging at different positions of the security inspection machine during the security inspection process. Therefore, it can improve the reliability of the scaling factor and take into account the differences in imaging at different positions of the security inspection machine.

[0055] Please refer to Figure 3 , Figure 3 which is a schematic framework diagram of an embodiment of the scaling factor determination device of the present application. The scaling factor determination device 30 includes: a detection and loading module 31, an index search module 32, and a coefficient calculation module 33. The detection and loading module 31 is configured to, in response to the first scanned image of the object to be measured by the security inspection machine, detect the first pixel coordinates of the upper boundary point of the object to be measured in the first scanned image and load the scale line sequence; wherein, the scale line sequence is pre-detected based on the second scanned image of the calibration scale by the security inspection machine, and the scale line sequence includes the second pixel coordinates of the scale lines on the calibration scale. The index search module 32 is configured to find the scale line adjacent to the boundary point in the scale line sequence based on the first pixel coordinates and the second pixel coordinates to obtain the first scale index. The coefficient calculation module 33 is configured to obtain the scaling factor when the security inspection machine images the object to be measured based on the first scale index, the physical distance between adjacent scale lines on the calibration scale, and the pixel distance between the boundary points.

[0056] In the above solution, the zoom factor determination device 30 responds to the first scanned image of the object to be detected by the security inspection machine, detects the first pixel coordinates of the upper boundary point of the object to be detected in the first scanned image, and loads a scale line sequence. The scale line sequence is pre-detected based on the second scanned image of the calibration ruler by the security inspection machine, and the scale line sequence includes the second pixel coordinates of the scale lines on the calibration ruler. Thus, based on the first pixel coordinates and the second pixel coordinates, the scale line adjacent to the boundary point is searched in the scale line sequence to obtain the first scale index. Furthermore, based on the first scale index, the physical distance between adjacent scale lines on the calibration ruler, and the pixel distance between the boundaries, the zoom factor when the security inspection machine images at the object to be detected is obtained. Therefore, on the one hand, calibrating the zoom factor through the calibration ruler can improve the reliability of the zoom factor compared with directly using the built-in zoom factor. On the other hand, combining the scale line sequence and the upper boundary point of the object to be detected in the first scanned image can calibrate the zoom factor of the security inspection machine at the object to be detected according to the actual position of the object to be detected during calibration. Compared with using a general zoom factor, it can take into account the differences in imaging at different positions of the security inspection machine during the security inspection process. Therefore, it can improve the reliability of the zoom factor and take into account the differences in imaging at different positions of the security inspection machine.

[0057] In some disclosed embodiments, the coefficient calculation module 33 includes an actual distance sub-module for obtaining the product of the absolute difference of the first scale index and the physical distance as the first distance; the coefficient calculation module 33 includes a first calculation sub-module for obtaining the ratio of the first distance to the pixel distance as the zoom factor.

[0058] In some disclosed embodiments, the coefficient calculation module 33 includes a difference calculation sub-module for obtaining the difference between the first pixel coordinates and the second pixel coordinates of the first scale index as the first difference, and obtaining the difference between the second pixel coordinates of the reference scale index and the second pixel coordinates of the first scale index as the second difference; wherein, the reference scale index is the next scale index of the first scale index; the coefficient calculation module 33 includes an additional index sub-module for obtaining the ratio of the first difference to the second difference as the additional scale index of the first scale index; the coefficient calculation module 33 includes a second calculation sub-module for obtaining the zoom factor when the security inspection machine images at the object to be detected based on the first scale index, the additional scale index, the physical distance, and the pixel distance.

[0059] In some disclosed embodiments, the second calculation sub-module includes an index combination unit for obtaining the second scale index based on the first scale index and the additional scale index of the first scale index; the second calculation sub-module includes a distance calculation unit for obtaining the product of the absolute difference of the second scale index and the physical distance as the second distance; the second calculation sub-module includes a coefficient calculation unit for obtaining the ratio of the second distance to the pixel distance as the zoom factor.

[0060] In some disclosed embodiments, the scaling factor determination device 30 includes an edge detection module configured to perform edge detection based on the second scanned image to obtain edge information at different height values in the extending direction of the calibration scale; the scaling factor determination device 30 includes a first sequence module configured to screen at least one height value based on the edge information at each height value to obtain a first line sequence; wherein, the first line sequence includes the scale pixel coordinates suspected to be scale lines at the height values; the scaling factor determination device 30 includes a second sequence module configured to intercept a plurality of second line sequences from the first line sequence based on the coordinate intervals between adjacent scale pixel coordinates in the first line sequence; the scaling factor determination device 30 includes a sequence processing module configured to select and sequentially combine a plurality of second line sequences as the scale line sequence based on the first quantity of the scale pixel coordinates in the plurality of second line sequences and the second quantity of the scale lines on the calibration scale, or continue to add based on the plurality of second line sequences to obtain the scale line sequence.

[0061] In some disclosed embodiments, the coordinate intervals between adjacent scale pixel coordinates in the same second line sequence are respectively within the same numerical range; and / or, for different groups of adjacent scale pixel coordinates in the same second line sequence, the interval difference between the coordinate intervals is lower than a preset threshold.

[0062] In some disclosed embodiments, the sequence processing module is specifically configured to, in response to the first quantity being equal to the second quantity, sequentially combine a plurality of second line sequences as the scale line sequence, and in response to the first quantity being greater than the second quantity, select the scale pixel coordinates in the first line sequence that are not intercepted into the second line sequence as candidate pixel coordinates, and add the candidate pixel coordinates based on the coordinate quality of the candidate pixel coordinates on the basis of the plurality of second line sequences to obtain the scale line sequence.

[0063] In some disclosed embodiments, the sequence processing module includes a first edge calculation sub-module configured to obtain a first edge width, a first edge density, an on-line edge scale width, and an off-line edge scale width based on the edge information at the height value corresponding to the candidate pixel coordinates; the sequence processing module includes a first median calculation sub-module configured to perform median statistics on the edge information at the height values corresponding to each scale pixel coordinate in the second line sequence to obtain a first median width, a first median density, an on-line edge median width, and an off-line edge median width; the sequence processing module includes a coordinate quality calculation sub-module configured to obtain the coordinate quality of the candidate pixel coordinates based on the absolute difference between the first edge width and the first median width, the absolute difference between the first edge density and the first median density, the absolute difference between the on-line edge scale width and the on-line edge median width, and the absolute difference between the off-line edge scale width and the off-line edge median width.

[0064] In some disclosed embodiments, when the number of several second line sequences is more than one, the sequence processing module includes a first candidate sub-module, configured to select the scale pixel coordinates that are not intercepted into the second line sequences in the first line sequence and are located between the second line sequences, as the first candidate coordinates; the sequence processing module includes a first prediction sub-module, configured to perform prediction based on the coordinate intervals between the scale pixel coordinates in the several second line sequences, to obtain first prediction coordinates where scale lines are suspected to exist between the several second line sequences; the sequence processing module includes a first addition sub-module, configured to select first candidate coordinates whose coordinate quality meets a preset condition within a preset range of the first prediction coordinates, and add them to the several second line sequences, to obtain a scale line sequence.

[0065] In some disclosed embodiments, when the number of several second line sequences is only one, the sequence processing module includes a second candidate sub-module, configured to select the scale pixel coordinates that are not intercepted into the second line sequence in the first line sequence and are located before and after the second line sequence, as the second candidate coordinates; the sequence processing module includes a second prediction sub-module, configured to perform prediction based on the coordinate intervals between the scale pixel coordinates in the second line sequence, to obtain second prediction coordinates where scale lines are suspected to exist before and after the second line sequence; the sequence processing module includes a third candidate sub-module, configured to select the second candidate coordinates within a preset range of the second prediction coordinates, as the third candidate coordinates; the sequence processing module includes a quality fusion sub-module, configured to perform fusion based on the third candidate coordinates and the coordinate quality of the third candidate coordinates between them and the second line sequence, to obtain a new coordinate quality of the third candidate coordinates; the sequence processing module includes a third addition sub-module, configured to select the third candidate coordinates and the third candidate coordinates between them and the second line sequence based on the new coordinate quality of the third candidate coordinates, and add them to the second line sequence, to obtain a scale line sequence.

[0066] In some disclosed embodiments, the zoom coefficient determination device 30 includes a parameter traversal module, configured to traverse different values of processing parameters in sequence before obtaining the edge information of the calibration ruler at different height values in the extension direction based on edge detection of the second scanned image; wherein, the processing parameters include edge detection parameters; the zoom coefficient determination device 30 includes a sequence selection module, configured to select and combine several second line sequences in order based on the first number of scale pixel coordinates in the several second line sequences and the second number of scale lines on the calibration ruler, as the scale line sequence, or continue to add based on the several second line sequences, and after obtaining the scale line sequence, select the scale line sequence as the scale line sequence for loading into the security inspection machine based on the sequence quality of each scale line sequence under different values.

[0067] In some disclosed embodiments, the sequence selection module includes a second edge computing sub-module, which is configured to obtain a second edge width and a second edge density based on the edge information at the height values respectively corresponding to the respective scale pixel coordinates in the scale line sequence; the sequence selection module includes a second median computing sub-module, which is configured to perform median statistics based on the edge information at the height values respectively corresponding to the respective scale pixel coordinates in the scale line sequence to obtain a second median width and a second median density, and perform two differences on the respective scale pixel coordinates in the scale line sequence to obtain a plurality of pixel coordinate difference values; the sequence selection module includes a sequence quality computing sub-module, which is configured to obtain the sequence quality of the scale line sequence based on the average of the absolute differences between the respective second edge widths and the second median width, the average of the absolute differences between the respective second edge densities and the second median density, and the absolute average of the plurality of pixel coordinate difference values.

[0068] In some disclosed embodiments, the edge information includes an edge width and an edge density. The first sequence module includes a curve acquisition sub-module, which is configured to obtain a first curve representing the distribution of the edge width with respect to the height value based on the edge width at each height value, and obtain a second curve representing the distribution of the edge density with respect to the height value based on the edge density at each height value; the first sequence module includes a peak detection sub-module, which is configured to screen at least one height value that is a peak of the curve in both the first curve and the second curve to obtain a first line sequence.

[0069] In some disclosed embodiments, the calibration ruler is perpendicular to the traveling direction of the security inspection channel; and / or, the boundary points include: a first boundary point and a second boundary point on the object to be measured in the target direction of the first scanned image, and the target direction is the placement direction of the calibration ruler on the security inspection channel; and / or, for the first scale index corresponding to any boundary point, the second pixel coordinate of the scale line to which the first scale index belongs is not greater than the first pixel coordinate of the boundary point, and the scale line to which the first scale index belongs is closest to the boundary point.

[0070] Please refer to Figure 4 , Figure 4 is a schematic framework diagram of an embodiment of the electronic device of the present application. The electronic device 40 at least includes a memory 41 and a processor 42 that are coupled to each other. The memory 41 stores at least program instructions, and the processor 42 is configured to execute the program instructions to implement the steps in any of the above embodiments of the scaling factor determination method. Specifically, reference can be made to the foregoing disclosed embodiments, which will not be elaborated herein.

[0071] Specifically, the processor 42 is used to control itself and the memory 41 to implement the steps in any of the above embodiments of the scaling factor determination method. The processor 42 can also be referred to as a CPU (Central Processing Unit). The processor 42 may be an integrated circuit chip with signal processing capabilities. The processor 42 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. Additionally, the processor 42 can be implemented jointly by integrated circuit chips.

[0072] In the above solution, the electronic device 40 responds to the first scanned image of the object to be measured by the security inspection machine, detects the first pixel coordinates of the upper boundary point of the object to be measured in the first scanned image, and loads the scale line sequence. The scale line sequence is pre-detected based on the second scanned image of the calibration ruler by the security inspection machine, and the scale line sequence contains the second pixel coordinates of the scale lines on the calibration ruler. Thus, based on the first pixel coordinates and the second pixel coordinates, the scale line adjacent to the boundary point is searched in the scale line sequence to obtain the first scale index. Furthermore, based on the first scale index, the physical distance between adjacent scale lines on the calibration ruler, and the pixel distance between the boundaries, the scaling factor when the security inspection machine images at the object to be measured is obtained. Therefore, on the one hand, calibrating the scaling factor through the calibration ruler can improve the reliability of the scaling factor compared to directly using the built-in scaling factor. On the other hand, combining the scale line sequence and the upper boundary point of the object to be measured in the first scanned image can calibrate the scaling factor of the security inspection machine at the object to be measured according to the actual position of the object to be measured when calibrating the scaling factor. Compared with using a general scaling factor, it can take into account the differences in imaging at different positions of the security inspection machine during the security inspection process. Therefore, it can improve the reliability of the scaling factor and take into account the differences in imaging at different positions of the security inspection machine.

[0073] Please refer to Figure 5 , Figure 5It is a schematic diagram of the framework of an embodiment of the security inspection machine in this application. The security inspection machine 50 at least includes the electronic device 40 in the above embodiment. Of course, in addition to this, the security inspection machine 50 may also include other component devices, such as a light source (not shown), a security inspection channel such as a belt (not shown), an outer frame (not shown), a detector (not shown), etc. The specific structure of the security inspection machine 50 can refer to the technical details related thereto in the art, and the specific structure of the security inspection machine will not be elaborated herein.

[0074] In the above solution, the electronic device 40 in the security inspection machine 50 responds to the first scanned image of the object to be inspected by the security inspection machine 50, detects the first pixel coordinates of the upper boundary point of the object to be inspected in the first scanned image, and loads a scale line sequence. The scale line sequence is pre-detected based on the second scanned image of the calibration ruler by the security inspection machine 50, and the scale line sequence contains the second pixel coordinates of the scale lines on the calibration ruler. Thus, based on the first pixel coordinates and the second pixel coordinates, the scale line adjacent to the boundary point is found in the scale line sequence to obtain the first scale index. Furthermore, based on the first scale index, the physical distance between adjacent scale lines on the calibration ruler, and the pixel distance between the boundaries, the scaling factor of the security inspection machine 50 when imaging at the object to be inspected is obtained. Therefore, on the one hand, calibrating the scaling factor through the calibration ruler can improve the reliability of the scaling factor compared with directly using the built-in scaling factor. On the other hand, combining the scale line sequence and the upper boundary point of the object to be inspected in the first scanned image can calibrate the scaling factor of the security inspection machine 50 at the object to be inspected according to the actual position of the object to be inspected when calibrating the scaling factor. Compared with using a general scaling factor, it can take into account the differences in imaging at different positions of the security inspection machine 50 during the security inspection process. Therefore, it can improve the reliability of the scaling factor and take into account the differences in imaging at different positions of the security inspection machine 50.

[0075] Please refer to Figure 6 , Figure 6 It is a schematic diagram of the framework of an embodiment of the computer-readable storage medium in this application. The computer-readable storage medium 60 stores program instructions 61 that can be run by a processor, and the program instructions 61 are used to implement the steps in any of the above embodiments of the scaling factor determination method.

[0076] In the above solution, the computer-readable storage medium 60 detects the first pixel coordinates of the upper boundary point of the object to be measured in the first scanned image in response to the first scanned image of the object to be measured by the security inspection machine, and loads a scale line sequence. The scale line sequence is pre-detected based on the second scanned image of the calibration ruler by the security inspection machine, and the scale line sequence includes the second pixel coordinates of the scale lines on the calibration ruler. Thus, based on the first pixel coordinates and the second pixel coordinates, the scale line adjacent to the boundary point is searched in the scale line sequence to obtain a first scale index. Furthermore, based on the first scale index, the physical distance between adjacent scale lines on the calibration ruler, and the pixel distance between the boundaries, the scaling factor when the security inspection machine forms an image at the object to be measured is obtained. Therefore, on the one hand, calibrating the scaling factor through the calibration ruler can improve the reliability of the scaling factor compared with directly using the built-in scaling factor. On the other hand, combining the scale line sequence and the upper boundary point of the object to be measured in the first scanned image can calibrate the scaling factor of the security inspection machine at the object to be measured according to the actual position of the object to be measured when calibrating the scaling factor. Compared with using a general scaling factor, it can take into account the differences in imaging at different positions of the security inspection machine during the security inspection process. Therefore, it can improve the reliability of the scaling factor and take into account the differences in imaging at different positions of the security inspection machine.

[0077] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the methods described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.

[0078] The descriptions of the above embodiments tend to emphasize the differences between the embodiments. The same or similar parts can be referred to each other. For the sake of brevity, they will not be repeated in this article.

[0079] In several embodiments provided by the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in electrical, mechanical or other forms.

[0080] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0081] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0082] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0083] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.

Claims

1. A method for determining a scaling factor, characterized in that: include: In response to a first scanned image of the object to be tested by the security inspection machine, the first pixel coordinates of the upper boundary point of the object to be tested in the first scanned image are detected, and a scale line sequence is loaded; wherein the scale line sequence is pre-obtained based on the second scanned image of the calibration ruler detected by the security inspection machine, and the scale line sequence includes the second pixel coordinates of the scale lines on the calibration ruler; Searching for a scale line adjacent to the boundary point in the scale line sequence based on the first pixel coordinate and the second pixel coordinate to obtain a first scale index; Based on the first scale index, the physical spacing between adjacent scale lines on the calibration ruler and the pixel spacing between the boundary points, a scaling factor of the security inspection machine when imaging the object to be inspected is obtained.

2. The method according to claim 1, characterized in that: The obtaining, based on the first scale index, the physical spacing between adjacent scale lines on the calibration ruler and the pixel spacing between the boundary points, a scaling factor when the security inspection machine is imaging at the object to be inspected includes: Obtaining the product of the absolute difference of the first scale index and the physical distance as the first distance; A ratio of the first pitch to the pixel pitch is obtained as the scaling factor.

3. The method according to claim 1, characterized in that After searching the scale line adjacent to the boundary point in the scale line sequence based on the first pixel coordinate and the second pixel coordinate to obtain a first scale index, and before obtaining a scaling factor of the security inspection machine when imaging the object to be tested based on the first scale index, the physical spacing between adjacent scale lines on the calibration ruler, and the pixel spacing between the boundary points, the method further includes: Obtaining a difference between the first pixel coordinate and the second pixel coordinate of the first scale index as a first difference value, and obtaining a difference between the second pixel coordinate of a reference scale index and the second pixel coordinate of the first scale index as a second difference value; wherein the reference scale index is a scale index subsequent to the first scale index; Obtaining a ratio of the first difference to the second difference as an additional scale index of the first scale index; The obtaining, based on the first scale index, the physical spacing between adjacent scale lines on the calibration ruler and the pixel spacing between the boundary points, a scaling factor when the security inspection machine is imaging at the object to be inspected includes: Based on the first scale index, the additional scale index, the physical spacing and the pixel spacing, a scaling factor of the security inspection machine when imaging the object to be inspected is obtained.

4. The method according to claim 3, characterized in that The method of obtaining a scaling factor of the security inspection machine when imaging the object to be detected based on the first scale index, the additional scale index, the physical spacing and the pixel spacing. Obtaining a second scale index based on the first scale index and an additional scale index of the first scale index; Obtaining the product of the absolute difference of the second scale index and the physical interval as the second interval; A ratio of the second pitch to the pixel pitch is obtained as the scaling factor.

5. The method according to claim 1, characterized in that The step of detecting the scale line sequence comprises: Performing edge detection based on the second scanned image to obtain edge information of the calibration ruler at different height values ​​in the extension direction; Based on the edge information at each of the height values, at least one of the height values ​​is filtered to obtain a first line sequence; wherein the first line sequence includes coordinates of scale pixels at the height value that are suspected to be the scale lines; Based on the coordinate interval between the adjacent scale pixel coordinates in the first line sequence, extracting a plurality of second line sequences from the first line sequence; Based on the first number of the scale pixel coordinates in the plurality of second line sequences and the second number of the scale lines on the calibration ruler, the plurality of second line sequences are selected to be sequentially combined as the scale line sequence, or are continuously added on the basis of the plurality of second line sequences to obtain the scale line sequence.

6. The method according to claim 5, characterized in that The coordinate intervals between the adjacent scale pixel coordinates in the same second line sequence are respectively within the same value range; And / or, in the same second line sequence, for different groups of adjacent scale pixel coordinates, the interval difference between the coordinate intervals is lower than a preset threshold.

7. The method according to claim 5, characterized in that The selecting and sequentially combining the plurality of second line sequences based on the first number of the scale pixel coordinates in the plurality of second line sequences and the second number of the scale lines on the calibration ruler as the scale line sequence, or continuously adding to the plurality of second line sequences to obtain the scale line sequence, comprises: In response to the first number being equal to the second number, sequentially combining the plurality of second line sequences as the scale line sequence; In response to the first number being greater than the second number, scale pixel coordinates in the first line sequence that are not intercepted to the second line sequence are selected as candidate pixel coordinates, and based on the coordinate quality of the candidate pixel coordinates, the candidate pixel coordinates are added to the plurality of second line sequences to obtain the scale line sequence.

8. The method according to claim 7, characterized in that The step of obtaining the coordinate quality of the candidate pixel coordinates comprises: Based on the edge information at the height value corresponding to the candidate pixel coordinates, a first edge width, a first edge density, an online edge scale width, and an offline edge scale width are obtained; Based on the edge information at the height values ​​corresponding to the respective scale pixel coordinates in the second line sequence, median statistics are performed to obtain a first median width, a first median density, an online edge median width, and a offline edge median width; The coordinate quality of the candidate pixel coordinates is obtained based on the absolute difference between the first edge width and the first median width, the absolute difference between the first edge density and the first median density, the absolute difference between the online upper edge scale width and the online upper edge median width, and the absolute difference between the offline lower edge scale width and the offline lower edge median width.

9. The method according to claim 7, characterized in that: In a case where the number of the plurality of second line sequences is more than one, selecting the scale pixel coordinates in the first line sequence that are not intercepted to the second line sequence as candidate pixel coordinates includes: Selecting, as first candidate coordinates, scale pixel coordinates in the first line sequence that are not intercepted to the second line sequence and are located between the second line sequences; The adding the candidate pixel coordinates to the plurality of second line sequences based on the coordinate quality of the candidate pixel coordinates to obtain the scale line sequence includes: Predicting based on the coordinate intervals between the scale pixel coordinates in the plurality of second line sequences, to obtain first predicted coordinates between the plurality of second line sequences where the scale line is suspected to exist; The first candidate coordinates whose coordinate quality meets a preset condition are selected within a preset range of the first predicted coordinates and added to the plurality of second line sequences to obtain the scale line sequence.

10. The method according to claim 7, characterized in that In a case where there is only one sequence of the plurality of second line sequences, selecting the scale pixel coordinates in the first line sequence that are not intercepted to the second line sequence as candidate pixel coordinates includes: Selecting scale pixel coordinates in the first line sequence that are not intercepted to the second line sequence and are located before or after the second line sequence as second candidate coordinates; The adding the candidate pixel coordinates to the plurality of second line sequences based on the coordinate quality of the candidate pixel coordinates to obtain the scale line sequence includes: Predicting based on the coordinate interval between the scale pixel coordinates in the second line sequence, obtaining second predicted coordinates where the scale lines are suspected to exist before and after the plurality of second line sequences; Selecting the second candidate coordinate within a preset range of the second predicted coordinate as the third candidate coordinate; Based on the third candidate coordinates and the coordinate quality of the third candidate coordinates between the third candidate coordinates and the second line sequence, a new coordinate quality of the third candidate coordinates is obtained; Based on the new coordinate quality of the third candidate coordinate, the third candidate coordinate and the third candidate coordinate between the third candidate coordinate and the second line sequence are selected and added to the plurality of second line sequences to obtain the scale line sequence.

11. The method according to claim 5, characterized in that Before performing edge detection based on the second scanned image to obtain edge information of the calibration ruler at different height values ​​in the extension direction, the method further includes: Sequentially traverse processing parameters with different values; wherein the processing parameters include edge detection parameters; After selecting and sequentially combining the plurality of second line sequences based on the first number of scale pixel coordinates in the plurality of second line sequences and the second number of scale lines on the calibration ruler to serve as the scale line sequence, or continuing to add to the plurality of second line sequences to obtain the scale line sequence, the method further comprises: Based on the sequence quality of each of the scale line sequences under the different values, the scale line sequence is selected as the scale line sequence for loading the security inspection machine.

12. The method according to claim 11, characterized in that The sequence quality acquisition step of the scale line sequence comprises: Based on the edge information at the height values ​​corresponding to the coordinates of each of the scale pixels in the scale line sequence, a second edge width and a second edge density are obtained; Performing median statistics based on the edge information at the height values ​​corresponding to the respective scale pixel coordinates in the scale line sequence to obtain a second median width and a second median density, and performing two differences based on the respective scale pixel coordinates in the scale line sequence to obtain a plurality of pixel coordinate difference values; The sequence quality of the scale line sequence is obtained based on the average value of the absolute differences between each second edge width and the second median width, the average value of the absolute differences between each second edge density and the second median density, and the absolute average value of the plurality of pixel coordinate differential values.

13. The method according to claim 5, characterized in that The edge information includes edge width and edge density, and the step of filtering at least one of the height values ​​based on the edge information at each of the height values ​​to obtain a first line sequence includes: Based on the edge width at each of the height values, a first curve representing the distribution of the edge width with the height value is obtained, and based on the edge density at each of the height values, a second curve representing the distribution of the edge density with the height value is obtained; At least one of the height values ​​that is a curve peak in both the first curve and the second curve is screened to obtain the first line sequence.

14. The method according to any one of claims 1 to 13, characterized in that: The calibration ruler is perpendicular to the travel direction of the security inspection channel in the security inspection machine; And / or, the boundary points include: a first boundary point and a second boundary point on the object to be measured in a target direction of the first scanned image, the target direction being a placement direction of the calibration ruler on the security inspection channel in the security inspection machine; And / or, for a first scale index corresponding to any of the boundary points, the second pixel coordinate of the scale line to which the first scale index belongs is not greater than the first pixel coordinate of the boundary point, and the scale line to which the first scale index belongs is closest to the boundary point.

15. A device for determining a scaling factor, characterized in that: include: A detection and loading module, configured to detect the first pixel coordinates of the upper boundary point of the object to be detected in the first scanned image in response to the first scanned image of the object to be detected by the security inspection machine, and load a scale line sequence; wherein the scale line sequence is pre-obtained based on the second scanned image of the calibration ruler detected by the security inspection machine, and the scale line sequence includes the second pixel coordinates of the scale lines on the calibration ruler; An index search module, configured to search for a scale line adjacent to the boundary point in the scale line sequence based on the first pixel coordinate and the second pixel coordinate to obtain a first scale index; The coefficient calculation module is used to obtain the scaling coefficient of the security inspection machine when imaging the object to be tested based on the first scale index, the physical spacing between adjacent scale lines on the calibration ruler and the pixel spacing between the boundary points.

16. An electronic device, characterized in that: The method comprises at least a memory and a processor coupled to each other, wherein the memory at least stores program instructions, and the processor is used to execute the program instructions to implement the method for determining the scaling factor according to any one of claims 1 to 14.

17. A security inspection machine, characterized in that: At least comprising the electronic device as claimed in claim 16.

18. A computer-readable storage medium, characterized in that: Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the scaling factor determination method according to any one of claims 1 to 14.

Citation Information

Patent Citations

  • Security inspection machine calibration method, related method, device, equipment and storage medium

    CN117422777A

  • Security inspection machine calibration method, related method, device, equipment and storage medium

    CN117437305A

  • Carrier position determination method and device, computer equipment and storage medium

    CN119104050A

  • Die image grayscale correction method, computer equipment and computer storage medium

    CN119741207A

  • Model reconstruction method and related apparatus, and electronic device and storage medium

    WO2023024441A1