CN115953463A - Package marking method, device and equipment and storage medium - Google Patents

Package marking method, device and equipment and storage medium Download PDF

Info

Publication number
CN115953463A
CN115953463A CN202211627929.8A CN202211627929A CN115953463A CN 115953463 A CN115953463 A CN 115953463A CN 202211627929 A CN202211627929 A CN 202211627929A CN 115953463 A CN115953463 A CN 115953463A
Authority
CN
China
Prior art keywords
determining
target
package
actual scene
express
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.)
Pending
Application number
CN202211627929.8A
Other languages
Chinese (zh)
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.)
Zhejiang Zhuoyun Intelligent Technology Co ltd
Original Assignee
Zhejiang Zhuoyun Intelligent Technology 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 Zhejiang Zhuoyun Intelligent Technology Co ltd filed Critical Zhejiang Zhuoyun Intelligent Technology Co ltd
Priority to CN202211627929.8A priority Critical patent/CN115953463A/en
Publication of CN115953463A publication Critical patent/CN115953463A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Analysis (AREA)

Abstract

The invention discloses a package marking method, a package marking device, package marking equipment and a storage medium. The method comprises the following steps: determining the position information of the package and/or the express bill in the actual scene image acquired by the camera and the corresponding condition of the package and/or the express bill based on a preset example segmentation algorithm; according to the corresponding situation of the packages and/or the express waybills, when the packages are detected to exist in the actual scene image, determining the target packages, and determining whether the express waybills corresponding to the target packages exist or not; if yes, determining an area except for the express bill as a target area in the image area where the target package is located, and determining an optimal position for marking the target package in the target area; according to the mapping relation between the optimal position and the actual scene image and the actual scene monitoring range, the actual position for marking the target package in the actual scene is determined, and the related equipment is controlled to mark the package according to the actual position, so that the efficiency and the accuracy of marking the package can be improved.

Description

