Scaling Coefficient Determination Method and Related Devices, Security Inspection Machine, and Storage Medium

By detecting the pixel coordinates of boundary points in the security inspection machine and loading the tick line sequence, the scaling coefficient is calculated, and the problems of unreliability and imaging differences in the prior art are solved, and more accurate dimensional measurement is achieved.

CN120070599BActive Publication Date: 2025-07-11IFLYTEK (SUZHOU) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The scaling coefficient of existing security machines cannot ensure reliability and cannot take into account the differences in imaging at different locations, resulting in inaccurate measurement of size.

Method used

By detecting the boundary point pixel coordinates in the scan image of the object to be measured by the security check machine, loading the pre-rated scale sequence based on the calibration ruler, finding the adjacent scale index, and combining the physical spacing of adjacent scale lines on the calibration ruler and the pixel spacing of the boundary point, the scaling coefficient of the security check machine at the object to be measured is calculated.

Benefits of technology

It improves the reliability of the scaling coefficient and can take into account the imaging differences of the security check machine at different locations to ensure the accuracy of size measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120070599B_ABST
    Figure CN120070599B_ABST
Patent Text Reader

Abstract

The present application discloses a method for determining a scaling factor, related devices, an X-ray security inspection machine, and a storage medium. The method for determining the scaling factor includes: in response to a first scanned image of an object to be detected by the X-ray security inspection machine, detecting first pixel coordinates of an upper boundary point of the object to be detected in 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 coordinates and the second pixel coordinates to obtain a first scale index; and obtaining a scaling factor when the X-ray security inspection machine images at the object to be detected based on the first scale index, the physical distance between adjacent scale lines on the calibration ruler, and the pixel distance between boundary points. The above solution 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.
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 in particular, 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; 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, a scaling factor determination device is provided in the second aspect of the present application, including: a detection and loading module, an index search module, and a coefficient calculation module. The detection and loading module is configured to detect the first pixel coordinates of the upper boundary point of the object to be measured in the first scan image in response to the first scan image of the object to be measured by the security inspection machine, and load a scale line sequence; wherein, the scale line sequence is pre-detected based on the second scan 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. 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 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 ruler, and the pixel distance between boundary points.

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

[0008] To solve the above technical problems, a security inspection machine is provided in the fourth aspect of the present application, at least including the electronic device in the third aspect above.

[0009] To solve the above technical problems, a computer-readable storage medium is provided in the fifth aspect of the present application, storing program instructions that can be run by a processor. The program instructions are used to implement the scaling 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 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 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 scaling coefficient when the security inspection machine forms an image at the object to be measured 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, by combining the scale line sequence and the upper boundary point of the object to be measured in the first scanned image, the scaling coefficient of the security inspection machine at the object to be measured can be calibrated according to the actual position of the object to be measured 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;

[0012] Figure 2a is a schematic diagram of the effect of an embodiment of the first scanned image of the present application;

[0013] Figure 2b is a schematic diagram of the effect of an embodiment of the second scanned image of the present application;

[0014] Figure 2c is a partial schematic diagram of an embodiment of performing edge detection on the second scanned image of the present application;

[0015] Figure 2d is a partial schematic diagram of another embodiment of performing edge detection on the second scanned image of the present application;

[0016] Figure 2e is a schematic diagram of the effect of an embodiment of the first curve and the second curve of the present application;

[0017] Figure 2f is a schematic diagram of the effect of another embodiment of the first scanned image of the present application;

[0018] Figure 3 is a schematic framework diagram of an embodiment of the device for determining the scaling coefficient of the present application;

[0019] Figure 4 is a schematic framework diagram of an embodiment of the electronic device of the present application;

[0020] Figure 5 It is a schematic diagram of the framework of an embodiment of the security inspection machine of the present application;

[0021] Figure 6 It is a schematic diagram of the framework of an embodiment of the computer-readable storage medium of the present application. Specific embodiments

[0022] The following will combine the accompanying drawings of the specification to elaborate on the solutions of the embodiments of the present application in detail.

