CN111340869B - Express package surface flatness identification method, device, equipment and storage medium - Google Patents

Express package surface flatness identification method, device, equipment and storage medium Download PDF

Info

Publication number
CN111340869B
CN111340869B CN202010227450.XA CN202010227450A CN111340869B CN 111340869 B CN111340869 B CN 111340869B CN 202010227450 A CN202010227450 A CN 202010227450A CN 111340869 B CN111340869 B CN 111340869B
Authority
CN
China
Prior art keywords
express
parcel
pictures
package
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010227450.XA
Other languages
Chinese (zh)
Other versions
CN111340869A (en
Inventor
李斯
赵齐辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dongpu Software Co Ltd
Original Assignee
Dongpu Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dongpu Software Co Ltd filed Critical Dongpu Software Co Ltd
Priority to CN202010227450.XA priority Critical patent/CN111340869B/en
Publication of CN111340869A publication Critical patent/CN111340869A/en
Application granted granted Critical
Publication of CN111340869B publication Critical patent/CN111340869B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • G06T7/55Depth or shape recovery from multiple images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20228Disparity calculation for image-based rendering

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The invention relates to the field of image processing, and discloses an express package surface flatness identification method, device, equipment and storage medium, which are used for solving the problem of low efficiency in identifying express package surface flatness. The express package surface flatness identification method comprises the following steps: the method comprises the steps of obtaining a plurality of express parcel pictures for displaying the express parcel surface, and preprocessing the express parcel pictures to obtain a plurality of basic express parcel pictures; according to the multiple basic express parcel pictures and a binocular stereoscopic vision algorithm, calculating the depth between multiple target points on the surface of the express parcel and imaging equipment to obtain multiple target depths; calculating the flatness of the surface of the express package through a plurality of target depths; if the numerical value of the flatness is larger than or equal to the standard threshold value, the express parcel surface is judged to be an uneven surface, if the numerical value of the flatness is smaller than the standard threshold value, the express parcel surface is judged to be a flat surface, and the standard threshold value is a limit value for judging whether the express parcel surface is a flat surface.

Description

Express package surface flatness identification method, device, equipment and storage medium
Technical Field
The invention relates to the field of image processing, in particular to an express package surface flatness identification method, device, equipment and storage medium.
Background
Along with the rapid development of electronic commerce, express delivery traffic rises gradually, and a large amount of express packages need timely and intact to be delivered to the assigned address, consequently, need put more express packages in certain space and transport, just can improve the efficiency of delivering of express packages. Most express delivery trades adopt express delivery case or express bag to pack express delivery article, but the surface unevenness of current a lot of express delivery parcel packing, like this insufficient packaging's express delivery parcel not only leads to express delivery parcel yielding, fragile outside, still leads to when putting the express delivery parcel, the space utilization of express delivery parcel is not high.
At present, the express industry can only judge whether the package of the express package is fully packaged by a method of manually identifying the flatness of the surface of the express package, so that the efficiency of identifying the flatness of the surface of the express package is low.
Disclosure of Invention
The invention mainly aims to solve the problem of low efficiency of identifying the surface flatness of express packages.
The invention provides a first aspect of an express package surface flatness identification method, which comprises the following steps: the method comprises the steps of obtaining a plurality of express parcel pictures for displaying the surfaces of express parcels, and preprocessing the express parcel pictures to obtain a plurality of basic express parcel pictures, wherein the express parcel pictures are pictures shot by imaging equipment at a plurality of different angles; according to the multiple basic express parcel pictures and a binocular stereoscopic vision algorithm, calculating the depth between multiple target points on the express parcel surface and the imaging equipment to obtain multiple target depths, wherein the multiple target depths comprise a maximum depth and a minimum depth; calculating the flatness of the express package surface through the plurality of target depths, wherein the flatness is the difference value between the maximum depth and the minimum depth; if the numerical value of the flatness is larger than or equal to a standard threshold value, the express package surface is judged to be an uneven surface, if the numerical value of the flatness is smaller than the standard threshold value, the express package surface is judged to be a flat surface, and the standard threshold value is a limit value for judging whether the express package surface is a flat surface.
Optionally, in a first implementation manner of the first aspect of the present invention, the calculating, according to the multiple base express parcel pictures and a binocular stereo vision algorithm, depths between multiple target points on the express parcel surface and the imaging device to obtain multiple target depths, where the multiple target depths include a maximum depth and a minimum depth, and the calculating includes: selecting any two imaging devices from the multiple imaging devices, wherein the two imaging devices have different angles for shooting the surface of the same express package; performing equipment calibration on the two imaging devices by adopting a binocular stereo vision algorithm, and acquiring basic parameters of the two imaging devices after the equipment calibration is completed, wherein the basic parameters comprise a focal length, an imaging base line, a rotation matrix and a translation matrix; respectively extracting two basic express parcel pictures of the same express parcel surface shot by the two imaging devices, and carrying out image correction on the two basic express parcel pictures according to an epipolar line correction algorithm and the basic parameters to obtain two target express parcel pictures, wherein the two target express parcel pictures are positioned on the same plane; matching pixel values in the two target express parcel pictures through a global matching algorithm to obtain an express parcel disparity map, wherein the express parcel disparity map is used for displaying three-dimensional information of the surface of the same express parcel; projecting the express package disparity map, and calculating the three-dimensional information of the surface of the same express package to obtain the plane information of the surface of the same express package; and calculating the depths between a plurality of target points on the surface of the same express package and the imaging equipment according to the plane information to obtain a plurality of target depths, wherein the plurality of target depths comprise a maximum depth and a minimum depth.
Optionally, in a second implementation manner of the first aspect of the present invention, the respectively extracting two basic express package pictures of the same express package surface taken by the two imaging devices, and performing image correction on the two basic express package pictures according to an epipolar line correction algorithm and the basic parameters to obtain two target express package pictures, where the two target express package pictures are located on the same plane includes: respectively extracting two basic express parcel pictures of the same express parcel surface shot by the two imaging devices; according to an epipolar correction algorithm, rotating the two basic express parcel pictures according to a correction matrix to obtain two target express parcel pictures, wherein the two target express parcel pictures are located on the same plane, the correction matrix comprises a first correction matrix and a second correction matrix, and the first correction matrix R 1 ' is: r' 1 =R rect ×R 1 The second correction matrix R 2 ' is: r' 2 =R rect ×R 2 In the formula:
Figure BDA0002428190640000021
T=[T x T y T z ] T ,e 3 =e 1 ×e 2
R 1 for the rotation matrix of one of the two image-forming devices, R 2 For the rotation matrix of the other of the two image forming apparatuses, R rect For the desired rotation matrix, e 1 ,e 2 ,e 3 Are each R rect T is a translation matrix after the two imaging devices are calibrated, T x ,T y ,T z Are respectively marked by numerical values in T.
Optionally, in a third implementation manner of the first aspect of the present invention, the matching, by using a global matching algorithm, pixel values in the two target express parcel pictures to obtain an express parcel disparity map, where the express parcel disparity map is used to display three-dimensional information of the same express parcel surface includes: selecting a reference pixel point in a target express parcel picture by adopting a global matching algorithm, and establishing a horizontal axis by taking the reference pixel point as a reference, wherein the horizontal axis is a virtual coordinate axis and penetrates through the two target express parcel pictures; selecting a plurality of candidate pixel points on the horizontal axis from another target express parcel picture, and calculating the similarity between the candidate pixel points and the reference pixel point by adopting an error sum of squares algorithm to obtain a plurality of comparison similarities; and screening out the minimum contrast similarity with the minimum numerical value from the plurality of contrast similarities, and taking the candidate pixel points with the minimum contrast similarity as corresponding pixel points to obtain an express package disparity map which is used for displaying three-dimensional information on the surface of the same express package.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the projecting the express package disparity map and obtaining the plane information of the same express package surface by calculating the three-dimensional information of the same express package surface includes: establishing a projection plane through the express package disparity map, wherein the projection plane is used for indicating any plane parallel to a reference plane in the express package disparity map, and the reference plane is the same plane where the two target express package pictures are located; and projecting the same express parcel surface on the projection plane, and calculating two-dimensional information of the same express parcel surface according to the three-dimensional information of the same express parcel surface to obtain the plane information of the same express parcel surface, wherein the plane information of the same express parcel surface comprises a virtual two-dimensional coordinate axis and two-dimensional coordinates of the same express parcel surface.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the calculating, according to the plane information, depths between multiple target points on the surface of the same express package and the imaging device to obtain multiple target depths, where the multiple target depths include a maximum depth and a minimum depth, and the calculating includes: selecting a plurality of target points on the surface of the same express package; according to a preset depth formula, basic parameters and plane information, calculating the depths between the multiple target points and the imaging device on the surface of the same express package to obtain multiple target depths, wherein the multiple target depths comprise a maximum depth and a minimum depth, and the preset depth formula is as follows:
Figure BDA0002428190640000031
in the formula, z is the depth between the target point and the imaging device, f is the focal length of the imaging device, b is the imaging baseline of the two imaging devices, and d is the corresponding relationship between each pixel point between the two imaging devices.
Optionally, in a sixth implementation manner of the first aspect of the present invention, the obtaining and displaying multiple express package pictures on an express package surface, and preprocessing the express package pictures to obtain multiple basic express package pictures, where the express package pictures are pictures taken by imaging devices at multiple different angles, includes: the method comprises the steps of obtaining a plurality of express parcel pictures for displaying the surfaces of express parcels, wherein the express parcel pictures are pictures shot by imaging equipment at a plurality of different angles; carrying out normalization processing on the express parcel pictures by adopting a preprocessing formula to obtain a plurality of basic express parcel pictures, wherein the preprocessing formula is as follows:
Figure BDA0002428190640000041
in the formula: and a' is the pixel value of the basic express parcel picture, and a is the original pixel value of the express parcel picture.
The second aspect of the invention provides an express package surface flatness recognition device, which comprises: the system comprises a preprocessing module, a display module and a display module, wherein the preprocessing module is used for acquiring a plurality of express package pictures for displaying the surfaces of express packages, and preprocessing the express package pictures to obtain a plurality of basic express package pictures, and the express package pictures are pictures shot by imaging equipment at a plurality of different angles; the first calculating module is used for calculating the depths between a plurality of target points on the express parcel surface and the imaging equipment according to the plurality of basic express parcel pictures and a binocular stereoscopic vision algorithm to obtain a plurality of target depths, wherein the plurality of target depths comprise a maximum depth and a minimum depth; the second calculation module is used for calculating the flatness of the surface of the express parcel through the plurality of target depths, and the flatness is the difference value between the maximum depth and the minimum depth; and the judging module is used for judging that the express package surface is an uneven surface if the flatness value is greater than or equal to a standard threshold value, and judging that the express package surface is a flat surface if the flatness value is smaller than the standard threshold value, wherein the standard threshold value is a threshold value for judging whether the express package surface is a flat surface.
Optionally, in a first implementation manner of the second aspect of the present invention, the first computing module includes: the system comprises an acquisition unit, a processing unit and a display unit, wherein the acquisition unit is used for selecting any two imaging devices from a plurality of imaging devices, and the angles of the two imaging devices for shooting the surface of the same express package are different; the device calibration unit is used for performing device calibration on the two imaging devices by adopting a binocular stereo vision algorithm to obtain basic parameters of the two imaging devices after the device calibration is completed, wherein the basic parameters comprise a focal length, an imaging baseline, a rotation matrix and a translation matrix; the correction unit is used for respectively extracting two basic express parcel pictures of the same express parcel surface shot by the two imaging devices, and carrying out image correction on the two basic express parcel pictures according to an epipolar correction algorithm and the basic parameters to obtain two target express parcel pictures, wherein the two target express parcel pictures are positioned on the same plane; the matching unit is used for matching pixel values in the two target express parcel pictures through a global matching algorithm to obtain an express parcel disparity map, and the express parcel disparity map is used for displaying three-dimensional information of the surface of the same express parcel; the projection unit is used for projecting the express parcel disparity map and obtaining plane information of the same express parcel surface by calculating the three-dimensional information of the same express parcel surface; and the calculating unit is used for calculating the depths between a plurality of target points on the surface of the same express parcel and the imaging equipment according to the plane information to obtain a plurality of target depths, wherein the plurality of target depths comprise a maximum depth and a minimum depth.
Optionally, in a second implementation manner of the second aspect of the present invention, the correcting unit is specifically configured to: respectively extracting two basic express parcel pictures of the same express parcel surface shot by the two imaging devices; according to an epipolar correction algorithm, rotating the two basic express parcel pictures according to a correction matrix to obtain two target express parcel pictures, wherein the two target express parcel pictures are located on the same plane, the correction matrix comprises a first correction matrix and a second correction matrix, and the first correction matrix R 1 ' is: r' 1 =R rect ×R 1 The second correction matrix R 2 ' is: r' 2 =R rect ×R 2 In the formula:
Figure BDA0002428190640000051
T=[T x T y T z ] T ,e 3 =e 1 ×e 2
R 1 for the rotation matrix of one of the two image-forming devices, R 2 For the rotation matrix of the other of the two image forming apparatuses, R rect For the desired rotation matrix, e 1 ,e 2 ,e 3 Are each R rect The numerical value in (1) is marked, T is a translation matrix after the two imaging devices finish device calibration, T x ,T y ,T z Respectively, are numerical values in T.
Optionally, in a third implementation manner of the second aspect of the present invention, the matching unit is specifically configured to: selecting a reference pixel point in a target express parcel picture by adopting a global matching algorithm, and establishing a horizontal axis by taking the reference pixel point as a reference, wherein the horizontal axis is a virtual coordinate axis and penetrates through the two target express parcel pictures; selecting a plurality of candidate pixel points on the horizontal axis from another target express parcel picture, and calculating the similarity between the candidate pixel points and the reference pixel point by adopting an error sum of squares algorithm to obtain a plurality of comparison similarities; screening out the contrast similarity with the minimum contrast similarity value from the plurality of contrast similarities, and taking the candidate pixel points with the calculated contrast similarities as corresponding pixel points to obtain an express package disparity map, wherein the express package disparity map is used for displaying three-dimensional information of the surface of the same express package.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the projection unit is specifically configured to: establishing a projection plane through the express package disparity map, wherein the projection plane is used for indicating any plane parallel to a reference plane in the express package disparity map, and the reference plane is the same plane where the two target express package pictures are located; and projecting the same express parcel surface on the projection plane, and calculating two-dimensional information of the same express parcel surface according to the three-dimensional information of the same express parcel surface to obtain the plane information of the same express parcel surface, wherein the plane information of the same express parcel surface comprises a virtual two-dimensional coordinate axis and two-dimensional coordinates of the same express parcel surface.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the computing unit is specifically configured to: selecting a plurality of target points on the surface of the same express package; according to a preset depth formula, basic parameters and plane information, calculating the depths between the multiple target points and the imaging device on the surface of the same express package to obtain multiple target depths, wherein the multiple target depths comprise a maximum depth and a minimum depth, and the preset depth formula is as follows:
Figure BDA0002428190640000061
in the formula, z is the depth between the target point and the imaging device, f is the focal length of the imaging device, b is the imaging baseline of the two imaging devices, and d is the corresponding relationship between each pixel point between the two imaging devices.
Optionally, in a sixth implementation manner of the second aspect of the present invention, the preprocessing module is specifically configured to: the method comprises the steps of obtaining a plurality of express package pictures for displaying the surfaces of express packages, wherein the express package pictures are pictures shot by imaging equipment at a plurality of different angles; carrying out normalization processing on the express parcel pictures by adopting a preprocessing formula to obtain a plurality of basic express parcel pictures, wherein the preprocessing formula is as follows:
Figure BDA0002428190640000062
in the formula: and a' is the pixel value of the basic express parcel picture, and a is the original pixel value of the express parcel picture.
The third aspect of the invention provides an express package surface flatness identification device, which comprises: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line; the at least one processor calls the instruction in the memory to enable the express package surface flatness identification equipment to execute the express package surface flatness identification method.
A fourth aspect of the present invention provides a computer-readable storage medium, which stores instructions that, when executed on a computer, cause the computer to execute the above express package surface flatness identification method.
According to the technical scheme, a plurality of express parcel pictures for displaying the surfaces of express parcels are obtained, the express parcel pictures are preprocessed, and a plurality of basic express parcel pictures are obtained, wherein the express parcel pictures are pictures shot by imaging equipment at a plurality of different angles; according to the multiple basic express parcel pictures and a binocular stereoscopic vision algorithm, calculating the depth between multiple target points on the express parcel surface and the imaging equipment to obtain multiple target depths, wherein the multiple target depths comprise a maximum depth and a minimum depth; calculating the flatness of the surface of the express parcel through the plurality of target depths, wherein the flatness is the difference value between the maximum depth and the minimum depth; if the numerical value of the flatness is larger than or equal to a standard threshold value, the express package surface is judged to be an uneven surface, if the numerical value of the flatness is smaller than the standard threshold value, the express package surface is judged to be a flat surface, and the standard threshold value is a limit value for judging whether the express package surface is a flat surface. In the embodiment of the invention, the flatness of the surface of the express parcel is calculated by adopting a binocular stereoscopic vision algorithm, whether the surface of the express parcel is flat or not is judged by comparing the flatness with a standard threshold value, and the efficiency of identifying the surface flatness of the express parcel is improved.
Drawings
FIG. 1 is a schematic diagram of an embodiment of an express package surface flatness identification method in an embodiment of the present invention;
fig. 2 is a schematic diagram of another embodiment of the express package surface flatness identification method in the embodiment of the present invention;
fig. 3 is a schematic diagram of an embodiment of an express package surface flatness identification device in an embodiment of the present invention;
fig. 4 is a schematic view of another embodiment of the express package surface flatness identification device in the embodiment of the invention;
fig. 5 is a schematic diagram of an embodiment of express package surface flatness identification equipment in an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides an express parcel surface flatness identification method, an express parcel surface flatness identification device, express parcel surface flatness identification equipment and a storage medium.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Moreover, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of understanding, a specific flow of an embodiment of the present invention is described below, with reference to fig. 1, an embodiment of a method for identifying surface flatness of an express package according to an embodiment of the present invention includes:
101. the method comprises the steps of obtaining a plurality of express parcel pictures for displaying the surfaces of express parcels, and preprocessing the express parcel pictures to obtain a plurality of basic express parcel pictures, wherein the express parcel pictures are pictures shot by imaging equipment at a plurality of different angles;
it can be understood that the execution main body of the present invention may be an express package surface flatness identification apparatus, and may also be a terminal or a server, which is not limited herein. The embodiment of the present invention is described by taking a server as an execution subject.
The server acquires a plurality of express package pictures which are shot by imaging equipment at a plurality of different angles and display the surfaces of express packages, and preprocesses the express package pictures to obtain a plurality of basic express package pictures.
It can be understood that the server needs to analyze the flatness of the surface of the express package by acquiring a plurality of express package pictures displaying the surface of the express package, and the express package pictures need to be preprocessed before being analyzed, so that the preprocessing operation is convenient for the execution of the subsequent steps. In addition, the imaging device herein is a photographing device such as a camera or a camera capable of taking a clear picture, and the form of the imaging device is not limited in the present application. It should be noted that, here, a plurality of imaging devices are located respectively in the different directions of express delivery parcel, and the angle that different imaging devices shoot the express delivery parcel is different.
102. According to the multiple basic express parcel pictures and a binocular stereoscopic vision algorithm, calculating the depth between multiple target points and imaging equipment on the surface of an express parcel to obtain multiple target depths, wherein the multiple target depths comprise a maximum depth and a minimum depth;
the server binocular stereoscopic vision algorithm processes and analyzes a plurality of basic express parcel pictures at different angles, the depth between a plurality of target points and imaging equipment on the surface of an express parcel is calculated according to the processing result, a plurality of target depths are obtained, the plurality of target depths comprise the maximum depth and the minimum depth, the target depth refers to the depth information of the express parcel surface, and the distance between the express parcel surface and the imaging equipment can be calculated through the depth information.
The server processes and analyzes the basic express parcel pictures by adopting a binocular stereo vision algorithm, the binocular stereo vision algorithm is an important form of machine vision, and the method is a method for acquiring three-dimensional geometric information of an object by acquiring two images of the object to be detected from different positions by utilizing imaging equipment based on a parallax principle and calculating the position deviation between corresponding points of the images. The principle of the binocular stereo vision algorithm is as follows: firstly, calibrating a binocular camera to obtain internal parameters and external parameters of the two cameras, wherein the internal parameters comprise: focal length, imaging baseline, image center and distortion coefficient, the external parameters include: a rotation (R) matrix and a translation (T) matrix; secondly, correcting the original image according to the calibration result to enable the two corrected images to be located on the same plane and to be parallel to each other; then matching pixel points in the corrected two images; and finally, calculating the depth of each pixel according to the matching result so as to obtain a depth map. The method comprises the steps that two imaging devices are selected from a plurality of imaging devices by a server, the positions of the two imaging devices and a shot express parcel picture are utilized to obtain the matching relation of pixels between the express parcel pictures, the server obtains three-dimensional information of an object by calculating the offset between the pixels, and finally the server calculates the depth between a plurality of target points on the surface of the express parcel and the imaging devices through the three-dimensional information.
103. Calculating the flatness of the surface of the express package through a plurality of target depths, wherein the flatness is the difference value between the maximum depth and the minimum depth;
and after the server obtains the target depths between a plurality of target points and the imaging equipment on the surface of the express package according to a binocular stereoscopic vision algorithm, the flatness of the surface of the express package is obtained by calculating the difference between the maximum value and the minimum value of the target depths.
The flatness of the surface of the express package is judged by the server through calculating the distance between the highest point and the lowest point on the surface of the express package, and the flatness of the express package can further judge whether the express package is regularly packaged. After the server obtains the flatness of the surface of the express package through calculation, the larger the numerical value of the flatness is, the larger the distance between the highest point and the lowest point on the surface of the express package is, namely, the more uneven the surface of the express package is, and if the express package is not packaged regularly, the problem of damage or deformation of the express package is easy to occur, so that unnecessary loss is caused. Therefore, the server judges whether the express packages can be placed in the space by fully utilizing the express packages through calculating the surface flatness of the express packages, and the placing space utilization rate is improved.
104. If the numerical value of the flatness is larger than or equal to the standard threshold value, the express parcel surface is judged to be an uneven surface, if the numerical value of the flatness is smaller than the standard threshold value, the express parcel surface is judged to be a flat surface, and the standard threshold value is a limit value for judging whether the express parcel surface is a flat surface.
After the flatness of the surface of the express parcel is calculated, the server compares the flatness with a standard threshold value, the standard threshold value is a threshold value for judging whether the surface of the express parcel is a flat surface, when the numerical value of the flatness is larger than or equal to the standard threshold value, the surface of the express parcel is judged to be an uneven surface, and when the numerical value of the flatness is smaller than the standard threshold value, the surface of the express parcel is judged to be a flat surface.
It should be noted that the standard threshold value is a value obtained by collecting flatness values of a large number of express package surfaces and performing a large number of calculations, and the standard threshold value can represent a limit value for judging whether the express package surface is a flat surface for a large number of different express packages, and whether the express package surface is flat can be determined by comparing the size relationship between the express package surface and the standard threshold value for a large number of express packages.
In the embodiment of the invention, the flatness of the surface of the express parcel is calculated by adopting a binocular stereoscopic vision algorithm, whether the surface of the express parcel is flat or not is judged by comparing the flatness with a standard threshold value, and the efficiency of identifying the surface flatness of the express parcel is improved.
Referring to fig. 2, another embodiment of the express package surface flatness identification method according to the embodiment of the present invention includes:
201. the method comprises the steps of obtaining a plurality of express parcel pictures for displaying the surfaces of express parcels, and preprocessing the express parcel pictures to obtain a plurality of basic express parcel pictures, wherein the express parcel pictures are pictures shot by imaging equipment at a plurality of different angles;
the method comprises the steps that a server firstly displays pictures of the surface of an express package shot by imaging equipment at a plurality of different angles, and obtains a plurality of shot express package pictures; then, the server normalizes the express parcel pictures by adopting a preprocessing formula to obtain a plurality of basic express parcel pictures, wherein the preprocessing formula is as follows:
Figure BDA0002428190640000101
in the formula: and a' is the pixel value of the basic express parcel picture, and a is the original pixel value of the express parcel picture.
It can be understood that the server needs to analyze the flatness of the surface of the express package by acquiring a plurality of express package pictures displaying the surface of the express package, and the express package pictures need to be preprocessed before being analyzed, so that the preprocessing operation is convenient for the execution of the subsequent steps. The express package pictures are preprocessed, express package picture data are mapped to the range of 0-1, and then a plurality of obtained basic express package pictures are analyzed, so that the subsequent calculation of the server is more convenient and faster. In addition, the imaging device herein is a photographing device such as a camera or a camera capable of taking a clear picture, and the form of the imaging device is not limited in the present application. It should be noted that, here, a plurality of imaging devices are located respectively in the different directions of express delivery parcel, and the angle that different imaging devices shoot the express delivery parcel is different.
202. Selecting any two imaging devices from the multiple imaging devices, wherein the two imaging devices have different angles for shooting the surface of the same express package;
the server selects any two imaging devices from the plurality of imaging devices, and the two imaging devices meet the imaging conditions of the same express parcel surface with different shooting angles.
It should be noted that, according to the demand of binocular stereoscopic vision algorithm, the imaging device that obtains the express delivery parcel picture is two, and the angle that two imaging devices shoot the picture on express delivery parcel surface is different, if: one imaging device is located the upper left side of express delivery parcel, and another imaging device is located the upper right side of express delivery parcel, but the express delivery parcel surface that two imaging devices shot needs to have the same position, and such processing setting is convenient for follow-up correction of carrying out express delivery parcel surface photo, if: suppose that express delivery parcel surface has a arch, and the express delivery parcel surface photo that two imaging device shoot all will have this arch, and two imaging device can not select simultaneously in addition to place the imaging device in different express delivery parcel surface forward directions, if: the imaging devices located in the front and the back of the express package cannot be selected simultaneously, and the express package picture shot by the two imaging devices cannot be guaranteed to contain the same position.
203. Performing equipment calibration on the two imaging devices by adopting a binocular stereo vision algorithm, and acquiring basic parameters of the two imaging devices after the equipment calibration is completed, wherein the basic parameters comprise a focal length, an imaging baseline, a rotation matrix and a translation matrix;
the server performs equipment calibration on the two imaging devices by adopting a binocular stereo vision algorithm, and acquires basic parameters of the two imaging devices after the equipment calibration is completed, wherein the basic parameters comprise a focal length, an imaging baseline, a rotation matrix and a translation matrix. It should be noted that, when two imaging devices with different shooting angles are used, because there is a distance between the two imaging devices to cause a visual difference, when a binocular stereo vision algorithm is used for processing express package images, the two imaging devices need to be calibrated first, and a relative position relationship between the two imaging devices is determined, so that in two express package images shot by the two imaging devices, a relative position relationship exists between any two coordinate systems, and after the two imaging devices are calibrated, a rotation matrix and a translation matrix of the two express package images in the same coordinate system can be obtained, and further, the relative position relationship between the two imaging devices is obtained. In addition, the focal length in the basic parameter is data known to the imaging device, and the imaging baseline is a line connecting the imaging focal points of the two imaging devices.
The two imaging devices positioned at the upper left and the upper right of the express package are marked as an example for explanation: to convert the coordinates under the left camera into the coordinate system under the right camera to determine the rotation matrix R and the translation matrix T. Setting a point P in the space, and the coordinate in the world coordinate system is P w The world coordinate system is a coordinate system established by taking the focus of the left camera as an origin, and the coordinate of P under the coordinate systems of the left camera and the right camera is as follows: the P point coordinates under the left camera are: p 1 =R 1 P w +T 1 Wherein R is 1 A rotation matrix, T, of the known left camera relative to the express parcel obtained by monocular calibration 1 For a translation matrix of a known left camera relative to an express package obtained through monocular calibration, the coordinates of a point P below a right camera are as follows: p is 2 =R 2 P w +T 2 Wherein R is 2 A rotation matrix, T, of the known right camera relative to the express parcel obtained by monocular calibration 2 A translation matrix, known P, relative to the express package obtained by the monocular calibration of the known right camera 2 =RP 1 + T, thus, obtained by calculation
Figure BDA0002428190640000111
T=T 2 -RT 1 And obtaining a rotation matrix and a translation matrix after the equipment calibration.
204. Respectively extracting two basic express parcel pictures of the same express parcel surface shot by two imaging devices, and carrying out image correction on the two basic express parcel pictures according to a polar line correction algorithm and basic parameters to obtain two target express parcel pictures, wherein the two target express parcel pictures are positioned on the same plane;
the server respectively extracts two basic express parcel pictures of the same express parcel surface shot by the two selected imaging devices; according to the polar line correction algorithm, the server rotates two basic express package pictures according to the correction matrix to obtain two target express package pictures, wherein the two target express package pictures are located on the same plane, the correction matrix comprises a first correction matrix and a second correction matrix, and the first correction matrix R is 1 ' is: r' 1 =R rect ×R 1 The second correction matrix R 2 ' is: r' 2 =R rect ×R 2 In the formula:
Figure BDA0002428190640000121
T=[T x T y T z ] T ,e 3 =e 1 ×e 2
R 1 for the rotation matrix of one of the two image-forming devices, R 2 For the rotation matrix of the other of the two image forming apparatuses, R rect For the desired rotation matrix, e 1 ,e 2 ,e 3 Are each R rect The numerical value in (1) is marked, T is a translation matrix after the two imaging devices are calibrated, and T x ,T y ,T z Respectively, are numerical values in T.
It can be understood that the primary task of using the binocular stereo vision algorithm is to measure the distance between the object to be measured and the imaging device, and the formula for the parallax distance is to be used when the imaging device is in an ideal conditionDerived below, this is ideally referred to as: the two imaging image planes are parallel, the imaging base line and the imaging image plane are perpendicular to each other, and the pole is far away from the radio, and the time point (x) 0 ,y 0 ) Corresponding polar line y = y 0 The pole is the intersection of the line connecting the origin of the coordinate systems of the two imaging devices and the imaging image plane. However, in the use of the binocular stereo vision algorithm, two imaging image planes which are completely aligned in a coplanar line do not exist, so that the server needs to perform stereo correction to correct two imaging images which are actually aligned in a non-coplanar line into an imaging image aligned in a coplanar line. Coplanar row alignment here refers to: the two imaged image planes are on the same plane, and when the same point is projected to the two imaged image planes, the point is in the same row of the two pixel coordinate systems.
Express delivery parcel picture that two imaging device of upper left side and upper right side of express delivery parcel were shot with correcting explains as an example: generally, the server needs to make the plane of two express delivery parcel pictures and the line parallel of the coordinate system initial point of imaging device about two, and is specific: the server calculates the required rotation matrix R first rect So that the pole is at infinity, the calculation is as follows:
Figure BDA0002428190640000122
T=[T x T y T z ] T ,e 3 =e 1 ×e 2
e 1 ,e 2 ,e 3 are each R rect T is a translation matrix after the two imaging devices are calibrated, T x ,T y ,T z Are respectively marked by numerical values in T, in order to obtain R rect Then, the server obtains a correction matrix according to a formula, wherein the first correction matrix of the left target express parcel picture is as follows: r' 1 =R rect ×R 1 Wherein R is 1 A rotation matrix of the left imaging device and a second correction matrix R of the right target express parcel picture 2 ' is: r' 2 =R rect ×R 2 ,R 2 And obtaining a final correction matrix for the rotation matrix of the right imaging device.
205. Matching pixel values in the two target express parcel pictures through a global matching algorithm to obtain an express parcel disparity map, wherein the express parcel disparity map is used for displaying three-dimensional information of the surface of the same express parcel;
the method comprises the steps that a server firstly selects a reference pixel point in a target express parcel picture by adopting a global matching algorithm, and establishes a horizontal axis by taking the reference pixel point as a reference, wherein the horizontal axis is a virtual coordinate axis and penetrates through two target express parcel pictures; then the server selects a plurality of candidate pixel points on a horizontal axis from another target express parcel picture, and similarity between the candidate pixel points and the reference pixel points is calculated by adopting an error sum of squares algorithm to obtain a plurality of comparison similarities; and finally, the server screens out the minimum contrast similarity with the minimum numerical value from the multiple contrast similarities, and the candidate pixel points with the minimum contrast similarity are used as corresponding pixel points to obtain an express package disparity map which is used for displaying three-dimensional information of the surface of the same express package. It should be noted that, in order to obtain three-dimensional information of a certain point on the surface of an express package, the server needs to match pixel points in two target express package pictures, and after the target express package pictures are subjected to image correction, corresponding points in the two target express package pictures are in the same row, so that only a matching point needs to be found in the corresponding row during matching.
The method adopts a global variable algorithm to match pixel values in two target express parcel pictures, and the principle of the global variable algorithm is as follows: given that two images needing pixel value matching are available, a point is selected on a given image, a sub-window in the point field is obtained, a window most similar to the sub-window is matched in an area in the other image according to certain similarity, the corresponding pixel point in the obtained matching window is the matching point of the pixel, and then a dense disparity map is output, wherein the disparity map is used for indicating three-dimensional information of the surface of an object in the image. Specifically, when the similarity is calculated, a sum of squared errors (SSD) algorithm is used, and the SSD algorithm determines the similarity of two windows by calculating the sum of squared errors of the two windows, wherein the more similar the two windows are, the smaller the SSD value is, and thus, the pixel values matched with each other in the two images can be obtained.
206. Projecting a disparity map of the express packages, and calculating three-dimensional information of the surfaces of the same express packages to obtain plane information of the surfaces of the same express packages;
the server firstly establishes a projection plane through the express package disparity map, wherein the projection plane is used for indicating any plane parallel to a reference plane in the express package disparity map, and the reference plane is the same plane where two target express package pictures are located; the method comprises the steps of projecting the same express parcel surface on a projection plane, calculating two-dimensional information of the same express parcel surface according to three-dimensional information of the same express parcel surface, and obtaining plane information of the same express parcel surface, wherein the plane information of the same express parcel surface comprises a virtual two-dimensional coordinate axis and two-dimensional coordinates of the same express parcel surface.
After the server matches pixel values in two target express parcel pictures to obtain an express parcel disparity map, the depth between a certain point on the express parcel surface and imaging equipment needs to be calculated, and the depth needs to be calculated through two-dimensional information, so that the obtained express parcel three-dimensional information needs to be converted into two-dimensional information.
For example, selecting a pixel point on the ground from a picture shot By imaging equipment positioned on the upper left of an express package, fitting a space plane Ax + By + Cz = D where the pixel points are located By using a least square method according to express package three-dimensional information in an express package disparity map, wherein a space coordinate system takes an optical center of the imaging equipment on the upper left as an origin, a visual axis as a Z axis, and a base line as a right-hand system of an X axis (the direction is towards a right camera), and for convenience of calculation, a server establishes a virtual two-dimensional coordinate axis of the express package, the virtual two-dimensional coordinate axis takes an intersection point of the space plane and the Z axis as an origin O of a two-dimensional coordinate of the same express package surface, and an intersection point of the virtual two-dimensional coordinate axis and the Z axis as a point on an X axis positive half axis, so that the following coordinate points exist:
O(0,0,D),
Figure BDA0002428190640000141
several coordinate vectors can thus be derived:
Figure BDA0002428190640000142
there is a point S (X) in the known spatial coordinate system s ,Y s ,Z s ),
Figure BDA0002428190640000143
Now it is claimed that the projection point P,. Sup.>
Figure BDA0002428190640000144
In or on>
Figure BDA0002428190640000145
The projection on is recorded as->
Figure BDA0002428190640000146
Specifically, the method comprises the following steps:
Figure BDA0002428190640000147
this gives: />
Figure BDA0002428190640000148
Finally, a value is determined>
Figure BDA0002428190640000149
In or on>
Figure BDA00024281906400001410
And/or>
Figure BDA00024281906400001411
The two-dimensional coordinates on the projection plane can be obtained by the projection.
207. Calculating depths between a plurality of target points and imaging equipment on the surface of the same express package according to the plane information to obtain a plurality of target depths, wherein the plurality of target depths comprise a maximum depth and a minimum depth;
the method comprises the following steps that a server selects a plurality of target points on the surface of the same express package; then the server calculates the depths between a plurality of target points and imaging equipment on the surface of the same express package according to a preset depth formula, basic parameters and plane information to obtain a plurality of target depths, wherein the plurality of target depths comprise a maximum depth and a minimum depth, and the preset depth formula is as follows:
Figure BDA00024281906400001412
in the formula, z is the depth between the target point and the imaging device, f is the focal length of the imaging device, b is the imaging baseline of the two imaging devices, and d is the corresponding relationship between each pixel point between the two imaging devices.
It can be understood that after the server obtains the two-dimensional information of each target point on the surface of the express package, the depth between the target point on the surface of the express package and the imaging device can be calculated, a preset depth formula is obtained according to the similar triangle principle, and the depth between the target point and the imaging device can be calculated by substituting the two-dimensional coordinates of the target point.
For example, calculating the depth between a target point P and two imaging devices on the surface of an express parcel as an example, the server projects the point P onto a projection plane, the point P and the optical centers of the two imaging devices form a straight line, and the intersection points of the two straight lines and the projection plane are respectively P l (x l ,y l ) And P r (x r ,y r ) And P is l And P r Corresponding to each other, the distance between the projection plane and the imaging device is the focal length f, the distance between the two imaging devices is the base line b, and the distance can be obtained according to the principle of similar triangleThe following formula:
Figure BDA0002428190640000151
from these equations it can be derived:
Figure BDA0002428190640000152
d=x l -x r ,/>
Figure BDA0002428190640000153
and bringing in the specific coordinate value of the point P in the two-dimensional coordinate system to obtain the depth z.
208. Calculating the flatness of the surface of the express package through a plurality of target depths, wherein the flatness is the difference value between the maximum depth and the minimum depth;
after the server obtains the target depths between a plurality of target points and imaging equipment on the surface of the express package according to a binocular stereo vision algorithm, the flatness of the surface of the express package is obtained by calculating the difference between the maximum value and the minimum value of the target depths. The flatness of the surface of the express package is judged by the server through calculating the distance between the highest point and the lowest point on the surface of the express package, and the flatness of the express package can further judge whether the express package is regularly packaged. After the flatness of the surface of the express parcel is obtained by the server through calculation, the larger the numerical value of the flatness is, the larger the distance between the highest point and the lowest point on the surface of the express parcel is, the more uneven the surface of the express parcel is, and if the express parcel is not regularly packaged, the problem of damage or deformation of the express parcel easily occurs, so that unnecessary loss is caused. Therefore, the server judges whether the express packages can be placed in the space by fully utilizing the express packages through calculating the surface flatness of the express packages, and the placing space utilization rate is improved.
209. If the numerical value of the flatness is larger than or equal to the standard threshold value, the express parcel surface is judged to be an uneven surface, if the numerical value of the flatness is smaller than the standard threshold value, the express parcel surface is judged to be a flat surface, and the standard threshold value is a limit value for judging whether the express parcel surface is a flat surface.
After the flatness of the surface of the express parcel is calculated, the server compares the flatness with a standard threshold value, wherein the standard threshold value is a limit value for judging whether the surface of the express parcel is a flat surface. It should be noted that the standard threshold value is a value obtained by collecting flatness values of a large number of express package surfaces and performing a large number of calculations, and the standard threshold value can represent a limit value for judging whether the express package surface is a flat surface for a large number of different express packages, and whether the express package surface is flat can be determined by comparing the size relationship between the express package surface and the standard threshold value for a large number of express packages.
In the embodiment of the invention, the flatness of the surface of the express parcel is calculated by adopting a binocular stereoscopic vision algorithm, whether the surface of the express parcel is flat or not is judged by comparing the flatness with a standard threshold value, and the efficiency of identifying the surface flatness of the express parcel is improved.
The above description of the method for identifying the surface flatness of the express package in the embodiment of the present invention, and the following description of the device for identifying the surface flatness of the express package in the embodiment of the present invention refer to fig. 3, where an embodiment of the device for identifying the surface flatness of the express package in the embodiment of the present invention includes:
the preprocessing module 301 is configured to acquire a plurality of express package pictures displaying the surfaces of express packages, and preprocess the express package pictures to obtain a plurality of basic express package pictures, where the express package pictures are pictures shot by imaging devices at different angles;
the first calculating module 302 is configured to calculate depths between a plurality of target points and imaging equipment on the surface of the express package according to the plurality of basic express package pictures and a binocular stereoscopic vision algorithm to obtain a plurality of target depths, where the plurality of target depths include a maximum depth and a minimum depth;
the second calculating module 303 is configured to calculate the flatness of the surface of the express package according to the multiple target depths, where the flatness is a difference between a maximum depth and a minimum depth;
the determination module 304 is configured to determine that the express package surface is an uneven surface if the value of the flatness is greater than or equal to a standard threshold, determine that the express package surface is a flat surface if the value of the flatness is less than the standard threshold, and determine that the standard threshold is a threshold for determining whether the express package surface is a flat surface.
In the embodiment of the invention, the flatness of the surface of the express parcel is calculated by adopting a binocular stereoscopic vision algorithm, whether the surface of the express parcel is flat or not is judged by comparing the flatness with a standard threshold value, and the efficiency of identifying the surface flatness of the express parcel is improved.
Referring to fig. 4, another embodiment of the device for identifying the surface flatness of the express package in the embodiment of the present invention includes:
the preprocessing module 301 is configured to acquire a plurality of express package pictures displaying the surfaces of express packages, and preprocess the express package pictures to obtain a plurality of basic express package pictures, where the express package pictures are pictures shot by imaging devices at different angles;
the first calculating module 302 is configured to calculate depths between a plurality of target points and imaging equipment on the surface of the express package according to the plurality of basic express package pictures and a binocular stereo vision algorithm to obtain a plurality of target depths, where the plurality of target depths include a maximum depth and a minimum depth;
the second calculating module 303 is configured to calculate the flatness of the surface of the express package according to the multiple target depths, where the flatness is a difference between a maximum depth and a minimum depth;
the determination module 304 is configured to determine that the express package surface is an uneven surface if the value of the flatness is greater than or equal to a standard threshold, determine that the express package surface is a flat surface if the value of the flatness is less than the standard threshold, and determine that the standard threshold is a threshold for determining whether the express package surface is a flat surface.
Optionally, the first calculating module 302 includes:
the acquiring unit 3021 is configured to select any two imaging devices from the multiple imaging devices, where angles of the two imaging devices for shooting the surface of the same express package are different;
the device calibration unit 3022 is configured to perform device calibration on the two imaging devices by using a binocular stereo vision algorithm, and obtain basic parameters of the two imaging devices after the device calibration is completed, where the basic parameters include a focal length, an imaging baseline, a rotation matrix, and a translation matrix;
the correction unit 3023 is configured to extract two basic express package pictures of the same express package surface shot by two imaging devices, and perform image correction on the two basic express package pictures according to the polar line correction algorithm and the basic parameters to obtain two target express package pictures, where the two target express package pictures are located on the same plane;
the matching unit 3024 is configured to match pixel values in the two target express parcel pictures by using a global matching algorithm to obtain an express parcel disparity map, where the express parcel disparity map is used to display three-dimensional information of the same express parcel surface;
the projection unit 3025 is configured to project a disparity map of the express package, and obtain plane information of the same express package surface by calculating three-dimensional information of the same express package surface;
the calculating unit 3026 is configured to calculate depths between a plurality of target points and the imaging device on the same express package surface according to the plane information, so as to obtain a plurality of target depths, where the plurality of target depths include a maximum depth and a minimum depth.
Optionally, the correction unit 3023 may be further specifically configured to:
respectively extracting two basic express parcel pictures of the same express parcel surface shot by two imaging devices;
according to the polar line correction algorithm, rotating the two basic express package pictures according to the correction matrix to obtain two target express package pictures, wherein the two target express package pictures are located on the same plane, the correction matrix comprises a first correction matrix and a second correction matrix, and the first correction matrix R 1 ' is: r' 1 =R rect ×R 1 The second correction matrix R 2 ' is: r' 2 =R rect ×R 2 In the formula:
Figure BDA0002428190640000181
T=[T x T y T z ] T ,e 3 =e 1 ×e 2
R 1 rotation matrix for one of two image forming apparatuses, R 2 For the rotation matrix of the other of the two image forming apparatuses, R rect For the desired rotation matrix, e 1 ,e 2 ,e 3 Are each R rect T is a translation matrix after the two imaging devices are calibrated, T x ,T y ,T z Respectively, are numerical values in T.
Optionally, the matching unit 3024 may be further specifically configured to:
selecting a reference pixel point in a target express parcel picture by adopting a global matching algorithm, and establishing a horizontal axis by taking the reference pixel point as a reference, wherein the horizontal axis is a virtual coordinate axis and penetrates through the two target express parcel pictures;
selecting a plurality of candidate pixel points on a horizontal axis from another target express parcel picture, and calculating the similarity between the candidate pixel points and the reference pixel points by adopting an error sum of squares algorithm to obtain a plurality of comparison similarities;
and screening out the minimum contrast similarity with the minimum numerical value from the plurality of contrast similarities, and taking the candidate pixel points with the minimum contrast similarity as corresponding pixel points to obtain an express package disparity map which is used for displaying the three-dimensional information of the surface of the same express package.
Optionally, the projection unit 3025 may be further specifically configured to:
establishing a projection plane through the express package disparity map, wherein the projection plane is used for indicating any plane parallel to the reference plane in the express package disparity map, and the reference plane is the same plane where the two target express package pictures are located;
the method comprises the steps of projecting the same express parcel surface on a projection plane, calculating two-dimensional information of the same express parcel surface according to three-dimensional information of the same express parcel surface, and obtaining plane information of the same express parcel surface, wherein the plane information of the same express parcel surface comprises a virtual two-dimensional coordinate axis and two-dimensional coordinates of the same express parcel surface.
Optionally, the computing unit 3026 may be further specifically configured to:
selecting a plurality of target points on the surface of the same express package;
according to a preset depth formula, basic parameters and plane information, calculating the depth between a plurality of target points and imaging equipment on the surface of the same express package to obtain a plurality of target depths, wherein the plurality of target depths comprise a maximum depth and a minimum depth, and the preset depth formula is as follows:
Figure BDA0002428190640000191
in the formula, z is the depth between the target point and the imaging device, f is the focal length of the imaging device, b is the imaging baseline of the two imaging devices, and d is the corresponding relationship between each pixel point between the two imaging devices.
Optionally, the preprocessing module 301 may be further specifically configured to:
the method comprises the steps of obtaining a plurality of express package pictures for displaying the surfaces of express packages, wherein the express package pictures are pictures shot by imaging equipment at a plurality of different angles;
carrying out normalization processing on the express parcel pictures by adopting a preprocessing formula to obtain a plurality of basic express parcel pictures, wherein the preprocessing formula is as follows:
Figure BDA0002428190640000192
in the formula: and a' is the pixel value of the basic express parcel picture, and a is the original pixel value of the express parcel picture.
In the embodiment of the invention, the flatness of the surface of the express parcel is calculated by adopting a binocular stereo vision algorithm, and whether the surface of the express parcel is flat or not is judged by comparing the flatness with a standard threshold value, so that the efficiency of identifying the flatness of the surface of the express parcel is improved.
The express package surface flatness identification device in the embodiment of the present invention is described in detail in terms of the modular functional entity in fig. 3 and 4, and the express package surface flatness identification device in the embodiment of the present invention is described in detail in terms of hardware processing.
Fig. 5 is a schematic structural diagram of an express package surface flatness identification apparatus according to an embodiment of the present invention, where the express package surface flatness identification apparatus 500 may generate relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 510 (e.g., one or more processors) and a memory 520, one or more storage media 530 (e.g., one or more mass storage devices) storing applications 533 or data 532. Memory 520 and storage media 530 may be, among other things, transient or persistent storage. The program stored on the storage medium 530 may include one or more modules (not shown), each of which may include a sequence of instructions operating on the courier package surface flatness identification apparatus 500. Still further, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the courier package surface flatness identification device 500.
The courier package surface flatness identification apparatus 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input-output interfaces 560, and/or one or more operating systems 531, such as Windows server, mac OS X, unix, linux, freeBSD, and the like. Those skilled in the art will appreciate that the configuration of the courier package surface flatness identification device shown in fig. 5 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The present invention also provides a computer readable storage medium, which may be a non-volatile computer readable storage medium, or a volatile computer readable storage medium, having stored thereon instructions, which, when executed on a computer, cause the computer to perform the steps of the express package surface flatness identification method.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is substantially or partly contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. The express package surface flatness identification method is characterized by comprising the following steps:
the method comprises the steps of obtaining a plurality of express parcel pictures for displaying the surfaces of express parcels, and preprocessing the express parcel pictures to obtain a plurality of basic express parcel pictures, wherein the express parcel pictures are pictures shot by imaging equipment at a plurality of different angles;
according to the plurality of basic express parcel pictures and a binocular stereoscopic vision algorithm, calculating depths between a plurality of target points on the express parcel surface and the imaging equipment to obtain a plurality of target depths, wherein the plurality of target depths comprise a maximum depth and a minimum depth;
calculating the flatness of the surface of the express parcel through the plurality of target depths, wherein the flatness is the difference value between the maximum depth and the minimum depth;
if the numerical value of the flatness is larger than or equal to a standard threshold value, the express package surface is judged to be an uneven surface, if the numerical value of the flatness is smaller than the standard threshold value, the express package surface is judged to be a flat surface, and the standard threshold value is a limit value for judging whether the express package surface is a flat surface.
2. The express parcel surface flatness identification method of claim 1, wherein the calculating a depth between a plurality of target points on the express parcel surface and the imaging device according to the plurality of base express parcel pictures and a binocular stereo vision algorithm to obtain a plurality of target depths, the plurality of target depths including a maximum depth and a minimum depth comprises:
randomly selecting two imaging devices from the multiple imaging devices, wherein the two imaging devices have different angles for shooting the surface of the same express package;
performing equipment calibration on the two imaging devices by adopting a binocular stereo vision algorithm, and acquiring basic parameters of the two imaging devices after the equipment calibration is completed, wherein the basic parameters comprise a focal length, an imaging baseline, a rotation matrix and a translation matrix;
respectively extracting two basic express parcel pictures of the same express parcel surface shot by the two imaging devices, and carrying out image correction on the two basic express parcel pictures according to an epipolar line correction algorithm and the basic parameters to obtain two target express parcel pictures, wherein the two target express parcel pictures are positioned on the same plane;
matching pixel values in the two target express parcel pictures through a global matching algorithm to obtain an express parcel disparity map, wherein the express parcel disparity map is used for displaying three-dimensional information of the surface of the same express parcel;
projecting the express package disparity map, and calculating the three-dimensional information of the surface of the same express package to obtain the plane information of the surface of the same express package;
and calculating the depths between a plurality of target points on the surface of the same express package and the imaging equipment according to the plane information to obtain a plurality of target depths, wherein the plurality of target depths comprise a maximum depth and a minimum depth.
3. The express package surface flatness identification method according to claim 2, wherein the respectively extracting the two imaging devices to take two basic express package pictures of the same express package surface, and performing image correction on the two basic express package pictures according to an epipolar correction algorithm and the basic parameters to obtain two target express package pictures, wherein the two target express package pictures are located on the same plane includes:
respectively extracting two basic express parcel pictures of the same express parcel surface shot by the two imaging devices;
according to an epipolar correction algorithm, rotating the two basic express package pictures according to a correction matrix to obtain two target express package pictures, wherein the two target express package pictures are located on the same plane, the correction matrix comprises a first correction matrix and a second correction matrix, and the first correction matrix R is 1 ' is: r' 1 =R rect ×R 1 The second correction matrix R 2 ' is: r' 2 =R rect ×R 2 In the formula:
Figure FDA0002428190630000021
T=[T x T y T z ] T ,e 3 =e 1 ×e 2
R 1 for the rotation matrix of one of the two image-forming devices, R 2 For the rotation matrix of the other of the two image forming apparatuses, R rect For the desired rotation matrix, e 1 ,e 2 ,e 3 Are each R rect The numerical value in (1) is marked, T is a translation matrix after the two imaging devices are calibrated, and T x ,T y ,T z Respectively, are numerical values in T.
4. The express parcel surface flatness identification method of claim 2, wherein the matching of pixel values in the two target express parcel pictures through a global matching algorithm to obtain an express parcel disparity map, wherein the express parcel disparity map is used for displaying three-dimensional information of the same express parcel surface comprises:
selecting a reference pixel point in a target express parcel picture by adopting a global matching algorithm, and establishing a horizontal axis by taking the reference pixel point as a reference, wherein the horizontal axis is a virtual coordinate axis and penetrates through the two target express parcel pictures;
selecting a plurality of candidate pixel points on the horizontal axis from another target express parcel picture, and calculating the similarity between the candidate pixel points and the reference pixel point by adopting an error sum of squares algorithm to obtain a plurality of comparison similarities;
and screening out the minimum contrast similarity with the minimum numerical value from the plurality of contrast similarities, and taking the candidate pixel points with the minimum contrast similarity as corresponding pixel points to obtain an express package disparity map, wherein the express package disparity map is used for displaying three-dimensional information of the surface of the same express package.
5. The method of claim 4, wherein the projecting the disparity map of the express package and obtaining the plane information of the surface of the same express package by calculating the three-dimensional information of the surface of the same express package comprise:
establishing a projection plane through the express package disparity map, wherein the projection plane is used for indicating any plane parallel to a reference plane in the express package disparity map, and the reference plane is the same plane where the two target express package pictures are located;
and projecting the same express parcel surface on the projection plane, and calculating two-dimensional information of the same express parcel surface according to the three-dimensional information of the same express parcel surface to obtain the plane information of the same express parcel surface, wherein the plane information of the same express parcel surface comprises a virtual two-dimensional coordinate axis and two-dimensional coordinates of the same express parcel surface.
6. The express parcel surface flatness identification method of claim 5, wherein the calculating a depth between a plurality of target points on the same express parcel surface and the imaging device according to the plane information to obtain a plurality of target depths, the plurality of target depths comprising a maximum depth and a minimum depth comprises:
selecting a plurality of target points on the surface of the same express package;
according to a preset depth formula, basic parameters and plane information, calculating the depths between the multiple target points and the imaging device on the surface of the same express package to obtain multiple target depths, wherein the multiple target depths comprise a maximum depth and a minimum depth, and the preset depth formula is as follows:
Figure FDA0002428190630000031
in the formula, z is the depth between the target point and the imaging device, f is the focal length of the imaging device, b is the imaging baseline of the two imaging devices, and d is the corresponding relationship between each pixel point between the two imaging devices.
7. The express package surface flatness identification method according to any one of claims 1 to 6, wherein the obtaining of a plurality of express package pictures showing the express package surface and the preprocessing of the express package pictures are performed to obtain a plurality of basic express package pictures, and the express package pictures are pictures taken by imaging equipment at a plurality of different angles include:
the method comprises the steps of obtaining a plurality of express parcel pictures for displaying the surfaces of express parcels, wherein the express parcel pictures are pictures shot by imaging equipment at a plurality of different angles;
carrying out normalization processing on the express parcel pictures by adopting a preprocessing formula to obtain a plurality of basic express parcel pictures, wherein the preprocessing formula is as follows:
Figure FDA0002428190630000041
in the formula: a' is the pixel value of the basic express parcel picture, and a is the original pixel value of the express parcel picture.
8. The utility model provides an express delivery parcel surface flatness recognition device which characterized in that, express delivery parcel surface flatness recognition device includes:
the system comprises a preprocessing module, a display module and a display module, wherein the preprocessing module is used for acquiring a plurality of express package pictures for displaying the surfaces of express packages, and preprocessing the express package pictures to obtain a plurality of basic express package pictures, and the express package pictures are pictures shot by imaging equipment at a plurality of different angles;
the first calculation module is used for calculating the depth between a plurality of target points on the surface of the express parcel and the imaging equipment according to the plurality of basic express parcel pictures and a binocular stereoscopic vision algorithm to obtain a plurality of target depths, wherein the plurality of target depths comprise a maximum depth and a minimum depth;
the second calculation module is used for calculating the flatness of the surface of the express parcel through the plurality of target depths, and the flatness is the difference value between the maximum depth and the minimum depth;
and the judging module is used for judging that the express package surface is an uneven surface if the flatness value is greater than or equal to a standard threshold value, and judging that the express package surface is a flat surface if the flatness value is smaller than the standard threshold value, wherein the standard threshold value is a threshold value for judging whether the express package surface is a flat surface.
9. The utility model provides an express delivery parcel surface flatness identification equipment which characterized in that, express delivery parcel surface flatness identification equipment includes: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line;
the at least one processor invokes the instructions in the memory to cause the express package surface flatness identification device to perform the express package surface flatness identification method of any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the express package surface flatness identification method according to any one of claims 1-7.
CN202010227450.XA 2020-03-27 2020-03-27 Express package surface flatness identification method, device, equipment and storage medium Active CN111340869B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010227450.XA CN111340869B (en) 2020-03-27 2020-03-27 Express package surface flatness identification method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010227450.XA CN111340869B (en) 2020-03-27 2020-03-27 Express package surface flatness identification method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111340869A CN111340869A (en) 2020-06-26
CN111340869B true CN111340869B (en) 2023-04-11

