Object size measurement method and related device, security inspection machine and storage medium
By detecting and analyzing the first scan image of the object to be measured on the security inspection channel, establishing the target coordinate system and constructing the light equation, the problem of difficulty in automatically measuring the physical radius of the object during security inspection is solved, and efficient and accurate measurement of the object size is achieved.
Patent Information
- Application Number
- CN202510543014.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2045-04-28
AI Technical Summary
During security inspection, it is difficult for the prior art to automatically and accurately measure the physical radius of the object to be measured, especially when the object is tilted or irregular in shape.
By detecting the first scan image of the object to be measured on the security check channel, the coordinate difference between the target angle and the edge of the object is obtained, the target coordinate system is established, the equations of the first and second rays are constructed, and the physical radius is used as a variable, and the physical distance is solved.
It realizes automatic and accurate measurement of the physical radius of the object to be measured during the security inspection process, improves the convenience and accuracy of the measurement process, and is suitable for objects of various shapes and inclined angles.
Smart Images

Figure CN120063173A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of security inspection image processing, and particularly to a method for measuring the size of an object, a related device, an X-ray security inspection machine, and a storage medium. Background Art
[0002] In places such as airports, subways, and logistics, X-ray security inspection machines can help detect the size of objects being inspected, etc., and thus have gradually become one of the standard configurations in the above-mentioned places.
[0003] In some special scenarios, the object to be measured is required to be placed on the security inspection channel 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. On the one hand, the above measurement method requires manual operation by relevant personnel and is difficult to automate the measurement of the object size; on the other hand, in daily life scenarios such as commuting, it is usually difficult to require the object to be measured to be placed in the above regular manner before passing through the security inspection, but rather to be randomly placed on the security inspection channel. As a result, the object to be measured inevitably tilts with respect to the traveling direction of the security inspection channel, making the above measurement method inapplicable, especially when measuring the physical radius of a cylindrical object. In view of this, how to automatically and accurately measure the physical radius of the object to be measured during the security inspection 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 a method for measuring the size of an object, a related device, an X-ray security inspection machine, and a storage medium, which can automatically and accurately measure the physical radius of the object to be measured during the security inspection process.
[0005] To solve the above technical problems, the first aspect of the present application provides a method for measuring the size of an object, including: detecting a first scanned image of an object to be measured on a security inspection channel based on a security inspection machine to obtain a detection result, and acquiring device parameters including at least a scaling coefficient during imaging of the security inspection machine; wherein, the detection result includes: a target angle between the object to be measured and the traveling direction of the security inspection channel, and a coordinate difference between relative endpoints of the object edge of the object to be measured in the vertical direction of the traveling direction; based on the scaling coefficient and the coordinate difference, obtaining a 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; wherein, the first light ray and the second light ray are respectively tangent to the object to be measured and respectively form imaging relative endpoints, and a cross-section of the plane where the first light ray and the second light ray are located on the object to be measured is used as a target ellipse; taking the center of the target ellipse as the origin, the direction of the major axis of the target ellipse as the coordinate horizontal axis, and the direction of the minor axis of the target ellipse as the coordinate vertical axis, establishing a target coordinate system; wherein, the major axis is obtained based on the target angle and the physical radius of the object to be measured, and the minor axis is the physical radius; based on the target coordinate system, constructing a first equation of the first light ray and a second equation of the second light ray; wherein, the first equation and the second equation take the physical radius as a variable; based on the first equation, the second equation and the physical distance, solving the physical radius.
[0006] To solve the above technical problems, the second aspect of the present application provides an object size measurement device, including: a measurement preparation module, a distance measurement module, a coordinate establishment module, an equation construction module, and a radius solution module. The measurement preparation module is configured to detect a first scanned image of an object to be measured on a security inspection channel based on a security inspection machine to obtain a detection result, and acquire device parameters including at least a scaling coefficient during imaging of the security inspection machine; wherein, the detection result includes: a target angle between the object to be measured and the traveling direction of the security inspection channel, and a coordinate difference between relative endpoints of the object edge of the object to be measured in the vertical direction of the traveling direction; the distance measurement module is configured to obtain a 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 scaling coefficient and the coordinate difference; wherein, the first light ray and the second light ray are respectively tangent to the object to be measured and respectively form imaging relative endpoints, and a cross-section of the plane where the first light ray and the second light ray are located on the object to be measured is used as a target ellipse; the coordinate establishment module is configured to establish a target coordinate system with the center of the target ellipse as the origin, the direction of the major axis of the target ellipse as the coordinate horizontal axis, and the direction of the minor axis of the target ellipse as the coordinate vertical axis; wherein, the major axis is obtained based on the target angle and the physical radius of the object to be measured, and the minor axis is the physical radius; the equation construction module is configured to construct a first equation of the first light ray and a second equation of the second light ray based on the target coordinate system; wherein, the first equation and the second equation take the physical radius as a variable; the radius solution module is configured to solve the physical radius based on the first equation, the second equation and the physical distance.
[0007] To solve the above technical problems, a third aspect of the present application provides an electronic device, which at least includes 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 an X-ray security inspection machine, which at least includes 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, which stores program instructions that can be run by a processor, and the program instructions are used to implement the object size measurement method in the first aspect above.
[0010] Based on the above solution, the first scanned image of the object to be measured on the security inspection channel by the security inspection machine is detected to obtain a detection result, and device parameters including at least the scaling factor during the imaging of the security inspection machine are obtained. The detection result includes: the target angle between the object to be measured and the traveling direction of the security inspection channel, and the coordinate difference between the relative endpoints of the object edge of the object to be measured in the vertical direction of the traveling direction. Then, based on the scaling factor and the coordinate difference, 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. The first light ray and the second light ray are respectively tangent to the object to be measured and respectively form relative endpoints during imaging. The cross-section of the plane where the first light ray and the second light ray are located on the object to be measured is used as the target ellipse. Thus, with the center of the target ellipse as the origin, the direction of the major axis of the target ellipse as the coordinate horizontal axis, and the direction of the minor axis of the target ellipse as the coordinate vertical axis, a target coordinate system is established. The major axis is obtained based on the target angle and the physical radius of the object to be measured, and the minor axis is the physical radius. Furthermore, based on the target coordinate system, the first equation of the first light ray and the second equation of the second light ray are constructed, and the first equation and the second equation take the physical radius as a variable. Based on the first equation, the second equation, and the physical distance, the physical radius is solved. Therefore, on the one hand, since relevant detections are performed based on the first scanned image and relevant calculations are combined with device parameters, the physical radius of the object to be measured can be obtained without manual operations by relevant personnel on the first scanned image, which can improve the convenience of the measurement process. On the other hand, when the object to be measured is inclined to the traveling direction of the security inspection channel, the cross-section of the plane where the light source rays tangent to the object to be measured are located on the object to be measured is used as the target ellipse, and based on this, a target coordinate system is established. The major axis of the target ellipse is obtained from the target angle between the object to be measured and the traveling direction and the physical radius, and the minor axis of the target ellipse is the physical radius. Then, based on the established target coordinate system, the equations of the aforementioned tangent rays with the physical radius as a variable can be constructed, and combined with the physical distance between the intersection points of the aforementioned tangent rays on the security inspection channel, the physical radius is solved. Therefore, it can be solved through a series of operations such as mathematical modeling and equation solving, which helps to improve the accuracy of the measurement process. Thus, the physical radius of the object to be measured can be automatically and accurately measured during the security inspection process. 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 the present application; Figure 2a is a schematic diagram of the effect of an embodiment of the method for measuring the size of an object in the present application; Figure 2b is a schematic diagram of the effect of an embodiment of the first scanned image in the present application; Figure 2c is a schematic diagram of the effect of another embodiment of the method for measuring the size of an object in the present application; Figure 3 is a schematic framework diagram of an embodiment of the device for measuring the size of an object in the present application; Figure 4 It is a schematic diagram of the framework of an embodiment of the electronic device of the present application; Figure 5 It is a schematic diagram of the framework of an embodiment of the security inspection machine of the present application; Figure 6 It is a schematic diagram of the framework of an embodiment of the computer-readable storage medium of the present application. Detailed implementation manners
[0012] The following will combine the accompanying drawings of the specification to elaborate in detail on the solutions of the embodiments of the present application.
[0013] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system structures, interfaces, and technologies are presented to thoroughly understand the present application.
[0014] In this article, the terms "system" and "network" are often used interchangeably. The term "and / or" in this article merely describes 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 front and rear associated objects. In addition, "multiple" in this article means two or more than two.
[0015] Please refer to Figure 1 , Figure 1 It 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: Step S11: Detect the first scanned image of the object to be measured on the security inspection channel based on the security inspection machine to obtain a detection result, and obtain device parameters including at least the scaling factor when the security inspection machine forms an image.
[0016] In the embodiments of the present disclosure, the detection result includes: the target angle between the object to be measured and the traveling direction of the security inspection channel, and the coordinate difference between the relative endpoints of the object edge of the object to be measured in the vertical direction of the traveling direction. It should be noted that the target angle can be specifically determined by detecting the axis of the object to be measured in the first scanned image. For example, the axis of the object to be measured can be detected in the first scanned image, and the angle between the axis and the traveling direction is the target angle. In addition, in addition to the scaling factor, the device parameters may further include, but are not limited to: the vertical distance from the light source to the security inspection channel, the imaging coordinates of the light source perpendicular to the security inspection channel and emitting light, etc. The specific content of the device parameters is not limited here.
[0017] In an implementation scenario, the device parameters can be provided by the manufacturer by burning them into the internal storage of the security inspection machine at the time of factory for subsequent retrieval and use.
[0018] 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, and 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 here.
[0019] 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. The sum of the unknown quantity representing the vertical distance and the physical height can be obtained as the shortest distance, and then based on the unknown quantity representing the vertical distance and the shortest distance, the first algebraic expression can be obtained. 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. At the same time, based on the vertex coordinates of each vertex of the calibration ruler on the same cross-section in the second scanned image, the distance ratio between the first distance and the second distance can be obtained. Exemplarily, the difference between the vertex coordinates of the vertices on the top edge of the cross-section can be obtained as the top edge coordinate difference, and the difference between the vertex coordinates of the vertices on the bottom edge of the cross-section can be obtained as the bottom edge coordinate difference. On this basis, the distance ratio can be obtained based on the ratio of the top edge coordinate difference to the bottom edge coordinate difference. It should be noted that when 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. On this basis, 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 based on 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 the light rays of the light source passing through the target edges on the calibration ruler. The target edges are perpendicular to the traveling direction. The first distance is the distance between the intersection points of the light rays of the light source on the detector after passing through the target edge on the top surface of the calibration ruler, and the second distance is the distance between the intersection points of the light rays of the light source on the detector after passing through the target edge on the bottom surface of the calibration ruler. For ease of understanding, please refer to Figure 2a , Figure 2a is a schematic diagram of the effect of an embodiment of the object size measurement method of the present application. As Figure 2aAs shown, the three thick straight 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 emitted by the light source to form corresponding pixels on the image layer. Since different materials have different light absorption rates, the detector can detect the energy of the received light to determine the differences between the materials through which different lights pass, 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, and OP represents the vertical distance from the light source to the security inspection channel, OP 2 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), and the vertex coordinates of vertex A are V a , the vertex coordinates of vertex B are V b , the vertex coordinates of vertex C are V c , the vertex coordinates of vertex D are 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 coordinates V a are 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 coordinates V b are 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 coordinates V c are 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 coordinates V d are formed by the imaging of the light ray OD of the light source passing through the target edge at point D (i.e., the edge line perpendicular to the paper surface at point D). The intersection point between the light ray OB and the security inspection channel can be denoted as B 0 , and the intersection point with the detector can be denoted as B 1 , the intersection point between the light ray OA and the detector can be denoted as A 1 , the intersection point between the light ray OC and the security inspection channel can be denoted as C 0 , and the intersection point with the detector can be denoted as C 1 , the intersection point between the light ray OD and the detector can be denoted as D 1 . 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: B0 C 0 / B 1 C 1 =OP / OP 1 AD / A 1 D 1 =OP / OP 1 Combining the above two equations, we can obtain: B 0 C 0 / B 1 C 1 =AD / A 1 D 1 That is to say: B 0 C 0 / AD = B 1 C 1 / A 1 D 1 Also, because AD = BC, the above equation can be further transformed into: B 0 C 0 / BC = B 1 C 1 / A 1 D 1 In addition, according to the principle of similar triangles, it is also known that: OP / OP 2 =B 0 C 0 / BC Combining the above two equations, we can obtain again: OP / OP 2 =B 1 C 1 / A 1 D 1 Also because: OP 2 =OP + PP 2 =OP + AB Combining the above two equations, we can obtain again: OP / (OP + AB)=B 1 C 1 / A 1 D 1 Also because: B 1 C 1 =λ 1 *(V b -Vc ) A 1 D 1 = λ 1 *(V a - V d ) Therefore: B 1 C 1 / A 1 D 1 =(V b - V c ) / (V a - V d ) In the above formula, B 1 C 1 is the first distance, A 1 D 1 is the second distance, and B 1 C 1 / A 1 D 1 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.
[0020] Substitute the above formula into the previous formula OP / (OP + AB) = B 1 C 1 / A 1 D 1 , and we can get: OP / (OP + AB) = (V b - V c ) / (V a - V d ) 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: OP = (V b - V c ) * AB / (V a - V d + V b - Vc ) 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. Exemplarily, 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. At the same time, the numerical ratio between the physical height of the calibration scale and the vertical distance can be obtained. On this basis, 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 based on 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 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 rays 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 light rays on the detector of the security inspection machine. For ease of understanding, please continue to refer to Figure 2a , P 1 is the intersection point of the outgoing light ray perpendicular to the security inspection channel from the light source O on the detector, and the imaging coordinates are V p . According to the principle of similar triangles: AB 0 / A 1 B 1 =OP / OP 1 PB 0 / P 1 B 1 =OP / OP 1 Combining the above two equations, we can get: AB 0 / A 1 B 1 =PB 0 / P 1 B 1 The above equation can be transformed into: AB 0 / PB 0 =A 1 B 1 / P 1 B 1 According to the principle of similar triangles, it can also be known that: AB0 / PB 0 =AB / OP By combining the above two equations, we can obtain: A 1 B 1 / P 1 B 1 =AB / OP In the above equation, AB / OP represents the numerical ratio between the physical height of the calibration scale and the vertical distance. A 1 B 1 / P 1 B 1 represents the second algebraic expression. Among them, A 1 B 1 represents the distance between the intersection points on the detector of the security inspection machine after the light source ray passes through the high line AB. P 1 B 1 represents the intersection point B on the detector of the security inspection machine after the light source ray passes through the upper vertex B of the high line AB 1 and the intersection point P of the outgoing ray on the detector of the security inspection machine 1 The distance between them. Further, for the second algebraic expression, since: A 1 B 1 =λ 1 *(V b -V a ) P 1 B 1 =λ 1 *(V p -V b ) In the above equation, V b -V a represents the difference between the vertex coordinate and the lower vertex coordinate (i.e., the coordinate difference of the high line). 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 A 1 B 1 / P 1 B 1 can also be expressed as: A 1 B 1 / P 1 B 1 =(V b -V a ) / (V p -V b ) That is, the second algebraic expression can also be expressed as the ratio of the coordinate difference of the high line to the target equation. Therefore, the above equation A1 B 1 / P 1 B 1 = AB / OP can be reconstructed as: (V b -V a ) / (V p -V b ) = AB / OP The above equation is the third function. Solving the above third function can obtain the imaging coordinate V p : V p =(V b -V a )*OP / AB + V b 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 vertex coordinate difference between the two vertices at 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 scale side facing, the height direction is the thickness direction of the calibration ruler, and the extension direction is the direction in which the scale index increases or decreases. Subsequently, the width direction is the direction in which the scale is 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 A 2 to D 1 using the aforementioned scaling factor λ 1 : AD = λ 2 *A 1 D 1 In addition, as described above: A 1 D 1 = λ 1 *(V a -V d ) Combining the above two equations, we can obtain: AD = λ 2 *λ 1 *(V a -V d ) And because the scaling factor λ of the security inspection machine = λ 2 *λ 1 , so the scaling factor λ of the security inspection machine can be expressed as: λ = AD / (V a - V d ) In the above formula, the two vertices at the bottom edge of the calibration scale in the same cross-section are points A and D. Therefore, the difference in the vertex coordinates of the two can be expressed as V a - V d . That is to say, the physical width AD and the coordinate difference V a - V d The ratio is denoted as the scaling coefficient λ.
[0021] In a specific implementation scenario, for the "scaling coefficient" in the device parameters, different from the aforementioned calibration method, in order to calibrate the scaling coefficient when the security inspection machine images the object to be measured, the first pixel coordinates of the upper boundary point of the object to be measured in the first scanned image can be detected. Exemplarily, the boundary points may include: in the target direction of the first scanned image, the first boundary point and the second boundary point of the object to be measured. The target direction is the placement direction of the calibration scale on the security inspection channel, that is, the direction perpendicular to the traveling direction. It should be noted that after obtaining the first scanned image, the first scanned image can be subjected to object detection to obtain the target area of the object to be measured in the first scanned image (such as the minimum bounding rectangle of the object to be measured). On this basis, the pixel points located on the boundary of the target area in the target direction can be selected, which are the first boundary point and the second boundary point. That is to say, the first boundary point and the second boundary point must 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 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 2bThe 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. At the same time, the scale line sequence of the calibration ruler in the second scanned image can be detected, and the scale line sequence can include the second pixel coordinates of the scale lines on the calibration ruler, so that the scale line adjacent to the boundary point can be found in the scale line sequence based on the first pixel coordinate and the second pixel coordinate 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 images 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 on the security inspection machine first to obtain the second scanned image of the calibration ruler by the security inspection machine, and then detection (such as edge detection of the second scanned image) can be performed based 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. Then, 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 to avoid affecting the security inspection due to the placement of the calibration ruler on the security inspection machine. As a possible implementation manner, when the accuracy requirement for the scaling factor is relatively loose, the product of the absolute difference of the first scale index and the physical distance can be obtained as the first distance, and then the ratio of the first distance to the pixel distance can be obtained as the scaling factor. It should be noted that the absolute difference of the first scale index is the absolute difference between the first scale indices of the aforementioned first boundary point and the second boundary point, and the pixel distance between boundary points is the pixel distance between the aforementioned first boundary point and the second boundary point (more precisely, the pixel distance in the target direction). Or, 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 inspected can be obtained based on the first scale index, the additional scale index, the physical distance, and the pixel distance. 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, an additional scale index of the first scale index can be added to the first scale index to obtain a 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.
[0022] It should be noted that the above examples are only several possible ways to obtain device parameters, and the ways to obtain 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, by calibration, or even by other possible ways not mentioned in the embodiments of the present disclosure, they can all be applied to the embodiments of the present disclosure to measure the physical radius of the object to be measured accordingly.
[0023] In an implementation scenario, as described above, after obtaining the first scanned image, 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 (such as the minimum circumscribed rectangle of the object to be measured). On this basis, the axis of the object to be measured can be determined with the assistance of the target area, so that the angle between the axis and the traveling direction can be obtained as the target angle. Please continue to refer to Figure 2b , Figure 2b The dashed box in Figure 2b is the target area, and the midline of the target area (such as the dashed line without an arrow in Figure 2b ) is the axis of the object to be measured, and the target angle is Figure 2b θ in
[0024] In an implementation scenario, as described above, after obtaining the first scanned image, 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 (such as the minimum circumscribed rectangle of the object to be measured). On this basis, edge detection can be further performed in the target area to obtain the object edge of the object to be measured in the first scanned image. That is, in the direction perpendicular to the traveling direction, relative endpoints can be selected on the object edge of the object to be measured, and the coordinate difference between the relative endpoints can be obtained. It should be noted that the coordinate difference between the relative endpoints is more precisely the coordinate difference of the relative endpoints on the ordinate (i.e., the V coordinate difference). Please continue to refer to Figure 2b , Figure 2b The dashed box in Figure 2b is the target area. In the direction perpendicular to the traveling direction (such as the dashed line with an arrow in Figure 2bThe object to be measured has a narrow neck and a thick body. To make the physical radius obtained by the final measurement more valuable for reference, a regular area that occupies a relatively larger area (such as Figure 2b the bottle body area, rather than the neck area) can be determined on the object to be measured in the first scanned image, and then relative endpoints can be selected on the edge of the object in the regular area in the direction perpendicular to the traveling direction to obtain the coordinate difference between the relative endpoints. Of course, Figure 2b The example shown is only one possible example in the actual application process, and other possible situations will not be exemplified one by one here.
[0025] Step S12: Based on the scaling coefficient and the coordinate difference, 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.
[0026] In the embodiment of the present disclosure, the first light ray and the second light ray are respectively tangent to the object to be measured and respectively form relative endpoints by imaging. The cross-section of the plane where the first light ray and the second light ray are located on the object to be measured is used as the target ellipse. It should be noted that since the object to be measured is inclined to the traveling direction of the security inspection channel, when the security inspection machine light source scans the object to be measured, the fan-shaped light beam on the cross-section of the object to be measured is elliptical. Therefore, when measuring the physical radius, the cross-section of the fan-shaped light beam where the two light rays that form the relative endpoints in the first scanned image are located on the object to be measured can be used as the target ellipse.
[0027] In an implementation scenario, the coordinate difference can be scaled based on the scaling coefficient, and the physical distance between the first corner point of the first light ray on the security inspection channel and the second corner point of the second light ray on the security inspection channel can be obtained. For example, since the scaling coefficient during the imaging of the security inspection machine essentially represents the mapping relationship between the image layer and the security inspection channel, the scaling coefficient can be directly multiplied by the coordinate difference to obtain the above physical distance.
[0028] In an implementation scenario, for the convenience of understanding, 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 three thick lines from top to bottom respectively represent the image layer, the detector, and the security inspection channel. The light source of the security inspection machine is usually located below its security inspection channel, denoted as O. In addition, the coordinate difference between the relative endpoints in the first scanned image is V c -V b , and the physical distance BC between the first intersection point B between the first light ray OB that forms the endpoint coordinate V b and the security inspection channel and the second intersection point C between the second light ray OC that forms the endpoint coordinate V c and the security inspection channel can be expressed as: BC=(V c -V b )*λ In addition, the fan-shaped light beams where the first light ray OB and the second light ray OC are located form an ellipse as shown in Figure 2c on the cross-section of the object to be measured, and this ellipse can be used as the target ellipse for subsequent analysis. Of course, Figure 2c the situation shown is only a possible example in the actual application process, and other possible situations will not be exemplified one by one here.
[0029] Step S13: Establish a target coordinate system with the center of the target ellipse as the origin, the direction of the major axis of the target ellipse as the horizontal coordinate axis, and the direction of the minor axis of the target ellipse as the vertical coordinate axis.
[0030] In the embodiment of the present disclosure, the major axis can be obtained based on the target angle and the physical radius of the object to be measured, and the minor axis is the physical radius. Please continue to refer to Figure 2c . For the convenience of description, the major axis of the target ellipse can be denoted as a, and the minor axis can be denoted as b, and the two can be respectively expressed as: a = r / cos(θ) b = r In the above formula, θ represents the target angle, and r represents the physical radius, that is, the major axis of the target ellipse can be expressed as the ratio of the minor axis to the cosine value of the target angle. In addition, Figure 2c in 1 O represents the center of the target ellipse, that is, the origin of the target coordinate system, so its coordinates are (0, 0). B' is the tangent point of the first light ray OB and the target ellipse, C' is the tangent point of the second light ray OC and the target ellipse, B 2 C 2 is a virtual plane passing through the center of the target ellipse and parallel to the security inspection passage, and the intersection point of the outgoing light ray of the light source O perpendicular to the security inspection passage on the virtual plane is P 2 . Among them, B 2 is the intersection point of the first light ray OB on the virtual plane, and C 2 is the intersection point of the second light ray OC on the virtual plane.
[0031] Step S14: Based on the target coordinate system, construct the first equation of the first light ray and the second equation of the second light ray.
[0032] In the embodiment of the present disclosure, the first equation and the second equation take the physical radius as a variable. That is to say, both the first equation and the second equation are essentially expressed as equations with the abscissa x as the independent variable and the ordinate y as the dependent variable, and the equations also contain the variable: the physical radius r.
[0033] In one implementation scenario, as a possible implementation method, in order to construct the first equation and the second equation, the coordinate expression of the light source coordinates on the target coordinate system can be obtained based on the imaging coordinates, the vertical distance, the endpoint coordinates and the scaling factor, and the coordinate expression takes the physical radius as a variable. Based on this, the first constraint equation satisfied by the ellipse tangent passing through the light source coordinates can be obtained based on the ellipse equation and the coordinate expression of the light source coordinates, and the first constraint equation takes the light source coordinates as a variable, so that the first expression of the coordinates of the tangent point of the first light on the target ellipse and the second expression of the coordinates of the tangent point of the second light on the target ellipse can be obtained based on the ellipse equation and the first constraint equation, and both the first expression and the second expression contain the light source coordinates, and then the first equation can be obtained based on the first expression and the second constraint equation of the tangent on the target ellipse, and the second equation can be obtained based on the second expression and the second constraint equation of the tangent on the target ellipse. It should be noted that the device parameters can also include the vertical distance from the light source to the security inspection channel and the imaging coordinates of the light source emitted perpendicular to the security inspection channel. The specific meaning and acquisition method can refer to the above-mentioned related description, which will not be repeated here. The above method, by establishing a coordinate expression of the light source coordinates and a first expression of the coordinates of the tangent point of the first light ray on the target ellipse and a second expression of the coordinates of the tangent point of the second light ray on the target ellipse, can then jointly establish the constraint equations of the tangents on the target ellipse to obtain the first equation of the first light ray and the second equation of the second light ray, that is, the light equations can be determined from the perspective of combining the light source coordinates and the tangent point coordinates.
[0034] In a specific implementation scenario, in order to obtain the coordinate expression of the light source coordinates, the coordinate difference between the endpoint coordinates and the imaging coordinates can be scaled based on the scaling factor to obtain the actual distance between the intersection points of the light source light and the outgoing light on the security inspection channel, and the endpoint coordinates can be formed by the imaging of the light source light. Then, based on the actual distance and the vertical distance, the horizontal coordinate expression with the physical radius as the variable in the coordinate expression is obtained, and based on the vertical distance, the vertical coordinate expression with the physical radius as the variable in the coordinate expression is obtained. For ease of understanding, please continue to refer to Figure 2c , the scaling factor λ can be used to adjust the endpoint coordinates V b With imaging coordinates V p The coordinate difference between them is scaled to obtain the actual distance BP between the intersection points B and P of the light source light OB and the outgoing light OP on the security inspection channel: BP=(V b -V p )*λ According to the principle of similar triangles: B 2 P 2 / BP=OP 2 / OP=(OP+PP 2 ) / OP Also, because: PP 2 =b=r Therefore, it can be obtained that: B 2 P 2 =BP*(OP + PP 2 ) / OP=(V b -V p )*λ*(OP + r) / OP In addition, the ellipse equation of the target ellipse can be expressed as:
[0035] Therefore, for any point (x’, y’) on the target ellipse, the constraint equation (i.e., the aforementioned second constraint equation) of the tangent line passing through this point on the target ellipse can be expressed as:
[0036] The abscissa of the intersection point between the above constraint condition and the x-axis of the target coordinate system is O 1 B 2 , so y = 0 can be substituted into the above constraint equation to obtain O 1 B 2 : O 1 B 2 =a 2 / x’ = (r / cosθ) 2 / x’ Therefore, the expression of the abscissa in the light source coordinates can be obtained: x 0 = O 1 B 2 + B 2 P 2 = (r / cosθ) 2 / x’+(V b -V p )*λ*(OP + r) / OP And the expression of the ordinate in the light source coordinates: y 0 =-OP - PP 2 =-OP - r In a specific implementation scenario, please continue to refer to Figure 2c , since the coordinate expressions of the light source coordinates and the ellipse equation are both known, the constraint equation (i.e., the first constraint equation) that the ellipse tangent line of the target ellipse passing through the light source coordinates needs to satisfy can be obtained by combining the two:
[0037] It can be seen that the first constraint equation is more stringent than the aforementioned second constraint equation. That is, the second constraint equation only represents the constraint equation of the tangent line on the target ellipse, while the first constraint equation not only represents the constraint equation of the tangent line on the target ellipse, but also requires that the tangent line passes through the light source coordinates. It should be noted that in order to make the expression of the first constraint equation relatively concise, the coordinate expression of the aforementioned light source coordinates is not reflected in the first constraint equation to avoid overly complex equation expressions. The same applies in subsequent similar situations.
[0038] In a specific implementation scenario, after obtaining the first constraint equation, based on the ellipse equation and the first constraint equation, the ordinate equation of the tangent point coordinates can be obtained by simultaneous equations. The ordinate equation can contain the light source coordinates and take the physical radius and the abscissa of the tangent point coordinates as variables. Thus, based on the ordinate equation of the tangent point coordinates and the coordinate expression of the light source coordinates, the abscissa expression of the tangent point coordinates of the first light ray and the second light ray on the target ellipse can be solved. Furthermore, the ordinate expression of the tangent point coordinates of the first light ray on the target ellipse can be obtained by substituting the abscissa expression of the tangent point coordinates of the first light ray on the target ellipse into the ordinate equation, and the ordinate expression of the tangent point coordinates of the second light ray on the target ellipse can be obtained by substituting the abscissa expression of the tangent point coordinates of the second light ray on the target ellipse into the ordinate equation. It should be noted that the first expression of the tangent point coordinates of the first light ray on the target ellipse can include the abscissa expression and the ordinate expression of the tangent point coordinates of the first light ray on the target ellipse, and the second expression of the tangent point coordinates of the second light ray on the target ellipse can include the abscissa expression and the ordinate expression of the tangent point coordinates of the second light ray on the target ellipse. For ease of understanding, please continue to refer to Figure 2c By simultaneously solving the aforementioned ellipse equation and the first constraint equation, the ordinate equation of the tangent point coordinates can be obtained:
[0039] Then substitute the abscissa expression \(x\) 0 \(=a\) 2 \( / x'+d\) into the above ordinate expression:
[0040] It should be noted that as mentioned above, for ease of expression, relevant expressions are simplified. In this example, \(d = BP(b + OP) / OP\), and specific details can be referred to the aforementioned relevant descriptions and will not be elaborated here.
[0041] Also, since any point \((x',y')\) on the target ellipse must satisfy the ellipse equation, that is:
[0042] Substitute the obtained \(y'\) into the above equation to get:
[0043] It can be simplified to obtain:
[0044] The abscissa expression of the tangent point coordinates of the first ray and the second ray on the target ellipse can be obtained by solving:
[0045] The above abscissa expression is the abscissa expression of the tangent point B' of the first ray OB on the target ellipse and the tangent point C' of the second ray OC on the target ellipse:
[0046]
[0047] Substituting the above abscissa expressions into the aforementioned ordinate equations respectively, the ordinate expressions of the tangent point coordinates of the first ray on the target ellipse and the ordinate expressions of the tangent point coordinates of the second ray on the target ellipse can be obtained:
[0048] Thus far, the first expression of the tangent point coordinates of the first ray OB on the target ellipse can be obtained and the second expression of the tangent point coordinates of the second ray OC on the target ellipse . Of course, the above example is only one possible example of the situation shown by Figure 2c in the actual application process, and other possible situations will not be exemplified one by one here.
[0049] In a specific implementation scenario, after obtaining the first expression, the first expression can be substituted into the second constraint equation to obtain the first equation of the first ray; similarly, the second expression can be substituted into the second constraint equation to obtain the second equation of the second ray. Please continue to refer to Figure 2c , the first expression can be substituted into the second constraint equation to obtain the first equation of the first ray:
[0050] and the second expression substituted into the second constraint equation to obtain the second equation of the second ray:
[0051] In another implementation scenario, as another possible implementation method, in order to construct the first equation and the second equation, it is also possible to obtain the first slope of the first light ray in the target coordinate system based on the pixel coordinates, imaging coordinates, scaling factor, and vertical distance of the first endpoint, and obtain the second slope of the second light ray in the target coordinate system based on the pixel coordinates, imaging coordinates, scaling factor, and vertical distance of the second endpoint. The pixel coordinates of the first endpoint are formed by the imaging of the first light ray, and the pixel coordinates of the second endpoint are formed by the imaging of the second light ray. It should be noted that the device parameters also include the vertical distance from the light source to the security inspection channel and the imaging coordinates of the light ray emitted perpendicularly to the security inspection channel by the light source, and the relative endpoints include the first endpoint and the second endpoint. For specific details, reference can be made to the foregoing relevant descriptions and will not be elaborated here. In addition, based on the ellipse equation of the target ellipse in the target coordinate system, the first intercept and the second intercept of the tangent equation of the target ellipse at the target slope can be obtained. The first intercept is a positive number, the second intercept is a negative number, and both the first intercept and the second intercept are expressions represented by the target slope and the physical radius as variables. On this basis, based on the magnitude relationship between the first slope and the second slope, one of the first intercept and the second intercept is selected for the first slope to form the first equation, and the other of the first intercept and the second intercept is selected for the second slope to form the second equation. In the above manner, by obtaining the first slope and the second slope of the first light ray and the second light ray in the target coordinate system respectively, and analyzing the ellipse equation, the first intercept and the second intercept of the tangent equation of the target ellipse at the target slope are obtained, so as to combine the first slope and the first intercept and the second slope and the second intercept to form the first equation of the first light ray and the second equation of the second light ray. Therefore, different from the foregoing method of determining the light ray equation from the perspective of the light source coordinates and the tangent point coordinates, this implementation method can determine the light ray equation from the perspective of combining the slope and the intercept.
[0052] In a specific implementation scenario, in order to obtain the first slope, the coordinate difference between the pixel coordinates and the imaging coordinates of the first endpoint can be scaled based on the scaling factor to obtain the first distance between the intersection point between the outgoing light ray and the security inspection channel and the first intersection point, and the first slope can be obtained based on the ratio of the vertical distance to the first distance. Please continue to refer to Figure 2c , the first distance BP between the intersection point between the outgoing light ray OP and the security inspection channel and the first intersection point B can be expressed as: BP=(V b -V p )*λ In the above formula, V b represents the pixel coordinates of the first endpoint, V p represents the imaging coordinates, and λ represents the scaling factor. On this basis, the first slope of the first light ray OB in the target coordinate system can be obtained: k 1 =-OP / BP=-OP / {(Vb -V p )*λ} In a specific implementation scenario, in order to obtain the second slope, the coordinate difference between the pixel coordinates of the second endpoint and the imaging coordinates can be scaled based on the scaling factor to obtain the second distance between the intersection point of the outgoing light ray and the security inspection channel and the second intersection point, and the second slope can be obtained based on the ratio of the vertical distance to the second distance. Please continue to refer to Figure 2c , the second distance CP between the intersection point P of the outgoing light ray OP and the security inspection channel and the second intersection point C can be expressed as: CP=(V c -V p )*λ In the above formula, V c represents the pixel coordinates of the second endpoint, V p represents the imaging coordinates, and λ represents the scaling factor. On this basis, the second slope of the second light ray OC in the target coordinate system can be obtained: K 2 =-OP / CP=-OP / {(V c -V p )*λ} In a specific implementation scenario, in order to obtain the first intercept and the second intercept of the tangent equation of the target ellipse at the target slope, the ellipse equation of the target ellipse in the target coordinate system can be analyzed. For the convenience of understanding, please refer to Figure 2c , as mentioned above, the ellipse equation of the target ellipse in the target coordinate system can be expressed as:
[0053] Assume that the target slope of the tangent equation of the target ellipse is k, then the tangent equation can be expressed as: y=kx+m Substituting the above tangent equation into the aforementioned ellipse equation, we can get:
[0054] After simplification, we can get:
[0055] Let A=a 2 k 2 +b 2 , B=2a 2 km, C=a 2 (m 2 -b 2 ), since any tangent of the target ellipse has only one intersection point (i.e., the tangent point) with the target ellipse, the above quadratic equation in one variable has only one unique solution, that is, the discriminant B 2-4AC = 0, that is: (2a 2 km) 2 -4 * (a 2 k 2 +b 2 ) * (a 2 (m 2 -b 2 )) = 0 After simplification, we can get: 4a 2 b 4 +4a 4 b 2 k 2 =4a 2 b 2 m 2 Therefore, two solutions for the intercept m at the target slope k can be obtained, namely the first intercept and the second intercept:
[0056]
[0057] In a specific implementation scenario, after obtaining the first slope, the second slope, the first intercept, and the second intercept, based on the magnitude relationship between the first slope and the second slope, one of the first intercept and the second intercept can be selected for the first slope to form the first equation, and the other of the first intercept and the second intercept can be selected for the second slope to form the second equation. Specifically, in response to the magnitude relationship indicating that the first ray is steeper than the second ray, the first intercept is selected for the first slope to form the first equation, and the second intercept is selected for the second slope to form the second equation. While for the case where the slope selects the second intercept to form the first equation, and the second slope selects the first intercept to form the second equation. It should be noted that the equation can be obtained by substituting the slope into the intercept and further combining with the slope after substitution. For example, when the magnitude relationship indicates that the first ray is steeper than the second ray, the first slope can be substituted into the expression of the first intercept and combined with the first slope to form the first equation, and the second slope can be substituted into the expression of the second intercept and combined with the second slope to form the second equation; or, when the magnitude relationship indicates that the second ray is steeper than the first ray, the first slope can be substituted into the expression of the second intercept and combined with the first slope to form the first equation, and the second slope can be substituted into the expression of the first intercept and combined with the second slope to form the second equation. For ease of understanding, please continue to refer to Figure 2c , in Figure 2c the example shown, since the magnitude relationship between the first slope k 1 and the second slope k 2 indicates that the first ray is steeper than the second ray, then the first slope k 1Substitute into the first intercept m 1 :
[0058] And combine with the first slope k 1 To form the first equation of the first ray: y = k 1 *x + m 1 Similarly, the first slope k 2 Can be substituted into the first intercept m 2 :
[0059] And combine with the second slope k 2 To form the second equation of the second ray: y = k 2 *x + m 2 So far, combining the relevant expressions of the major axis a and the minor axis b (specifically, refer to the foregoing relevant descriptions), both the first equation and the second equation can be characterized as equations with the physical radius r as the variable.
[0060] It should be noted that the above examples are only two possible examples for constructing the first equation and the second equation. Appropriate adjustments can also be made based on the above two examples to obtain other possible implementation manners, and the first equation and the second equation can also be constructed. Other possible implementation manners are not limited herein, and no further examples will be given one by one.
[0061] Step S15: Solve for the physical radius based on the first equation, the second equation, and the physical distance.
[0062] Specifically, based on the first equation and the straight-line equation of the security inspection channel in the target coordinate system, the first abscissa of the first intersection point in the target coordinate system can be obtained, and based on the second equation and the equation of the security inspection channel in the target coordinate system, the second abscissa of the second intersection point in the target coordinate system can be obtained, and both the first abscissa and the second abscissa are variables with the physical radius. On this basis, the physical radius can be solved based on the first function constructed from the first abscissa, the second abscissa, and the physical distance. For example, the difference between the first abscissa and the second abscissa can be obtained as the target expression representing the physical distance, and based on the target expression and the physical distance, the first function can be constructed, and then the physical radius can be solved based on the first function. For the sake of understanding, the following will respectively give examples in the above two ways of obtaining the tangent equation: As a possible implementation example, after obtaining the tangent equation in the foregoing first way, for the first equation of the first ray:
[0063] It can be solved jointly with the straight-line equation y = -b of the security inspection channel in the target coordinate system to obtain the first abscissa of the first intersection point B in the target coordinate system:
[0064] Similarly, for the second equation of the second light ray:
[0065] It can be solved jointly with the straight-line equation y = -b of the security inspection channel in the target coordinate system to obtain the second abscissa of the second intersection point C in the target coordinate system:
[0066] On this basis, the difference between the first abscissa and the second abscissa can be obtained as the target expression representing the physical distance:
[0067] And combine it with the previously obtained physical distance BC = (V c -V b )*λ to construct the first function:
[0068] Since in the above first function, a, b, x’ B , x’ C , y’ B , y’ C are essentially all expressions with the physical radius r as a variable, so by solving the above first function, the physical radius r can be obtained, and the solution process will not be derived in detail here.
[0069] As another possible implementation example, after obtaining the tangent equation in the aforementioned second method, for the first equation of the first light ray: y = k 1 *x + m 1 It can be solved jointly with the straight-line equation y = -b of the security inspection channel in the target coordinate system to obtain the first abscissa of the first intersection point B in the target coordinate system:
[0070] Similarly, for the second equation of the second light ray: y = k 2 *x + m 2 It can be solved jointly with the straight-line equation y = -b of the security inspection channel in the target coordinate system to obtain the second abscissa of the second intersection point C in the target coordinate system:
[0071] On this basis, the difference between the first horizontal coordinate and the second horizontal coordinate can be obtained as the target expression to characterize the physical distance:
[0072] And compare it with the physical distance BC=(V c -V b )*λ jointly construct the first function:
[0073] Since in the first function above, b, m 1 、m 2 In essence, they are all expressions with the physical radius r as a variable. Therefore, by solving the first function above, the physical radius r can be obtained. The solution process will not be deduced in detail here.
[0074] In an implementation scenario, after obtaining the physical radius, the actual thickness of the third light passing through the object to be measured can also be detected by imaging the pixel point on the object to be measured. Specifically, the light source coordinates in the target coordinate system can be obtained based on the first equation, the second equation and the physical radius in response to the point to be measured on the object to be measured in the first scanned image, and the third slope of the third light can be obtained based on the pixel coordinates, imaging coordinates, scaling factor and vertical distance of the point to be measured. It should be noted that the pixel coordinates of the point to be measured are formed by imaging the third light, and the point to be measured is located on the line between the relative endpoints. Of course, in this example, the "relative endpoint" is not limited to the relative endpoint determined when calculating the physical radius, as long as it satisfies the constraint condition of being in the vertical direction of the travel direction and located at the edge of the object to be measured. In addition, when the object to be measured is of irregular shape, the "relative endpoint" can better further satisfy the constraint condition of being located on a regular area occupying a relatively larger area on the object to be measured (the specific meaning can be referred to the above-mentioned related description, which will not be repeated here). On this basis, the actual thickness of the object to be measured through the third light can be obtained based on the final equation of the third light obtained from the light source coordinates and the third slope and the final equation of the target ellipse obtained from the physical radius.
[0075] In a specific implementation scenario, as mentioned above, the first equation and the second equation are essentially expressions with the physical radius as the variable (with x as the independent variable and y as the dependent variable). Therefore, after solving the physical radius, they can be substituted into the first equation and the second equation respectively to obtain the linear equation of the first light ray and the linear equation of the second light ray. The two can be connected to obtain the coordinates of the light source in the target coordinate system.
[0076] In a specific implementation scenario, for the point to be measured, the scaling factor can be used to scale the coordinate difference between the pixel coordinates of the point to be measured and the imaging coordinates to obtain the actual distance between the third intersection of the third light ray between the security inspection channels and the intersection of the outgoing light ray on the security inspection channel. Then, based on the ratio of the vertical distance to the actual distance, the third slope of the third light ray in the target coordinate system can be obtained. For ease of understanding, please continue to refer to Figure 2c , the pixel coordinates of the point to be measured are V d , the third light ray is OD, point D is the third intersection point, and the intersection point between the outgoing light ray OP and the security inspection channel is P, so the actual distance DP between the two can be expressed as: DP=(V d -V p )*λ On this basis, the third slope k of the third light OD in the target coordinate system can be obtained: 3 : k 3 =-OP / DP=-OP / {(V d -V p )*λ} In a specific implementation scenario, after obtaining the third slope and the light source coordinates, the final equation of the third light ray in the target coordinate system can be determined. Since the ellipse equation of the target ellipse is essentially an equation with the physical radius as a variable, after obtaining the physical radius, the physical radius is substituted into the ellipse equation to obtain the final equation of the target ellipse in the target coordinate system. On this basis, the final equation of the third light ray and the final equation of the target ellipse can be solved together to obtain the coordinates of the two intersection points of the third light ray in the target ellipse. Based on this, the actual distance between the two intersection points can be obtained, which is the actual thickness of the object to be measured when the third light ray passes through it. Please continue to refer to Figure 2c After obtaining the final equation of the third ray OD in the target coordinate system and the final equation of the target ellipse in the target coordinate system, the two intersection points D' and D' can be obtained by combining the two. 1 The actual thickness D'D' of the object to be measured can be calculated based on the intersection coordinates. 1 Of course, the above examples are only examples of Figure 2c The example shown is only one possible scenario of actual thickness, and other possible scenarios will not be given one by one here.
[0077] Based on the above solution, the first scanned image of the object to be measured on the security inspection channel by the security inspection machine is detected to obtain a detection result, and device parameters including at least the zoom factor during the imaging of the security inspection machine are obtained. The detection result includes: the target angle between the object to be measured and the traveling direction of the security inspection channel, and the coordinate difference between the relative endpoints of the object edge of the object to be measured in the vertical direction of the traveling direction. Then, based on the zoom factor and the coordinate difference, 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. The first light ray and the second light ray are respectively tangent to the object to be measured and form relative endpoints through imaging. The cross-section of the plane where the first light ray and the second light ray are located on the object to be measured is used as the target ellipse. Thus, with the center of the target ellipse as the origin, the direction of the major axis of the target ellipse as the coordinate horizontal axis, and the direction of the minor axis of the target ellipse as the coordinate vertical axis, a target coordinate system is established. The major axis is obtained based on the target angle and the physical radius of the object to be measured, and the minor axis is the physical radius. Furthermore, based on the target coordinate system, the first equation of the first light ray and the second equation of the second light ray are constructed, and the first equation and the second equation use the physical radius as a variable. Based on the first equation, the second equation, and the physical distance, the physical radius is solved. Therefore, on the one hand, since relevant detections are performed based on the first scanned image and relevant calculations are combined with device parameters, the physical radius of the object to be measured can be obtained without manual operations by relevant personnel on the first scanned image, which can improve the convenience of the measurement process. On the other hand, when the object to be measured is inclined to the traveling direction of the security inspection channel, the cross-section of the plane where the light source rays tangent to the object to be measured are located on the object to be measured is used as the target ellipse, and based on this, a target coordinate system is established. The major axis of the target ellipse is obtained from the target angle between the object to be measured and the traveling direction and the physical radius, and the minor axis of the target ellipse is the physical radius. Then, according to the established target coordinate system, the equations of the aforementioned tangent light rays with the physical radius as a variable can be constructed, and combined with the physical distance between the intersection points of the aforementioned tangent light rays on the security inspection channel, the physical radius can be solved. Therefore, it can be solved through a series of operations such as mathematical modeling and equation solving, which helps to improve the accuracy of the measurement process. Therefore, the physical radius of the object to be measured can be automatically and accurately measured during the security inspection process.
[0078] 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, a distance measurement module 32, a coordinate establishment module 33, an equation construction module 34, and a radius solution module 35. The measurement preparation module 31 is configured to detect a first scanned image of a to-be-measured object on a security inspection passage by a security inspection machine, obtain a detection result, and acquire device parameters including at least a scaling factor when the security inspection machine forms an image; wherein, the detection result includes: a target angle between the to-be-measured object and the traveling direction of the security inspection passage, and a coordinate difference between opposite endpoints of the object edge of the to-be-measured object in the direction perpendicular to the traveling direction; the distance measurement module 32 is configured to obtain a physical distance between a first intersection point of a first light ray on the security inspection passage and a second intersection point of a second light ray on the security inspection passage based on the scaling factor and the coordinate difference; wherein, the first light ray and the second light ray are respectively tangent to the to-be-measured object and respectively form images of opposite endpoints, and a cross-section of the plane where the first light ray and the second light ray are located on the to-be-measured object is used as a target ellipse; the coordinate establishment module 33 is configured to establish a target coordinate system with the center of the target ellipse as the origin, the direction of the major axis of the target ellipse as the coordinate horizontal axis, and the direction of the minor axis of the target ellipse as the coordinate vertical axis; wherein, the major axis is obtained based on the target angle and the physical radius of the to-be-measured object, and the minor axis is the physical radius; the equation construction module 34 is configured to construct a first equation of the first light ray and a second equation of the second light ray based on the target coordinate system; wherein, the first equation and the second equation take the physical radius as a variable; the radius solution module 35 is configured to solve the physical radius based on the first equation, the second equation, and the physical distance.
[0079] In the above solution, the object size measurement device 30 detects a first scanned image of an object to be measured on the security inspection channel by the security inspection machine, obtains a detection result, and acquires device parameters including at least the scaling factor when the security inspection machine forms an image. The detection result includes: a target angle between the object to be measured and the traveling direction of the security inspection channel, and a coordinate difference between opposite endpoints of the object edge of the object to be measured in the vertical direction of the traveling direction. Then, based on the scaling factor and the coordinate difference, 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 is obtained. The first light ray and the second light ray are respectively tangent to the object to be measured and respectively form opposite endpoints when imaging. The cross-section of the plane where the first light ray and the second light ray are located on the object to be measured is used as a target ellipse. Thus, with the center of the target ellipse as the origin, the direction of the major axis of the target ellipse as the coordinate horizontal axis, and the direction of the minor axis of the target ellipse as the coordinate vertical axis, a target coordinate system is established. The major axis is obtained based on the target angle and the physical radius of the object to be measured, and the minor axis is the physical radius. Furthermore, based on the target coordinate system, a first equation of the first light ray and a second equation of the second light ray are constructed. The first equation and the second equation take the physical radius as a variable. Based on the first equation, the second equation, and the physical distance, the physical radius is solved. Therefore, on the one hand, since relevant detections are performed based on the first scanned image and relevant calculations are combined with device parameters, the physical radius of the object to be measured can be obtained without manual operation by relevant personnel on the first scanned image, which can improve the convenience of the measurement process. On the other hand, when the object to be measured is inclined to the traveling direction of the security inspection channel, by using the cross-section of the plane where the light source rays tangent to the object to be measured are located on the object to be measured as the target ellipse, and accordingly establishing a target coordinate system, and the major axis of the target ellipse is obtained from the target angle between the object to be measured and the traveling direction and the physical radius, while the minor axis of the target ellipse is the physical radius. The equations of the aforementioned tangent rays with the physical radius as a variable can be constructed according to the established target coordinate system, and combined with the physical distance between the intersection points of the aforementioned tangent rays on the security inspection channel, the physical radius is solved. Therefore, it can be solved through a series of operations such as mathematical modeling and equation solving, which helps to improve the accuracy of the measurement process. Thus, the physical radius of the object to be measured can be automatically and accurately measured during the security inspection process.
[0080] In some disclosed embodiments, the radius solving module 35 includes an intersection coordinate solving sub-module for obtaining a first abscissa of the first intersection point in the target coordinate system based on the first equation and the straight line equation of the security inspection channel in the target coordinate system, and obtaining a second abscissa of the second intersection point in the target coordinate system based on the second equation and the equation of the security inspection channel in the target coordinate system; wherein, the first abscissa and the second abscissa take the physical radius as a variable; the radius solving module 35 includes a first function solving sub-module for solving based on a first function constructed from the first abscissa, the second abscissa, and the physical distance to obtain the physical radius.
[0081] In some disclosed embodiments, the first function solving sub-module includes a distance expression obtaining unit configured to obtain the difference between the first abscissa and the second abscissa as a target expression characterizing the physical distance; the first function solving sub-module includes a first function constructing unit configured to construct a first function based on the target expression and the physical distance; the first function solving sub-module includes a physical radius solving unit configured to solve based on the first function to obtain the physical radius.
[0082] In some disclosed embodiments, the device parameters further include the vertical distance from the light source to the security inspection channel and the imaging coordinates of the light emitted from the light source perpendicular to the security inspection channel. Based on the target coordinate system, the equation construction module 34 includes a light source coordinate expression sub-module configured to obtain a coordinate expression of the light source coordinates on the target coordinate system based on the imaging coordinates, the vertical distance, the endpoint coordinates, and the scaling factor; wherein the coordinate expression takes the physical radius as a variable; the equation construction module 34 includes a tangent constraint obtaining sub-module configured to obtain a first constraint equation satisfied by the ellipse tangent passing through the light source coordinates based on the ellipse equation and the coordinate expression of the light source coordinates; wherein the first constraint equation takes the light source coordinates as variables; the equation construction module 34 includes a tangent point coordinate expression sub-module configured to obtain a first expression of the tangent point coordinates of the first light ray on the target ellipse and a second expression of the tangent point coordinates of the second light ray on the target ellipse based on the ellipse equation and the first constraint equation; wherein both the first expression and the second expression contain the light source coordinates; the equation construction module 34 includes a light ray equation construction sub-module configured to obtain a first equation based on the first expression and a second constraint equation of the tangent on the target ellipse, and obtain a second equation based on the second expression and the second constraint equation of the tangent on the target ellipse.
[0083] In some disclosed embodiments, the light source coordinate expression sub-module includes an actual distance obtaining unit configured to scale the coordinate difference between the endpoint coordinates and the imaging coordinates based on the scaling factor to obtain the actual distance between the intersection points of the light source ray and the emitted ray on the security inspection channel respectively; wherein the endpoint coordinates are formed by the imaging of the light source ray; the light source coordinate expression sub-module includes a light source abscissa expression unit configured to obtain an abscissa expression taking the physical radius as a variable in the coordinate expression based on the actual distance and the vertical distance; the light source coordinate expression sub-module includes a light source ordinate expression unit configured to obtain an ordinate expression taking the physical radius as a variable in the coordinate expression based on the vertical distance.
[0084] In some disclosed embodiments, the tangent point coordinate expression sub-module includes a tangent point abscissa expression unit, which is configured to solve for the abscissa expression of the tangent point coordinates of the first light ray and the second light ray on the target ellipse based on the ordinate equation of the tangent point coordinates and the coordinate expression of the light source coordinates; the tangent point coordinate expression sub-module includes a tangent point ordinate expression unit, which is configured to substitute the abscissa expression of the tangent point coordinates of the first light ray on the target ellipse into the ordinate equation to obtain the ordinate expression of the tangent point coordinates of the first light ray on the target ellipse, and substitute the abscissa expression of the tangent point coordinates of the second light ray on the target ellipse into the ordinate equation to obtain the ordinate expression of the tangent point coordinates of the second light ray on the target ellipse; wherein, the first expression includes the abscissa expression and the ordinate expression of the tangent point coordinates of the first light ray on the target ellipse, and the second expression includes the abscissa expression and the ordinate expression of the tangent point coordinates of the second light ray on the target ellipse.
[0085] In some disclosed embodiments, the light ray equation construction sub-module includes a first construction unit, which is configured to substitute the first expression into the second constraint equation to obtain a first equation; the light ray equation construction sub-module includes a second construction unit, which is configured to substitute the second expression into the second constraint equation to obtain a second equation.
[0086] In some disclosed embodiments, the device parameters further include the vertical distance from the light source to the security inspection channel and the imaging coordinates of the light ray emitted perpendicularly to the security inspection channel by the light source, and the relative endpoints include a first endpoint and a second endpoint. The equation construction module 34 includes a slope solving sub-module, which is configured to obtain the first slope of the first light ray in the target coordinate system based on the pixel coordinates, imaging coordinates, scaling factor, and vertical distance of the first endpoint, and obtain the second slope of the second light ray in the target coordinate system based on the pixel coordinates, imaging coordinates, scaling factor, and vertical distance of the second endpoint; wherein, the pixel coordinates of the first endpoint are formed by the imaging of the first light ray, and the pixel coordinates of the second endpoint are formed by the imaging of the second light ray; the equation construction module 34 includes an intercept solving sub-module, which is configured to analyze based on the ellipse equation of the target ellipse in the target coordinate system to obtain the first intercept and the second intercept of the tangent equation of the target ellipse at the target slope; wherein, the first intercept is a positive number, the second intercept is a negative number, and both the first intercept and the second intercept are expressions represented by the target slope and the physical radius as variables; the equation construction module 34 includes a parameter selection sub-module, which is configured to select one of the first intercept and the second intercept for the first slope to form a first equation based on the magnitude relationship between the first slope and the second slope, and select the other of the first intercept and the second intercept for the second slope to form a second equation.
[0087] In some disclosed embodiments, the slope solving sub-module includes a first scaling unit configured to scale the coordinate difference between the pixel coordinates and the imaging coordinates of the first endpoint based on a scaling coefficient to obtain a first distance between the intersection point between the outgoing light ray and the security inspection channel and the first intersection point; the slope solving sub-module includes a first slope unit configured to obtain a first slope based on the ratio of the vertical distance to the first distance; the slope solving sub-module includes a second scaling unit configured to scale the coordinate difference between the pixel coordinates and the imaging coordinates of the second endpoint based on the scaling coefficient to obtain a second distance between the intersection point between the outgoing light ray and the security inspection channel and the second intersection point; the slope solving sub-module includes a second slope unit configured to obtain a second slope based on the ratio of the vertical distance to the second distance.
[0088] In some disclosed embodiments, the parameter selection sub-module includes a first response unit configured to, in response to the size relationship indicating that the first light ray is steeper than the second light ray, select a first intercept for the first slope to form a first equation and select a second intercept for the second slope to form a second equation; the parameter selection sub-module includes a second response unit configured to, in response to the size relationship indicating that the second light ray is steeper than the first light ray, select a second intercept for the first slope to form a first equation and select a first intercept for the second slope to form a second equation.
[0089] In some disclosed embodiments, the first response unit is specifically configured to substitute the first slope into the expression of the first intercept and form a first equation with the first slope; substitute the second slope into the expression of the second intercept and form a second equation with the second slope.
[0090] In some disclosed embodiments, the second response unit is specifically configured to substitute the first slope into the expression of the second intercept and form a first equation with the first slope; substitute the second slope into the expression of the first intercept and form a second equation with the second slope.
[0091] In some disclosed embodiments, the device parameters further include the vertical distance from the light source to the security inspection channel and the imaging coordinates of the outgoing light ray perpendicular to the security inspection channel of the light source. The object size measuring device 30 includes a light ray slope calculation module configured to, in response to a point to be measured on the object to be measured in the first scanned image, obtain the light source coordinates in the target coordinate system based on the first equation, the second equation, and the physical radius, and obtain the third slope of the third light ray based on the pixel coordinates, the imaging coordinates, the scaling coefficient, and the vertical distance of the point to be measured; wherein, the pixel coordinates of the point to be measured are formed by the imaging of the third light ray, and the point to be measured is located on the connection line between the relative endpoints; the object size measuring device 30 includes an actual thickness measurement module configured to obtain the actual thickness of the third light ray passing through the object to be measured based on the final equation of the third light ray obtained from the light source coordinates and the third slope and the final equation of the target ellipse obtained from the physical radius.
[0092] In some disclosed embodiments, the device parameters are pre - calibrated based on 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.
[0093] In some disclosed embodiments, the object size measurement device 30 includes a boundary detection module for detecting the first pixel coordinates of the upper boundary points of the object to be measured in the first scanned image. The object size measurement device 30 includes a sequence detection module for 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. The object size measurement device 30 includes a scale search module for searching 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 object size measurement device 30 includes a scaling determination module for obtaining the scaling coefficient when the security inspection machine images at the object to be measured based on the first scale index, the physical distance between adjacent scale lines on the calibration ruler, and the pixel distance between the boundary points.
[0094] In some disclosed embodiments, the object size measurement device 30 includes a coordinate difference module for obtaining the difference between the first pixel coordinates and the second pixel coordinates of the first scale index as the first difference, and obtaining the difference between the second pixel coordinates of the reference scale index and the second pixel coordinates of the first scale index as the second difference; wherein, the reference scale index is the next scale index of the first scale index. The object size measurement device 30 includes an additional index module for obtaining the ratio of the first difference to the second difference as the additional scale index of the first scale index. The scaling determination module is specifically used for obtaining the scaling coefficient when the security inspection machine images at the object to be measured based on the first scale index, the additional scale index, the physical distance, and the pixel distance.
[0095] In some disclosed embodiments, the major axis is represented as the ratio of the minor axis to the cosine value of the target angle; and / or, the target angle is determined by detecting the axis of the object to be measured in the first scanned image.
[0096] Please refer to Figure 4 , Figure 4 is a schematic framework diagram of an embodiment of the electronic device of the present application. The electronic device 40 at least includes a memory 41 and a processor 42 which are coupled to each other. At least program instructions are stored in the memory 41, and the processor 42 is used to execute the program instructions to implement the steps in any of the above - mentioned object size measurement method embodiments. Specifically, reference can be made to the foregoing disclosed embodiments, which will not be elaborated herein.
[0097] Specifically, the processor 42 is used to control itself and the memory 41 to implement the steps in any of the above-described 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.
[0098] In the above solution, the electronic device 40 detects a first scanned image of an object to be measured on the security inspection channel by the security inspection machine, obtains a detection result, and acquires device parameters including at least the zoom factor when the security inspection machine forms an image. The detection result includes: a target angle between the object to be measured and the traveling direction of the security inspection channel, and a coordinate difference between opposite endpoints of the object edge of the object to be measured in the direction perpendicular to the traveling direction. Then, based on the zoom factor and the coordinate difference, 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 is obtained. The first light ray and the second light ray are respectively tangent to the object to be measured and form opposite endpoints through imaging. The cross-section of the plane where the first light ray and the second light ray are located on the object to be measured is used as a target ellipse. Thus, with the center of the target ellipse as the origin, the direction of the major axis of the target ellipse as the horizontal coordinate axis, and the direction of the minor axis of the target ellipse as the vertical coordinate axis, a target coordinate system is established. The major axis is obtained based on the target angle and the physical radius of the object to be measured, and the minor axis is the physical radius. Furthermore, based on the target coordinate system, a first equation of the first light ray and a second equation of the second light ray are constructed. The first equation and the second equation use the physical radius as a variable. Based on the first equation, the second equation, and the physical distance, the physical radius is solved. Therefore, on the one hand, since relevant detections are performed based on the first scanned image and relevant calculations are combined with device parameters, the physical radius of the object to be measured can be obtained without manual operation by relevant personnel on the first scanned image, which can improve the convenience of the measurement process. On the other hand, when the object to be measured is inclined to the traveling direction of the security inspection channel, the cross-section of the plane where the light source rays tangent to the object to be measured are located on the object to be measured is used as the target ellipse, and based on this, a target coordinate system is established. The major axis of the target ellipse is obtained from the target angle between the object to be measured and the traveling direction and the physical radius, and the minor axis of the target ellipse is the physical radius. Thus, according to the established target coordinate system, equations of the aforementioned tangent light rays with the physical radius as a variable can be constructed, and by combining the physical distance between the intersection points of the aforementioned tangent light rays on the security inspection channel, the physical radius can be solved. Therefore, it can be solved through a series of operations such as mathematical modeling and equation solving, which helps to improve the accuracy of the measurement process. Therefore, the physical radius of the object to be measured can be automatically and accurately measured during the security inspection process.
[0099] Please refer to Figure 5 , Figure 5 FIG. 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 further include other component devices, such as a light source (not shown), a security inspection channel such as a belt (not shown), an outer frame (not shown), a detector (not shown), etc. The specific structure of the security inspection machine 50 can refer to the technical details related thereto in the art, and the specific structure of the security inspection machine will not be elaborated herein.
[0100] In the above solution, the electronic device 40 in the security inspection machine 50 detects a first scanned image of an object to be measured on the security inspection channel of the security inspection machine 50 to obtain a detection result, and obtains device parameters including at least the zoom factor when the security inspection machine 50 forms an image. The detection result includes: the target angle between the object to be measured and the traveling direction of the security inspection channel, and the coordinate difference between the relative endpoints of the object edge of the object to be measured in the vertical direction of the traveling direction. Then, based on the zoom factor and the coordinate difference, 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. The first light ray and the second light ray are respectively tangent to the object to be measured and respectively form images of the relative endpoints. The cross-section of the plane where the first light ray and the second light ray are located on the object to be measured is used as the target ellipse. Thus, with the center of the target ellipse as the origin, the direction of the major axis of the target ellipse as the coordinate horizontal axis, and the direction of the minor axis of the target ellipse as the coordinate vertical axis, a target coordinate system is established. The major axis is obtained based on the target angle and the physical radius of the object to be measured, and the minor axis is the physical radius. Furthermore, based on the target coordinate system, the first equation of the first light ray and the second equation of the second light ray are constructed. The first equation and the second equation take the physical radius as a variable. Based on the first equation, the second equation, and the physical distance, the physical radius is solved. Therefore, on the one hand, since relevant detections are performed based on the first scanned image and relevant calculations are combined with device parameters, the physical radius of the object to be measured can be obtained without manual operations by relevant personnel on the first scanned image, which can improve the convenience of the measurement process. On the other hand, when the object to be measured is inclined to the traveling direction of the security inspection channel, the cross-section of the plane where the light source rays tangent to the object to be measured are located on the object to be measured is used as the target ellipse, and a target coordinate system is established accordingly. The major axis of the target ellipse is obtained from the target angle between the object to be measured and the traveling direction and the physical radius, and the minor axis of the target ellipse is the physical radius. Then, based on the established target coordinate system, the equations of the aforementioned tangent rays with the physical radius as a variable can be constructed, and by combining the physical distance between the intersection points of the aforementioned tangent rays on the security inspection channel, the physical radius can be solved. Therefore, it is possible to perform a series of operations such as mathematical modeling and equation solving to obtain the solution, which helps to improve the accuracy of the measurement process. Therefore, it is possible to automatically and accurately measure the physical radius of the object to be measured during the security inspection process.
[0101] Please refer to Figure 6 , Figure 6 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. The program instructions 61 are used to implement the steps in any of the embodiments of the above object size measurement method.
[0102] In the above solution, the computer-readable storage medium 60 detects a first scanned image of an object to be measured on a security inspection channel by a security inspection machine, obtains a detection result, and acquires device parameters including at least a scaling factor when the security inspection machine forms an image. The detection result includes: a target angle between the object to be measured and the traveling direction of the security inspection channel, and a coordinate difference between opposite endpoints of the object edge of the object to be measured in the direction perpendicular to the traveling direction. Then, based on the scaling factor and the coordinate difference, 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 is obtained. The first light ray and the second light ray are respectively tangent to the object to be measured and respectively form opposite endpoints when imaging. The cross-section of the plane where the first light ray and the second light ray are located on the object to be measured is used as a target ellipse. Thus, with the center of the target ellipse as the origin, the direction of the major axis of the target ellipse as the coordinate horizontal axis, and the direction of the minor axis of the target ellipse as the coordinate vertical axis, a target coordinate system is established. The major axis is obtained based on the target angle and the physical radius of the object to be measured, and the minor axis is the physical radius. Furthermore, based on the target coordinate system, a first equation of the first light ray and a second equation of the second light ray are constructed. The first equation and the second equation take the physical radius as a variable. Based on the first equation, the second equation, and the physical distance, the physical radius is solved. Therefore, on the one hand, since relevant detections are performed based on the first scanned image and relevant calculations are combined with device parameters, the physical radius of the object to be measured can be obtained without manual operation by relevant personnel on the first scanned image, which can improve the convenience of the measurement process. On the other hand, when the object to be measured is inclined to the traveling direction of the security inspection channel, by using the cross-section of the plane where the light source rays tangent to the object to be measured are located on the object to be measured as the target ellipse, and accordingly establishing the target coordinate system, and the major axis of the target ellipse is obtained from the target angle between the object to be measured and the traveling direction and the physical radius, while the minor axis of the target ellipse is the physical radius. Then, based on the established target coordinate system, the equations of the aforementioned tangent rays with the physical radius as a variable can be constructed, and combined with the physical distance between the intersection points of the aforementioned tangent rays on the security inspection channel, the physical radius is solved. Therefore, it can be solved through a series of operations such as mathematical modeling and equation solving, which helps to improve the accuracy of the measurement process. Thus, the physical radius of the object to be measured can be automatically and accurately measured during the security inspection process.
[0103] 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.
[0104] The descriptions of the above embodiments tend to emphasize the differences between the embodiments. Their similarities or similarities can be referred to each other. For the sake of brevity, they will not be repeated in this article.
[0105] In several embodiments provided by 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 couplings or direct couplings or communication connections between each other can be through some interfaces. The indirect couplings or communication connections of the apparatuses or units can be in electrical, mechanical or other forms.
[0106] 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.
[0107] In addition, in each embodiment of the present application, the functional units 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 units can be implemented in the form of hardware or in the form of software functional units.
[0108] 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 the 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 each embodiment of the present application. And the aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks or optical discs and other various media that can store program codes.
[0109] 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: include: Based on the security inspection machine, a first scanned image of the object to be detected on the security inspection channel is detected to obtain a detection result, and a device parameter including at least a scaling factor of the security inspection machine during imaging is obtained; wherein the detection result includes: a target angle between the object to be detected and the traveling direction of the security inspection channel, and a coordinate difference between relative end points of the object edge of the object to be detected in a direction perpendicular to the traveling direction; Based on the scaling factor and the coordinate difference, a physical distance between a first intersection point of the first light ray on the security inspection channel and a second intersection point of the second light ray on the security inspection channel is obtained; wherein the first light ray and the second light ray are respectively tangent to the object to be measured and are imaged to form the relative endpoints, and the plane where the first light ray and the second light ray are located is used as a target ellipse on the cross section of the object to be measured; A target coordinate system is established with the center of the target ellipse as the origin, the direction of the major axis of the target ellipse as the horizontal axis of the coordinate, and the direction of the minor axis of the target ellipse as the vertical axis of the coordinate; wherein the major axis is obtained based on the target angle and the physical radius of the object to be measured, and the minor axis is the physical radius; Based on the target coordinate system, construct a first equation for the first light and a second equation for the second light; wherein the first equation and the second equation use the physical radius as a variable; The physical radius is solved based on the first equation, the second equation and the physical distance.
2. The method according to claim 1, characterized in that The solving the physical radius based on the first equation, the second equation and the physical distance includes: Based on the first equation and the straight line equation of the security inspection channel in the target coordinate system, a first horizontal coordinate of the first intersection point in the target coordinate system is obtained, and based on the second equation and the equation of the security inspection channel in the target coordinate system, a second horizontal coordinate of the second intersection point in the target coordinate system is obtained; wherein the first horizontal coordinate and the second horizontal coordinate use the physical radius as a variable; The physical radius is obtained by solving a first function constructed based on the first horizontal coordinate, the second horizontal coordinate and the physical distance.
3. The method according to claim 2, characterized in that The step of solving a target equation constructed based on the first horizontal coordinate, the second horizontal coordinate, and the physical distance to obtain the physical radius includes: Obtaining a difference between the first horizontal coordinate and the second horizontal coordinate as a target expression representing the physical distance; constructing the first function based on the target expression and the physical distance; The physical radius is obtained by solving the first function.
4. The method according to claim 1, characterized in that The equipment parameters also include a vertical distance from the light source to the security inspection channel and an imaging coordinate of a light emitted by the light source perpendicular to the security inspection channel. The first equation of the first light and the second equation of the second light based on the target coordinate system are constructed, including: Based on the imaging coordinates, the vertical distance, the endpoint coordinates and the scaling factor, a coordinate expression of the light source coordinates on the target coordinate system is obtained; wherein the coordinate expression uses the physical radius as a variable; Based on the ellipse equation and the coordinate expression of the light source coordinates, a first constraint equation satisfied by the ellipse tangent passing through the light source coordinates is obtained; wherein the first constraint equation uses the light source coordinates as a variable; Based on the ellipse equation and the first constraint equation, a first expression for the coordinates of the tangent point of the first light ray on the target ellipse and a second expression for the coordinates of the tangent point of the second light ray on the target ellipse are obtained; wherein both the first expression and the second expression contain the light source coordinates; The first equation is obtained based on the first expression and the second constraint equation of the tangent line on the target ellipse, and the second equation is obtained based on the second expression and the second constraint equation of the tangent line on the target ellipse.
5. The method according to claim 4, characterized in that The step of obtaining a coordinate expression of the light source coordinates on the target coordinate system based on the imaging coordinates, the vertical distance, the endpoint coordinates and the scaling factor includes: The coordinate difference between the endpoint coordinates and the imaging coordinates is scaled based on the scaling factor to obtain the actual distance between the intersection points of the light source light and the outgoing light on the security inspection channel; wherein the endpoint coordinates are formed by imaging the light source light; Based on the actual distance and the vertical distance, the horizontal coordinate expression with the physical radius as a variable in the coordinate expression is obtained, and based on the vertical distance, the vertical coordinate expression with the physical radius as a variable in the coordinate expression is obtained.
6. The method according to claim 4, characterized in that The obtaining, based on the ellipse equation and the first constraint equation, a first expression for the coordinates of the tangent point of the first light ray on the target ellipse and a second expression for the coordinates of the tangent point of the second light ray on the target ellipse comprises: Based on the ellipse equation and the first constraint equation, a ordinate equation of the tangent point coordinates is obtained; wherein the ordinate equation contains the light source coordinates and takes the physical radius and the abscissa of the tangent point coordinates as variables; Based on the ordinate equation of the tangent point coordinates and the coordinate expression of the light source coordinates, solving to obtain the abscissa expression of the tangent point coordinates of the first light ray and the second light ray on the target ellipse; Substituting the abscissa expression of the coordinates of the tangent point of the first light on the target ellipse into the ordinate equation to obtain the ordinate expression of the coordinates of the tangent point of the first light on the target ellipse, and substituting the abscissa expression of the coordinates of the tangent point of the second light on the target ellipse into the ordinate equation to obtain the ordinate expression of the coordinates of the tangent point of the second light on the target ellipse; The first expression includes the abscissa expression and the ordinate expression of the coordinates of the tangent point of the first light ray on the target ellipse, and the second expression includes the abscissa expression and the ordinate expression of the coordinates of the tangent point of the second light ray on the target ellipse.
7. The method according to claim 4, characterized in that The first equation is obtained based on the first expression and the second constraint equation of the tangent line on the target ellipse, comprising: Substituting the first expression into the second constraint equation to obtain the first equation; And / or, the second equation is obtained based on the second expression and the second constraint equation of the tangent line on the target ellipse, comprising: Substituting the second expression into the second constraint equation, the second equation is obtained.
8. The method according to claim 1, characterized in that The equipment parameters also include a vertical distance from the light source to the security inspection channel and an imaging coordinate of a light emitted by the light source perpendicular to the security inspection channel, and the relative endpoints include a first endpoint and a second endpoint. The first equation of the first light and the second equation of the second light are constructed based on the target coordinate system, including: Based on the pixel coordinates of the first endpoint, the imaging coordinates, the scaling factor and the vertical distance, a first slope of the first light in the target coordinate system is obtained, and based on the pixel coordinates of the second endpoint, the imaging coordinates, the scaling factor and the vertical distance, a second slope of the second light in the target coordinate system is obtained; wherein the pixel coordinates of the first endpoint are formed by imaging the first light, and the pixel coordinates of the second endpoint are formed by imaging the second light; Based on the ellipse equation of the target ellipse in the target coordinate system, a first intercept and a second intercept of the tangent equation of the target ellipse at the target slope are obtained; wherein the first intercept is a positive number, the second intercept is a negative number, and the first intercept and the second intercept are both expressions represented by the target slope and the physical radius as variables; Based on the magnitude relationship between the first slope and the second slope, one of the first intercept and the second intercept is selected for the first slope to form the first equation, and the other of the first intercept and the second intercept is selected for the second slope to form the second equation.
9. The method according to claim 8, characterized in that The obtaining, based on the pixel coordinates of the first endpoint, the imaging coordinates, the scaling factor and the vertical distance, a first slope of the first light in the target coordinate system comprises: Scaling the coordinate difference between the pixel coordinates of the first endpoint and the imaging coordinates based on the scaling factor to obtain a first distance between the intersection point between the outgoing light and the security inspection channel and the first intersection point; Obtaining the first slope based on a ratio of the vertical distance to the first distance; And / or, obtaining a second slope of the second light in the target coordinate system based on the pixel coordinate of the second endpoint, the imaging coordinate, the scaling factor and the vertical distance includes: Scaling the coordinate difference between the pixel coordinates of the second endpoint and the imaging coordinates based on the scaling factor to obtain a second distance between the intersection point between the outgoing light and the security inspection channel and the second intersection point; The second slope is obtained based on the ratio of the vertical distance to the second distance.
10. The method according to claim 8, characterized in that The step of selecting one of the first intercept and the second intercept for the first slope to form the first equation based on the magnitude relationship between the first slope and the second slope, and selecting the other of the first intercept and the second intercept for the second slope to form the second equation comprises: In response to the magnitude relationship indicating that the first light is steeper than the second light, selecting the first intercept for the first slope to form the first equation, and selecting the second intercept for the second slope to form the second equation; In response to the magnitude relationship indicating that the second ray is steeper than the first ray, the second intercept is selected for the first slope to form the first equation, and the first intercept is selected for the second slope to form the second equation.
11. The method according to claim 10, characterized in that The step of selecting the first intercept for the first slope to form the first equation comprises: substituting the first slope into an expression of the first intercept, and forming the first equation with the first slope; the step of selecting the second intercept for the second slope to form the second equation comprises: substituting the second slope into an expression of the second intercept, and forming the second equation with the second slope; Alternatively, selecting the second intercept for the first slope to form the first equation includes: substituting the first slope into the representation of the second intercept, and forming the first equation with the first slope; selecting the first intercept for the second slope to form the second equation includes: substituting the second slope into the expression of the first intercept, and forming the second equation with the second slope.
12. The method according to claim 1, characterized in that The equipment parameters also include a vertical distance from the light source to the security inspection channel and an imaging coordinate of a light beam emitted by the light source perpendicular to the security inspection channel. After solving the physical radius based on the first equation, the second equation and the physical distance, the method further includes: In response to a point to be measured on the object to be measured in the first scanned image, based on the first equation, the second equation and the physical radius, the light source coordinates in the target coordinate system are obtained, and based on the pixel coordinates of the point to be measured, the imaging coordinates, the scaling factor and the vertical distance, a third slope of the third light is obtained; wherein the pixel coordinates of the point to be measured are formed by imaging the third light, and the point to be measured is located on the line between the opposite endpoints; Based on the final equation of the third light obtained from the light source coordinates and the third slope and the final equation of the target ellipse obtained from the physical radius, the actual thickness of the object to be measured through the third light is obtained.
13. The method according to claim 1, characterized in that The equipment parameters are obtained in advance based on the security inspection machine calibrating a second scan image of a calibration ruler placed on the security inspection channel, and the calibration ruler is perpendicular to the travel direction of the security inspection channel.
14. The method according to claim 13, characterized in that The scaling factor calibration step includes: Detecting the first pixel coordinates of the boundary points on 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; Searching for a scale line adjacent to the boundary point in the scale line sequence based on the first pixel coordinate and the second pixel coordinate to obtain a first scale index; Based on the first scale index, the physical spacing between adjacent scale lines on the calibration ruler and the pixel spacing between the boundary points, a scaling factor of the security inspection machine when imaging the object to be inspected is obtained.
15. The method according to claim 14, characterized in that After searching the scale line adjacent to the boundary point in the scale line sequence based on the first pixel coordinate and the second pixel coordinate to obtain a first scale index, and before obtaining a scaling factor of the security inspection machine when imaging the object to be tested based on the first scale index, the physical spacing between adjacent scale lines on the calibration ruler, and the pixel spacing between the boundary points, the method further includes: Obtaining a difference between the first pixel coordinate and the second pixel coordinate of the first scale index as a first difference value, and obtaining a difference between the second pixel coordinate of a reference scale index and the second pixel coordinate of the first scale index as a second difference value; wherein the reference scale index is a scale index subsequent to the first scale index; Obtaining a ratio of the first difference to the second difference as an additional scale index of the first scale index; The obtaining, based on the first scale index, the physical spacing between adjacent scale lines on the calibration ruler and the pixel spacing between the boundary points, a scaling factor when the security inspection machine is imaging at the object to be inspected includes: Based on the first scale index, the additional scale index, the physical spacing and the pixel spacing, a scaling factor of the security inspection machine when imaging the object to be inspected is obtained.
16. The method according to any one of claims 1 to 15, characterized in that The major axis is expressed as the ratio of the minor axis to the cosine of the target angle; And / or, the target angle is determined by detecting the axis of the object to be measured in the first scanning image.
17. An object size measuring device, characterized in that: include: A measurement preparation module, used to detect a first scanned image of an object to be detected on a security inspection channel based on a security inspection machine, obtain a detection result, and obtain device parameters including at least a scaling factor of the security inspection machine during imaging; wherein the detection result includes: a target angle between the object to be detected and the traveling direction of the security inspection channel, and a coordinate difference between relative end points of an object edge of the object to be detected in a direction perpendicular to the traveling direction; A distance measurement module, used for 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 based on the scaling factor and the coordinate difference; wherein the first light ray and the second light ray are respectively tangent to the object to be measured and are imaged to form the relative endpoints, and the plane where the first light ray and the second light ray are located is used as the target ellipse on the cross section of the object to be measured; A coordinate establishment module, used to establish a target coordinate system with the center of the target ellipse as the origin, the direction of the major axis of the target ellipse as the coordinate horizontal axis, and the direction of the minor axis of the target ellipse as the coordinate vertical axis; wherein the major axis is obtained based on the target angle and the physical radius of the object to be measured, and the minor axis is the physical radius; an equation construction module, configured to construct a first equation for the first light ray and a second equation for the second light ray based on the target coordinate system; wherein the first equation and the second equation use the physical radius as a variable; A radius solving module is used to solve the physical radius based on the first equation, the second equation and the physical distance.
18. An electronic device, characterized in that: The device at least comprises a memory and a processor coupled to each other, wherein the memory at least stores program instructions, and the processor is used to execute the program instructions to implement the object size measurement method according to any one of claims 1 to 16.
19. A security inspection machine, characterized in that: At least comprising the electronic device as claimed in claim 18.
20. A computer-readable storage medium, characterized in that: Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the object size measurement method according to any one of claims 1 to 16.
Citation Information
Patent Citations
Online detection method for size of moving steel pipe
CN118602978A
Revolving body size measurement method and system based on binocular vision
CN119879721A
Three-dimensional position input device
JP2006190212A
Object recognition device, object recognition method, and program
JP2022042103A