Real-time Inventory Monitoring Method and System Based on Barcode Scanning
Through the preprocessing and matching degree calculation of barcode images, the problem of barcode scanning technology identifying errors in inventory monitoring is solved, high-precision and efficient inventory monitoring is achieved, and the accuracy and efficiency of inventory management are improved.
Patent Information
- Application Number
- CN202510667916.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-23
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-05-23
AI Technical Summary
The existing barcode scanning technology is susceptible to external factors such as pollution and wear in inventory monitoring, resulting in identification errors, affecting the accuracy of inventory monitoring results and the correct judgment of inventory status, and thus affecting the efficiency and accuracy of warehousing and allocation decisions.
By pre-processing the barcode image, including contrast enhancement and semantic segmentation, removing noise, extracting effective areas, combining the fit index of the connecting domain and the independence of the stripes, the matching degree between the barcode diagram and the standard barcode diagram is calculated, and the matching of the barcode diagram is evaluated using the information matrix and cosine similarity.
Improve the accuracy and stability of barcode identification, ensure real-time and high-precision of inventory monitoring, and provide high-quality identification results in complex environments.
Smart Images

Figure CN120181763B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of inventory monitoring. More specifically, the present invention relates to a real-time inventory monitoring method and system based on barcode scanning. Background Art
[0002] As a mature and efficient data acquisition technology, barcode scanning technology is applied in fields such as inventory management, commodity tracking, and asset management. Through a barcode scanning system, an enterprise can obtain detailed information about each commodity in real time, such as the type, quantity, warehousing and outbound time of the commodity, etc., greatly improving the accuracy of inventory data. However, in practical applications, real-time inventory monitoring based on barcode scanning still faces many challenges, especially difficulties in inventory quantity update, data consistency, and real-time performance.
[0003] However, when scanning goods for outbound, the barcode is easily affected by external factors such as contamination and wear, resulting in an increase in the difference between the collected real-time barcode image and the standard barcode library. Moreover, when multiple barcodes are partially similar or the damaged areas overlap, the existing simple matching algorithms are difficult to accurately distinguish these barcodes, easily leading to misjudgment or recognition errors. These problems not only affect the accuracy of inventory monitoring results but also hinder the correct judgment of the inventory status, thereby affecting the efficiency and accuracy of warehousing deployment decisions and hindering the efficient flow of goods. Summary of the Invention
[0004] To solve the problem of low accuracy of inventory monitoring results, the present invention provides solutions in the following aspects.
[0005] In a first aspect, the present invention discloses a real-time inventory monitoring method based on barcode scanning, including: collecting a barcode image after preprocessing of goods, obtaining a plurality of connected components in the barcode image based on connected component extraction, calculating the fitting index of any connected component, and taking the mean of the fitting indices of all connected components as the initial matching degree between the barcode image and any standard barcode image; retaining the standard barcode images with an initial matching degree greater than a preset threshold as similar images, for any similar image, constructing an information matrix of any stripe in the similar image, and calculating the independence degree of any stripe according to the information matrix; obtaining the fitting index of each stripe in the barcode image in the same way as the calculation method of the fitting index of the connected component, and calculating the final matching degree between the barcode image and any similar image to complete inventory monitoring; the final matching degree includes: for any similar image, taking the independence degree as a weight, calculating the product of the fitting index of the stripe and the weight, and taking the mean of the accumulated values of all products as the final matching degree between the barcode image and the similar image.
[0006] Preferably, the preprocessed barcode image includes: increasing the clarity of the barcode image through contrast enhancement, removing the background noise of the barcode image through semantic segmentation, extracting the effective area, and taking the effective area as the preprocessed barcode image.
[0007] Preferably, the effective area includes: for any connected region in the barcode image, obtaining the minimum bounding rectangle of the connected region, taking the ratio of the number of pixel points in the connected region to the number of pixel points in the minimum bounding rectangle as the integrity, and taking the connected region with integrity greater than the preset integrity threshold as the effective area.
[0008] Preferably, the effective area includes: for any connected region in the barcode image, using Hough line detection to extract straight lines from the edge of the connected region to obtain several straight lines, obtaining a first straight line, a second straight line, and a third straight line, where the first straight line is perpendicular to the second straight line, and the second straight line is perpendicular to the third straight line; splicing the first straight line, the second straight line, and the third straight line into a rectangle, and taking the region within the rectangle as the effective area.
[0009] Preferably, the fitting index includes: constructing a pixel value sequence of any connected region in the barcode image, and obtaining a standard pixel value sequence at the same position as any connected region in the standard barcode image, calculating the difference sequence between the pixel value sequence and the standard pixel value sequence, obtaining the minimum value and the maximum value in the difference sequence, and taking the ratio of the minimum value to the maximum value as the first ratio; taking the ratio of the number of pixel points in any connected region to the number of pixel points in the standard barcode image as the second ratio; taking the product of the first ratio and the second ratio as the fitting index.
[0010] Preferably, the information matrix includes: calculating the width, length, and refractive index of each stripe in the similarity image, taking any stripe in the similarity image as the target stripe, taking the stripes other than the target stripe in the same similarity image as the reference stripes, respectively calculating the difference between the width of the target stripe and the width of each reference stripe, the difference between the length of the target stripe and the length of each reference stripe, and the difference between the refractive index of the target stripe and the refractive index of each reference stripe, and constructing all the differences into a matrix as the information matrix of the target stripe.
[0011] Preferably, the degree of independence includes: taking any similarity image as the target image, taking the similarity images other than the target image as the reference images, respectively calculating the cosine similarity between the information matrix of any stripe in the target image and the information matrix of any stripe in each reference image, and screening to obtain the minimum value of the cosine similarity, and taking the difference between 1 and the minimum value of the cosine similarity as the degree of independence of any stripe.
[0012] In a second aspect, the present invention discloses a real-time inventory monitoring system based on barcode scanning, including: a processor and a memory, where the memory stores computer program instructions, and when the computer program instructions are executed by the processor, any one of the real-time inventory monitoring methods based on barcode scanning is implemented.
[0013] Advantages of the present invention:
[0014] Through the preprocessing and clarity enhancement of the barcode image, noise is removed and the effective area is extracted, ensuring the high quality and accuracy of the image. Then, based on the fitting index of the connected components and the independence degree of the stripes, the matching degree between the barcode image and the standard barcode image is comprehensively evaluated, improving the accuracy and stability of recognition. By calculating the correlation between the stripes, the consistency between the stripes in the barcode image and the standard barcode image can be accurately determined, thus effectively monitoring the item information in the inventory. This not only improves the real-time performance of inventory monitoring but also provides high-precision recognition results in complex environments. Brief Description of the Drawings
[0015] Figure 1 is a flowchart of the real-time inventory monitoring method based on barcode scanning according to an embodiment of the present invention. Detailed Description of the Embodiments
[0016] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention.
[0017] The following will describe in detail the specific embodiments of the present invention in conjunction with the accompanying drawings.
[0018] Refer to Figure 1 , the real-time inventory monitoring method based on barcode scanning includes steps S1 - S3, which are specifically described below.
[0019] S1: Collect the barcode image after preprocessing the goods, extract several connected components in the barcode image based on the connected components, calculate the fitting index of any connected component, and take the average value of the fitting indexes of all connected components as the initial matching degree between the barcode image and any standard barcode image.
[0020] In one embodiment, to improve the accuracy of barcode recognition, a standard barcode image library is first constructed, which stores multiple standardized barcode patterns. These standard barcode images serve as a reference library for comparing with the actually scanned barcode images.
[0021] First, the barcode image of the goods is collected and preprocessed. During the preprocessing, the clarity of the barcode image is enhanced through contrast enhancement technology to ensure that the barcode lines are more obvious. Subsequently, the background noise in the image is removed using semantic segmentation method, and the effective area of the barcode is accurately extracted, and this effective area is used as the barcode image after preprocessing.
[0022] Among them, the effective area includes: for any connected component in the barcode image, obtain the minimum bounding rectangle of the connected component, and take the ratio of the number of pixel points of the connected component to the number of pixel points of the minimum bounding rectangle as the integrity. The connected component with integrity greater than the preset integrity threshold is used as the effective area.
[0023] By defining the valid region as a connected domain with high integrity, the true barcode region in the barcode image can be effectively screened out. By calculating the integrity of the connected domain and its minimum bounding rectangle, non-barcode regions caused by noise or irregular shapes can be eliminated, ensuring that the extracted valid region is more accurate and stable. This method can remove background noise and avoid interference during the preprocessing process, thereby improving the accuracy and robustness of barcode recognition, playing a key optimization role in barcode scanning and data acquisition in practical applications, especially in scenarios of complex or low-quality images, ensuring efficient and accurate collection of barcodes.
[0024] Calculating the fitting index of any connected domain is equivalent to calculating the degree of fit between the barcode image and the area at the same position of any standard barcode image. First, a pixel value sequence needs to be constructed for the pixel points within the connected domain in the barcode image, and a standard pixel value sequence needs to be constructed for the pixel points within the connected domain at the same position in any standard barcode image. Calculate the difference sequence between the pixel value sequence and the standard pixel value sequence. Based on the difference sequence and the number of pixel points, the fitting index of any connected domain in the barcode image and the connected domain at the same position in any standard barcode image can be calculated, which is used as the fitting index of any connected domain in the barcode image.
[0025] Among them, the fitting index satisfies the relational expression:
[0026] , represents the fitting index of the connected domain , represents the number of pixel points of the connected domain , represents the number of pixel points in the standard barcode image, and represent the minimum value and the maximum value in the difference sequence respectively.
[0027] The fitting index takes into account the number of pixel points and the pixel value difference of the connected domain, and can effectively evaluate the consistency of the connected domain in terms of shape and size. In this way, the quality of the connected domain in the barcode image can be accurately measured, and regions highly consistent with the standard barcode image can be screened out, thereby improving the accuracy of barcode recognition. It helps to accurately identify and exclude misjudgments, ensuring the efficiency and accuracy of data collection.
[0028] For the same standard barcode image, traverse to obtain the fitting index of each connected domain in the barcode image and the connected domain at the corresponding position in this standard barcode image, and take the mean value of the fitting indices of all connected domains as the initial matching degree between the barcode image and any standard barcode image. According to this calculation method, the initial matching degree between the barcode image and each standard barcode image in the standard barcode image library can be obtained.
[0029] In another embodiment, the effective area includes: for any connected domain in the barcode image, use Hough line detection to extract lines from the edges of the connected domain to obtain several lines, and acquire a first line, a second line, and a third line, where the first line is perpendicular to the second line, and the second line is perpendicular to the third line; splice the first line, the second line, and the third line into a rectangle, and use the area within the rectangle as the effective area.
[0030] By combining the boundary of the connected domain with lines, it is possible to effectively extract a rectangular area that meets the standard form from the barcode image, ensuring that the extracted effective area has accurate geometric features and avoiding interference from noise or irregular shapes. This method not only improves the reliability of barcode area extraction but also enhances the recognition accuracy of the barcode image. Especially in complex backgrounds or low-quality images, it ensures that barcode data can be accurately extracted and recognized.
[0031] S2: Retain the standard barcode images with an initial matching degree greater than the preset threshold as similar images. For any similar image, construct an information matrix for any stripe in the similar image, and calculate the independence degree of any stripe according to the information matrix.
[0032] In one embodiment, retain the standard barcode images with an initial matching degree greater than the preset threshold as similar images. There are several stripes in a similar image. Construct an information matrix for each stripe. For the same similar image, calculate the width, length, and refractive index of each stripe in the similar image. Take any stripe in the similar image as the target stripe, and take the stripes other than the target stripe in the same similar image as reference stripes. Calculate the difference between the width of the target stripe and the width of each reference stripe, the difference between the length of the target stripe and the length of each reference stripe, and the difference between the refractive index of the target stripe and the refractive index of each reference stripe. Construct all the differences into a matrix as the information matrix of the target stripe.
[0033] Exemplarily, the information matrix is , denotes the information matrix, denotes the difference in width between the target stripe and reference stripe 1, denotes the difference in width between the target stripe and reference stripe ; denotes the difference in length between the target stripe and reference stripe 1, denotes the difference in length between the target stripe and reference stripe ; denotes the difference in refractive index between the target stripe and reference stripe 1, denotes the difference in refractive index between the target stripe and reference stripe ; denotes the total number of reference stripes.
[0034] Traverse to obtain the information matrix of each stripe. Take any similar image as the target image, and take the similar images other than the target image as reference images. Calculate the cosine similarity between the information matrix of any stripe in the target image and the information matrix of any stripe in each reference image, that is, the cosine similarity between the information matrices of the stripes at the same position in the target image and the reference images, and screen to obtain the minimum value of the cosine similarity. Take the difference between 1 and the minimum value of the cosine similarity as the independence degree of any stripe.
[0035] By screening the minimum value of the cosine similarity and calculating the difference with 1, it can effectively reflect the independence and specificity of the stripes in different images and avoid unnecessary interference between the stripes.
[0036] S3: Similarly, according to the calculation method of the fitting index of the connected domain, obtain the fitting index of each stripe in the barcode image, calculate the final matching degree between the barcode image and any similar image, and complete the inventory monitoring.
[0037] It should be noted that generally, there is a one-to-one correspondence between each connected domain and the stripe in the barcode image. However, in order to ensure the accuracy of the calculation results, it is necessary to obtain the fitting index of each stripe in the barcode image again according to the calculation method of the fitting index of the connected domain.
[0038] In one embodiment, for any similar image, take the independence degree as the weight, calculate the product of the fitting index of the stripe and the weight, and take the average value of the accumulated values of all products as the final matching degree between the barcode image and the similar image.
[0039] Traverse to obtain the final matching degree between the barcode image and each similar image. At this time, the one with the largest final matching degree is the corresponding goods, and thus the real-time inventory monitoring is completed.
[0040] The system includes a processor and a memory. The memory stores computer program instructions. When the computer program instructions are executed by the processor, the real-time inventory monitoring method based on barcode scanning according to the first aspect of the present invention is implemented.
[0041] The system also includes other components well-known to those skilled in the art such as a communication bus and a communication interface. Their settings and functions are known in the art, so they will not be elaborated here.
[0042] It should be pointed out that for those of ordinary skill in the art, without departing from the concept of the present application, several deformations and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.
Claims
1. A real-time inventory monitoring method based on barcode scanning, characterized in that, Including: Collect the barcode image after preprocessing the goods, extract several connected components in the barcode image based on connected component extraction, calculate the fitting index of any connected component, and take the average value of the fitting indexes of all connected components as the initial matching degree between the barcode image and any standard barcode image; Retain the standard barcode images with the initial matching degree greater than the preset threshold as similar images. For any similar image, construct the information matrix of any stripe in the similar image, and calculate the independence degree of any stripe according to the information matrix; Obtain the fitting index of each stripe in the barcode image in the same way as the calculation method of the fitting index of the connected component, calculate the final matching degree between the barcode image and any similar image, and complete the inventory monitoring; The final matching degree includes: for any similar image, take the independence degree as the weight, calculate the product of the fitting index of the stripe and the weight, and take the average value of the accumulated values of all products as the final matching degree between the barcode image and the similar image; The fitting index includes: Construct the pixel value sequence of any connected component in the barcode image, and obtain the standard pixel value sequence at the same position as any connected component in the standard barcode image. Calculate the difference sequence between the pixel value sequence and the standard pixel value sequence, obtain the minimum value and the maximum value in the difference sequence, and take the ratio of the minimum value to the maximum value as the first ratio; Take the ratio of the number of pixel points of any connected component to the number of pixel points in the standard barcode image as the second ratio; Take the product of the first ratio and the second ratio as the fitting index; The independence degree includes: Take any similar image as the target image, and take the similar images other than the target image as the reference images. Calculate the cosine similarity between the information matrix of any stripe in the target image and the information matrix of any stripe in each reference image, and screen to obtain the minimum value of the cosine similarity. Take the difference between 1 and the minimum value of the cosine similarity as the independence degree of any stripe.
2. The real-time inventory monitoring method based on barcode scanning according to claim 1, wherein The preprocessed barcode image includes: Increase the clarity of the barcode image through contrast enhancement, remove the background noise of the barcode image through semantic segmentation, extract the effective area, and take the effective area as the preprocessed barcode image.
3. The real-time inventory monitoring method based on barcode scanning according to claim 2, wherein The effective area includes: For any connected component in the barcode image, obtain the minimum bounding rectangle of the connected component, take the ratio of the number of pixel points of the connected component to the number of pixel points of the minimum bounding rectangle as the integrity, and take the connected component with the integrity greater than the preset integrity threshold as the effective area.
4. The real-time inventory monitoring method based on barcode scanning according to claim 2, wherein, The effective area includes: For any connected component in the barcode image, use the Hough line detection to extract straight lines from the edge of the connected component to obtain several straight lines, and obtain the first straight line, the second straight line and the third straight line, where the first straight line is perpendicular to the second straight line, and the second straight line is perpendicular to the third straight line; Piece together the first straight line, the second straight line and the third straight line into a rectangle, and take the area inside the rectangle as the effective area.
5. The real-time inventory monitoring method based on barcode scanning according to claim 1, characterized in that The information matrix includes: Calculate the width, length, and refractive index of each stripe in the similar figure. Take any stripe in the similar figure as the target stripe, and take the stripes other than the target stripe in the same similar figure as the reference stripes. Calculate the difference between the width of the target stripe and the width of each reference stripe, the difference between the length of the target stripe and the length of each reference stripe, and the difference between the refractive index of the target stripe and the refractive index of each reference stripe. Construct all the differences into a matrix as the information matrix of the target stripe.
6. Real-time inventory monitoring system based on barcode scanning, characterized in that, Including: A processor and a memory, where the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the real-time inventory monitoring method based on barcode scanning according to any one of claims 1-5 is implemented.
Citation Information
Patent Citations
Express bar code image intelligent enhancement method and system based on computer vision
CN116629291A