Family

ID=71182782

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010227450.XA Active CN111340869B (en) 2020-03-27 2020-03-27 Express package surface flatness identification method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111340869B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113221754A (en) * 2021-05-14 2021-08-06 深圳前海百递网络有限公司 Express waybill image detection method and device, computer equipment and storage medium
CN113284137B (en) * 2021-06-24 2023-07-18 中国平安人寿保险股份有限公司 Paper fold detection method, device, equipment and storage medium
CN114061482A (en) * 2021-10-19 2022-02-18 嘉善宇达电子有限公司 Rapid and accurate detection system for sound film size
CN114324168B (en) * 2022-01-04 2024-05-17 广东奥普特科技股份有限公司 Surface defect detection method and system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106981081A (en) * 2017-03-06 2017-07-25 电子科技大学 A kind of degree of plainness for wall surface detection method based on extraction of depth information
CN109540105A (en) * 2017-09-22 2019-03-29 北京印刷学院 A kind of courier packages' grabbing device and grasping means based on binocular vision

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106981081A (en) * 2017-03-06 2017-07-25 电子科技大学 A kind of degree of plainness for wall surface detection method based on extraction of depth information
CN109540105A (en) * 2017-09-22 2019-03-29 北京印刷学院 A kind of courier packages' grabbing device and grasping means based on binocular vision

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李辉 ; .基于虚拟双目视觉的玉米叶片三维重建方法.科技通报.2016,(05),全文. *