Package marking method, device and equipment and storage medium
Technical Field
The invention relates to the field of computers, in particular to a package marking method, device, equipment and storage medium.
Background
The technology of marking packages by an automatic means appears in many application scenes, and with the continuous development of the express delivery industry, the manual marking of each package is extremely labor-consuming.
Therefore, how to automatically determine the optimal position for marking the package and improve the efficiency and accuracy of marking the package is a problem to be solved urgently at present.
Disclosure of Invention
The invention provides a method, a device, equipment and a storage medium for marking a package, which can automatically determine the optimal position for marking the package and improve the efficiency and the accuracy of marking the package.
According to an aspect of the present invention, there is provided a package marking method, including:
determining the position information of the package and/or the express bill in the actual scene image acquired by the camera and the corresponding condition of the package and/or the express bill based on a preset example segmentation algorithm;
according to the corresponding situation of the packages and/or the express waybills, when the packages are detected to exist in the actual scene image, determining a target package, and determining whether the express waybills corresponding to the target package exist;
if so, determining an area except the express bill as a target area in the image area where the target package is located, and determining an optimal position for marking the target package in the target area;
and determining the actual position of marking the target package in the actual scene according to the optimal position and the mapping relation of the size between the actual scene image acquired by the camera and the monitoring range of the camera on the actual scene, and controlling related equipment to mark the package according to the actual position.
According to another aspect of the present invention, there is provided a package marking device comprising:
the system comprises a first determining module, a second determining module and a third determining module, wherein the first determining module is used for determining the position information of a package and/or an express bill in an actual scene image acquired by a camera and the corresponding situation of the package and/or the express bill based on a preset example segmentation algorithm;
the second determining module is used for determining a target parcel and determining whether an express bill corresponding to the target parcel exists or not when detecting that the parcel exists in the actual scene image according to the corresponding situation of the parcel and/or the express bill;
a third determining module, configured to determine, if yes, an area other than the express bill as a target area in the image area where the target package is located, and determine an optimal position for marking the target package in the target area;
and the marking identification module is used for determining the actual position for marking the target package in the actual scene according to the optimal position and the mapping relation of the size between the actual scene image acquired by the camera and the monitoring range of the camera on the actual scene, and controlling related equipment to mark the package according to the actual position.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the method of marking packages according to any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium having stored thereon computer instructions for causing a processor to execute a method of identifying a package according to any one of the embodiments of the present invention.
According to the technical scheme, the position information of a package and/or an express bill in an actual scene image acquired by a camera and the corresponding condition of the package and/or the express bill are determined based on a preset example segmentation algorithm, when the package is detected to exist in the actual scene image according to the corresponding condition of the package and/or the express bill, a target package is determined, whether the express bill corresponding to the target package exists is determined, if yes, an area except the express bill is determined to be a target area in an image area where the target package exists, the optimal position of a target package mark is determined in the target area, the actual position of the target package mark in the actual scene is determined according to the optimal position and the mapping relation of the size between the actual scene image acquired by the camera and the monitoring range of the camera on the actual scene, and related equipment is controlled to mark the package according to the actual position. Through such a mode, can be automatic beat the sign for the parcel, improve the parcel and beat mark efficiency, in addition, can guarantee to beat good sign, neither can shelter from express delivery single information, can not beat the place outside the parcel again, improve the parcel and beat the accuracy of sign.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow chart of a package marking method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a package marking method according to a second embodiment of the present invention;
fig. 3 is a block diagram of a structure of a package identification device according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," "target," "candidate," "alternative," and the like in the description and claims of the invention and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "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.
It should be noted that, with the continuous development of the express delivery industry, packages which have passed through X-ray detection and packages which have not been detected need to be distinguished by means of marking, so as to avoid confusion, in the related art, marking is often performed manually, which is extremely labor-consuming and limits the efficiency of marking packages.
Example one
Fig. 1 is a flowchart of a package marking method according to an embodiment of the present invention, where the embodiment is applicable to a case of marking a package placed in an actual scene, and the method may be executed by a package marking device, where the package marking device may be implemented in a form of hardware and/or software, and the package marking device may be configured in an electronic device. As shown in fig. 1, the package marking method includes:
s101, determining position information of the packages and/or the express waybills in the actual scene images acquired by the camera and corresponding conditions of the packages and/or the express waybills based on a preset example segmentation algorithm.
The Instance segmentation algorithm (Instance segmentation) is an algorithm for performing target detection on an image and acquiring Mask information (Mask) of each target object in the image. An example segmentation algorithm may be, for example, the Mask RCNN algorithm. The actual scene image is an image acquired by a camera through image acquisition of an actual scene in which a parcel and/or an express bill is placed. The position information of the parcel and/or express waybill refers to the position information of the central point of the parcel and/or express waybill in the actual scene image, and the position information can be represented by rectangular coordinates, namely, the distances between the central position of the parcel and/or express waybill and four sides of the actual scene image respectively.
It should be noted that, only the package or the express waybill (for example, the express waybill greatly covers the whole package) can be visible in the actual scene image, both the package and the express waybill can be provided, and for both the package and the express waybill, a corresponding express waybill may be provided on each package, or an express waybill may not be attached to some packages, which is not limited in this respect.
The correspondence of a parcel and/or courier slip may be parcel only, courier slip only, and both parcel and courier slips. Illustratively, for the case that each parcel has a corresponding express bill, if the actual scene image includes parcel 1, parcel 2, express bill 1, and express bill 2, the corresponding case of the parcel and/or the express bill may be that parcel 1 corresponds to express bill 1, and parcel 2 corresponds to express bill 2. To the situation that there is no corresponding express bill on some packages, if the actual scene image contains package 1, package 2 and express bill 1, the corresponding situation of the package and/or the express bill may be that package 1 corresponds to express bill 1, and package 2 has no corresponding express bill.
Optionally, the determining, based on a preset example segmentation algorithm, the position information of the parcel and/or the express waybill in the actual scene image acquired by the camera and the corresponding situation of the parcel and/or the express waybill includes: based on a preset example segmentation algorithm, carrying out segmentation processing on an actual scene image acquired by a camera, determining mask information of a parcel and/or an express bill in the actual scene image, and determining position information of the parcel and/or the express bill in the actual scene image according to the mask information; and according to the position information, dividing the parcels and/or the express waybills in the actual scene image into at least one group, and according to the grouping result, determining the corresponding situation of the parcels and/or the express waybills in the actual scene image.
Optionally, after the actual scene image acquired by the camera is segmented, the category and the corresponding mask information of each target object may be determined according to the processing result, where the target object includes a parcel and/or a courier receipt, that is, the mask information of the parcel and/or the courier receipt in the actual scene image is determined.
It should be noted that, if the actual scene image includes a parcel 1, a parcel 2, and an express bill 1, four sets of mask information may be obtained after the segmentation processing, where the category corresponding to two sets of mask information is the parcel, the category corresponding to one set of mask information is the express bill, and the category corresponding to the last set of mask information is the image background.
Optionally, after determining the mask information of the parcel and/or the express waybill, the mask coordinates of the parcel and/or the express waybill after the noise is removed may be extracted, so as to determine the center position of the parcel and/or the express waybill, that is, determine the position information of the parcel and/or the express waybill in the actual scene image.
Optionally, after the location information of the parcels and/or the express waybills in the actual scene image is determined, for each parcel, a closest distance between the express waybills closest to the parcel location and the parcel may be determined according to the location information, whether the express waybills are inside the parcel may be determined according to a relationship between the closest distance and a preset distance threshold (denoted as k), if the closest distance between the parcel and the express waybills is smaller than k, it is denoted that the express waybills are inside the parcel, and if the closest distance is larger than k, it is denoted that the parcel does not have a corresponding express waybills, so that the parcels and/or the express waybills in the actual scene image are divided into at least one group.
For example, the preset distance threshold k may be set to be the maximum value of the width and height values of the parcel and/or express waybills in the actual scene image.
Optionally, after the position information of the parcels and/or the express waybills in the actual scene image is determined, if the number of the parcels and the express waybills is the same, the parcels and the express waybills are considered to be in one-to-one correspondence, the express waybills closest to the parcels can be determined for each parcel, and the express waybills and the parcels are divided into a group; if the number of the parcels is larger than the number of the express waybills, the parcels which do not contain the express waybills exist, the express waybills and the parcels which are closest to the express waybills can be divided into a group aiming at each express waybills, and each parcel is taken as a group aiming at the parcels which are not matched, so that the parcels and/or the express waybills in the actual scene image are divided into at least one group.
Optionally, after the parcels and/or the waybills in the actual scene image are grouped, the parcels and/or the waybills in each group may be corresponded, that is, the corresponding situation of the parcels and/or the waybills in the actual scene image is determined according to the grouping result.
S102, according to the corresponding situation of the packages and/or the express waybills, when the packages are detected to exist in the actual scene image, the target packages are determined, and whether the express waybills corresponding to the target packages exist is determined.
The target parcel refers to a parcel in an actual scene image.
Optionally, when it is detected that a parcel exists in the actual scene image, each parcel may be determined as a target parcel, and whether an express bill corresponding to the target parcel exists is determined by further combining the corresponding situation of the parcel and/or the express bill. For example, if the actual scene image includes a parcel 1, a parcel 2, and an express waybill 1, and the corresponding situation is that the parcel 1 corresponds to the express waybill 1, it may be determined that an express waybill corresponding to the target parcel exists when the target parcel is the parcel 1, and it may be determined that an express waybill corresponding to the target parcel does not exist when the target parcel is the parcel 2.
Optionally, after determining whether the express waybill corresponding to the target package exists, the method further includes: if the express bill corresponding to the target package does not exist, performing binaryzation on an image area where the target package is located, generating a binaryzation image, and determining a pixel matrix corresponding to the binaryzation image; and determining the optimal position for marking the target package in the image area where the target package is located based on a preset screening rule according to the pixel matrix and a preset identification matrix.
The mark matrix is a preset matrix corresponding to the size of the mark to be marked, and the mark to be marked is a mark printed or covered on the target package.
For example, an identifier matrix with an element of 1 may be set according to the size of the identifier to be marked, and one fourth of the width and height of the target parcel is respectively determined as the number of rows and columns of the identifier matrix, thereby generating the identifier matrix.
Optionally, if it is determined that there is no express waybill corresponding to the target package, a package picture may be extracted from the actual scene image according to a rectangular coordinate (i.e., position information) of the package, that is, an image area where the target package is located is determined, and further, an assignment operation is performed through the type of the mask information to generate a binarization picture, for example, a pixel whose type is the package may be assigned to 255, and a pixel whose type is the background may be assigned to 0, so as to generate a binarization image corresponding to the image area where the target package is located, and generate a corresponding pixel matrix according to a pixel value of each pixel point in the generated binarization image.
Optionally, based on a preset screening rule, determining an optimal position for marking the target package in the image area where the target package is located according to the pixel matrix and the preset identification matrix, where the optimal position includes: taking a preset identification matrix as a sliding window, and performing traversal convolution operation on a pixel matrix of the target image and the preset identification matrix based on a preset step length; determining a sub-area corresponding to a sub-matrix which meets a preset screening rule in the pixel matrix according to the convolution result; and performing communication operation on the sub-areas, determining a communication area, and determining the central position of the communication area as the optimal position of the target parcel marking.
For example, the step length may be set to 1, a pixel matrix corresponding to the identifier matrix and the binarized image is subjected to slider processing, a corresponding pixel sub-matrix after each slider processing is determined, and a dot product operation is performed on the identifier matrix after each slider processing and the corresponding pixel sub-matrix, that is, a traversal convolution operation is performed on the pixel matrix of the target image and a preset identifier matrix.
If the width and the height of the binarized image are w and h, respectively, the number of operations corresponding to the above-described traversal convolution operation for performing the slider processing and performing the dot multiplication is 9/16 (w × h).
For example, the matrix product of each slider process can be represented by the following formula:
Figure BDA0004004349660000081
wherein omega i Representing the matrix product of the i-th slider pass,
Figure BDA0004004349660000082
sub-matrix of pixels representing the ith slider manipulation,U Matrix array Representing a preset identification matrix with elements of 1.
Optionally, according to the matrix product corresponding to each slider processing in the convolution result, a pixel sub-matrix corresponding to the matrix product smaller than the preset screening threshold may be determined, the pixel sub-matrix is removed from the sub-matrix corresponding to the pixel matrix, and the pixel areas corresponding to the remaining sub-matrices meeting the requirements, that is, sub-areas corresponding to the sub-matrices meeting the preset screening rule in the determined pixel matrix, are determined.
For example, the preset filtering threshold may be set to k × w Matrix of ×h Matrix array Wherein w is Matrix array And h Matrix of The number of rows and columns, respectively, of the pixel matrix, k and a predetermined constant value, for example, may be 0.75.
It should be noted that, by screening the matrix product value processed by each slider and eliminating the value smaller than the preset screening threshold, the points of the mask at the original edge can be mapped and deleted, and the binary image of the mask can be compressed.
Optionally, a connected operation may be performed on the binarized image after mask compression, that is, the obtained sub-regions are combined to generate a connected region that can be marked, so that the connected operation on the sub-regions is realized, and the connected region is determined.
Optionally, after the connected region is determined, the central point of the connected region may be determined as the central position to be identified, that is, the central position of the connected region is determined as the optimal position for identifying the target package.
S103, if yes, determining an area except the express bill as a target area in the image area where the target package is located, and determining the optimal position for marking the target package in the target area.
The image area where the target package is located refers to an image area which is obtained by extracting and segmenting an actual scene image and contains at least one of the target package, an express bill on the target package and a background image. The target area is an area which is used for representing that marking is allowed on the target package except for the express waybill.
Optionally, if it is determined that the express waybill corresponding to the target package exists, determining, in the image area where the target package is located, an area other than the express waybill as the target area, and determining, in the target area, an optimal position for marking the target package, includes: according to the mask information of the target parcel and the corresponding express waybill, carrying out binarization on an image area where the target parcel is located to generate a binarized image, and determining an area except the express waybill in the binarized image as a target area; determining a central line corresponding to the target area, performing traversal convolution operation on a pixel matrix corresponding to each central point on the central line and a preset identification matrix, determining a central point position corresponding to the pixel matrix meeting preset screening conditions, and determining the central point position as an optimal position for marking the identification of the target package.
The identifier matrix in the case where the express bill corresponding to the target parcel exists may be the same as or different from the identifier matrix in the case where the express bill corresponding to the target parcel does not exist, which is not limited in the present invention. For example, the width and height of the identification matrix may be set to 3 × 3, and the element of the identification matrix may be set to 1, thereby generating a preset identification matrix.
Optionally, a parcel picture can be extracted according to a rectangular coordinate of the parcel, so as to determine an image area where the target parcel is located, further perform binarization operation on the extracted image area according to mask information, the pixel represents the setting of the parcel to be 255, the pixel represents the setting of the background and the express bill to be 0, so as to generate a binarization image, specifically, the image area where the target parcel is located is binarized according to the mask information of the target parcel and the corresponding express bill, and an implementation mode for generating the binarization image is as follows: and assigning an assignment operation to the image area where the target parcel is located according to the types of the mask information of the target parcel and the corresponding express bill to generate a binaryzation picture.
For example, the step of generating the binarized picture may be: 1) Generating a binary image with the width and the height as same as those of an image area where the target package is located, and setting the pixel value of the binary image to be 0; 2) Mapping the pixel position of the mask type as the package to a binary image according to the type information corresponding to the mask information, and updating and assigning the value to be 255; 3) And mapping the pixel position of which the mask type is the express bill to a binary image according to the type information corresponding to the mask information, and updating and assigning the pixel position to be 0. The blank area with the pixel value of 255 in the binary image obtained through the above steps is the target area.
Optionally, after the target area is determined, traversal convolution operation may be performed on the preset identifier matrix and the pixel matrix corresponding to the target area, that is, based on a preset step length (for example, the step length is 1), slider processing and dot product operation may be performed on the pixel matrix corresponding to the identifier matrix and the target area. The number of times of operation is (w-3) × (h-3), w and h are the width and height of the pixel matrix corresponding to the target area respectively.
Optionally, after performing traversal convolution operation on the preset identification matrix and the pixel matrix corresponding to the target region, an image region corresponding to the case where the product of the dot product is smaller than a preset product threshold (the preset product threshold may be 9, for example) may be eliminated, the pixel value of the target region after the elimination operation is set to 0, the euclidean distance between each pixel point in the target region after the elimination operation is calculated, and the coordinate points which are farthest from the pixel 0 and have a variance of 0 within the 255 pixel range are merged to obtain the center line of the target region.
It should be noted that, if the express delivery unit is located in the middle of the parcel, the determined target area is generally an annular area, the center line corresponding to the target area is an annular center line, and if the express delivery unit is located at the edge of the parcel, the determined target area is generally a U-shaped area, and the center line corresponding to the target area is a U-shaped center line.
Optionally, after determining the center line corresponding to the target area, based on a similar manner to the traversal convolution operation described in the above embodiment of the present invention, the traversal convolution operation may be performed on the pixel matrix corresponding to each center point on the center line and the preset identifier matrix, for example, the preset identifier matrix with an element value of 1 may be subjected to slider processing and dot product operation based on a preset step length according to the principle that the center point is the point of the center line, that is, the traversal convolution operation is performed on the pixel matrix corresponding to each center point on the center line and the preset identifier matrix, and after performing the traversal convolution operation, the position of the corresponding center point when the dot product is the maximum may be determined as the optimal position for marking the identifier for the target package.
Optionally, after the target area is determined, whether the target area meets a preset markable identification condition may be analyzed through a preset rule, if not, it is considered that the express waybill information may be covered during marking, at this time, the subsequent operation of S104 is not performed, and if so, it is indicated that the target area can be marked, and the subsequent operation of S104 is continuously performed.
Specifically, one possible implementation manner for analyzing whether the target region meets the preset markable identification condition is as follows: setting a width matrix and a height matrix as a width matrix and a height matrix corresponding to the target parcel respectively, setting the value of the matrix as 0, and setting the area covered by the identifier corresponding to the target parcel as 255, and recording as a matrix 1; extracting the width and height of a rectangle of a target parcel segmented by an example, setting 255 for a parcel area, setting 0 for a background and an express bill area, and recording as a matrix 2; and comparing the positions 255 of the matrix 1 and the matrix 2 to obtain the number of coordinates 255 of which the numerical values are the same, wherein the percentage of the area of the identification area is less than 0.75, the identification area does not accord with identification, the identification area possibly covers express bill information, and the identification can be marked if the numerical values are more than or equal to 0.75.
And S104, determining the actual position of marking the target package in the actual scene according to the optimal position and the mapping relation of the size between the actual scene image acquired by the camera and the monitoring range of the camera on the actual scene, and controlling related equipment to mark the package according to the actual position.
The optimal position refers to the optimal position for marking the target package in the actual scene image. The actual location refers to the best location identified for the target package in the actual scene.
Optionally, determining a mapping relationship between an actual scene image acquired by the camera and a size of a monitoring range of the camera on the actual scene includes: determining the width and height of an actual scene image acquired by a camera and a corresponding ratio between the width and height of a monitoring range of the camera on the actual scene based on a pinhole imaging principle and a similar triangle principle; and determining the mapping relation of the sizes between the actual scene image acquired by the camera and the monitoring range of the camera to the actual scene according to the ratio.
Illustratively, the ratio rate between the width of the actual scene image captured by the camera and the monitoring range of the actual scene by the camera is wide width Can be expressed by the following formula:
Figure BDA0004004349660000121
wherein, width _ ori fact Is the width of the monitoring range, width _ obj im,g Is the width, width _ ori, of the target object in the preset actual scene image img Refers to the width of the actual scene image.
Illustratively, the ratio rate between the height of the actual scene image captured by the camera and the height of the monitoring range of the camera on the actual scene height Can be expressed by the following formula:
Figure BDA0004004349660000122
wherein height _ ori fact Refers to the height of the monitoring range, height _ obj img Is the height of the target object in the preset actual scene image, height _ ori img Refers to the height of the actual scene image.
Optionally, determining an actual position of the target package marked in the actual scene according to the optimal position and a mapping relationship between the size of the actual scene image acquired by the camera and the size of the monitoring range of the camera on the actual scene, including: determining a width value and a height value of the optimal position between the optimal position in the actual scene image and the image edge; and determining the actual position of marking the target package in the actual scene according to the width value and the height value and the mapping relation between the size of the actual scene image acquired by the camera and the size of the monitoring range of the camera on the actual scene.
Optionally, according to the width value and the height value, and a mapping relationship between the size of the actual scene image acquired by the camera and the size of the monitoring range of the camera on the actual scene, the width value and the height value of the boundary line between the actual position of the mark for the target package in the actual scene and the monitoring range of the actual scene can be determined, and accordingly, the actual position of the mark for the target package in the actual scene can be determined.
For example, the mapping relationship between the width value and the height value of the optimal position in the actual scene image and the image edge, and the width value and the height value of the actual position and the monitoring range boundary line can be represented by the following formula:
top_x fact =top_x img ×rate width
left_y fact =left_y img ×rate heigth
bot_x fact =bot_x img ×rate width
right_y fact =right_y img ×rate heigth
the width value and the height value of the optimal position between the actual scene image and the image edge are specifically as follows: the width value of top edge of the image is top _ x img And the height value from the left edge of the image is left _ y img Width of bottom edge of image is bot _ x img Height value from the right edge of the image is right _ y img Then, the ratio rate of the width of the actual scene image to the width of the monitoring range is combined width And a ratio rate of high to high monitoring range of an actual scene image height The width value and the height value of the boundary line between the actual position and the monitoring range, which marks the target package in the actual scene, can be respectively calculated, namely: the width value of top edge of the monitoring range is top _ x fact And the height value of the left edge of the monitoring range is left _ y fact And the width value of the lower edge of the monitoring range is bot _ x fact The height value of the right edge of the monitored area is right _ y fact
It should be noted that, by using the principle of pinhole imaging and similar triangles, the invention expresses the correlation between the image and the actual scene by a formula, and realizes the mapping between the two.
According to the technical scheme provided by the invention, the positions of the packages and/or the express waybills in the images can be determined through an example segmentation algorithm, the optimal marking positions are further determined for each package, the positions of the marks for the packages in the actual scene are determined based on the mapping relation between the images and the actual scene, and the optimal marking positions can be automatically selected, so that the labor is liberated, the express work efficiency is improved, and the automatic, high-efficiency and high-accuracy package marking scheme is realized.
Example two
Fig. 2 is a flowchart of a package marking method according to a second embodiment of the present invention, and this embodiment provides a preferred example based on the above embodiments.
As shown in fig. 2, the method comprises the following specific steps:
s201, determining the width and height of an actual scene image acquired by a camera based on a pinhole imaging principle and a similar triangle principle, and determining the corresponding ratio between the width and height of the monitoring range of the camera on the actual scene.
S202, according to the ratio, determining the mapping relation between the size of the actual scene image acquired by the camera and the size of the monitoring range of the camera on the actual scene.
S203, based on a preset example segmentation algorithm, segmenting the actual scene image acquired by the camera, determining mask information of the parcel and/or express waybills in the actual scene image, and determining position information of the parcel and/or express waybills in the actual scene image according to the mask information.
And S204, dividing the packages and/or the express waybills in the actual scene image into at least one group according to the position information, and determining the corresponding conditions of the packages and/or the express waybills in the actual scene image according to the grouping result.
S205, according to the corresponding situation of the packages and/or the express waybills, when the fact that the packages exist in the actual scene image is detected, the target packages are determined, whether the express waybills corresponding to the target packages exist is determined, if yes, S206 is executed, and if not, S207 is executed.
S206, if so, determining an area except the express bill as a target area in the image area where the target parcel is located, and determining the optimal position for marking the target parcel in the target area.
Optionally, the image area where the target parcel is located may be binarized according to the mask information of the target parcel and the corresponding express waybill to generate a binarized image, and the area except for the express waybill in the binarized image is determined as the target area; determining a central line corresponding to the target area, performing traversal convolution operation on a pixel matrix corresponding to each central point on the central line and a preset identification matrix, determining a central point position corresponding to the pixel matrix meeting preset screening conditions, and determining the central point position as an optimal position for marking the identification of the target package.
And S207, if the express waybill corresponding to the target parcel does not exist, binarizing the image area where the target parcel is located, generating a binarized image, and determining a pixel matrix corresponding to the binarized image.
And S208, based on a preset screening rule, determining an optimal position for marking the target package in the image area where the target package is located according to the pixel matrix and the preset identification matrix.
Optionally, a preset identification matrix may be used as a sliding window, and a pixel matrix of the target image and the preset identification matrix are subjected to traversal convolution operation based on a preset step length; determining a sub-area corresponding to a sub-matrix which meets a preset screening rule in the pixel matrix according to the convolution result; and performing communication operation on the sub-areas, determining a communication area, and determining the central position of the communication area as the optimal position of the target parcel marking.
S209, according to the optimal position and the mapping relation of the size between the actual scene image acquired by the camera and the monitoring range of the camera to the actual scene, determining the actual position of marking the target package in the actual scene, and controlling related equipment to mark the package according to the actual position.
Alternatively, a width value and a height value of the optimal position between the image edge and the actual scene image can be determined; and determining the actual position of marking the target package in the actual scene according to the width value and the height value and the mapping relation between the size of the actual scene image acquired by the camera and the size of the monitoring range of the camera on the actual scene.
EXAMPLE III
Fig. 3 is a block diagram of a structure of a package identification device according to a third embodiment of the present invention, where the package identification device according to the third embodiment of the present invention is applicable to a case of identifying a package in an actual scene, and the package identification device may be implemented in a form of hardware and/or software, as shown in fig. 3, the device specifically includes: a first determination module 301, a second determination module 302, a third determination module 303, and a marking identification module 304. Wherein,
a first determining module 301, configured to determine, based on a preset instance segmentation algorithm, location information of a parcel and/or an express waybill in an actual scene image acquired by a camera, and a corresponding situation of the parcel and/or the express waybill;
a second determining module 302, configured to determine, according to a correspondence between the parcel and/or the waybill, a target parcel when it is detected that a parcel exists in the actual scene image, and determine whether a waybill corresponding to the target parcel exists;
a third determining module 303, configured to determine, in the image area where the target package is located, an area other than the express delivery order as a target area, and determine, in the target area, an optimal position for marking the target package;
and the marking module 304 is configured to determine an actual position for marking the target package in the actual scene according to the optimal position and a mapping relationship between the size of the actual scene image acquired by the camera and the size of the monitoring range of the camera on the actual scene, and control the relevant device to mark the package according to the actual position.
According to the technical scheme, the position information of a package and/or an express bill in an actual scene image acquired by a camera and the corresponding condition of the package and/or the express bill are determined based on a preset example segmentation algorithm, when the package is detected to exist in the actual scene image according to the corresponding condition of the package and/or the express bill, a target package is determined, whether the express bill corresponding to the target package exists is determined, if yes, an area except the express bill is determined to be a target area in an image area where the target package is located, the optimal position of a target package mark is determined in the target area, the actual position of the target package mark in the actual scene is determined according to the optimal position and the mapping relation of the size between the actual scene image acquired by the camera and the monitoring range of the camera on the actual scene, and related equipment is controlled to mark the package according to the actual position. Through such a mode, can be automatic beat the sign for the parcel, improve the parcel and beat mark efficiency, in addition, can guarantee to beat good sign as far as possible, neither can shelter from express delivery list information, can not beat the place outside the parcel again, improve the parcel and beat the accuracy of sign.
Further, the first determining module 301 is specifically configured to:
based on a preset example segmentation algorithm, carrying out segmentation processing on an actual scene image acquired by a camera, determining mask information of a parcel and/or an express bill in the actual scene image, and determining position information of the parcel and/or the express bill in the actual scene image according to the mask information;
and according to the position information, dividing the parcels and/or the express waybills in the actual scene image into at least one group, and according to a grouping result, determining the corresponding situation of the parcels and/or the express waybills in the actual scene image.
Further, the third determining module 303 is specifically configured to:
according to the mask information of the target parcel and the corresponding express waybill, carrying out binarization on an image area where the target parcel is located to generate a binarized image, and determining an area except the express waybill in the binarized image as a target area;
determining a central line corresponding to a target area, performing traversal convolution operation on a pixel matrix corresponding to each central point on the central line and a preset identification matrix, determining a central point position corresponding to the pixel matrix meeting preset screening conditions, and determining the central point position as an optimal position for marking the identification of the target package.
Further, the above apparatus further comprises:
the fourth determining module is used for carrying out binarization on an image area where the target package is located to generate a binarized image and determining a pixel matrix corresponding to the binarized image if the express waybill corresponding to the target package is determined not to exist;
and the position determining module is used for determining the optimal position for marking the target package in the image area where the target package is located according to the pixel matrix and the preset identification matrix based on a preset screening rule.
Further, the location determination module is specifically configured to:
taking a preset identification matrix as a sliding window, and performing traversal convolution operation on a pixel matrix of the target image and the preset identification matrix based on a preset step length;
determining a sub-area corresponding to a sub-matrix which meets a preset screening rule in the pixel matrix according to the convolution result;
and performing communication operation on the sub-areas, determining a communication area, and determining the central position of the communication area as the optimal position of the target parcel marking.
Further, the above apparatus is further configured to:
determining the width and height of an actual scene image acquired by a camera and a corresponding ratio between the width and height of a monitoring range of the camera on the actual scene based on a pinhole imaging principle and a similar triangle principle;
and determining the mapping relation of the sizes between the actual scene image acquired by the camera and the monitoring range of the camera to the actual scene according to the ratio.
Further, the mark identification module 304 is specifically configured to:
determining a width value and a height value of the optimal position between the optimal position in the actual scene image and the image edge;
and determining the actual position of marking the target package in the actual scene according to the width value and the height value and the mapping relation between the size of the actual scene image acquired by the camera and the size of the monitoring range of the camera on the actual scene.
Example four
Fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention. FIG. 4 shows a schematic block diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 can perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from a storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. Processor 11 performs the various methods and processes described above, such as the package labeling method.
In some embodiments, the package marking method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the package labeling method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the package identification method by any other suitable means (e.g., by way of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method of identifying a package, comprising:
determining position information of the packages and/or the express waybills in the actual scene images acquired by the camera and corresponding conditions of the packages and/or the express waybills based on a preset example segmentation algorithm;
according to the corresponding situation of the packages and/or the express waybills, when the packages are detected to exist in the actual scene image, determining a target package, and determining whether the express waybills corresponding to the target package exist;
if so, determining an area except the express bill as a target area in the image area where the target package is located, and determining an optimal position for marking the target package in the target area;
and determining the actual position of marking the target package in the actual scene according to the optimal position and the mapping relation of the size between the actual scene image acquired by the camera and the monitoring range of the camera on the actual scene, and controlling related equipment to mark the package according to the actual position.
2. The method of claim 1, wherein determining the position information of the parcel and/or express waybill in the actual scene image acquired by the camera and the corresponding situation of the parcel and/or express waybill based on a preset instance segmentation algorithm comprises:
based on a preset example segmentation algorithm, segmenting an actual scene image acquired by a camera, determining mask information of a parcel and/or express bill in the actual scene image, and determining position information of the parcel and/or express bill in the actual scene image according to the mask information;
and according to the position information, dividing the parcels and/or the express waybills in the actual scene image into at least one group, and according to a grouping result, determining the corresponding situation of the parcels and/or the express waybills in the actual scene image.
3. The method of claim 2, wherein determining an area other than the express waybill as a target area in the image area where the target package is located, and determining an optimal location for marking the target package in the target area comprises:
according to the target package and the mask information of the corresponding express bill, performing binaryzation on an image area where the target package is located to generate a binaryzation image, and determining an area except for the express bill in the binaryzation image as a target area;
determining a central line corresponding to a target area, performing traversal convolution operation on a pixel matrix corresponding to each central point on the central line and a preset identification matrix, determining a central point position corresponding to the pixel matrix meeting preset screening conditions, and determining the central point position as an optimal position for marking the identification of the target package.
4. The method of claim 1, wherein determining whether the courier corresponding to the target package exists further comprises:
if the express bill corresponding to the target package does not exist, carrying out binaryzation on an image area where the target package is located, generating a binaryzation image, and determining a pixel matrix corresponding to the binaryzation image;
and determining the optimal position for marking the target package in the image area where the target package is located based on a preset screening rule according to the pixel matrix and a preset identification matrix.
5. The method according to claim 4, wherein determining an optimal position for marking the target parcel in the image area where the target parcel is located based on a preset screening rule according to the pixel matrix and a preset identification matrix comprises:
taking a preset identification matrix as a sliding window, and performing traversal convolution operation on a pixel matrix of the target image and the preset identification matrix based on a preset step length;
determining a sub-area corresponding to a sub-matrix meeting a preset screening rule in the pixel matrix according to the convolution result;
and performing communication operation on the sub-areas, determining a communication area, and determining the central position of the communication area as the optimal position of the target parcel marking.
6. The method of claim 1, further comprising:
determining the width and height of an actual scene image acquired by a camera and a corresponding ratio between the width and height of a monitoring range of the camera on the actual scene based on a pinhole imaging principle and a similar triangle principle;
and determining the mapping relation of the sizes between the actual scene image acquired by the camera and the monitoring range of the camera to the actual scene according to the ratio.
7. The method of claim 6, wherein determining the actual position in the actual scene for marking the target package according to the optimal position and a mapping relationship between the size of the actual scene image acquired by the camera and the monitoring range of the camera on the actual scene comprises:
determining a width value and a height value of the optimal position between the optimal position and the image edge in the actual scene image;
and determining the actual position of marking the target package in the actual scene according to the width value and the height value and the mapping relation between the size of the actual scene image acquired by the camera and the size of the monitoring range of the camera on the actual scene.
8. A package marking device, comprising:
the system comprises a first determining module, a second determining module and a third determining module, wherein the first determining module is used for determining the position information of a package and/or an express bill in an actual scene image acquired by a camera and the corresponding situation of the package and/or the express bill based on a preset example segmentation algorithm;
the second determining module is used for determining a target parcel and determining whether an express bill corresponding to the target parcel exists or not when detecting that the parcel exists in the actual scene image according to the corresponding situation of the parcel and/or the express bill;
the third determining module is used for determining the area except the express bill as the target area in the image area where the target package is located if the target package is located, and determining the optimal position for marking the target package in the target area;
and the marking identification module is used for determining the actual position for marking the target package in the actual scene according to the optimal position and the mapping relation of the size between the actual scene image acquired by the camera and the monitoring range of the camera on the actual scene, and controlling related equipment to mark the package according to the actual position.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the package labeling method of any one of claims 1-7.
10. A computer readable storage medium having stored thereon computer instructions for causing a processor, when executed, to implement the package marking method of any one of claims 1-7.
CN202211627929.8A 2022-12-16 2022-12-16 Package marking method, device and equipment and storage medium Pending CN115953463A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211627929.8A CN115953463A (en) 2022-12-16 2022-12-16 Package marking method, device and equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211627929.8A CN115953463A (en) 2022-12-16 2022-12-16 Package marking method, device and equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115953463A true CN115953463A (en) 2023-04-11

Family

ID=87296499

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211627929.8A Pending CN115953463A (en) 2022-12-16 2022-12-16 Package marking method, device and equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115953463A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116818786A (en) * 2023-06-14 2023-09-29 成都瑞波科材料科技有限公司 Foreign matter detection device and method for optical film and optical film coating device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116818786A (en) * 2023-06-14 2023-09-29 成都瑞波科材料科技有限公司 Foreign matter detection device and method for optical film and optical film coating device

Similar Documents

Publication Publication Date Title
CN114066900A (en) Image segmentation method and device, electronic equipment and storage medium
CN112560862B (en) Text recognition method and device and electronic equipment
CN111625668B (en) Object detection and candidate filtering system
CN112597837A (en) Image detection method, apparatus, device, storage medium and computer program product
CN107895377B (en) Foreground target extraction method, device, equipment and storage medium
CN107808157A (en) A kind of method and device of detonator coding positioning and identification
CN110910445B (en) Object size detection method, device, detection equipment and storage medium
CN112528858A (en) Training method, device, equipment, medium and product of human body posture estimation model
CN116168351B (en) Inspection method and device for power equipment
JP2022543934A (en) Matching method, device, electronic device and computer readable storage medium
CN113378958A (en) Automatic labeling method, device, equipment, storage medium and computer program product
CN113012200B (en) Method and device for positioning moving object, electronic equipment and storage medium
CN114511661A (en) Image rendering method and device, electronic equipment and storage medium
CN111222507A (en) Automatic identification method of digital meter reading and computer readable storage medium
CN114359383A (en) Image positioning method, device, equipment and storage medium
CN115908988A (en) Defect detection model generation method, device, equipment and storage medium
CN115937101A (en) Quality detection method, device, equipment and storage medium
CN112651315A (en) Information extraction method and device of line graph, computer equipment and storage medium
CN115953463A (en) Package marking method, device and equipment and storage medium
CN115861400A (en) Target object detection method, training method and device and electronic equipment
CN115239700A (en) Spine Cobb angle measurement method, device, equipment and storage medium
CN114926849A (en) Text detection method, device, equipment and storage medium
CN114445697A (en) Target detection method and device, electronic equipment and storage medium
CN114299242A (en) Method, device and equipment for processing images in high-precision map and storage medium
CN113705380A (en) Target detection method and device in foggy days, electronic equipment and storage medium

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