[0023] 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.

[0024] The terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is merely a description of the association relationship between associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the segment " / " in this article generally represents an "or" relationship between the associated objects before and after. In addition, "multiple" in this article means two or more than two.

[0025] Please refer to Figure 1 , Figure 1 It 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:

[0026] Step S11: 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.

[0027] 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 measured, the calibration ruler can be placed on the security inspection machine first to obtain the second scanned image of the calibration ruler by the security inspection machine, and then the scale line sequence can be detected based on the second scanned image. As a possible example in the actual application process, the light source of the security inspection machine can be an X-ray. 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 here. 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 measured passes through the inspection and needs to measure the size of the object to be measured through the scanned image of the object to be measured, 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.

[0028] 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 manner, 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.

[0029] In an implementation scenario, the object to be measured can include, but is not limited to, any possible object during passing through the inspection, such as a bottle, a bag, a box, a notebook, etc. The specific type of the object to be measured is not limited here.

[0030] In an implementation scenario, the boundary points can include: the first boundary point and the second boundary point on the object to be measured in the target direction of the first scanned image, 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 the present 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 2aas shown by the dashed rectangle). As a possible example, the target area can be the smallest circumscribed rectangle enclosing the object to be measured. On this basis, pixel points located on the boundary of the target area in the target direction can be selected, which are the first boundary points (such as Figure 2a P1 in Figure 2a ), and the second boundary points (such as Figure 2a P2 in o1 ). Of course, o1 what is shown is only a possible example of 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, hereinafter, the first boundary point P1 and the second boundary point P2 will continue to be used as examples, and the first pixel coordinates of the first boundary point P1 will be denoted as [U o2 ,V o2 , and the first pixel coordinates of the second boundary point will be denoted as [U

[0031] r r1 ,V r1 , where U represents the abscissa and V represents the ordinate. Figure 2b Figure 2b Figure 2b Figure 2b r =[[U r1 ,V r1 ,[U r2 ,V r2 ,…,[U r10 ,V r10 in 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 on only one side, or may have scale lines on both sides. Other possible situations will not be exemplified one by one here. It should be noted that the specific process of edge detection can refer to the technical details of edge detection operators such as Canny, which will not be elaborated here.

[0032] 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.

[0033] 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 may also be different in the second scanned images of different security inspection machines. 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

[0034] , 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 2c shown in Figure 2c is just 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. Figure 2c Figure 2e 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 and the right figure of Figure 2eWhat is shown is merely 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. No further examples will be given here. After obtaining the first curve and the second curve, at least one height value that is a peak of the curve on both the first curve and the second curve can be selected to obtain the first line sequence. For example, each height value can be traversed in turn. If the height value is a peak of the curve in the first curve and also a 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 as 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

[0035] . In the above manner, peak detection is performed through the first curve representing the distribution of the edge width with respect to the height value and the second curve representing the distribution of the edge density with respect to the height value to obtain the first line sequence containing suspected calibration lines, which can combine the two aspects of the edge width and the edge density to obtain the initial calibration line sequence in the form of peak detection, helping to improve the convenience and accuracy of initializing the calibration line sequence. Figure 2d In a specific implementation scenario, after obtaining the first line sequence, considering the influence of factors such as the imaging algorithm in the actual application process, the calibration lines may have Figure 2d the different distribution situations shown, 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 imaging algorithm has a relatively large scaling effect on the area far from the light source, the numerical range can also be set relatively large, and the corresponding numerical range is 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 imaging algorithm has a relatively large scaling effect on the area far from the light source, the preset threshold can also be set relatively large, and the corresponding preset threshold is 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., the one shown by the dashed box in the leftmost figure in Figure 2d ) can be intercepted; or, as another possible example, such asFigure 2d The middle figure in [reference] shows that, through the above method, the first and second second-line sequences can be extracted (i.e., Figure 2d as shown by the dashed box in the middle figure in [reference]); or, as another possible example, as Figure 2d shown in the rightmost figure in [reference], through the above method, a second-line sequence can be extracted (such as Figure 2d shown by the dashed box in the rightmost figure in [reference]). Of course, Figure 2d The above are only several possible examples of extracting the second-line sequence during the actual application process, and other possible situations will not be elaborated 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.

[0036] 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 operations such as screening and intercepting, 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 for the time being), 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 during the actual application process, and other possible methods will not be elaborated 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 Figure 2d shown in the leftmost figure in [reference], 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 [figure number] is only one possible scenario where the first quantity is equal to the second quantity during the actual application process. 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 that a scale line actually exists at the candidate pixel coordinates. That is to say, the higher the coordinate quality of the candidate pixel coordinates, the higher the possibility that a scale line actually exists at the candidate pixel coordinates; conversely, the lower the coordinate quality of the candidate pixel coordinates, the lower the possibility that a scale line actually exists at the candidate pixel coordinates.

[0037] In a specific implementation scenario, when the first quantity of the scale pixel coordinates in several 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 sequences 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 several second line sequences to obtain a scale line sequence. It should be noted that when adding candidate pixel coordinates on the basis of the several second line sequences, the termination condition can be that the first quantity of the scale pixel coordinates added to the second line sequences is equal to the second quantity. The following will respectively give exemplary explanations from three aspects: the coordinate quality, the addition method when the number of sequences of the several second line sequences is more than one (such as the middle figure shown in [figure number]), and the addition method when the number of sequences of the several second line sequences is only one (such as the rightmost figure shown in [figure number]). It can be understood that the following exemplary explanations 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. All possible methods will not be exemplified one by one here. Figure 2d as shown in the middle figure in [figure number]), and Figure 2d as shown in the rightmost figure in [figure number]).

[0038] In a specific implementation scenario, in order to measure the coordinate quality of candidate pixel coordinates, based on the edge information at the height value corresponding to the candidate pixel coordinates, the first edge width, the first edge density, the width of the upper-edge scale, and the width of the lower-edge scale can be obtained. 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 "width of the upper-edge scale" and the "width of the lower-edge scale" are respectively supplemented and described. In the actual application process, the edge line detected at any height value may not only be disconnected but also misaligned. The "width of the upper-edge scale" at any height value is the width value of the uppermost edge line detected at that height value, and the "width of the lower-edge scale" at any height value is the width value of the lowermost edge line detected at that height value. If the edge line detected at a certain height value is not misaligned, then the "width of the upper-edge scale" and the "width of the lower-edge scale" 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. If the 2nd edge line is the bottommost edge line at this height value, then 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 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 bottom edge median width. It can be understood that the "first median width" is the median of the "first edge widths" 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 densities" 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 widths" at the height values corresponding to the respective scale pixel coordinates in the second line sequence, and the "bottom edge median width" is the median of the "bottom edge scale widths" 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 bottom edge scale width and the bottom 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 true 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 true 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:

[0039] val_line = abs(lineWidth - Median(linesStableWidth)) +

[0040] abs(lineDensity - Median(linesStableDensity)) +

[0041] abs(lineUeWidth - Median(linesStableUeWidth)) +

[0042] abs(lineDeWidth - Median(linesStableDeWidth))

[0043] 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, width of the upper edge of the line, and 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.

[0044] In a specific implementation scenario, when the number of several second line sequences is more than one, the scale pixel coordinates that are not intercepted into the second line sequence and are located between the second line sequences in the first line sequence can be selected as the first candidate coordinates. Please refer to the Figure 2d middle figure. There are 2 second line sequences in total (as shown by the dashed 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, then these 3 scale pixel coordinates can be used as the first candidate coordinates. Of course, Figure 2d the above is only a 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, using 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, using 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 the Figure 2dFor the middle 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, 2 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 number of 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 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 that the specific value of the coordinate quality is 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 For the middle figure, according to the above method, the first first candidate coordinate and the third first candidate coordinate between these two second line sequences can be screened out (i.e., the first solid line and the third solid line 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 illustration in the middle figure 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, and predictions are made based on the coordinate intervals between the scale pixel coordinates in the several second line sequences to obtain the first predicted coordinates where scale lines are suspected to exist between the several second line sequences. 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.

[0045] 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 may be 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 may be 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, the third candidate coordinates can be fused (such as taking the average value) based on the third candidate coordinates and their coordinate quality with respect to the second-line sequence to obtain the new coordinate quality of the third candidate coordinates. For the sake of description, the third candidate coordinates, their coordinate quality, and the new coordinate quality can be represented in matrix form as:

[0046]

[0047] 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:

[0048]

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

[0050]

[0051] 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 several second line sequences to obtain a scale line sequence. Exemplarily, for each third candidate coordinate 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 third candidate coordinate 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, then the scale 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 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 are selected as the second candidate coordinates, and predictions are made based on the coordinate intervals between the scale pixel coordinates in the second line sequence to obtain several second predicted coordinates where scale lines are suspected to exist before and after the second line sequence. Then, within the preset range of the second predicted coordinates, the second candidate coordinates are selected 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, the new coordinate quality of the third candidate coordinates is obtained. 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 several second line sequences to obtain a scale line sequence, which can accurately supplement coordinates for the second line sequence as much as possible when the number of sequences of several second line sequences is only one.

[0052] In yet another implementation scenario, different from the foregoing implementation, as another possible implementation, in order to be as compatible as possible with security scanners 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 processing steps and subsequent 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" can be executed, so as 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 scanner. Furthermore, by cycling through different values of the processing parameters and measuring the sequence quality for security scanners of different brands and models, it helps to be as compatible as possible with security scanners of different brands and models during the process of obtaining the scale line sequence.

[0053] 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 a Gaussian kernel is used for image filtering, the image filtering parameter is the Gaussian kernel matrix, that is, different values of the Gaussian kernel matrix can be traversed. That is to say, if there are M values for the Canny parameters and N values for the Gaussian kernel matrix, the processing steps and subsequent 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" need to be executed M * N times in a loop, and a scale line sequence can be obtained correspondingly after each loop execution.

[0054] In a specific implementation scenario, to measure the sequence quality of a scale line sequence, based on the edge information at the height values corresponding to the respective scale pixel coordinates in the scale line sequence, a second edge width and a second edge density can be obtained. 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 measurement of coordinate quality described above, similarly, 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 a second median width and a 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, 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, the sequence quality of the scale line sequence can be obtained. For ease of description, the sequence quality val can be expressed as:

[0055] val = Mean(abs(lines_width - Median(lines_width))) +

[0056] Mean(abs(lines_density - Median(lines_density))) +

[0057] Mean(abs(diff(diff(lines_p))))

[0058] 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.

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

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

[0061] . 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 obtaining the scale line sequence, it is also necessary to adopt a transformation method inverse to the foregoing perspective transformation to convert the scale pixel coordinates in the scale line sequence to the original image coordinate system, and the converted scale line sequence is the scale line sequence finally loaded by the security inspection machine.

[0062] 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 one by one.

[0063] 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, and the target direction is the placement direction of the calibration ruler in the security inspection channel. For specific reference, please refer to Figure 2a and related 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 sake of convenience of description, the first scale index rF1 corresponding to the first boundary point can be expressed as:

[0064]

[0065] 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 indexes that meet the conditions according to the given conditions (i.e., the conditions attached in the brackets).

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

[0067]

[0068] 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 is a schematic diagram of the effect of another embodiment of the first scanned image of the present 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.

[0069] 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.

[0070] 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 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:

[0071]

[0072] 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 o2represents the pixel coordinate value of the second boundary point in the target direction, fabs(V o1 -V o2 ) represents the pixel distance between the first boundary point and the second boundary point.

[0073] In another implementation scenario, different from the aforementioned implementation, as another possible implementation, when the accuracy of 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 an 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 of the security inspection machine when imaging at the object to be tested can be obtained based on the first scale index, the additional scale index, the physical spacing and the pixel spacing.

[0074] In a specific implementation scenario, 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, and then according to 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, its additional scale index rI1 corresponding to the first scale index rF1 can be expressed as:

[0075]

[0076] 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 corresponding to the first scale index r2 in the vertical direction can be obtained, that is, Figure 2f The pixel length of the midline segment P3r2 can be obtained, and the difference in pixel coordinates between the second pixel coordinate of the first scale index r2 and the second pixel coordinate of the reference scale index r3 in the vertical direction can be obtained, that is,Figure 2f The 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 for 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:

[0077]

[0078] 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 in, and the difference between the pixel coordinates in the vertical direction of the second pixel coordinate of the first scale index r8 and the second pixel coordinate of the reference scale index r9 can be obtained, that is Figure 2f the pixel length of the middle line segment r9r8 in, and the floating-point value of the ratio of the two is the additional scale index corresponding to the second boundary point P2 for the first scale index r8.

[0079] 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:

[0080]

[0081] 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 and will not be elaborated here.

[0082] It should be noted that the above examples are only two possible implementation examples for obtaining the scaling factor, and other possible methods are not limited herein, nor will they 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.

[0083] 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 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 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 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, by combining the scale line sequence and the upper boundary point of the object to be measured in the first scanned image, the scaling factor of the security inspection machine at the object to be measured can be calibrated according to the actual position of the object to be measured when calibrating the scaling factor. Compared to using a general scaling factor, the differences 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 factor can be improved, and the differences in imaging at different positions of the security inspection machine can be taken into account.

[0084] 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 a scale line sequence; wherein 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. 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 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.

[0085] In the above solution, the scaling 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 scaling factor when the security inspection machine images at the object to be detected 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 detected in the first scanned image can calibrate the scaling factor of the security inspection machine at the object to be detected according to the actual position of the object to be detected. 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.

[0086] 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 scaling factor.

[0087] 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 scaling 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.

[0088] 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 scaling factor.

[0089] In some disclosed embodiments, the zoom 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 zoom 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 value; the zoom 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 zoom 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 number of scale pixel coordinates in the plurality of second line sequences and the second number of scale lines on the calibration scale, or continue to add based on the plurality of second line sequences to obtain the scale line sequence.

[0090] 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.

[0091] In some disclosed embodiments, the sequence processing module is specifically configured to, in response to the first number being equal to the second number, sequentially combine a plurality of second line sequences as the scale line sequence, and in response to the first number being greater than the second number, 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.

[0092] 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 upper-edge scale width, and a lower-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 the respective scale pixel coordinates in the second line sequence to obtain a first median width, a first median density, an upper-edge median width, and a lower-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 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.

[0093] 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 and are located between the second line sequences in the first line sequence 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 the preset conditions within the preset range of the first prediction coordinates and add them to the several second line sequences to obtain a scale line sequence.

[0094] 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 and are located before and after the second line sequence in the first 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 several second line sequences; the sequence processing module includes a third candidate sub-module, configured to select the second candidate coordinates within the preset range of the second prediction coordinates as the third candidate coordinates; the sequence processing module includes a quality fusion sub-module, configured to fuse 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 several second line sequences to obtain a scale line sequence.

[0095] In some disclosed embodiments, the zoom coefficient determination device 30 includes a parameter traversal module, configured to sequentially traverse processing parameters with different values before obtaining the edge information of the calibration ruler at different height values in the extension direction based on 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 sequentially combine several second line sequences as a scale line sequence 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, 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.

[0096] In some disclosed embodiments, the sequence selection module includes a second edge computing sub-module for obtaining a second edge width and a second edge density based on the edge information at the height values corresponding to the respective scale pixel coordinates in the scale line sequence; the sequence selection module includes a second median computing sub-module for 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 on the respective scale pixel coordinates in the scale line sequence to obtain a number of pixel coordinate difference values; the sequence selection module includes a sequence quality computing sub-module for obtaining 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 number of pixel coordinate difference values.

[0097] 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 for obtaining 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 obtaining 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 for screening 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.

[0098] In some disclosed embodiments, the calibration ruler is perpendicular to the traveling direction of the security inspection passage; 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, where the target direction is the placement direction of the calibration ruler on the security inspection passage; 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.

[0099] 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 method for determining the scaling factor. For details, reference can be made to the foregoing disclosed embodiments, which will not be elaborated herein.

[0100] Specifically, the processor 42 is used to control itself and the memory 41 to implement the steps in any of the above-described scaling factor determination method embodiments. The processor 42 may also be referred to as a CPU (Central Processing Unit). The processor 42 may be an integrated circuit chip with the ability to process signals. The processor 42 may 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, or discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. Additionally, the processor 42 may be implemented jointly by integrated circuit chips.

[0101] In the above solution, the electronic device 40 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 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 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 scaling factor when the security inspection machine images at the object to be detected 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, by combining the scale line sequence and the upper boundary point of the object to be detected in the first scanned image, the scaling factor of the security inspection machine at the object to be detected can be calibrated according to the actual position of the object to be detected when calibrating the scaling factor. Compared with using a general scaling factor, the differences in imaging at different positions of the security inspection machine during the security inspection process can be taken into account. Therefore, the reliability of the scaling factor can be improved, and the differences in imaging at different positions of the security inspection machine can be taken into account.

[0102] Please refer to Figure 5 , Figure 5It is a schematic diagram of the framework of an embodiment of the security inspection machine of the present application. The security inspection machine 50 at least includes the electronic device 40 in the above embodiment. Of course, in addition, 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.

[0103] 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 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 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 coefficient of the security inspection machine 50 when imaging at the object to be inspected is obtained. Therefore, on the one hand, by calibrating the scaling coefficient with the calibration ruler, compared with directly using the built-in scaling coefficient, the reliability of the scaling coefficient can be improved. On the other hand, by combining the scale line sequence and the upper boundary point of the object to be inspected in the first scanned image, the scaling coefficient of the security inspection machine 50 at the object to be inspected can be calibrated according to the actual position of the object to be inspected when calibrating the scaling coefficient. Compared with using a general scaling coefficient, the difference in imaging at different positions of the security inspection machine 50 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 50 can be taken into account.

[0104] Please refer to Figure 6 , Figure 6 It is a schematic diagram of the framework of an embodiment of the computer-readable storage medium of the present 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 coefficient determination method.

[0105] 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 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 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 position of the object to be measured according to the actual position of the object to be measured. 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.

[0106] 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.

[0107] 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.

[0108] 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 implementation manners described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may 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 couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical or other forms.

[0109] 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 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.

[0110] 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.

[0111] 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.

[0112] 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, Including: In response to a first scanned image of an object to be measured by an X-ray security inspection machine, detecting first pixel coordinates of an upper boundary point of the object to be measured in 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 coordinates and the second pixel coordinates to obtain a first scale index; Obtaining a scaling factor when the X-ray security inspection machine images the object to be measured based on the first scale index, a physical distance between adjacent scale lines on the calibration ruler, and a pixel distance between the boundary points; wherein: The step of obtaining the scaling factor when the X-ray 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 ruler, and the pixel distance between the boundary points includes: obtaining a product of an absolute difference of the first scale index and the physical distance as a first distance; obtaining a ratio of the first distance to the pixel distance as the scaling factor; Alternatively, after finding 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, and before obtaining the scaling factor when the X-ray 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 ruler, and the pixel distance between the boundary points, the method further includes: obtaining a difference between the first pixel coordinates and the second pixel coordinates of the first scale index as a first difference, and obtaining a difference between the second pixel coordinates of a reference scale index and the second pixel coordinates of the first scale index as a second difference; wherein, the reference scale index is a scale index after 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 step of obtaining the scaling factor when the X-ray 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 ruler, and the pixel distance between the boundary points includes: obtaining the scaling factor when the X-ray security inspection machine images the object to be measured based on the first scale index, the additional scale index, the physical distance, and the pixel distance.

2. The method according to claim 1, characterized in that, The step of obtaining the scaling factor when the X-ray security inspection machine images the object to be measured based on the first scale index, the additional scale index, the physical distance, and the pixel distance includes: Obtaining a second scale index based on the first scale index and the additional scale index of the first scale index; Obtaining a product of an absolute difference of the second scale index and the physical distance as a second distance; Obtaining a ratio of the second distance to the pixel distance as the scaling factor.

3. The method according to claim 1, wherein The detection step of the scale line sequence includes: Perform edge detection based on the second scanned image to obtain edge information at different height values in the extension direction of the calibration ruler; Screen at least one of the height values based on the edge information at each of the height values to obtain a first line sequence; wherein, the first line sequence includes the scale pixel coordinates suspected to be the scale lines at the height values; Based on the coordinate intervals between adjacent scale pixel coordinates in the first line sequence, extract several second line sequences from the first line sequence; Based on the first quantity of the scale pixel coordinates in the several second line sequences and the second quantity of the scale lines on the calibration ruler, select and sequentially combine the several second line sequences as the scale line sequence, or continue to add on the basis of the several second line sequences to obtain the scale line sequence.

4. The method according to claim 3, wherein The coordinate intervals between adjacent scale pixel coordinates in the same second line sequence are respectively within the same numerical 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.

5. The method according to claim 3, wherein The step of selecting and sequentially combining the several second line sequences as the scale line sequence, or continuing to add on the basis of the several second line sequences to obtain the scale line sequence based on the first quantity of the scale pixel coordinates in the several second line sequences and the second quantity of the scale lines on the calibration ruler includes: In response to the first quantity being equal to the second quantity, sequentially combine the several second line sequences as the scale line sequence; 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 on the basis of the several second line sequences based on the coordinate quality of the candidate pixel coordinates to obtain the scale line sequence.

6. The method according to claim 5, characterized in that, The step of obtaining the coordinate quality of the candidate pixel coordinates includes: Based on the edge information at the height value corresponding to the candidate pixel coordinates, obtain a first edge width, a first edge density, an upper-edge scale width, and a lower-edge scale width; Perform median statistics based on the edge information at the height value corresponding to each of the scale pixel coordinates in the second line sequence to obtain a first median width, a first median density, an upper-edge median width, and a lower-edge median width; 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, obtain the coordinate quality of the candidate pixel coordinates.

7. The method according to claim 5, characterized in that In the case where the number of sequences of the several second line sequences is more than one, the step of selecting the scale pixel coordinates in the first line sequence that are not intercepted into the second line sequence as candidate pixel coordinates includes: Select the scale pixel coordinates in the first line sequence that are not intercepted by the second line sequence and are located between the second line sequences as the first candidate coordinates; Adding the candidate pixel coordinates based on the coordinate quality of the candidate pixel coordinates on the basis of the several second line sequences to obtain the scale line sequence includes: Predict based on the coordinate intervals between the scale pixel coordinates in the several second line sequences to obtain first predicted coordinates where the scale lines are suspected to exist between the several second line sequences; Select the first candidate coordinates whose coordinate quality meets the preset conditions within the preset range of the first predicted coordinates and add them to the several second line sequences to obtain the scale line sequence.

8. The method according to claim 5, wherein In the case where the number of sequences of the several second line sequences is only one, the step of selecting the scale pixel coordinates in the first line sequence that are not intercepted by the second line sequence as candidate pixel coordinates includes: Select the scale pixel coordinates in the first line sequence that are not intercepted by the second line sequence and are located before and after the second line sequence as the second candidate coordinates; Adding the candidate pixel coordinates based on the coordinate quality of the candidate pixel coordinates on the basis of the several second line sequences to obtain the scale line sequence includes: Predict based on the coordinate intervals between the scale pixel coordinates in the second line sequence to obtain second predicted coordinates where the scale lines are suspected to exist before and after the several second line sequences; Select the second candidate coordinates within the preset range of the second predicted coordinates as the third candidate coordinates; Fuse based on the third candidate coordinates and the coordinate quality of the third candidate coordinates between it and the second line sequence to obtain a new coordinate quality of the third candidate coordinates; Based on the new coordinate quality of the third candidate coordinates, select the third candidate coordinates and the third candidate coordinates between it and the second line sequence and add them to the several second line sequences to obtain the scale line sequence.

9. The method according to claim 3, wherein Before obtaining the edge information of the calibration ruler at different height values in the extending direction based on the second scanned image, the method further includes: Traverse the processing parameters with different values in sequence; wherein, the processing parameters include edge detection parameters; After selecting and sequentially combining the several second line sequences as the scale line sequence based on the first quantity of the scale pixel coordinates in the several second line sequences and the second quantity of the scale lines on the calibration ruler, or continuing to add on the basis of the several second line sequences to obtain the scale line sequence, the method further includes: 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.

10. The method according to claim 9, wherein The step of obtaining the sequence quality of the scale line sequence includes: Obtain a second edge width and a second edge density based on the edge information at the height value corresponding to each scale pixel coordinate in the scale line sequence; Performing median statistics on the edge information at the height values corresponding to each of the scale pixel coordinates in the scale line sequence to obtain a second median width and a second median density, and performing two - order differences on each of the scale pixel coordinates in the scale line sequence to obtain a number of pixel coordinate difference values; Based on the average of the absolute differences between each of the second edge widths and the second median width, the average of the absolute differences between each of the second edge densities and the second median density, and the absolute average of the number of pixel coordinate difference values, obtaining the sequence quality of the scale line sequence.

11. The method according to claim 3, wherein The edge information includes an edge width and an edge density. Screening at least one of the height values based on the edge information at each of the height values to obtain a first line sequence, including: Based on the edge width at each of the height values, obtaining a first curve representing the distribution of the edge width with respect to the height value, and based on the edge density at each of the height values, obtaining a second curve representing the distribution of the edge density with respect to the height value; Screening at least one of the height values that is a peak of the curve in both the first curve and the second curve to obtain the first line sequence.

12. The method according to any one of claims 1 to 11, characterized in that, The calibration ruler is perpendicular to the traveling direction of the security inspection channel in the security inspection machine; And / or, the boundary points include: in the target direction of the first scanned image, a first boundary point and a second boundary point on the object to be measured, and the target direction is the placement direction of the calibration ruler on the security inspection channel in the security inspection machine; And / or, for any first scale index corresponding to a 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.

13. A zoom factor determination device, characterized in that, Including: A detection and loading module, configured to detect the first pixel coordinate of the boundary point on 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 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 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; A coefficient calculation module, configured to obtain a scaling coefficient 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 ruler, and the pixel distance between the boundary points; wherein: Obtaining the scaling coefficient 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 ruler, and the pixel distance between the boundary points includes: obtaining the product of the absolute difference of the first scale index and the physical distance as a first distance; obtaining the ratio of the first distance to the pixel distance as the scaling coefficient; Alternatively, after finding 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 the first scale index, and before obtaining the scaling factor of the security inspection machine when imaging 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, it further includes: obtaining the difference between the second pixel coordinate of the first pixel coordinate and the first scale index as the first difference, and obtaining the difference between the second pixel coordinate of the reference scale index and the second pixel coordinate of the first scale index as the second difference; wherein, the reference scale index is the next scale index of the first scale index; obtaining the ratio of the first difference to the second difference as the additional scale index of the first scale index; and obtaining the scaling factor of the security inspection machine when imaging 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 includes: obtaining the scaling factor of the security inspection machine when imaging the object to be measured based on the first scale index, the additional scale index, the physical distance, and the pixel distance.

14. An electronic device, characterized in that, At least including a memory and a processor coupled to each other, at least program instructions are stored in the memory, and the processor is configured to execute the program instructions to implement the scaling factor determination method according to any one of claims 1 to 12.

15. An X-ray security inspection machine, characterized in that, At least including the electronic device according to claim 14.

16. A computer-readable storage medium, characterized in that, Stored with program instructions that can be run by a processor, and the program instructions are used to implement the scaling factor determination method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • 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