Also Published As

Publication number Publication date
CN111340869A (en) 2020-06-26

Similar Documents

Publication Publication Date Title
CN111340869B (en) Express package surface flatness identification method, device, equipment and storage medium
CN109737874B (en) Object size measuring method and device based on three-dimensional vision technology
CN111210468B (en) Image depth information acquisition method and device
Ortin et al. Indoor robot motion based on monocular images
US20180150973A1 (en) Method and Apparatus for Calculating Dual-Camera Relative Position, and Device
JP5955028B2 (en) Image processing apparatus, image processing method, and image processing program
CN107507277B (en) Three-dimensional point cloud reconstruction method and device, server and readable storage medium
JP2011174879A (en) Apparatus and method of estimating position and orientation
US20130272600A1 (en) Range image pixel matching method
US11205281B2 (en) Method and device for image rectification
Mohr et al. Relative positioning from geometric invariants.
CN110825079A (en) Map construction method and device
US11240477B2 (en) Method and device for image rectification
CN111666935B (en) Article center positioning method and device, logistics system and storage medium
CN110336991B (en) Binocular camera-based environment prompting method and device
CN116128966A (en) Semantic positioning method based on environmental object
CN111105467A (en) Image calibration method and device and electronic equipment
CN111915681A (en) External parameter calibration method and device for multi-group 3D camera group, storage medium and equipment
CN110800020B (en) Image information acquisition method, image processing equipment and computer storage medium
Pani Paudel et al. LMI-based 2D-3D registration: From uncalibrated images to Euclidean scene
CN109902695B (en) Line feature correction and purification method for image pair linear feature matching
US10356394B2 (en) Apparatus and method for measuring position of stereo camera
CN112164099A (en) Self-checking and self-calibrating method and device based on monocular structured light
US20230033339A1 (en) Image processing system
Paudel et al. Localization of 2D cameras in a known environment using direct 2D-3D registration

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant