Object Size Measurement Method and Related Devices, Security Inspection Machine, and Storage Medium
By obtaining the scanned images and equipment parameters of the security inspection machine, detecting the end point coordinates of the object, and using the intersection of light, the sine value of the angle and the scaling coefficient to calculate the physical radius of the object, the reliability and complexity of the security inspection machine when measuring the object radius is solved, and a more accurate and simplified measurement process is achieved.
Patent Information
- Application Number
- CN202510543010.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2045-04-28
AI Technical Summary
Existing security machines have poor reliability and complex processes when measuring the physical radius of objects, especially when measuring columnar objects, making it difficult to ensure the accuracy of measurement and simplify operation.
By obtaining the scanned image and equipment parameters of the security check machine, detecting the end point coordinates of the object, and using the intersection of light, the sine value of the angle and the scaling coefficient to calculate the physical radius of the object, combined with geometric data to measure.
Improves the reliability of object measurement and reduces the complexity of the measurement process, especially when measuring the physical radius of a columnar object, which can provide more accurate data calculations.
Smart Images

Figure CN120063172B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of security inspection image processing, and particularly to an object size measurement method, related device, security inspection machine, and storage medium. Background Art
[0002] The security inspection machine can penetrate the surface of an object to scan and image the object and its interior to help detect the size of the object being inspected, etc.
[0003] Currently, security inspection machines have gradually become one of the standard configurations in places such as airports, subways, and logistics. In some cases in the above-mentioned places, the object to be measured is usually required to be placed on the security inspection channel in a relatively regular manner parallel to the traveling direction of the security inspection channel, so that relevant personnel can estimate the physical size of the object to be measured through convenient operations such as fixing points and drawing lines on the scanned image. However, this measurement method still requires manual operation by relevant personnel, so it has the defect of complex procedures, and the reliability is also difficult to guarantee, especially when measuring the physical radius of a columnar object. In view of this, how to improve the reliability of measuring the physical radius of the object to be measured during the security inspection process and reduce the complexity of the measurement process 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 an object size measurement method, related device, security inspection machine, and storage medium, which can improve the reliability of measuring the physical radius of the object to be measured during the security inspection process and reduce the complexity of the measurement process.
[0005] To solve the above technical problem, in the first aspect of the present application, an object size measurement method is provided, including: obtaining a first scanned image of the object to be measured on the security inspection channel by the security inspection machine, and obtaining the device parameters of the security inspection machine; wherein, the device parameters include the vertical distance from the light source to the security inspection channel, the imaging coordinates of the light rays emitted perpendicularly to the security inspection channel by the light source, and the scaling factor when the security inspection machine images; detecting the endpoint coordinates of the relative endpoints of the object to be measured in the radial direction in the first scanned image; based on the endpoint coordinates of the relative endpoints and the scaling factor, obtaining the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel, and based on the endpoint coordinates of the relative endpoints, imaging coordinates, scaling factor, and vertical distance, obtaining the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel; wherein, the endpoint coordinates of the relative endpoints are respectively formed by the imaging of the first light ray and the second light ray; based on the physical distance, vertical distance, first sine value, and second sine value, obtaining the physical radius of the object to be measured.
[0006] To solve the above technical problems, a second aspect of the present application provides an object size measurement device, including: a measurement preparation module, an endpoint detection module, a data calculation module, and a radius determination module. The measurement preparation module is configured to obtain a first scanned image of an object to be measured on the security inspection channel by the security inspection machine, and obtain the device parameters of the security inspection machine; wherein, the device parameters include the vertical distance from the light source to the security inspection channel, the imaging coordinates of the light rays emitted perpendicularly to the security inspection channel by the light source, and the scaling factor when the security inspection machine forms an image. The endpoint detection module is configured to detect the endpoint coordinates of the object to be measured relative to the endpoints in the radial direction in the first scanned image. The data calculation module is configured to obtain the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel based on the endpoint coordinates relative to the endpoints and the scaling factor, and obtain the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel based on the endpoint coordinates relative to the endpoints, the imaging coordinates, the scaling factor, and the vertical distance; wherein, the endpoint coordinates relative to the endpoints are respectively formed by the imaging of the first light ray and the second light ray. The radius determination module is configured to obtain the physical radius of the object to be measured based on the physical distance, the vertical distance, the first sine value, and the second sine value.
[0007] To solve the above technical problems, a third aspect of the present application provides an electronic device, at least including a memory and a processor coupled to each other. The memory stores at least program instructions, and the processor is configured to execute the program instructions to implement the object size measurement method in the first aspect above.
[0008] To solve the above technical problems, a fourth aspect of the present application provides a security inspection machine, at least including the electronic device in the third aspect above.
[0009] To solve the above technical problems, a fifth aspect of the present application provides a computer-readable storage medium, storing program instructions that can be run by a processor. The program instructions are used to implement the object size measurement method in the first aspect above.
[0010] In the above solution, a first scanned image of the object to be measured on the security inspection channel is obtained by the security inspection machine, and the device parameters of the security inspection machine are obtained. The device parameters include the vertical distance from the light source to the security inspection channel, the imaging coordinates of the light rays emitted perpendicularly to the security inspection channel by the light source, and the scaling factor when the security inspection machine forms an image. Then, the endpoint coordinates of the object to be measured relative to the endpoints in the radial direction in the first scanned image are detected. Thus, based on the endpoint coordinates relative to the endpoints and the scaling factor, the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel is obtained, and based on the endpoint coordinates relative to the endpoints, the imaging coordinates, the scaling factor, and the vertical distance, the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel are obtained. Moreover, the endpoint coordinates relative to the endpoints are respectively formed by the imaging of the first light ray and the second light ray. Furthermore, based on the physical distance, the vertical distance, the first sine value, and the second sine value, the physical radius of the object to be measured is obtained. Therefore, on the one hand, since endpoint detection is performed based on the first scanned image and data calculation is combined with the device parameters, the physical radius of the object to be measured can be obtained, so the complexity of the measurement process can be reduced. On the other hand, by calculating the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel, and the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel, sufficient data can be provided for the subsequent radius calculation from a geometric perspective. Therefore, compared with directly scaling the radial dimension of the object to be measured on the first scanned image using the scaling factor, the radius can be calculated from a geometric perspective by combining the aforementioned geometric-related data, which helps to improve the reliability of measuring the physical radius. Therefore, the reliability of measuring the physical radius of the object to be measured during the security inspection process can be improved, and the complexity of the measurement process can be reduced. Description of the Drawings
[0011] Figure 1 is a schematic flowchart of an embodiment of the method for measuring the size of an object in this application;
[0012] Figure 2a is a schematic diagram of the effect of an embodiment of the method for measuring the size of an object in this application;
[0013] Figure 2b is a schematic diagram of the effect of an embodiment of the first scanned image in this application;
[0014] Figure 2c is a schematic diagram of the effect of another embodiment of the method for measuring the size of an object in this application;
[0015] Figure 3 is a schematic framework diagram of an embodiment of the device for measuring the size of an object in this application;
[0016] Figure 4 is a schematic framework diagram of an embodiment of the electronic device in this application;
[0017] Figure 5 is a schematic diagram of the framework of an embodiment of the security inspection machine of the present application;
[0018] Figure 6 is a schematic diagram of the framework of an embodiment of the computer-readable storage medium of the present application. Detailed implementation manners
[0019] The solutions of the embodiments of the present application will be described in detail below with reference to the accompanying drawings of the specification.
[0020] 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.
[0021] 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 of 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 fragment " / " in this article generally represents an "or" relationship between the associated objects before and after. In addition, "plurality" in this article means two or more than two.
[0022] Please refer to Figure 1 , Figure 1 is a schematic flowchart of an embodiment of the method for measuring the size of an object of the present application. Specifically, it may include the following steps:
[0023] Step S11: Obtain a first scanned image of the object to be measured on the security inspection channel by the security inspection machine, and obtain the device parameters of the security inspection machine.
[0024] In the embodiments of the present disclosure, the device parameters include the vertical distance from the light source to the security inspection channel, the imaging coordinates of the light emitted perpendicularly to the security inspection channel by the light source, and the scaling factor when the security inspection machine images. In addition, during the security inspection process, the object to be measured can be placed at any position on the security inspection channel (such as a belt, etc.) (such as close to the light source, or far from the light source; or close to the midline of the security inspection channel, or far from the midline of the security inspection channel), so as to be transported from one end to the other end during the security inspection process by the security inspection channel.
[0025] In one implementation scenario, the device parameters are provided by the manufacturer for subsequent retrieval by burning them into the internal storage of the security inspection machine when the security inspection machine leaves the factory.
[0026] In another implementation scenario, the device parameters can also be pre-calibrated based on a second scanned image of a calibration ruler placed on the security inspection channel by the security inspection machine. The calibration ruler can be perpendicular to the traveling direction of the security inspection channel. More precisely, the extending direction of the calibration ruler can be perpendicular to the traveling direction of the security inspection machine. As a possible example in the actual application process, if the light source of the security inspection machine is an X-ray, then in order to improve the clarity of scanning the calibration ruler as much as possible, the calibration ruler can be a lead ruler, or an X-ray developing ruler such as a radiopaque marking ruler. The specific type of the calibration ruler is not limited herein.
[0027] In a specific implementation scenario, for the "vertical distance" in the device parameters, in order to calibrate the "vertical distance", a first algebraic expression can be constructed based on the physical height of the calibration ruler and the unknown quantity representing the vertical distance. And based on the vertex coordinates of each vertex of the calibration ruler in the same cross-section in the second scanned image, the distance ratio between the first distance and the second distance can be obtained. Thus, a second function can be constructed based on the first algebraic expression and the distance ratio, and then the vertical distance can be obtained by solving the second function. It should be noted that the first algebraic expression represents the ratio of the vertical distance to the shortest distance from the light source to the plane where the top surface of the calibration ruler is located. The vertex coordinates of each vertex are respectively formed by the imaging of each light source ray passing through the target edge on the calibration ruler. The target edge is perpendicular to the traveling direction. The first distance is the distance between the intersection points on the detector of the security inspection machine after the light source ray passes through the target edge on the top surface of the calibration ruler, and the second distance is the distance between the intersection points on the detector after the light source ray passes through the target edge on the bottom surface of the calibration ruler. By the above method, a second function is constructed based on the first algebraic expression and the distance ratio to solve the second function to obtain the device parameter "vertical distance". And the first algebraic expression represents the ratio of the vertical distance to the shortest distance from the light source to the plane where the top surface of the calibration ruler is located. The vertex coordinates of each vertex are respectively formed by the imaging of each light source ray passing through the target edge on the calibration ruler. The target edge is perpendicular to the traveling direction. The first distance is the distance between the intersection points on the detector of the security inspection machine after the light source ray passes through the target edge on the top surface of the calibration ruler, and the second distance is the distance between the intersection points on the detector after the light source ray passes through the target edge on the bottom surface of the calibration ruler. Therefore, data calculation can be performed from a geometric perspective.
[0028] Exemplarily, in order to construct the first algebraic expression, the sum of the unknown quantity representing the vertical distance and the physical height can be obtained as the shortest distance, and then the first algebraic expression can be obtained based on the unknown quantity representing the vertical distance and the shortest distance. That is to say, after obtaining the shortest distance containing the unknown quantity, the first algebraic expression can be constructed based on the ratio of the unknown quantity to the shortest distance.
[0029] Exemplarily, in order to calculate the distance ratio between the first distance and the second distance, the difference between the vertex coordinates of the vertices on the top side of the cross-section can be obtained as the top-side coordinate difference, and the difference between the vertex coordinates of the vertices on the bottom side of the cross-section can be obtained as the bottom-side coordinate difference. On this basis, the distance ratio can be obtained based on the ratio of the top-side coordinate difference to the bottom-side coordinate difference. It should be noted that in the case where the pixel coordinates are represented by (U, V), unless otherwise specified in the embodiments of the present disclosure, when performing relevant calculations on the pixel coordinates, it generally specifically refers to the ordinate (i.e., the V coordinate) among them.
[0030] Exemplarily, for ease of understanding, please refer to Figure 2a , Figure 2a which is a schematic diagram of the effect of an embodiment of the object size measurement method of the present application. As Figure 2a shown, the three thick lines from top to bottom respectively represent the image layer, the detector, and the security inspection channel. It should be noted that the detector is used to sense the light rays emitted by the light source to form corresponding pixels on the image layer. Since different materials have different light absorption rates, the detector can determine the differences between the materials through which different light rays pass by performing energy detection on the received light rays, and then represent them with different grayscales or colors on the image layer. Among them, O represents the light source (i.e., regarded as a point light source), and the rectangle on the security inspection channel represents the cross-section of the calibration ruler. It should be noted that this cross-section is perpendicular to the extension direction of the calibration ruler. Please continue to refer to Figure 2a , A, B, C, and D are the four vertices on the cross-section, then AB represents the physical height of the calibration ruler, OP represents the vertical distance from the light source to the security inspection channel, OP2 represents the shortest distance from the light source to the plane where the top surface of the calibration ruler is located (i.e., the vertical distance from the light source to the plane where the top surface of the calibration ruler is located), the vertex coordinate of vertex A is V a , the vertex coordinate of vertex B is V b , the vertex coordinate of vertex C is V c , the vertex coordinate of vertex D is V d , the above vertex coordinates are respectively formed by the imaging of the light rays of each light source passing through the target edge on the calibration ruler. For example, the vertex coordinate V a is formed by the imaging of the light ray OA of the light source passing through the target edge at point A (i.e., the edge line perpendicular to the paper surface at point A), and the vertex coordinate V b is formed by the imaging of the light ray OB of the light source passing through the target edge at point B (i.e., the edge line perpendicular to the paper surface at point B), and the vertex coordinate V c is formed by the imaging of the light ray OC of the light source passing through the target edge at point C (i.e., the edge line perpendicular to the paper surface at point C), and the vertex coordinate V dIt is formed by the imaging of the light source ray OD passing through the target edge at point D (i.e., the edge line perpendicular to the paper plane at point D). The intersection point between the light source ray OB and the security inspection channel can be denoted as B0, the intersection point with the detector can be denoted as B1, the intersection point between the light source ray OA and the detector can be denoted as A1, the intersection point between the light source ray OC and the security inspection channel can be denoted as C0, the intersection point with the detector can be denoted as C1, and the intersection point between the light source ray OD and the detector can be denoted as D1. In addition, the scaling factor between the image layer and the detector can be denoted as λ1, and the scaling factor between the detector and the security inspection channel can be denoted as λ2. Then, the overall scaling factor of the security inspection machine can be denoted as λ = λ1 * λ2. According to the principle of similar triangles, it can be known that:
[0031] B0C0 / B1C1 = OP / OP1
[0032] AD / A1D1 = OP / OP1
[0033] By combining the above two equations, we can obtain:
[0034] B0C0 / B1C1 = AD / A1D1
[0035] That is to say:
[0036] B0C0 / AD = B1C1 / A1D1
[0037] Also, because AD = BC, the above equation can be further transformed into:
[0038] B0C0 / BC = B1C1 / A1D1
[0039] In addition, according to the principle of similar triangles, it can also be known that:
[0040] OP / OP2 = B0C0 / BC
[0041] By combining the above two equations, we can obtain again:
[0042] OP / OP2 = B1C1 / A1D1
[0043] Also, because:
[0044] OP2 = OP + PP2 = OP + AB
[0045] By combining the above two equations, we can obtain again:
[0046] OP / (OP + AB) = B1C1 / A1D1
[0047] Also, because:
[0048] B1C1 = λ1 * (V b - V c )
[0049] A1D1 = λ1 * (V a - V d )
[0050] Therefore:
[0051] B1C1 / A1D1 = (V b - V c ) / (V a - V d )
[0052] In the above formula, B1C1 is the first distance, A1D1 is the second distance, and B1C1 / A1D1 is the distance ratio between the first distance and the second distance. Among them, V b - V c represents the top - side coordinate difference, and V a - V d represents the bottom - side coordinate difference.
[0053] Substitute the above formula into the formula OP / (OP + AB) = B1C1 / A1D1, and we can get:
[0054] OP / (OP + AB) = (V b - V c ) / (V a - V d )
[0055] The above formula is the second function. Among them, OP is the unknown quantity representing the vertical distance, AB represents the physical height. Therefore, OP / (OP + AB) is the first algebraic expression representing the ratio of the vertical distance to the shortest distance from the light source to the plane where the top surface of the calibration scale is located, and (V b - V c ) / (V a - V d ) is the distance ratio between the first distance and the second distance. Therefore, by solving the above second function, we can get the vertical distance OP:
[0056] OP = (V b - V c ) * AB / (V a - V d + V b - V c )
[0057] In a specific implementation scenario, for the "imaging coordinates" in the device parameters, in order to calibrate the "imaging coordinates", a second algebraic expression can be constructed based on the upper vertex coordinates and lower vertex coordinates of the calibration scale on the same height line on the target side in the second scanned image and the unknown quantity representing the imaging coordinates, and the numerical ratio between the physical height and the vertical distance of the calibration scale can be obtained. Thus, a third function can be constructed based on the second algebraic expression and the numerical ratio, and then the imaging coordinates can be obtained by solving the third function. It should be noted that the target side is a side of the calibration scale close to the light source. The second algebraic expression represents the ratio of the third distance to the fourth distance. The upper vertex coordinates and lower vertex coordinates are respectively formed by the imaging of each light source ray passing through the same height line. The third distance is the distance between the intersection points of the light source rays on the detector of the security scanner after passing through the same height line, and the fourth distance is the distance between the intersection point of the light source ray passing through the upper vertex on the same height line on the detector of the security scanner and the intersection point of the outgoing ray on the detector of the security scanner. In the above method, by constructing a third function based on the second algebraic expression and the numerical ratio, and solving the third function to obtain the imaging coordinates, and the second algebraic expression represents the ratio of the third distance to the fourth distance. The upper vertex coordinates and lower vertex coordinates are respectively formed by the imaging of each light source ray passing through the same height line. The third distance is the distance between the intersection points of the light source rays on the detector of the security scanner after passing through the same height line, and the fourth distance is the distance between the intersection point of the light source ray passing through the upper vertex on the same height line on the detector of the security scanner and the intersection point of the outgoing ray on the detector of the security scanner. Therefore, data calculation can be performed from a geometric perspective.
[0058] Exemplarily, to construct the second algebraic expression, the difference between the upper vertex coordinates and the lower vertex coordinates can be obtained as the height line coordinate difference, and the difference between the upper vertex coordinates and the unknown quantity representing the imaging coordinates can be obtained as the target expression. On this basis, the second algebraic expression can be obtained based on the ratio of the height line coordinate difference to the target expression.
[0059] Exemplarily, for the sake of easy understanding, please continue to refer to Figure 2a , P1 is the intersection point of the outgoing ray of the light source O perpendicular to the security inspection channel on the detector, and the imaging coordinates are V p . According to the principle of similar triangles:
[0060] AB0 / A1B1 = OP / OP1
[0061] PB0 / P1B1 = OP / OP1
[0062] By combining the above two equations, we can get:
[0063] AB0 / A1B1 = PB0 / P1B1
[0064] The above equation can be transformed into:
[0065] AB0 / PB0 = A1B1 / P1B1
[0066] According to the principle of similar triangles, it can also be known that:
[0067] AB0 / PB0 = AB / OP
[0068] Combining the above two equations, we can obtain:
[0069] A1B1 / P1B1 = AB / OP
[0070] In the above equation, AB / OP represents the numerical ratio between the physical height of the calibration scale and the vertical distance, and A1B1 / P1B1 represents the second algebraic expression. Among them, A1B1 represents the distance between the intersection points of the light source rays on the detector of the security scanner after passing through the high line AB, and P1B1 represents the distance between the intersection point B1 of the light source rays on the detector of the security scanner after passing through the upper vertex B of the high line AB and the intersection point P1 of the outgoing rays on the detector of the security scanner. Further, for the second algebraic expression, since:
[0071] A1B1 = λ1 * (V b -V a )
[0072] P1B1 = λ1 * (V p -V b )
[0073] In the above equation, V b -V a represents the difference between the vertex coordinate and the lower vertex coordinate (i.e., the high line coordinate difference), and V p -V b represents the difference between the upper vertex coordinate and the unknown quantity representing the imaging coordinate (i.e., the target equation). Therefore, the second algebraic expression A1B1 / P1B1 can also be expressed as:
[0074] A1B1 / P1B1 = (V b -V a ) / (V p -V b )
[0075] That is, the second algebraic expression can also be expressed as the ratio of the high line coordinate difference to the target equation. Therefore, the above equation A1B1 / P1B1 = AB / OP can be reconstructed as:
[0076] (V b -V a ) / (V p -V b ) = AB / OP
[0077] The above equation is the third function. Solving the above third function can obtain the imaging coordinate Vp :
[0078] V p = (V b - V a ) * OP / AB + V b
[0079] In a specific implementation scenario, for the "scaling factor" in the device parameters, in order to calibrate the "scaling factor", the physical width of the calibration ruler can be obtained, and the difference between the vertex coordinates of two vertices on the bottom edge of the calibration ruler in the same cross-section in the second scanned image can be obtained as the bottom edge coordinate difference. On this basis, the scaling factor can be obtained based on the ratio of the physical width to the bottom edge coordinate difference. It should be noted that the width direction of the calibration ruler is perpendicular to the extension direction of the calibration ruler and perpendicular to the height direction of the calibration ruler. Generally speaking, when the calibration ruler is placed flat, with the side of the scale lines facing, the height direction is the thickness direction of the calibration ruler, and the extension direction is the direction in which the index of the scale lines increases or decreases, and then the width direction is the direction in which the scale lines are engraved. For ease of understanding, please continue to refer to Figure 2a , the physical width of the calibration ruler is AD, and the physical width AD can be obtained by scaling A1D1 with the aforementioned scaling factor λ2:
[0080] AD = λ2 * A1D1
[0081] In addition, as described above:
[0082] A1D1 = λ1 * (V a - V d )
[0083] By combining the above two equations, we can get:
[0084] AD = λ2 * λ1 * (V a - V d )
[0085] And because the scaling factor λ of the security inspection machine is λ = λ2 * λ1, the scaling factor λ of the security inspection machine can be expressed as:
[0086] λ = AD / (V a - V d )
[0087] In the above formula, the two vertices on the bottom edge of the calibration ruler in the same cross-section are points A and D, so the difference between their vertex coordinates can be expressed as V a - V d . That is to say, the ratio of the physical width AD to the bottom edge coordinate difference V a - V d is denoted as the scaling factor λ.
[0088] In a specific implementation scenario, for the "scaling factor" in the device parameters, different from the aforementioned calibration method, in order to calibrate the scaling factor when the security inspection machine forms an image at the object to be inspected, the first pixel coordinates of the upper boundary point of the object to be inspected in the first scanned image can be detected, and the scale line sequence of the calibration ruler in the second scanned image can be detected. The scale line sequence can include 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 can be 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 boundary points, the scaling factor when the security inspection machine forms an image at the object to be inspected can be obtained. Before the security inspection machine inspects the object to be inspected, the calibration ruler can be placed in the security inspection machine first to obtain the second scanned image of the calibration ruler by the security inspection machine. Then, detection can be performed based on the second scanned image (for example, edge detection can be performed on the second scanned image) to obtain the scale line sequence. It should be noted that after the scale line sequence is detected, the security inspection machine can save the scale line sequence. Later, when an object to be inspected passes through the inspection and its size needs to be measured by the scanned image of the object to be inspected, 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. In the above method, on the one hand, the scaling factor is calibrated by the calibration ruler, which can improve the reliability of the scaling factor compared with 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 inspected in the first scanned image, the scaling factor of the security inspection machine at the position of the object to be inspected can be calibrated according to the actual position of the object to be inspected when calibrating the scaling factor. Compared with using a general scaling factor, the difference in imaging at different positions of the security inspection machine can be taken into account during the security inspection process.
[0089] Exemplarily, the boundary points can include: in the target direction of the first scanned image, the first boundary point and the second boundary point on the object to be inspected. The target direction is the placement direction of the calibration ruler in the security inspection channel, that is, the direction perpendicular to the traveling direction. It should be noted that after the first scanned image is obtained, target detection can be performed on the first scanned image to obtain the target area of the object to be inspected in the first scanned image (such as the minimum bounding rectangle of the object to be inspected). On this basis, the pixel points located on the boundary of the target area in the target direction can be selected, which are the first boundary point and the second boundary point. That is to say, the first boundary point and the second boundary point should satisfy being located on the target area (such as on the rectangle frame of the minimum bounding rectangle) and also satisfy forming a boundary in the target direction. Please refer to Figure 2b , Figure 2b which is a schematic diagram of the effect of an embodiment of the first scanned image of the present application. As Figure 2b shown, the dashed box is the target area, and P1 and P2 are the first boundary point and the second boundary point respectively. Of course,Figure 2b The illustration is merely a possible example in the actual application process, and other possible situations will not be exemplified one by one here. In addition, 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.
[0090] Exemplarily, 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 pitch can be obtained as the scaling factor. It should be noted that the absolute difference of the first scale index is the absolute difference of the first scale indexes of the aforementioned first boundary point and the second boundary point, and the pixel pitch between the boundary points is the pixel pitch between the aforementioned first boundary point and the second boundary point (more precisely, the pixel pitch in the target direction).
[0091] Exemplarily, as another possible implementation manner, when the accuracy requirement for the scaling factor is relatively strict, after obtaining the first scale index, the difference between the first pixel coordinate and the second pixel coordinate of the first scale index can be obtained as the first difference, and the difference between the second pixel coordinate of the reference scale index and the second pixel coordinate of the first scale index can be obtained as the second difference, and the reference scale index is the scale index after the first scale index. On this basis, the ratio of the first difference to the second difference can be obtained as the additional scale index of the first scale index. It should be noted that the additional scale index is a floating-point value. After obtaining the additional scale index, the scaling factor when the security inspection machine images the object to be measured can be obtained based on the first scale index, the additional scale index, the physical distance, and the pixel pitch. For example, the second scale index can be obtained based on the first scale index and the additional scale index of the first scale index. Generally speaking, the additional scale index of the first scale index can be added to the first scale index to obtain the second 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 pitch can be obtained as the scaling factor.
[0092] It should be noted that the above examples are merely several possible ways to obtain the device parameters, and the ways to obtain the device parameters are not limited here. That is to say, whether the device parameters are obtained by reading the internal storage of the security inspection machine, or by calibration, or even by other possible ways not mentioned in the embodiments of the present disclosure, they can be applied to the embodiments of the present disclosure to measure the physical radius of the object to be measured accordingly.
[0093] Step S12: Detect the endpoint coordinates of the object to be measured relative to the endpoints in the radial direction in the first scanned image.
[0094] In an implementation scenario, the radial direction is relative to the axial direction, which represents the perpendicular direction starting from any point on the axis of the object to be measured and the circumferential side of the object to be measured. Exemplarily, please refer to Figure 2b , Figure 2b where the double-arrowed dashed line represents the radial direction. In addition, the relative endpoints in the radial direction, such as Figure 2b P3 and P4 in Figure 2b . Of course,
[0095] In an implementation scenario, target detection can be performed on the first scanned image to obtain the target area of the object to be measured in the first scanned image (e.g., the minimum rectangular frame of the object to be measured). Then, based on the target area of the object to be measured, the endpoint coordinates of the relative endpoints of the object to be measured in the radial direction can be obtained. It should be noted that in the embodiments of the present disclosure, the object to be measured is placed parallel to the security inspection channel, that is, the axial direction of the object to be measured is parallel to the traveling direction of the security inspection channel, and the endpoint coordinates can specifically refer to the ordinate (i.e., the aforementioned V coordinate). Therefore, a pair of relative endpoints in any radial direction can be taken. Please refer to Figure 2c , Figure 2c which is a schematic diagram of the effect of another embodiment of the object size measurement method of the present application. As Figure 2c shown, the first light ray OB and the second light ray OC tangent to the relative endpoints in the radial direction of the object to be measured are imaged respectively to form the endpoint coordinates V b and V c . Of course, Figure 2c shown is only a possible example in the actual application process, and other possible situations are not exemplified one by one here.
[0096] Step S13: Based on the endpoint coordinates of the relative endpoints and the scaling factor, obtain the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel, and based on the endpoint coordinates of the relative endpoints, the imaging coordinates, the scaling factor, and the vertical distance, obtain the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel.
[0097] In the embodiments of the present disclosure, the endpoint coordinates of the relative endpoints are respectively formed by the imaging of the first light ray and the second light ray. For example, Figure 2c the first light ray OB and the second light ray OC in b are imaged respectively to form the endpoint coordinates V c . In addition, for the convenience of description, the endpoint coordinates of the relative endpoints can be expressed as including the first endpoint coordinates formed by the imaging of the first light ray (such as Figure 2c V inb ), and the second endpoint coordinates formed by the imaging of the second light ray (such as Figure 2c V in c ).
[0098] In an implementation scenario, after obtaining the endpoint coordinates of the relative endpoints, the first coordinate difference between the first endpoint coordinates and the second endpoint coordinates can be obtained first, and then the first coordinate difference can be scaled based on the scaling coefficient to obtain the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel. For example, the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel can be directly obtained by multiplying the scaling coefficient by the first coordinate difference. Please refer to Figure 2c , the first intersection point of the first light ray on the security inspection channel is point B, and the second intersection point of the second light ray on the security inspection channel is point C. Therefore, the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel can be expressed as:
[0099] BC = λ(V b - V c )
[0100] In the above formula, BC represents the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel, λ represents the scaling coefficient, and V b - V c represents the first coordinate difference. In the above manner, the endpoint coordinates include the first endpoint coordinates formed by the imaging of the first light ray and the second endpoint coordinates formed by the imaging of the second light ray. The first coordinate difference between the first endpoint coordinates and the second endpoint coordinates is obtained, and then the first coordinate difference is scaled based on the scaling coefficient to obtain the physical distance. Therefore, the coordinate difference can be directly scaled by the scaling coefficient to determine the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel, and the above physical distance can be conveniently determined.
[0101] In an implementation scenario, to obtain the first sine value of the first angle between the first light ray and the security inspection passage and the second sine value of the second angle between the second light ray and the security inspection passage, the second coordinate difference between the target endpoint coordinates and the imaging coordinates can be obtained first, and then the second coordinate difference can be scaled based on the scaling coefficient to obtain the target distance between the intersection point of the target light ray on the security inspection passage and the intersection point of the outgoing light ray on the security inspection passage. Furthermore, based on the vertical distance and the target distance, the target sine value of the target angle between the target light ray and the security inspection passage can be obtained. It should be noted that the target endpoint coordinates are formed by the imaging of the target light ray. When the target light ray is the first light ray, the target angle is the first angle, and the target sine value is the first sine value. When the target light ray is the second light ray, the target angle is the second angle, and the target sine value is the second sine value. In the above method, by obtaining the coordinate difference between the target endpoint coordinates and the imaging coordinates of the security inspection machine and scaling it with the scaling coefficient, and combining the vertical distance from the light source to the security inspection passage, the target sine value can be obtained, which can conveniently determine the target sine value.
[0102] In a specific implementation scenario, the target tangent value of the target angle can be obtained first based on the ratio of the vertical distance to the target distance, and then the target sine value can be obtained based on the trigonometric function conversion of the target tangent value. That is to say, the conversion relationship between sine and tangent can be used to convert the target tangent value to obtain the target sine value. It should be noted that for the conversion relationship between sine and tangent, the technical details of trigonometric function conversion can be referred to and will not be elaborated here. In the above method, the target tangent value of the target angle is obtained first based on the ratio of the vertical distance to the target distance, and then the target sine value is obtained based on the trigonometric function conversion of the target tangent value, which can use the trigonometric function to convert from tangent to sine, helping to improve the simplicity of determining the target sine value.
[0103] In a specific implementation scenario, please continue to refer to Figure 2c , taking the first light ray OB as the target light ray as an example. At this time, the first endpoint coordinate V b formed by its imaging is the target endpoint coordinate, and the angle β1 between it and the security inspection passage is the target angle. At this time, the second coordinate difference V p between it and the imaging coordinate V p - V b can be obtained, and the second coordinate difference V p - V b is scaled based on the scaling coefficient λ to obtain the target distance BP between the intersection point B of the target light ray OB on the security inspection passage and the intersection point P of the outgoing light ray OP on the security inspection passage:
[0104] BP = λ * (V p - V b )
[0105] On this basis, the target tangent value of the target angle β1 can be obtained based on the ratio of the vertical distance OP to the target distance BP:
[0106] tan(β1) = BP / OP = λ * (V p - V b ) / OP
[0107] Furthermore, trigonometric function conversion can be performed based on the target tangent value of the target angle β1 to obtain the target sine value (i.e., the first sine value) of the target angle β1:
[0108]
[0109] In a specific implementation scenario, please continue to refer to Figure 2c , taking the second light ray OC as the target light ray as an example. At this time, the second endpoint coordinate V c formed by its imaging is the target endpoint coordinate, and the angle α1 between it and the security inspection channel is the target angle. At this time, the second coordinate difference V p between it and the imaging coordinate V p - V c can be obtained, and the second coordinate difference V p - V c is scaled based on the scaling factor λ to obtain the target distance CP between the intersection point C of the target light ray OC on the security inspection channel and the intersection point P of the outgoing light ray OP on the security inspection channel:
[0110] CP = λ * (V p - V c )
[0111] On this basis, the target tangent value of the target angle α1 can be obtained based on the ratio of the vertical distance OP to the target distance CP:
[0112] tan(α1) = CP / OP = λ * (V p - V c ) / OP
[0113] Furthermore, trigonometric function conversion can be performed based on the target tangent value of the target angle α1 to obtain the target sine value (i.e., the second sine value) of the target angle α1:
[0114]
[0115] It should be noted that the first angle β1 between the first light ray and the security inspection channel is the angle β0 between the first light ray and the virtual plane C2P2 passing through the center E of the object to be measured and parallel to the security inspection channel, and the second angle α1 between the second light ray and the security inspection channel is the angle α0 between the second light ray and the virtual plane C2P2 passing through the center E of the object to be measured and parallel to the security inspection channel. Therefore:
[0116] sin(α0)=sin(α1)
[0117] sin(β0)=sin(β1)
[0118] Step S14: Obtain the physical radius of the object to be measured based on the physical distance, the vertical distance, the first sine value, and the second sine value.
[0119] In an implementation scenario, as a possible implementation manner, please continue to refer to Figure 2c , after obtaining the second sine value sin(α1), the arcsine function can be used to process it to obtain the angle value of the second included angle α1, and then the angle value of the supplementary angle ∠C2CB of the second included angle can be obtained accordingly (that is, subtract the angle value of the first included angle α1 from 180 degrees). Since half of this supplementary angle (not shown, denoted as γ1 here for the convenience of description) forms one of the acute angles of a right triangle with CE as the hypotenuse and the radius perpendicular to the security inspection passage as one of the right sides. For the convenience of description, the intersection point of the center E perpendicular to the security inspection passage on the security inspection passage can be denoted as point F (to avoid interference with the second included angle α1 in Figure 2c , point F is not shown). Therefore, the ratio of the physical radius r to CF is the tangent value of half of this supplementary angle γ1:
[0120] tan(γ1)=r / CF
[0121] That is to say, CF = r / tan(γ1).
[0122] Meanwhile, after obtaining the second sine value sin(β1), the arcsine function can be used to process it to obtain the angle value of the first included angle β1, and then take half of this angle value (not shown, denoted as γ2 here for the convenience of description). Since half of the first included angle forms one of the acute angles of a right triangle with BE as the hypotenuse and the radius perpendicular to the security inspection passage as one of the right sides. As mentioned above, the intersection point of the center E perpendicular to the security inspection passage on the security inspection passage can be denoted as point F. Therefore, the ratio of the physical radius r to BF is the tangent value of half of the angle value of the first included angle γ2:
[0123] tan(γ2)=r / BF
[0124] That is to say, BF = r / tan(γ2). In addition, since the physical distance BC between the first intersection point of the first light ray on the security inspection passage and the second intersection point of the second light ray on the security inspection passage = CF + BF, it can be obtained that:
[0125] BC = CF + BF = r / tan(γ1) + r / tan(γ2)
[0126] That is to say:
[0127] r = BC / (1 / tan(γ1) + 1 / tan(γ2))
[0128] In another implementation scenario, different from the foregoing implementation manner, as another possible implementation manner, in order to avoid calculation errors that may be caused by using inverse trigonometric functions, it is also possible to first construct a first expression with the physical radius as the unknown based on the first sine value and the second sine value, and construct a second expression with the physical radius as the unknown based on the vertical distance. Thus, a first function with the physical radius as the unknown can be constructed based on the ratio of the physical distance to the first expression and the ratio of the vertical distance to the second expression. Furthermore, the physical radius of the object to be measured can be obtained by solving based on the first function. It should be noted that the first expression represents the physical length of the first line segment, which is formed by the intersection points of the first light ray and the second light ray on the virtual plane. The virtual plane passes through the center of the object to be measured and is parallel to the security inspection channel. The second expression represents the physical length of the second line segment, which is the vertical line segment from the light source to the virtual plane. In the above manner, a first function with the physical radius as the unknown is constructed based on the ratio of the physical distance to the first expression and the ratio of the vertical distance to the second expression, and the physical radius of the object to be measured is obtained by solving based on the first function. Moreover, the first expression represents the physical length of the first line segment, and the second expression represents the physical length of the second line segment, enabling the functional solution from a geometric perspective to obtain the physical radius of the object to be measured.
[0129] In a specific implementation scenario, in order to construct the first expression, a first sub-expression can be constructed first based on the first sine value and the unknown representing the physical radius, and a second sub-expression can be constructed based on the second sine value and the unknown representing the physical radius. The first sub-expression represents the physical length from the intersection point of the first light ray on the virtual plane to the center, and the second sub-expression represents the physical length from the intersection point of the second light ray on the virtual plane to the center. Please refer to Figure 2c , where the virtual plane is C2P2, and the physical length EB2 from the intersection point B2 of the first light ray OB on the virtual plane C2P2 to the center E can be expressed as:
[0130] EB2 = r / sin(β0)
[0131] Thus, the first sub-expression r / sin(β1) can be obtained. Similarly, the physical length EC2 from the intersection point C2 of the second light ray OC on the virtual plane C2P2 to the center E can be expressed as:
[0132] EC2 = r / sin(α0)
[0133] Thus, the second minor r / sin(α1) can be obtained. Since the first ray OB and the second ray OC intersect at points B2 and C2 on the virtual plane respectively to form the first line segment B2C2, the sum of the first minor and the second minor is the first formula:
[0134] B2C2 = EB2 + EC2 = r / sin(β0) + r / sin(α0)
[0135] In a specific implementation scenario, in order to construct the second formula, the second formula can be specifically constructed based on the sum of the vertical distance and the unknown quantity representing the physical radius. Please refer to Figure 2c , the physical length of the vertical line segment (i.e., the second line segment) OP2 from the light source O to the virtual plane. The second formula can be expressed as OP + r.
[0136] In a specific implementation scenario, after obtaining the first formula and the second formula, the first function with the physical radius r as the unknown quantity can be constructed:
[0137] BC / B2C2 = OP / (OP + r)
[0138] That is to say:
[0139] BC / (r / sin(β0) + r / sin(α0)) = OP / (OP + r)
[0140] Therefore, the physical radius r can be solved:
[0141] r = λ*(V b - V c )*OP / (OP*ω - λ*(V b - V c ))
[0142] where ω = 1 / sin(β0) + 1 / sin(α0). To facilitate the understanding of the above calculation process, please continue to refer to Figure 2c , according to the principle of similar triangles, it can be known that:
[0143] BC / B2C2 = OP / (OP + PP2) = OP / (OP + r)
[0144] As previously known:
[0145] B2C2 = EB2 + EC2 = r / sin(β0) + r / sin(α0) = r*ω
[0146] Therefore, by combining the above two formulas, we can get:
[0147] BC / (r*ω) = OP / (OP + r)
[0148] Therefore, the physical radius r can be obtained:
[0149] r = BC * OP / (OP * ω - BC)
[0150] Also, because:
[0151] BC = λ * (V b - V c )
[0152] Finally, the physical radius r can be obtained:
[0153] r = λ * (V b - V c ) * OP / (OP * ω - λ * (V b - V c ))
[0154] In the above solution, the first scanned image of the object to be measured on the security inspection channel is obtained by the security inspection machine, and the device parameters of the security inspection machine are obtained. The device parameters include the vertical distance from the light source to the security inspection channel, the imaging coordinates of the light ray perpendicular to the security inspection channel emitted by the light source, and the scaling factor when the security inspection machine images. Then, the endpoint coordinates of the object to be measured relative to the endpoints in the radial direction in the first scanned image are detected. Thus, based on the endpoint coordinates relative to the endpoints and the scaling factor, the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel is obtained, and based on the endpoint coordinates relative to the endpoints, the imaging coordinates, the scaling factor, and the vertical distance, the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel are obtained. And the endpoint coordinates relative to the endpoints are respectively formed by the imaging of the first light ray and the second light ray. Furthermore, based on the physical distance, the vertical distance, the first sine value, and the second sine value, the physical radius of the object to be measured is obtained. Therefore, on the one hand, since endpoint detection is performed based on the first scanned image and data calculation is combined with device parameters, the physical radius of the object to be measured can be obtained, so the complexity of the measurement process can be reduced. On the other hand, by calculating the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel, and the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel, sufficient data can be provided for the subsequent radius calculation from a geometric angle. Therefore, compared with directly scaling the radial size of the object to be measured on the first scanned image using the scaling factor, the radius can be calculated from a geometric angle by combining the aforementioned geometric-related data, which helps to improve the reliability of measuring the physical radius. Therefore, the reliability of measuring the physical radius of the object to be measured during the security inspection process can be improved, and the complexity of the measurement process can be reduced.
[0155] Please refer to Figure 3 , Figure 3It is a schematic diagram of the framework of an embodiment of the object size measurement device of the present application. The object size measurement device 30 includes: a measurement preparation module 31, an endpoint detection module 32, a data calculation module 33, and a radius determination module 34. The measurement preparation module 31 is configured to obtain a first scanned image of an object to be measured on the security inspection channel by the security inspection machine, and obtain the device parameters of the security inspection machine; wherein, the device parameters include the vertical distance from the light source to the security inspection channel, the imaging coordinates of the light rays emitted perpendicularly to the security inspection channel by the light source, and the scaling factor when the security inspection machine forms an image. The endpoint detection module 32 is configured to detect the endpoint coordinates of the object to be measured relative to the endpoints in the radial direction in the first scanned image. The data calculation module 33 is configured to obtain the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel based on the endpoint coordinates relative to the endpoints and the scaling factor, and obtain the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel based on the endpoint coordinates relative to the endpoints, the imaging coordinates, the scaling factor, and the vertical distance; wherein, the endpoint coordinates relative to the endpoints are respectively formed by the imaging of the first light ray and the second light ray. The radius determination module 34 is configured to obtain the physical radius of the object to be measured based on the physical distance, the vertical distance, the first sine value, and the second sine value.
[0156] In the above solution, the object size measurement device 30 obtains a first scanned image of the object to be measured on the security inspection channel by the security inspection machine, and obtains the device parameters of the security inspection machine. The device parameters include the vertical distance from the light source to the security inspection channel, the imaging coordinates of the light rays emitted perpendicularly to the security inspection channel by the light source, and the scaling factor when the security inspection machine forms an image. Then, it detects the endpoint coordinates of the object to be measured at opposite ends in the radial direction in the first scanned image, and thus, based on the endpoint coordinates of the opposite ends and the scaling factor, obtains the physical distance between the first intersection point of the first light ray and the second intersection point of the second light ray on the security inspection channel, and based on the endpoint coordinates of the opposite ends, the imaging coordinates, the scaling factor, and the vertical distance, obtains the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel. The endpoint coordinates of the opposite ends are respectively formed by the imaging of the first light ray and the second light ray. Furthermore, based on the physical distance, the vertical distance, the first sine value, and the second sine value, the physical radius of the object to be measured is obtained. Therefore, on the one hand, since endpoint detection is performed based on the first scanned image and data calculation is combined with the device parameters, the physical radius of the object to be measured can be obtained, so the complexity of the measurement process can be reduced. On the other hand, by calculating the physical distance between the first intersection point of the first light ray and the second intersection point of the second light ray on the security inspection channel, and the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel, sufficient data can be provided for the subsequent radius calculation from a geometric perspective. Therefore, compared with directly scaling the radial size of the object to be measured on the first scanned image using the scaling factor, the radius can be calculated from a geometric perspective by combining the aforementioned geometric-related data, which helps to improve the reliability of measuring the physical radius. Therefore, the reliability of measuring the physical radius of the object to be measured during the security inspection process can be improved, and the complexity of the measurement process can be reduced.
[0157] In some disclosed embodiments, the endpoint coordinates include the first endpoint coordinates formed by the imaging of the first light ray and the second endpoint coordinates formed by the imaging of the second light ray. The data calculation module 33 includes a first difference calculation sub-module for obtaining the first coordinate difference between the first endpoint coordinates and the second endpoint coordinates; the data calculation module 33 includes a first difference scaling sub-module for scaling the first coordinate difference based on the scaling factor to obtain the physical distance.
[0158] In some disclosed embodiments, the data calculation module 33 includes a second difference calculation sub-module for obtaining a second coordinate difference between the target endpoint coordinates and the imaging coordinates; the data calculation module 33 includes a second difference scaling sub-module for scaling the second coordinate difference based on a scaling factor to obtain a target distance between the intersection point of the target ray on the security inspection channel and the intersection point of the outgoing ray on the security inspection channel; the data calculation module 33 includes an included angle sine calculation sub-module for obtaining a target sine value of the target included angle between the target ray and the security inspection channel based on the vertical distance and the target distance; wherein, the target endpoint coordinates are formed by the imaging of the target ray. When the target ray is the first ray, the target included angle is the first included angle and the target sine value is the first sine value. When the target ray is the second ray, the target included angle is the second included angle and the target sine value is the second sine value.
[0159] In some disclosed embodiments, the included angle sine calculation sub-module includes a tangent calculation unit for obtaining a target tangent value of the target included angle based on the ratio of the vertical distance to the target distance; the included angle sine calculation sub-module includes a trigonometric conversion unit for performing trigonometric function conversion based on the target tangent value to obtain the target sine value.
[0160] In some disclosed embodiments, the radius determination module 34 includes a first formula construction sub-module for constructing a first formula with the physical radius as the unknown based on the first sine value and the second sine value, and constructing a second formula with the physical radius as the unknown based on the vertical distance; the radius determination module 34 includes a first function construction sub-module for constructing a first function with the physical radius as the unknown based on the ratio of the physical distance to the first formula and the ratio of the vertical distance to the second formula; the radius determination module 34 includes a first function solving sub-module for solving based on the first function to obtain the physical radius of the object to be measured; wherein, the first formula represents the physical length of the first line segment, the first line segment is formed by the intersection points of the first ray and the second ray on the virtual plane respectively, the virtual plane passes through the center of the object to be measured and is parallel to the security inspection channel, and the second formula represents the physical length of the second line segment, and the second line segment is the vertical line segment from the light source to the virtual plane.
[0161] In some disclosed embodiments, the calculation formula construction sub-module includes a sub-formula construction unit for constructing a first sub-formula based on the first sine value and the unknown representing the physical radius, and constructing a second sub-formula based on the second sine value and the unknown representing the physical radius; the calculation formula construction sub-module includes a first construction unit for obtaining the first formula based on the sum of the first sub-formula and the second sub-formula; wherein, the first sub-formula represents the physical length from the intersection point of the first ray on the virtual plane to the center, and the second sub-formula represents the physical length from the intersection point of the second ray on the virtual plane to the center.
[0162] In some disclosed embodiments, the calculation formula constructor sub-module includes a second construction unit for constructing a second formula based on the sum of the vertical distance and an unknown quantity representing the physical radius.
[0163] In some disclosed embodiments, the device parameters are pre-obtained by calibrating a second scanned image of a calibration ruler placed on the security inspection channel by the security inspection machine, and the calibration ruler is perpendicular to the traveling direction of the security inspection channel.
[0164] In some disclosed embodiments, the measurement preparation module 31 includes a second formula constructor sub-module for constructing a first algebraic formula based on the physical height of the calibration ruler and an unknown quantity representing the vertical distance, and obtaining a distance ratio between a first distance and a second distance based on the vertex coordinates of each vertex of the calibration ruler on the same cross-section in the second scanned image; the measurement preparation module 31 includes a second function constructor sub-module for constructing a second function based on the first algebraic formula and the distance ratio; the measurement preparation module 31 includes a second function solver sub-module for solving based on the second function to obtain the vertical distance; wherein, the first algebraic formula represents the ratio of the vertical distance to the shortest distance from the light source to the plane where the top surface of the calibration ruler is located, the vertex coordinates of each vertex are respectively formed by imaging of each light source ray passing through the target edge of the calibration ruler, the target edge is perpendicular to the traveling direction, the first distance is the distance between the intersection points on the detector of the security inspection machine after the light source ray passes through the target edge of the top surface of the calibration ruler, and the second distance is the distance between the intersection points on the detector after the light source ray passes through the target edge of the bottom surface of the calibration ruler.
[0165] In some disclosed embodiments, the second formula constructor sub-module includes a shortest distance construction unit for obtaining the sum of the unknown quantity representing the vertical distance and the physical height as the shortest distance; the second formula constructor sub-module includes a first algebraic formula construction unit for obtaining a first algebraic formula based on the unknown quantity representing the vertical distance and the shortest distance.
[0166] In some disclosed embodiments, the second formula constructor sub-module includes a coordinate difference unit for obtaining the difference between the vertex coordinates of the vertex on the top edge of the cross-section as the top edge coordinate difference, and obtaining the difference between the vertex coordinates of the vertex on the bottom edge of the cross-section as the bottom edge coordinate difference; the second formula constructor sub-module includes a difference ratio unit for obtaining a distance ratio based on the ratio of the top edge coordinate difference to the bottom edge coordinate difference.
[0167] In some disclosed embodiments, the measurement preparation module 31 includes a third algebraic expression construction sub-module, configured to construct a second algebraic expression based on the upper vertex coordinates and the lower vertex coordinates of the calibration scale on the same height line on the target side in the second scanned image and the unknowns representing the imaging coordinates, and obtain the numerical ratio between the physical height of the calibration scale and the vertical distance; the measurement preparation module 31 includes a third function construction sub-module, configured to construct a third function based on the second algebraic expression and the numerical ratio; the measurement preparation module 31 includes a third function solving sub-module, configured to solve based on the third function to obtain the imaging coordinates; wherein, the target side is a side of the calibration scale close to the light source, the second algebraic expression represents the ratio of the third distance to the fourth distance, the upper vertex coordinates and the lower vertex coordinates are respectively formed by the imaging of each light source ray passing through the same height line, the third distance is the distance between the intersection points of the light source rays on the detector of the security inspection machine after passing through the same height line, and the fourth distance is the distance between the intersection point of the light source ray on the detector of the security inspection machine after passing through the upper vertex on the same height line and the intersection point of the outgoing ray on the detector of the security inspection machine.
[0168] In some disclosed embodiments, the third algebraic expression construction sub-module includes a height line difference unit, configured to obtain the difference between the upper vertex coordinates and the lower vertex coordinates as the height line coordinate difference, and the third algebraic expression construction sub-module includes a target acquisition unit, configured to obtain the difference between the upper vertex coordinates and the unknowns representing the imaging coordinates as the target expression; the third algebraic expression construction sub-module includes a second algebraic expression construction unit, configured to obtain the second algebraic expression based on the ratio of the height line coordinate difference to the target expression.
[0169] In some disclosed embodiments, the measurement preparation module 31 includes a measurement data acquisition sub-module, configured to obtain the physical width of the calibration scale, and obtain the difference between the vertex coordinates of two vertices on the bottom edge of the calibration scale in the same cross-section of the second scanned image as the bottom edge coordinate difference; the measurement preparation module 31 includes a measurement data ratio sub-module, configured to obtain the scaling factor based on the ratio of the physical width to the bottom edge coordinate difference.
[0170] In some disclosed embodiments, the measurement preparation module 31 includes a boundary detection sub-module, configured to detect the first pixel coordinates of the upper boundary points of the object to be measured in the first scanned image, and the measurement preparation module 31 includes a sequence acquisition sub-module, configured to detect the scale line sequence of the calibration scale in the second scanned image; wherein, the scale line sequence includes the second pixel coordinates of the scale lines on the calibration scale; the measurement preparation module 31 includes an index search sub-module, 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 the first scale index; the measurement preparation module 31 includes a coefficient determination sub-module, configured to obtain the scaling factor when the security inspection machine images the object to be measured based on the first scale index, the physical distance between adjacent scale lines on the calibration scale, and the pixel distance between the boundary points.
[0171] In some disclosed embodiments, the measurement preparation module 31 includes a pixel difference sub-module, configured to obtain a difference between a first pixel coordinate and a second pixel coordinate of a first scale index as a first difference, and obtain a difference between a second pixel coordinate of a reference scale index and the second pixel coordinate of the first scale index as a second difference; wherein the reference scale index is the next scale index of the first scale index; the measurement preparation module 31 includes an additional index sub-module, configured to obtain a ratio of the first difference to the second difference as an additional scale index of the first scale index; the coefficient determination sub-module is specifically configured to obtain a scaling coefficient when the security inspection machine forms an image at the object to be measured based on the first scale index, the additional scale index, the physical distance, and the pixel pitch.
[0172] Please refer to Figure 4 , Figure 4 FIG. is a schematic framework diagram of an embodiment of an electronic device according to the present application. The electronic device 40 at least includes a memory 41 and a processor 42 that are coupled to each other. At least program instructions are stored in the memory 41, and the processor 42 is configured to execute the program instructions to implement the steps in any of the above-mentioned embodiments of the object size measurement method. Specifically, reference may be made to the foregoing disclosed embodiments, which will not be elaborated herein.
[0173] Specifically, the processor 42 is configured to control itself and the memory 41 to implement the steps in any of the above-mentioned embodiments of the object size measurement method. The processor 42 may also be referred to as a CPU (Central Processing Unit). The processor 42 may be an integrated circuit chip with signal processing capabilities. The processor 42 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, 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.
[0174] In the above solution, the electronic device 40 responds to the first scanned image of the object to be measured by the security inspection machine, detects the first pixel coordinates of the upper boundary point of the object to be measured in the first scanned image, and loads 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. Then, based on the first pixel coordinates and the second pixel coordinates, the scale line adjacent to the boundary point is searched in the scale line sequence to obtain the first scale index. Furthermore, based on the first scale index, the physical distance between adjacent scale lines on the calibration ruler, and the pixel distance between the boundaries, the scaling factor of the security inspection machine when imaging the object to be measured is obtained. Therefore, on the one hand, calibrating the scaling factor with the calibration ruler can improve the reliability of the scaling factor compared to directly using the built-in scaling factor. On the other hand, combining the scale line sequence and the upper boundary point of the object to be measured in the first scanned image can calibrate the scaling factor of the security inspection machine at the 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.
[0175] Please refer to Figure 5 , Figure 5 which is a schematic framework diagram 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 described in detail here.
[0176] In the above solution, the electronic device 40 in the security inspection machine 50 obtains the first scanned image of the object to be measured on the security inspection channel by the security inspection machine 50, and obtains the device parameters of the security inspection machine 50. The device parameters include the vertical distance from the light source to the security inspection channel, the imaging coordinates of the light emitted perpendicularly to the security inspection channel by the light source, and the scaling factor when the security inspection machine 50 forms an image. Then, it detects the endpoint coordinates of the object to be measured relative to the endpoints in the radial direction in the first scanned image. Thus, based on the endpoint coordinates relative to the endpoints and the scaling factor, it obtains the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel, and based on the endpoint coordinates relative to the endpoints, the imaging coordinates, the scaling factor, and the vertical distance, it obtains the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel. And the endpoint coordinates relative to the endpoints are respectively formed by the imaging of the first light ray and the second light ray. Furthermore, based on the physical distance, the vertical distance, the first sine value, and the second sine value, it obtains the physical radius of the object to be measured. Therefore, on the one hand, since endpoint detection is performed based on the first scanned image and data calculation is combined with device parameters, the physical radius of the object to be measured can be obtained, so the complexity of the measurement process can be reduced. On the other hand, by calculating the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel, and the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel, sufficient data can be provided for the subsequent radius calculation from a geometric perspective. Therefore, compared with directly scaling the radial dimension of the object to be measured on the first scanned image using the scaling factor, the radius calculation can be performed from a geometric perspective by combining the aforementioned geometric-related data, which helps to improve the reliability of measuring the physical radius. Therefore, the reliability of measuring the physical radius of the object to be measured during the security inspection process can be improved, and the complexity of the measurement process can be reduced.
[0177] Please refer to Figure 6 , Figure 6 which is a schematic framework diagram 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 object size measurement method.
[0178] In the above solution, the computer-readable storage medium 60 acquires a first scanned image of an object to be measured on the security inspection channel by the security inspection machine, and acquires the device parameters of the security inspection machine. The device parameters include the vertical distance from the light source to the security inspection channel, the imaging coordinates of the light rays emitted perpendicularly to the security inspection channel by the light source, and the scaling factor when the security inspection machine forms an image. Then, it detects the endpoint coordinates of the object to be measured relative to the endpoints in the radial direction in the first scanned image, so as to obtain the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel based on the endpoint coordinates of the relative endpoints and the scaling factor, and obtain the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel based on the endpoint coordinates of the relative endpoints, the imaging coordinates, the scaling factor, and the vertical distance. The endpoint coordinates of the relative endpoints are respectively formed by the imaging of the first light ray and the second light ray. Furthermore, based on the physical distance, the vertical distance, the first sine value, and the second sine value, the physical radius of the object to be measured is obtained. Therefore, on the one hand, since endpoint detection is performed based on the first scanned image and data calculation is combined with device parameters, the physical radius of the object to be measured can be obtained, so the complexity of the measurement process can be reduced. On the other hand, by calculating the physical distance between the first intersection point of the first light ray on the security inspection channel and the second intersection point of the second light ray on the security inspection channel, and the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel, sufficient data can be provided for subsequent radius calculation from a geometric perspective. Therefore, compared with directly scaling the radial dimension of the object to be measured on the first scanned image using the scaling factor, radius calculation can be performed from a geometric perspective by combining the aforementioned geometric-related data, which helps to improve the reliability of measuring the physical radius. Therefore, the reliability of measuring the physical radius of the object to be measured during the security inspection process can be improved, and the complexity of the measurement process can be reduced.
[0179] 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.
[0180] The above descriptions of the various embodiments tend to emphasize the differences between the various 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.
[0181] In several embodiments provided in the present application, it should be understood that the disclosed methods and apparatuses can be implemented in other ways. For example, the apparatus embodiments described above are merely 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 coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the apparatus or unit can be in electrical, mechanical or other forms.
[0182] 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.
[0183] In addition, each functional unit in various embodiments of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0184] 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 such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods in various embodiments of the present application. The foregoing storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs and other various media that can store program codes.
[0185] 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 measuring the size of an object, characterized in that, Including: Obtaining a first scanned image of an object to be measured on a security inspection channel by a security inspection machine, and obtaining device parameters of the security inspection machine; wherein, the device parameters include the vertical distance from a light source to the security inspection channel, the imaging coordinates of the light rays emitted perpendicularly to the security inspection channel by the light source, and the scaling factor during imaging of the security inspection machine; Detecting the endpoint coordinates of the object to be measured in the radial direction relative to the endpoints in the first scanned image; Based on the endpoint coordinates of the relative endpoints and the scaling factor, obtaining the physical distance between a first intersection point of a first light ray on the security inspection channel and a second intersection point of a second light ray on the security inspection channel, and based on the endpoint coordinates of the relative endpoints, the imaging coordinates, the scaling factor, and the vertical distance, obtaining a first sine value of a first angle between the first light ray and the security inspection channel and a second sine value of a second angle between the second light ray and the security inspection channel; wherein, the endpoint coordinates of the relative endpoints are respectively formed by imaging of the first light ray and the second light ray; Based on the physical distance, the vertical distance, the first sine value, and the second sine value, obtaining the physical radius of the object to be measured.
2. The method according to claim 1, wherein The endpoint coordinates include a first endpoint coordinate formed by imaging of the first light ray and a second endpoint coordinate formed by imaging of the second light ray. The obtaining the physical distance between a first intersection point of a first light ray on the security inspection channel and a second intersection point of a second light ray on the security inspection channel based on the endpoint coordinates of the relative endpoints and the scaling factor includes: Obtaining a first coordinate difference between the first endpoint coordinate and the second endpoint coordinate; Scaling the first coordinate difference based on the scaling factor to obtain the physical distance.
3. The method according to claim 1, characterized in that, The obtaining the first sine value of the first angle between the first light ray and the security inspection channel and the second sine value of the second angle between the second light ray and the security inspection channel based on the endpoint coordinates of the relative endpoints, the imaging coordinates, the scaling factor, and the vertical distance includes: Obtaining a second coordinate difference between the target endpoint coordinate and the imaging coordinates; Scaling the second coordinate difference based on the scaling factor to obtain a target distance between an intersection point of the target light ray on the security inspection channel and an intersection point of the emitted light ray on the security inspection channel; Based on the vertical distance and the target distance, obtaining a target sine value of a target angle between the target light ray and the security inspection channel; Wherein, the target endpoint coordinate is formed by imaging of the target light ray. When the target light ray is the first light ray, the target angle is the first angle, the target sine value is the first sine value. When the target light ray is the second light ray, the target angle is the second angle, and the target sine value is the second sine value.
4. The method according to claim 3, wherein The obtaining the target sine value of the angle between the target light ray and the security inspection channel based on the vertical distance and the target distance includes: Based on the ratio of the vertical distance to the target distance, obtaining a target tangent value of the target angle; Based on the target tangent value, performing trigonometric function conversion to obtain the target sine value.
5. The method according to claim 1, wherein Obtaining the physical radius of the object to be measured based on the physical distance, the vertical distance, the first sine value, and the second sine value includes: Based on the first sine value and the second sine value, constructing a first equation with the physical radius as the unknown, and based on the vertical distance, constructing a second equation with the physical radius as the unknown; Based on the ratio of the physical distance to the first equation and the ratio of the vertical distance to the second equation, constructing a first function with the physical radius as the unknown; Solving based on the first function to obtain the physical radius of the object to be measured; wherein, the first equation represents the physical length of a first line segment formed by the intersection of the first light ray and the second light ray on a virtual plane respectively, the virtual plane passes through the center of the object to be measured and is parallel to the security inspection channel, and the second equation represents the physical length of a second line segment, which is the perpendicular line segment from the light source to the virtual plane.
6. The method according to claim 5, characterized in that The constructing of the first equation with the physical radius as the unknown based on the first sine value and the second sine value includes: Based on the first sine value and the unknown representing the physical radius, constructing a first sub - equation, and based on the second sine value and the unknown representing the physical radius, constructing a second sub - equation; Based on the sum of the first sub - equation and the second sub - equation, obtaining the first equation; wherein, the first sub - equation represents the physical length from the intersection of the first light ray on the virtual plane to the center, and the second sub - equation represents the physical length from the intersection of the second light ray on the virtual plane to the center.
7. The method according to claim 5, characterized in that The constructing of the second equation with the physical radius as the unknown based on the vertical distance includes: Based on the sum of the vertical distance and the unknown representing the physical radius, constructing the second equation.
8. The method according to claim 1, wherein The device parameters are pre - obtained by calibrating the second scanned image of the calibration ruler placed on the security inspection channel by the security inspection machine, and the calibration ruler is perpendicular to the traveling direction of the security inspection channel.
9. The method according to claim 8, characterized in that, The calibration steps of the vertical distance include: Based on the physical height of the calibration ruler and the unknown representing the vertical distance, constructing a first algebraic expression, and based on the vertex coordinates of each vertex of the calibration ruler in the same cross - section in the second scanned image, obtaining the distance ratio between a first distance and a second distance; Based on the first algebraic expression and the distance ratio, constructing a second function; Solving based on the second function to obtain the vertical distance; wherein, the first algebraic expression represents the ratio of the vertical distance to the shortest distance from the light source to the plane where the top surface of the calibration ruler is located, the vertex coordinates of each vertex are respectively formed by the imaging of each light source ray passing through the target edge of the calibration ruler, the target edge is perpendicular to the traveling direction, the first distance is the distance between the intersections of the light source rays on the detector after passing through the target edge of the top surface of the calibration ruler, and the second distance is the distance between the intersections of the light source rays on the detector after passing through the target edge of the bottom surface of the calibration ruler.
10. The method according to claim 9, characterized in that, Constructing a first algebraic expression based on the physical height of the calibration ruler and the unknown quantity representing the vertical distance, including: Obtaining the sum of the unknown quantity representing the vertical distance and the physical height as the shortest distance; Based on the unknown quantity representing the vertical distance and the shortest distance, obtaining the first algebraic expression.
11. The method according to claim 9, wherein Obtaining the distance ratio between the first distance and the second distance based on the vertex coordinates of each vertex of the calibration ruler on the same cross-section in the second scanned image, including: Obtaining the difference between the vertex coordinates of the vertex on the top side of the cross-section as the top-side coordinate difference, and obtaining the difference between the vertex coordinates of the vertex on the bottom side of the cross-section as the bottom-side coordinate difference; Based on the ratio of the top-side coordinate difference to the bottom-side coordinate difference, obtaining the distance ratio.
12. The method according to claim 8, characterized in that, The calibration steps of the imaging coordinates include: Constructing a second algebraic expression based on the upper vertex coordinate and the lower vertex coordinate of the calibration ruler on the same height line on the target side in the second scanned image and the unknown quantity representing the imaging coordinates, and obtaining the numerical ratio between the physical height of the calibration ruler and the vertical distance; Based on the second algebraic expression and the numerical ratio, constructing a third function; Based on the solution of the third function, obtaining the imaging coordinates; Wherein, the target side is a side of the calibration ruler close to the light source, the second algebraic expression represents the ratio of the third distance to the fourth distance, the upper vertex coordinate and the lower vertex coordinate are respectively formed by imaging of each light source ray passing through the same height line, the third distance is the distance between the intersection points of the light source rays on the detector of the security inspection machine after passing through the same height line, and the fourth distance is the distance between the intersection point of the light source ray on the detector of the security inspection machine after passing through the upper vertex on the same height line and the intersection point of the outgoing ray on the detector of the security inspection machine.
13. The method according to claim 12, wherein Constructing a second algebraic expression based on the upper vertex coordinate and the lower vertex coordinate of the calibration ruler on the same height line on the target side in the second scanned image and the unknown quantity representing the imaging coordinates, including: Obtaining the difference between the upper vertex coordinate and the lower vertex coordinate as the height-line coordinate difference, and obtaining the difference between the upper vertex coordinate and the unknown quantity representing the imaging coordinates as the target expression; Based on the ratio of the height-line coordinate difference to the target expression, obtaining the second algebraic expression.
14. The method according to claim 8, wherein The calibration steps of the scaling factor include: Obtaining the physical width of the calibration ruler, and obtaining the difference between the vertex coordinates of two vertices on the bottom side of the calibration ruler in the same cross-section in the second scanned image as the bottom-side coordinate difference; Based on the ratio of the physical width to the bottom-side coordinate difference, obtaining the scaling factor.
15. The method according to claim 8, wherein The calibration steps of the scaling factor include: Detecting the first pixel coordinates of the upper boundary point of the object to be measured in the first scanned image, and detecting the scale line sequence of the calibration ruler in the second scanned image; wherein, the scale line sequence includes the second pixel coordinates of the scale lines on the calibration ruler. Find the scale line adjacent to the boundary point in the scale line sequence based on the first pixel coordinate and the second pixel coordinate to obtain a first scale index; 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, obtain the scaling factor when the security inspection machine images the object to be measured.
16. The method according to claim 15, wherein 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 a first scale index, and before obtaining 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 the boundary points, the method further includes: Obtain the difference between the second pixel coordinate of the first pixel coordinate and the first scale index as a first difference, and obtain the difference between the second pixel coordinate of the reference scale index and the second pixel coordinate of the first scale index as a second difference; wherein, the reference scale index is the scale index after the first scale index; Obtain the ratio of the first difference to the second difference as the additional scale index of the first scale index; The obtaining 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 the boundary points includes: Based on the first scale index, the additional scale index, the physical distance, and the pixel distance, obtain the scaling factor when the security inspection machine images the object to be measured.
17. An object size measuring device, characterized in that, including: A measurement preparation module for obtaining a first scan image of an object to be measured on a security inspection channel by a security inspection machine, and obtaining device parameters of the security inspection machine; wherein, the device parameters include the vertical distance from a light source to the security inspection channel, the imaging coordinates of the light rays emitted perpendicularly to the security inspection channel by the light source, and the scaling factor when the security inspection machine images; An endpoint detection module for detecting the endpoint coordinates of the object to be measured relative to the endpoints in the radial direction in the first scan image; A data calculation module for obtaining the physical distance between a first intersection point of a first light ray on the security inspection channel and a second intersection point of a second light ray on the security inspection channel based on the endpoint coordinates of the relative endpoints and the scaling factor, and obtaining a first sine value of a first angle between the first light ray and the security inspection channel and a second sine value of a second angle between the second light ray and the security inspection channel based on the endpoint coordinates of the relative endpoints, the imaging coordinates, the scaling factor, and the vertical distance; wherein, the endpoint coordinates of the relative endpoints are respectively formed by imaging of the first light ray and the second light ray; A radius determination module for obtaining the physical radius of the object to be measured based on the physical distance, the vertical distance, the first sine value, and the second sine value.
18. 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 object size measurement method according to any one of claims 1 to 16.
19. An X-ray security inspection machine, characterized in that, At least including the electronic device according to claim 18.
20. 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 object size measurement method according to any one of claims 1 to 16.
Citation Information
Patent Citations
Imaging device and image analysis method
CN102932591A
Monocular vision system, portable ball target used by monocular vision system and measuring method of monocular vision system
CN103162622A