A parcel volume determination method and apparatus
By acquiring feature points from package images, identifying vertical planes, and correcting deviation angles in cuboid models, the problem of inaccurate determination of package size and volume in existing technologies is solved, enabling more accurate package volume calculation.
Patent Information
- Application Number
- CN202210275396.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-05-10
- Filing Date
- 2022-03-21
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2042-03-21
AI Technical Summary
In existing technologies, the cuboid model built by collecting feature points through AR does not fit the package, resulting in inaccurate determination of the package's size and volume.
By acquiring feature points from the package image, a cuboid model is established, and the vertical plane of the package is identified. The deviation angle between the vertical plane and the model is determined, and the model is rotated to correct the dimensions, thereby accurately determining the volume of the package.
It improves the accuracy of modeling, ensures accurate determination of package volume, and is applicable to the storage and transportation of packages in the express delivery and freight industries.
Smart Images

Figure CN115409767B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The embodiment of the present disclosure relates to a parcel volume determination method and device. BACKGROUND
[0002] At present, in the express and freight industry, goods are usually packaged as a parcel, and the size and volume of the parcel have a great influence on the storage and transportation of goods, so it is necessary to accurately obtain the volume of the parcel.
[0003] The existing implementation determines the size and volume of the parcel by establishing a three-dimensional bounding box, i.e., a cuboid model, through AR acquisition of feature points.
[0004] In the implementation of the present application, the inventor found that the existing established cuboid model does not fit the parcel, resulting in inaccurate determination of the size and volume of the parcel. SUMMARY
[0005] Therefore, the present application provides a parcel volume determination method and device, which can improve the accuracy of modeling and accurately determine the volume of the parcel.
[0006] To solve the above technical problems, the technical scheme of the present application is as follows:
[0007] In one embodiment, a parcel volume determination method is provided, which comprises:
[0008] Acquiring feature points in a parcel image; wherein the parcel image is an image obtained by photographing a horizontally placed parcel through a camera device;
[0009] Establishing a cuboid model of the parcel according to the acquired feature points, and identifying a vertical plane of the parcel;
[0010] If the vertical plane of the parcel is identified, the deviation angle between the identified vertical plane and the vertical plane of the established cuboid model is determined;
[0011] Rotating the cuboid model around the vertical coordinate axis in the horizontal direction by the deviation angle, and correcting the size of the rotated cuboid model according to the feature points acquired before rotation;
[0012] Determining the size of the parcel according to the currently established cuboid model, and calculating the volume of the parcel.
[0013] In another embodiment, a parcel volume determination device is provided, which comprises an acquisition unit, an establishment unit, an identification unit, a calculation unit, an adjustment unit and a determination unit.
[0014] The acquisition unit is configured to acquire feature points in a parcel image, wherein the parcel image is an image obtained by photographing a horizontally placed parcel by using a camera device.
[0015] The establishment unit is configured to establish a cuboid model of the parcel according to the feature points acquired by the acquisition unit.
[0016] The identification unit is configured to identify a vertical plane of the parcel according to the feature points acquired by the acquisition unit.
[0017] The calculation unit is configured to, if the vertical plane of the parcel is identified by the identification unit, determine a deviation angle between the identified vertical plane and a vertical plane of the established cuboid model.
[0018] The adjustment unit is configured to rotate the cuboid model established by the establishment unit around a vertical coordinate axis in a horizontal direction by the deviation angle determined by the calculation unit, and correct the size of the cuboid model after rotation according to the feature points acquired before rotation.
[0019] The determination unit is configured to determine the size of the parcel according to the cuboid model currently established by the establishment unit, and calculate the volume of the parcel.
[0020] In another embodiment, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the parcel volume determination method when executing the program.
[0021] In another embodiment, a computer readable storage medium is provided, which stores a computer program, and the program implements the steps of the parcel volume determination method when executed by a processor.
[0022] In another embodiment, a computer program product is provided, which includes a computer program, and the computer program implements the steps of the parcel volume determination method when executed by a processor.
[0023] As can be seen from the above technical solutions, in the above embodiments, the deviation angle between the vertical plane of the established cuboid model and the vertical plane identified by the feature points is determined to obtain the deviation angle between the established cuboid model and the parcel, and the cuboid model is rotated by the deviation angle to make the cuboid model consistent with the direction in which the parcel is placed on the horizontal plane. This scheme can improve the accuracy of modeling and accurately determine the volume of the parcel. BRIEF DESCRIPTION OF DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and all other drawings obtained by those of ordinary skill in the art without creative labor based on the drawings are within the protection scope of the present application.
[0025] Figure 1 The flowchart for determining the volume of the package in the first embodiment of the present application is shown in the figure.
[0026] Figure 2 The flowchart for determining the volume of the package in the second embodiment of the present application is shown in the figure.
[0027] Figure 3 The flowchart for determining the angle between two vertical planes in the embodiments of the present application is shown in the figure.
[0028] Figure 4 The geometric diagram of two vertical planes in the same coordinate system in the embodiments of the present application is shown in the figure.
[0029] Figure 5 The diagram for the deviation angle of two vertical planes in the embodiments of the present application is shown in the figure.
[0030] Figure 6 The structural diagram of the package volume determination device in the embodiments of the present application is shown in the figure.
[0031] Figure 7 The physical structure diagram of the electronic device provided in the embodiments of the present application is shown in the figure. DETAILED DESCRIPTION
[0032] The technical solutions in the embodiments of the present application will be described clearly and completely in the following description with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor are within the protection scope of the present application.
[0033] The terms "first", "second", "third", "fourth" and the like in the description and in the claims of the present application, and above-mentioned drawings, if any, are used to distinguish between similar objects and are not necessarily used to describe a particular sequential or chronological order. It is to be understood that the use of the terms so-termed, data can be interchanged, where appropriate, so that the embodiments of the application described herein can be carried out in other than the order shown or described herein. Furthermore, the terms "comprising" and "having", and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus that includes a list of steps or units need not be limited to those steps or units that are clearly listed, but can include other steps or units not clearly listed or inherent to such processes, methods, products or apparatuses.
[0034] The technical solutions of the present application will be described in detail below with specific examples. The following specific examples can be combined with each other, and the same or similar concepts or processes may not be described in detail in some examples.
[0035] In the embodiments of the present application, a parcel volume determination method is provided, which is applied to the scenario of determining the volume of a horizontally placed cuboid parcel. The volume of the parcel is determined by constructing a three-dimensional model of the parcel. In the process of constructing the model, the deviation of the established model from the direction in which the object is placed on the horizontal plane is calculated by using the vertical plane corresponding to the feature points and the side (vertical plane) of the parcel, and the orientation of the model is automatically corrected to more accurately model and accurately determine the volume of the parcel.
[0036] In the current express and freight industry, goods are generally packaged in regular cuboids by cartons, such as storage parcels, transportation parcels, etc. The size and volume of the parcel can be accurately obtained before execution, and the goods can be better stored and transported.
[0037] The process of determining the volume of the parcel according to the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0038] Embodiment One
[0039] Referring to Figure 1 , Figure 1 The flowchart of determining the volume of the parcel in the first embodiment of the present application is shown. The specific steps are as follows:
[0040] Step 101, acquiring feature points in a parcel image.
[0041] The parcel image is an image obtained by photographing the horizontally placed parcel by a camera device.
[0042] In the scenario applied in the embodiments of the present application, the parcel is horizontally placed.
[0043] The camera can be mounted on the modeling device, such as a mobile phone, a pad or other handheld terminal with a camera, or the camera and the modeling device can be independent devices, such as a camera and a computer terminal.
[0044] The camera can take pictures around the package, and the obtained package image is transmitted to the modeling device.
[0045] The modeling device obtains the package image transmitted by the camera and obtains feature points in the image.
[0046] The feature points herein are visual difference features in the package image, which are expressed by coordinates in a three-dimensional space.
[0047] In specific implementation, the feature points in the package image can be obtained by using but not limited to the following methods:
[0048] ARKit or ARCore framework.
[0049] In step 102, a cuboid model of the package is established according to the obtained feature points, and a vertical plane of the package is identified.
[0050] In specific implementation, the point cloud composed of the obtained feature points can be preprocessed, such as filtering processing, noise reduction processing, etc.
[0051] The specific implementation of establishing the cuboid model according to the feature points in the embodiments of the present application is not limited, and existing implementation methods can be used.
[0052] The specific implementation of identifying the vertical plane according to the obtained feature points can be:
[0053] The vertical plane composed of the feature points is identified by fitting processing on the obtained feature points.
[0054] The vertical plane herein is a plane perpendicular to a horizontal plane, and the package is placed horizontally in the embodiments of the present application, so the vertical plane is a plane corresponding to a side of the package.
[0055] In step 103, if the vertical plane of the package is identified, the deviation angle between the identified vertical plane and the vertical plane of the established cuboid model is determined.
[0056] In step 104, the cuboid model is rotated around the vertical coordinate axis in the horizontal direction by the deviation angle, and the size of the rotated cuboid model is corrected according to the feature points obtained before rotation.
[0057] In this step, the cuboid model is rotated around the vertical coordinate axis in the horizontal direction by the deviation angle, so that the cuboid model is consistent with the direction in which the package is placed on the horizontal plane.
[0058] Step 105, determining the size of the package according to the currently established cuboid model, and calculating the volume of the package.
[0059] The cuboid size here includes length, width, and height.
[0060] In the embodiments of the present application, the deviation angle between the vertical plane of the established cuboid model and the vertical plane identified by the feature points is determined to obtain the deviation angle between the established cuboid model and the package. The cuboid model is rotated by the deviation angle to make the cuboid model consistent with the direction in which the package is placed on the horizontal plane. This scheme can improve the accuracy of modeling and accurately determine the volume of the package.
[0061] Embodiment two
[0062] Referring to Figure 2 , Figure 2 is a flowchart for determining the volume of a package in the second embodiment of the present application. The specific steps are as follows:
[0063] Step 201, obtaining feature points in a package image.
[0064] The package image is an image obtained by photographing a horizontally placed package by a camera device.
[0065] In the scenario applied in the embodiments of the present application, the package is placed horizontally.
[0066] The camera can be mounted on a modeling device, such as a mobile phone, a Pad, or other handheld terminals with a camera. Alternatively, the camera and the modeling device can be independent devices, such as a camera and a computer terminal.
[0067] The camera can photograph around the package and transmit the obtained package image to the modeling device.
[0068] The modeling device obtains the package image transmitted by the camera and obtains the feature points in the image.
[0069] The feature points here are visual difference features in the package image, which are expressed in the coordinates of a three-dimensional space.
[0070] In specific implementation, the feature points in the package image can be obtained by using, but not limited to, the following methods:
[0071] ARKit or ARCore framework.
[0072] Step 202, establishing a cuboid model of the package according to the obtained feature points, and identifying the vertical plane of the package.
[0073] In specific implementation, the point cloud composed of the obtained feature points can be preprocessed, such as filtering processing, noise reduction processing, etc.
[0074] The specific implementation of the step of establishing the cuboid model according to the feature points is not limited in the embodiments of the present application, and existing implementation manners can be used.
[0075] The specific implementation of identifying the vertical plane according to the obtained feature points can be as follows:
[0076] The vertical plane composed of the feature points is identified through fitting processing on the obtained feature points.
[0077] The vertical plane herein is a plane perpendicular to the horizontal plane. In the embodiments of the present application, the package is horizontally placed, and therefore the vertical plane is a plane corresponding to the side of the package.
[0078] In step 203, if a new feature point is obtained, the newly obtained feature point is used to update the currently established cuboid model.
[0079] In step 204, if the vertical plane of the package is identified, the deviation angle between the identified vertical plane and the vertical plane of the established cuboid model is determined.
[0080] In step 205, the cuboid model is rotated by the deviation angle around the vertical coordinate axis in the horizontal direction, and the size of the cuboid model after rotation is corrected according to the feature points obtained before rotation.
[0081] In this step, the cuboid model is rotated by the deviation angle around the vertical coordinate axis in the horizontal direction, so that the cuboid model is consistent with the direction in which the package is placed on the horizontal plane.
[0082] In step 206, if a new feature point is obtained, the newly obtained feature point is used to update the currently established cuboid model.
[0083] In step 207, the size of the package is determined according to the currently established cuboid model, and the volume of the package is calculated.
[0084] The cuboid size herein includes length, width and height.
[0085] In the embodiments of the present application, the deviation angle between the vertical plane of the established cuboid model and the vertical plane identified through the feature points is determined, so as to obtain the deviation angle between the established cuboid model and the package. The cuboid model is rotated by the deviation angle, so that the cuboid model is consistent with the direction in which the package is placed on the horizontal plane. If the feature points of the package are obtained again before and after the established cuboid model is rotated, the established cuboid model can be updated according to the obtained feature points. This scheme can improve the accuracy of modeling, and further accurately determine the volume of the package.
[0086] Embodiment Three
[0087] The following three, but not limited to the following three, ways of determining the deviation angle are given in this embodiment:
[0088] The first way is to determine the included angle between the specified vertical plane in the established cuboid model and the identified vertical plane, and determine the included angle as the deviation angle.
[0089] In this implementation, when the cuboid model is initially established, a vertical plane is specified for determining the deviation angle, and then the specified vertical plane and the identified vertical plane are directly used to determine the deviation angle.
[0090] In this way, the identified vertical plane can be one or multiple. When the identified vertical plane is multiple, the multiple identified vertical planes are used to determine the included angle with the specified vertical plane respectively, and the smallest included angle is taken as the deviation angle.
[0091] The second way is to select a vertical plane in the four vertical planes of the established cuboid model according to a preset rule, determine the included angle between the identified vertical plane and the selected vertical plane, and determine the included angle as the deviation angle.
[0092] The preset rule here can be to select the vertical plane of the cuboid model facing the current screen, or to randomly select a vertical plane in the four vertical planes, but is not limited to the above rules.
[0093] In this way, the identified vertical plane can be one or multiple. When the identified vertical plane is multiple, the multiple identified vertical planes are used to determine the included angle with the selected vertical plane respectively, and the smallest included angle is taken as the deviation angle.
[0094] The third way is to determine the included angle between the four vertical planes of the established cuboid model and the identified vertical plane respectively, and take the smallest included angle in the determined included angles as the deviation angle.
[0095] In this way, the four vertical planes of the established cuboid model are used to calculate the angle with the identified vertical plane, and the smallest angle is further selected as the deviation angle.
[0096] In this way, the identified vertical plane can be one or multiple. When the identified vertical plane is multiple, the multiple identified vertical planes are used to determine the included angle with the four vertical planes of the cuboid model respectively, and the smallest included angle is taken as the deviation angle.
[0097] The following implementation of determining the included angle between two vertical planes is given in the embodiment of the application, but is not limited to the following implementation:
[0098] Referring toFigure 3 , Figure 3 The flowchart is used for determining the included angle between two vertical planes in the embodiment of the present application. The specific steps are as follows:
[0099] In step 301, the two vertical planes are mapped into the same coordinate system.
[0100] Referring to Figure 4 , Figure 4 The geometric diagram of the two vertical planes in the same coordinate system in the embodiment of the present application is shown.
[0101] Figure 4 In the coordinate system, the coordinate axis of the horizontal plane is X0Z, and the vertical coordinate axis is Y. One vertical plane is represented as P v1 , and the other vertical plane is represented as P v2 . p1 is the direction vector of P v1 , and p2 is the direction vector of P v2 .
[0102] In step 302, the direction vector p1 of one of the vertical planes and the direction vector p2 of the other vertical plane are obtained.
[0103] In step 303, the dot product of p1 and p2 is calculated to obtain the cosine value of the included angle.
[0104] The cosine value of the included angle is in the interval [0, π] instead of [0, 2π].
[0105] In step 304, the cross product of p1 and p2 is calculated to obtain the cross product vector.
[0106] In step 305, the included angle between the two vertical planes is calculated according to the direction of the component of the cross product vector on the vertical coordinate axis and the cosine value.
[0107] Referring to Figure 5 , Figure 5 The diagram of the deviation angle of the two vertical planes in the embodiment of the present application is shown. Figure 5 In the coordinate system, when the component of the cross product vector pc on the Y axis is pc.y, the value of the included angle is calculated as follows:
[0108] If pc.y<0( Figure 5 indicated by the -Y direction), the value of the included angle is acos(Ω).
[0109] If pc.y≥0( Figure 5 indicated by the +Y direction), the value of the included angle is 2π-acos(Ω).
[0110] Thus, the included angle between the two vertical planes is determined.
[0111] When the included angle between the two perpendicular planes is calculated in the above manner, the rotating the cuboid model in the horizontal direction around the vertical coordinate axis by the deviation angle comprises:
[0112] rotating the cuboid model clockwise around the vertical coordinate axis by the deviation angle.
[0113] In a specific implementation, the coordinates of the cuboid model are local coordinates, and if the feature points are acquired through AR, the coordinates of the feature points are international coordinates. In a specific implementation, the local coordinates can coincide with the international coordinates, or can be different, as long as they are mapped into one coordinate system when the included angle between the perpendicular planes is determined.
[0114] In the embodiment, multiple manners of determining the deviation angle are given. In a specific implementation, a suitable determination manner for a current application scenario is selected according to actual needs.
[0115] Based on the same inventive concept, the embodiment of the present application also provides a package volume determination device. Referring to Figure 6 , Figure 6 The structure of the volume determination device is included in the embodiment of the present application. The device comprises an acquisition unit 601, an establishment unit 602, an identification unit 603, a calculation unit 604, an adjustment unit 605, and a determination unit 606.
[0116] The acquisition unit 601 is configured to acquire feature points in a package image, wherein the package image is an image acquired by photographing a horizontally placed package through a camera device.
[0117] The establishment unit 602 is configured to establish a cuboid model of the package according to the feature points acquired by the acquisition unit 601.
[0118] The identification unit 603 is configured to identify a perpendicular plane of the package according to the feature points acquired by the acquisition unit 601.
[0119] The calculation unit 604 is configured to determine a deviation angle between the identified perpendicular plane and a perpendicular plane of the established cuboid model if the identification unit 603 identifies the perpendicular plane of the package.
[0120] The adjustment unit 605 is configured to rotate the cuboid model established by the establishment unit 602 in the horizontal direction around the vertical coordinate axis by the deviation angle determined by the calculation unit 604, and correct the size of the rotated cuboid model according to the feature points acquired before the rotation.
[0121] The determination unit 606 is configured to determine the size of the package according to the cuboid model currently established by the establishment unit 602, and calculate the volume of the package.
[0122] In some embodiments,
[0123] The adjusting unit 605 is further configured to, after the establishing unit 602 establishes the cuboid model of the package according to the obtained feature points, before rotating the cuboid model around the vertical coordinate axis by the deviation angle in the horizontal direction, if the obtaining unit 601 obtains new feature points, updating the currently established cuboid model by using the newly obtained feature points.
[0124] In some embodiments,
[0125] After correcting the size of the rotated cuboid model according to the feature points obtained before rotation, before the determining unit 606 determines the size of the package according to the currently established cuboid model, if the obtaining unit 601 obtains new feature points, updating the currently established cuboid model by using the newly obtained feature points.
[0126] In some embodiments,
[0127] The identifying unit 603 is specifically configured to, when identifying the vertical plane of the package, comprising: fitting the obtained feature points, identifying the vertical plane corresponding to the feature points as the vertical plane of the package.
[0128] In some embodiments,
[0129] The calculating unit 604 is specifically configured to, when determining the deviation angle between the identified vertical plane and the vertical plane of the established cuboid model, comprising: determining the included angle between the specified vertical plane of the established cuboid model and the identified vertical plane, and determining the included angle as the deviation angle; or, selecting a vertical plane from the four vertical planes of the established cuboid model according to a preset rule, determining the included angle between the identified vertical plane and the selected vertical plane, and determining the included angle as the deviation angle; or, respectively determining the included angles between the four vertical planes of the established cuboid model and the identified vertical plane, and taking the smallest included angle among the determined included angles as the deviation angle.
[0130] In some embodiments,
[0131] The calculating unit 604 is specifically configured to, when determining the included angle between two vertical planes, comprising: mapping the two vertical planes into the same coordinate system; obtaining the direction vector p1 of one of the vertical planes, and the direction vector p2 of the other vertical plane; performing dot product calculation on p1 and p2 to obtain the cosine value of the included angle; performing cross product calculation on p1 and p2 to obtain a cross product vector; and calculating the included angle between the two vertical planes according to the direction of the component of the cross product vector on the vertical coordinate axis and the cosine value.
[0132] In some embodiments,
[0133] The adjusting unit 605 is specifically configured to rotate the cuboid model clockwise around the vertical coordinate axis by the deviation angle when rotating the cuboid model around the vertical coordinate axis by the deviation angle in the horizontal direction.
[0134] The units in the above embodiments can be integrated or deployed separately, and can be combined into one unit or further split into multiple sub-units.
[0135] In another embodiment, an electronic device is also provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the package volume determination method when executing the program.
[0136] In another embodiment, a computer readable storage medium is also provided, which stores computer instructions, and the instructions are executable on a processor to implement the steps in the package volume determination method.
[0137] Figure 7 The electronic device provided in the embodiments of the present application is shown in the entity structure diagram. As shown in the figure, the electronic device can include a processor 710, a communication interface 720, a memory 730, and a communication bus 740, wherein the processor 710, the communication interface 720, and the memory 730 complete mutual communication through the communication bus 740. The processor 710 can call the logical instructions in the memory 730 to execute the following method: Figure 7
[0138] Obtaining feature points in a package image; wherein the package image is an image obtained by photographing a horizontally placed package through a camera device;
[0139] Establishing a cuboid model of the package according to the obtained feature points, and identifying a vertical plane of the package;
[0140] If the vertical plane of the package is identified, determining a deviation angle between the identified vertical plane and a vertical plane of the established cuboid model;
[0141] Rotating the cuboid model around the vertical coordinate axis by the deviation angle in the horizontal direction, and correcting the size of the rotated cuboid model according to the feature points obtained before rotation;
[0142] Determining the size of the package according to the currently established cuboid model, and calculating the volume of the package.
[0143] Further, the logic instructions in the memory 730 described above can be implemented by a software function unit in the form of a computer program and sold or used as an independent product, which can be stored in a computer readable storage medium. Based on such an understanding, the technical solutions of the present application essentially or partially contribute to the prior art, or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, and various media that can store program codes.
[0144] The device embodiments described above are only schematic, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment. Those skilled in the art can understand and implement without creative labor.
[0145] From the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be realized by means of software and necessary universal hardware platforms, and of course can also be realized by hardware. Based on such an understanding, the above technical solutions essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some part of the embodiments.
[0146] In another embodiment, a computer program product is provided, including a computer program which, when executed by a processor, implements the steps of the package volume determination method.
[0147] The embodiments of the present application disclose a TS1, a package volume determination method, characterized in that the method comprises:
[0148] Obtaining feature points in a package image; wherein the package image is an image obtained by photographing a horizontally placed package by a camera device;
[0149] establish a cuboid model of the package according to the acquired feature points, and identify a vertical plane of the package;
[0150] determine a deviation angle between the identified vertical plane and a vertical plane of the established cuboid model;
[0151] rotate the cuboid model around a vertical coordinate axis in a horizontal direction by the deviation angle, and correct dimensions of the rotated cuboid model according to the feature points acquired before the rotation;
[0152] determine dimensions of the package according to the currently established cuboid model, and calculate a volume of the package.
[0153] TS2, the method according to claim TS1, after the cuboid model of the package is established according to the acquired feature points, before the cuboid model is rotated around a vertical coordinate axis in a horizontal direction by the deviation angle, the method further comprises:
[0154] if a new feature point is acquired, the currently established cuboid model is updated using the newly acquired feature point.
[0155] TS3, the method according to claim TS1, after the dimensions of the rotated cuboid model are corrected according to the feature points acquired before the rotation, before the dimensions of the package are determined according to the currently established cuboid model, the method further comprises:
[0156] if a new feature point is acquired, the currently established cuboid model is updated using the newly acquired feature point.
[0157] TS4, the method according to claim TS1, wherein the vertical plane of the package is identified by:
[0158] fitting the acquired feature points, identifying a vertical plane corresponding to the feature points as the vertical plane of the package.
[0159] TS5, the method according to any one of claims TS1-TS4, wherein the deviation angle between the identified vertical plane and the vertical plane of the established cuboid model is determined by:
[0160] determining an included angle between a specified vertical plane of the established cuboid model and the identified vertical plane, and determining the included angle as the deviation angle;
[0161] or, selecting a vertical plane from the four vertical planes of the established cuboid model according to a preset rule, determining an included angle between the identified vertical plane and the selected vertical plane, and determining the included angle as the deviation angle.
[0162] Or, respectively determine the included angle between the four vertical planes of the established cuboid model and the identified vertical planes, and take the smallest included angle in the determined included angles as the deviation angle.
[0163] TS6. The method of claim TS5, wherein determining the included angle between the two vertical planes comprises:
[0164] Mapping the two vertical planes into the same coordinate system;
[0165] Obtaining a direction vector p1 of one of the vertical planes, and a direction vector p2 of the other vertical plane;
[0166] Calculating the dot product of p1 and p2 to obtain the cosine value of the included angle;
[0167] Calculating the cross product of p1 and p2 to obtain a cross product vector;
[0168] Calculating the included angle between the two vertical planes according to the direction of the component of the cross product vector on the vertical coordinate axis and the cosine value.
[0169] TS7. The method of claim TS6, wherein rotating the cuboid model around the vertical coordinate axis in the horizontal direction by the deviation angle comprises:
[0170] Rotating the cuboid model around the vertical coordinate axis clockwise by the deviation angle.
[0171] Embodiments of the present application also disclose TS8, a package volume determination device, characterized in that the device comprises an acquisition unit, an establishment unit, an identification unit, a calculation unit, an adjustment unit and a determination unit.
[0172] The acquisition unit is configured to acquire feature points in a package image; wherein the package image is an image obtained by photographing a horizontally placed package by a camera device;
[0173] The establishment unit is configured to establish a cuboid model of the package according to the feature points acquired by the acquisition unit;
[0174] The identification unit is configured to identify vertical planes of the package according to the feature points acquired by the acquisition unit;
[0175] The calculation unit is configured to, if the identification unit identifies the vertical planes of the package, determine a deviation angle between the identified vertical planes and the vertical planes of the established cuboid model;
[0176] The adjusting unit is configured to rotate the cuboid model established by the establishing unit around a vertical coordinate axis in a horizontal direction by the deviation angle determined by the calculating unit, and correct the size of the rotated cuboid model according to the feature points obtained before the rotation.
[0177] The determining unit is configured to determine the size of the package according to the cuboid model currently established by the establishing unit, and calculate the volume of the package.
[0178] TS9. The apparatus according to claim TS8, characterized in that,
[0179] The adjusting unit is further configured to, after the establishing unit establishes the cuboid model of the package according to the obtained feature points, before rotating the cuboid model around a vertical coordinate axis in a horizontal direction by the deviation angle, if the obtaining unit obtains new feature points, update the currently established cuboid model using the newly obtained feature points.
[0180] TS10. The apparatus according to claim TS8, characterized in that,
[0181] The adjusting unit is further configured to, after correcting the size of the rotated cuboid model according to the feature points obtained before the rotation, before the determining unit determines the size of the package according to the currently established cuboid model, if the obtaining unit obtains new feature points, update the currently established cuboid model using the newly obtained feature points.
[0182] TS11. The apparatus according to claim TS8, characterized in that,
[0183] The recognizing unit is specifically configured to, when recognizing the vertical plane of the package, fit the obtained feature points, and recognize the vertical plane corresponding to the feature points as the vertical plane of the package.
[0184] TS12. The apparatus according to any one of claims TS8-TS11, characterized in that,
[0185] The calculating unit is specifically configured to, when determining the deviation angle between the recognized vertical plane and the vertical plane of the established cuboid model, determine the included angle between the specified vertical plane of the established cuboid model and the recognized vertical plane, and determine the included angle as the deviation angle; or, select one vertical plane from the four vertical planes of the established cuboid model according to a preset rule, determine the included angle between the recognized vertical plane and the selected vertical plane, and determine the included angle as the deviation angle; or, respectively determine the included angles between the four vertical planes of the established cuboid model and the recognized vertical plane, and determine the smallest included angle from the determined included angles as the deviation angle.
[0186] TS13. The apparatus of claim TS12, wherein,
[0187] The calculation unit is specifically configured to: when determining the included angle between the two vertical planes, map the two vertical planes into a same coordinate system; obtain a direction vector p1 of one of the vertical planes and a direction vector p2 of the other vertical plane; perform dot product calculation on p1 and p2 to obtain a cosine value of the included angle; perform cross product calculation on p1 and p2 to obtain a cross product vector; and determine the included angle between the two vertical planes according to a direction of a component of the cross product vector on a vertical coordinate axis and the cosine value.
[0188] TS14. The apparatus of claim TS13, wherein,
[0189] The adjustment unit is specifically configured to: when rotating the cuboid model in the horizontal direction around the vertical coordinate axis by the deviation angle, rotate the cuboid model clockwise around the vertical coordinate axis by the deviation angle.
[0190] TS15. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any one of claims TS1-TS7 when executing the program.
[0191] TS16. A computer readable storage medium, having stored thereon a computer program, wherein the program, when executed by a processor, implements the method of any one of claims TS1-TS7.
[0192] TS17. A computer program product, comprising a computer program, wherein the computer program, when executed by a processor, implements the method of any one of claims TS1-TS7.
[0193] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments disclosed in this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those shown in the drawings. For example, two blocks shown connectedly may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0194] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, without departing from the spirit and teachings of this application, the features described in the various embodiments and / or claims of this application can be combined and / or combined in various ways, and all such combinations and / or combinations fall within the scope of this application.
[0195] This document uses specific embodiments to illustrate the principles and implementation methods of the present invention. The descriptions of these embodiments are merely illustrative of the method and core concepts of the present invention and are not intended to limit this application. Those skilled in the art can make changes to the specific implementation methods and application scope based on the ideas, spirit, and principles of the present invention. Any modifications, equivalent substitutions, or improvements made should be included within the scope of protection of this application.
Claims
1. A method for determining the volume of a package, characterized in that, The method includes: Feature points are obtained from a package image; wherein the package image is an image obtained by taking a picture of a horizontally placed package using a camera device; A cuboid model of the package is established based on the acquired feature points; The acquired feature points are then fitted to identify the vertical plane of the package, which is then used as the vertical plane of the package. The deviation angle between the identified vertical plane and the vertical plane of the established cuboid model can be determined by one of the following methods: determining the angle between a specified vertical plane in the established cuboid model and the identified vertical plane, and defining the angle as the deviation angle; or selecting a vertical plane from the four vertical planes of the established cuboid model according to a preset rule, determining the angle between the identified vertical plane and the selected vertical plane, and defining the angle as the deviation angle; or determining the angles between each of the four vertical planes of the established cuboid model and the identified vertical plane, and taking the smallest angle among the determined angles as the deviation angle. The cuboid model is rotated horizontally around the vertical coordinate axis by the deviation angle, and the dimensions of the rotated cuboid model are corrected based on the feature points obtained before rotation. The dimensions of the package are determined based on the currently established cuboid model, and the volume of the package is calculated.
2. The method according to claim 1, characterized in that, After establishing the cuboid model of the package based on the acquired feature points, and before rotating the cuboid model horizontally around the vertical coordinate axis by the deviation angle, the method further includes: If new feature points are obtained, the newly obtained feature points are used to update the currently established cuboid model.
3. The method according to claim 1, characterized in that, After correcting the dimensions of the rotated cuboid model based on the feature points obtained before rotation, and before determining the dimensions of the package based on the currently established cuboid model, the method further includes: If new feature points are obtained, the newly obtained feature points are used to update the currently established cuboid model.
4. The method according to claim 3, characterized in that, Determining the angle between two perpendicular planes includes: Map two perpendicular planes to the same coordinate system; Obtain the direction vector p1 of one of the perpendicular planes, and the direction vector p2 of the other perpendicular plane; Perform a dot product calculation on p1 and p2 to obtain the cosine value of the included angle; Calculate the cross product of p1 and p2 to obtain the cross product vector; The angle between the two vertical planes is calculated based on the direction of the cross product vector's components on the vertical coordinate axis and the cosine value.
5. A device for determining the volume of a package, characterized in that, The device includes: an acquisition unit, an establishment unit, an identification unit, a calculation unit, an adjustment unit, and a determination unit; The acquisition unit is used to acquire feature points in the package image; wherein, the package image is an image acquired by taking a picture of a horizontally placed package using a camera device; The establishment unit is used to establish a cuboid model of the package based on the feature points obtained by the acquisition unit. The identification unit is used to fit the feature points acquired by the acquisition unit to identify the vertical plane of the package and use it as the vertical plane of the package. The calculation unit is configured to, if the identification unit identifies a vertical plane of the package, determine the deviation angle between the identified vertical plane and the vertical plane of the established cuboid model by one of the following methods: determining the angle between a specified vertical plane in the established cuboid model and the identified vertical plane, and defining the angle as the deviation angle; or selecting a vertical plane from the four vertical planes of the established cuboid model according to a preset rule, determining the angle between the identified vertical plane and the selected vertical plane, and defining the angle as the deviation angle; or determining the angles between the four vertical planes of the established cuboid model and the identified vertical plane respectively, and taking the smallest angle among the determined angles as the deviation angle. The adjustment unit is used to rotate the cuboid model established by the establishment unit in the horizontal direction around the vertical coordinate axis by the deviation angle determined by the calculation unit, and to correct the size of the rotated cuboid model based on the feature points obtained before rotation. The determining unit is used to determine the dimensions of the package based on the cuboid model currently established by the establishing unit, and to calculate the volume of the package.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1-4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method described in any one of claims 1-4.
8. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the method described in any one of claims 1-4.
Citation Information
Patent Citations
Graphic drawing method, device and equipment
CN107230239A
A4 paper-based camera modeling method and system
CN107464282A