Reader position adjustment method, electronic device, and storage medium
By acquiring real-time images and calculating deviation information through the control system, and generating position adjustment guidelines, the problem of barcode reader reading failure caused by offset was solved, realizing fast and accurate barcode reader position adjustment, and improving the efficiency and stability of the production line.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HONGYUN HONGHE TOBACCO (GRP) CO LTD
- Filing Date
- 2026-04-23
- Publication Date
- 2026-06-26
Smart Images

Figure CN122287674A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a method for adjusting the position of a barcode reader, an electronic device, and a storage medium. Background Technology
[0002] On high-speed cigarette packaging production lines, multiple industrial barcode readers are fixedly installed at different workstations using brackets. Each reader has a fixed preset scanning area, representing its optimal recognition area. This preset scanning area is marked with a highlighted red box on the user interface. Ideally, when a product reaches its designated workstation, the graphic to be recognized (such as a QR code or barcode) on the product should fall precisely in the center of the preset scanning area, allowing the reader to capture and decode the information contained within the graphic, which can then be used to identify the product. However, vibrations or accidental impacts on high-speed production lines can easily cause physical displacement of the barcode readers. This can result in the preset scanning area deviating from the area of the graphic to be recognized when the product reaches its designated workstation, leading to slow reading speeds or even reading failures, delaying normal production processes, and even causing production line shutdowns. Currently, adjusting the installation position of industrial barcode readers on the production line requires specialized maintenance personnel to interrupt production and use a dedicated computer to connect the equipment for complex software debugging. This process takes several minutes, has a high technical threshold, and severely impacts production efficiency. Summary of the Invention
[0003] This invention provides a method for adjusting the position of a barcode reader, an electronic device, and a storage medium, which can help non-professional operators quickly and accurately adjust the installation position of the barcode reader.
[0004] In a first aspect, the barcode reader position adjustment method provided in this embodiment of the invention is executed by the production line control system. The production line includes barcode readers installed at workstations. The barcode readers are used to identify the graphic to be identified on the product arriving at the workstation. The method includes: In response to a code reading failure signal, the code reader is controlled to acquire a real-time image containing the graphic to be identified; Retrieve a standard reference image acquired by the barcode reader in a standard posture, in which the graphic to be recognized is centered within a preset scanning area; Based on the relative positional relationship between the graphic to be identified and the preset scanning area in the real-time image, the deviation information is calculated; Based on the deviation information, position adjustment guidance information is generated and displayed on the human-machine interface to guide the operator in adjusting the physical position of the barcode reader.
[0005] Secondly, the barcode reader position adjustment device provided in the embodiments of the present invention includes: The acquisition module is used to control the barcode reader to acquire a real-time image containing the graphic to be identified in response to a barcode reader failure signal. The retrieval module is used to retrieve a standard reference image acquired by the barcode reader in a standard posture, wherein the graphic to be recognized is centered within a preset scanning area; The calculation module is used to calculate deviation information based on the relative positional relationship between the graphic to be identified and the preset scanning area in the real-time image; The generation module is used to generate position adjustment guidance information based on the deviation information and display the position adjustment guidance information on the human-machine interface to guide the operator to adjust the physical position of the barcode reader.
[0006] Thirdly, the electronic device provided in the embodiments of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the reader position adjustment method as described in any embodiment of the present invention.
[0007] Fourthly, the computer-readable storage medium provided in the embodiments of the present invention stores computer instructions thereon, the computer instructions being used to cause a processor to execute and implement the reader position adjustment method as in any embodiment of the present invention.
[0008] Fifthly, the computer program product provided in the embodiments of the present invention includes a computer program that, when executed by a processor, implements the reader position adjustment method as described in any embodiment of the present invention.
[0009] In this embodiment of the invention, a real-time image containing the graphic to be identified is acquired, and a standard reference image acquired by the barcode reader in a standard posture is retrieved; based on the relative positional relationship between the graphic to be identified and the preset scanning area in the real-time image, deviation information is calculated; position adjustment guidance information is generated according to the deviation information, and the position adjustment guidance information is displayed on the human-machine interface to guide the operator to adjust the physical position of the barcode reader. It can intuitively and conveniently guide inexperienced operators through real-time images and adjustment guidance information, and realize the rapid calibration of the installation position of the barcode reader installed on the production line without hardware modification. Attached Figure Description
[0010] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a flowchart illustrating a reader position adjustment method provided in an embodiment of the present invention; Figure 2 This is another flowchart illustrating the reader position adjustment method provided in this embodiment of the invention; Figure 3 This is a schematic diagram of a human-computer interaction interface provided in an embodiment of the present invention; Figure 4 This is another flowchart illustrating the reader position adjustment method provided in this embodiment of the invention; Figure 5 This is a schematic diagram of a reader position adjustment device provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0012] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0013] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0014] Figure 1 This is a flowchart illustrating a barcode reader position adjustment method provided in an embodiment of the present invention. The method is executed by the production line control system. The production line includes barcode readers installed at workstations, which are used to identify the graphic to be identified on the products arriving at the workstations. The production line control system can be deployed in electronic equipment, such as computers or servers. This method is applicable to scenarios where the physical installation position of barcode readers used to identify the graphic to be identified on products arriving at workstations needs to be adjusted on-site. (See also...) Figure 1 The reader position adjustment method in this embodiment may include the following steps: Step 101: In response to the code reading fault signal, control the code reader to acquire a real-time image containing the graphic to be identified.
[0015] A barcode reader fault signal indicates that the physical installation position of the barcode reader has shifted, causing the reader to be unable to recognize the graphic to be recognized on the product. The graphic to be recognized is a specific graphic on the product containing key product information. For example, the graphic to be recognized can be a QR code, barcode, etc. The barcode reader can scan the graphic to capture and decode the key product information contained within it, and upload this information to the production line control system. Key product information may include product identification, batch identification, and production date, used for full-process tracking of the product's production. The preset scanning area is the area on the barcode reader's imaging plane where the recognition of the image to be recognized is most effective. Specifically, the preset scanning area can be calibrated using software programs pre-stored in the barcode reader before it leaves the factory. For example, in the image captured by the barcode reader, the preset scanning area is located using a highlighted red frame. The real-time image of the graphic to be recognized is the product image captured by the barcode reader upon arrival at the designated workstation, containing the graphic to be recognized on the product.
[0016] Ideally, when a product on the production line reaches its designated station, the image to be identified on the product should fall clearly and completely in the center of the preset scanning area of the barcode reader installed at that station. However, due to the complex operating conditions on high-speed production lines, vibrations and accidental impacts can easily cause the physical installation position of the barcode reader to shift. This can lead to the image to be identified deviating from the preset scanning area in the reader's imaging plane when the product reaches its designated station, resulting in reading failure. For example, when the barcode reader's mounting bracket rotates, the image to be identified may extend beyond the outer edge of the preset scanning area, causing reading failure; when the mounting bracket descends, the image to be identified may become out of focus, blurry, or even extend beyond the outer edge of the preset scanning area; when the mounting bracket rises, the imaging resolution of the image to be identified in the preset scanning area is low, which can also easily lead to low reading accuracy, slow speed, or even reading failure. When the operator or the automatic detection algorithm deployed by the production control system detects a reader malfunction caused by the inability to recognize the graphic to be recognized on the product, the operator can start the reader position adjustment program through the human-machine interface, so that the production line enters a low-speed operation state. At this time, the production control system will automatically capture a real-time image containing the graphic to be recognized when the product arrives at the workstation.
[0017] Step 102: Retrieve a standard reference image acquired by the barcode reader in a standard posture, in which the graphic to be recognized is centered within a preset scanning area.
[0018] The standard posture refers to the relative spatial pose of the barcode reader relative to the area to be identified on the product after installation and calibration. Specifically, a barcode reader installed in the standard posture ensures that when the product is in a specific preset position, the image to be identified is centered within a preset scanning area on the imaging plane. The standard reference image is a frame captured by the barcode reader in the standard posture, with the image to be identified centered within the preset scanning area. The barcode reader achieves optimal scanning results when the relative positional relationship between the preset scanning area and the image to be identified matches the standard reference image. Specifically, after the barcode reader is installed and calibrated, it can be controlled to capture a frame of standard reference image with the image to be identified centered within the preset scanning area and store it in the storage module of the production control system for retrieval when the barcode reader adjustment program starts.
[0019] Step 103: Calculate the deviation information based on the relative positional relationship between the graphic to be identified and the preset scanning area in the real-time image.
[0020] The relative positional relationship between the graphic to be recognized and the preset scanning area represents the relationship between the position of the graphic to be recognized in the real-time image and the position of the preset scanning area. Specifically, the position of the preset scanning area in the reader's imaging plane is fixed, therefore, the position of the preset scanning area is the same as the position of the preset scanning area in the standard reference image. The relative positional relationship between the graphic to be recognized and the preset scanning area in the real-time image can indirectly reflect the deviation between the position of the graphic to be recognized in the real-time image and the position of the graphic to be recognized in the standard reference image, thus indirectly reflecting the offset of the reader and serving as a basis for adjusting the physical position of the reader.
[0021] The position of the graphic to be identified in the real-time image and the position of the preset scanning area can be represented by the center point coordinates. An edge detection algorithm can be used to identify the edges of the graphic to be identified in the real-time image, and the circumscribed rectangle of the edge of the graphic to be identified can be calculated. The center point coordinates of the graphic to be identified can be calculated based on the vertex coordinates of the circumscribed rectangle. The center point coordinates of the preset scanning area in the standard reference image can be stored in advance and retrieved directly during the calculation process.
[0022] Deviation information is the deviation between the position of the object to be recognized in the real-time image and the position of the preset scanning area. It can typically be represented by the difference between the coordinates of the center point of the preset scanning area in the standard reference image and the coordinates of the center point of the object to be recognized in the real-time image. For example, if the vertex coordinates of the bounding rectangle of the object to be recognized in the real-time image are {(x1,y1), (x2,y2), (x3,y3), (x4,y4)}, then its center point coordinates are (xc,yc), where x_c = (x1 + x2 + x3 + x4) / 4, and y_c = (y1 + y2 + y3 + y4) / 4. The center point coordinates of the preset scanning area are (x0,y0). The horizontal difference Δx = xc - x0 between the center point coordinates of the object to be recognized and the preset scanning area represents the horizontal deviation, and the vertical difference Δy = yc - y0 represents the vertical deviation. The absolute value of the deviation indicates its magnitude, and the sign indicates its direction.
[0023] In one feasible implementation, a deviation detection strategy configured according to the installation method of the barcode reader can be obtained. The deviation detection strategy includes at least one of the following: detecting position deviation and detecting size deviation; and calculating deviation information according to the deviation detection strategy and the relative positional relationship between the graphic to be identified and the preset scanning area in the real-time image.
[0024] Positional deviation can be understood as the offset of the position of the graphic to be recognized in the real-time image and the standard image. Size deviation can be understood as the pixel size deviation of the graphic to be recognized in the real-time image and the standard image. Specifically, positional deviation can be represented by the difference between the center point coordinates of the graphic to be recognized in the real-time image and the center point coordinates of the graphic to be recognized in the standard reference image, or indirectly by the difference between the center point coordinates of the graphic to be recognized and the preset scanning area; size deviation can be represented by the ratio of the pixel area of the graphic to be recognized in the real-time image and the pixel area of the graphic to be recognized in the standard reference image. Size deviation can indirectly reflect the distance difference between the reader and the graphic to be recognized when acquiring the real-time image and the standard reference image. The farther the graphic to be recognized is from the reader, the smaller its imaging area size in the real-time image according to the principle of near-large and far-small; correspondingly, the closer the distance, the larger the imaging size. For example, if the bounding rectangle of the graphic to be identified in the real-time image has a length of w and a width of h, and its area is w × h, while the area of the graphic to be identified in the standard reference image is w0 × h0, then the size deviation can be expressed as (w × h) / (w0 × h0).
[0025] In a feasible real-time approach, for a vertically mounted, pitch-adjustable barcode reader, the deviation detection strategy is to detect positional deviation; for a horizontally mounted, front-back adjustable barcode reader, the deviation detection strategy is to detect dimensional deviation; and for a barcode reader that can be both pitch-adjustable and front-back adjustable, both positional and dimensional deviations can be detected simultaneously.
[0026] Specifically, the pitch angle of a vertically mounted, pitch-adjustable barcode reader is prone to change, causing the position of the graphic to be identified in the real-time image acquired by the reader to shift vertically upwards or downwards relative to its position in the standard reference image. This positional deviation can be represented by the vertical difference between the center coordinates of the graphic to be identified and the center point of the preset scanning area, and the sign of this vertical difference is used to determine the direction of the pitch angle adjustment. For example, when the center point coordinates of the graphic to be identified are (xc, yc), and the center point coordinates of the preset scanning area are (x0, y0), the vertical difference Δy = yc - y0. If Δy > 0, it indicates that the graphic to be identified has shifted upwards relatively. In this case, the pitch angle of the barcode reader can be adjusted downwards, i.e., rotating the barcode reader downwards along a fixed rotation axis to increase the pitch angle, thus causing the position of the graphic to be identified in the real-time image to shift downwards relatively. If Δy < 0, it indicates that the graphic to be identified has shifted downwards relatively. In this case, the barcode reader can be rotated upwards along a fixed rotation axis to decrease the pitch angle, thus causing the position of the graphic to be identified in the real-time image to shift upwards relatively. A horizontally mounted, adjustable barcode reader cannot rotate, but its distance from the graphic to be recognized may vary. This causes the size of the graphic in the real-time image acquired by the reader to differ from its size in the standard reference image. The size deviation can be represented by the ratio of the pixel area of the graphic in the real-time image to the pixel area of the graphic in the standard reference image. If the ratio is greater than 1, it indicates that the pixel area of the graphic in the real-time image is too large. In this case, the reader position can be adjusted backward, moving it further away from the graphic, thus reducing the size of the graphic in the real-time image. If the ratio is less than 1, it indicates that the pixel area of the graphic in the real-time image is too small. In this case, the reader position can be adjusted forward, moving it closer to the graphic, thus increasing the size of the graphic in the real-time image.
[0027] Step 104: Generate position adjustment guidance information based on the deviation information, and display the position adjustment guidance information on the human-machine interface to guide the operator to adjust the physical position of the barcode reader.
[0028] Adjustment guidance information is information that instructs operators to adjust the physical position of the barcode reader. For example, adjustment guidance information could be displayed on the human-machine interface with the message "Please adjust the camera tilt angle upwards".
[0029] Adjustment guidance information can take various forms, including voice prompts, images displayed in the human-machine interface, and animations.
[0030] Specifically, after calculating the deviation information, position adjustment guidance information corresponding to the deviation information can be generated according to a preset strategy. For vertically installed, tilt-adjustable barcode readers, the position deviation can be compared with a preset position deviation threshold. When the position deviation exceeds the deviation threshold, it is determined that the barcode reader's tilt angle needs to be adjusted. Then, based on the direction of the position deviation, it is determined whether the barcode reader's tilt angle needs to be adjusted upwards or downwards. For horizontally installed, forward-backward adjustable barcode readers, the size deviation can be compared with a preset size deviation threshold. When the size deviation exceeds the deviation threshold, it is determined that the barcode reader's position needs to be adjusted. Then, based on the relative magnitude of the size deviation, it is determined whether the barcode reader's position needs to be adjusted forwards or backwards. Finally, adjustment guidance information can be generated according to a preset guidance word template.
[0031] In this embodiment, different deviation checking strategies are selected according to the specific installation location of the barcode reader, and position adjustment guidance information corresponding to the deviation information is generated according to the deviation checking strategy. This enables flexible adaptation between the installation method and the adjustment guidance information, has good scalability, eliminates interference from invalid guidance to operators, and improves the accuracy of adjustment.
[0032] In this embodiment, a real-time image containing the graphic to be identified is acquired, and a standard reference image acquired by the barcode reader in a standard posture is retrieved. Based on the relative positional relationship between the graphic to be identified and the preset scanning area in the real-time image, deviation information is calculated. Position adjustment guidance information is generated according to the deviation information and displayed on the human-machine interface to guide the operator to adjust the physical position of the barcode reader. This allows for intuitive and convenient guidance for inexperienced operators through real-time images and adjustment guidance information, enabling rapid calibration of the barcode reader installation position on the production line without hardware modification.
[0033] The following is combined Figure 2 The method for adjusting the position of the barcode reader provided in the embodiments of the present invention is further explained. Figure 2 This is another schematic flowchart of the reader position adjustment method provided in this embodiment of the invention. (See attached diagram.) Figure 2 The reader position adjustment method in this embodiment may include the following steps: Step 201: In response to the code reading fault signal, control the code reader to acquire a real-time image containing the graphic to be identified.
[0034] Step 202: Retrieve a standard reference image acquired by the barcode reader in a standard posture, in which the graphic to be recognized is centered within a preset scanning area.
[0035] In one feasible implementation, before retrieving the standard reference image acquired by the barcode reader in a standard posture, where the graphic to be recognized is centered within a preset scanning area, the barcode reader can be controlled to acquire an image where the graphic to be recognized is completely centered within the preset scanning area while in a standard posture, thus obtaining a standard reference image; the coordinates of the center point of the preset scanning area in the standard reference image are recorded; and the imaging area of the graphic to be recognized in the standard reference image is calculated and stored. When subsequently calculating the longitudinal difference between the center point coordinates of the graphic to be recognized in the real-time image and the center point coordinates of the preset scanning area, the stored center point coordinates and the imaging area of the graphic to be recognized in the standard reference image can be directly retrieved.
[0036] In one feasible implementation, a deviation detection strategy configured according to the installation method of the barcode reader can be obtained. The deviation detection strategy includes at least one of the following: detecting position deviation and detecting size deviation. For a vertically mounted barcode reader that is tilt-adjustable, the deviation detection strategy is to detect position deviation and generate corresponding adjustment guidance information based on the position deviation, i.e., execute steps 203 to 206. For a horizontally mounted barcode reader that is front-to-back adjustable, the deviation detection strategy is to detect size deviation and generate corresponding adjustment guidance information based on the size deviation, i.e., execute steps 207 to 209. For a barcode reader that is both tilt-adjustable and front-to-back adjustable, position deviation and size deviation can be detected simultaneously, i.e., execute steps 203 to 206 and steps 207 to 209 simultaneously.
[0037] Step 203: Extract the coordinates of the center point of the graphic to be identified in the real-time image.
[0038] In one feasible implementation, the real-time image can be grayscaled to obtain a grayscale image; the grayscale image can be binarized to obtain a binary image; contour extraction can be performed on the binary image to extract image contour information; based on the image contour information, a rectangular region that conforms to the features of the graphic to be identified can be identified, and the center point coordinates of the graphic to be identified can be determined according to the identification result.
[0039] Specifically, if the acquired real-time image is a color image, it can be converted into a grayscale image. An adaptive thresholding algorithm is then used to automatically calculate the optimal segmentation threshold based on the histogram of the grayscale image, transforming it into a binary image to further highlight the part of the image to be identified. Grayscale and binarization of the real-time image reduces subsequent computation and avoids noise and color interference. Subsequently, pixels in the binary image with drastic changes in grayscale values are identified, representing the image contour of the image to be identified. Alternatively, the grayscale image can be directly extracted using edge detection algorithms such as the Canny algorithm without binarization. Based on this contour information, the binary image is then filtered. For example, for a square QR code, a rotating minimum area bounding box algorithm is used to identify a rectangular region with an aspect ratio close to 1:1. Finally, the four vertices of the bounding box are arranged clockwise to obtain the boundary coordinates of the image to be identified. The X-axis and Y-axis coordinates of the boundary coordinates are then averaged to obtain the center point coordinates of the image.
[0040] Step 204: Calculate the vertical difference between the center point coordinates of the graphic to be identified in the real-time image and the center point coordinates of the preset scanning area.
[0041] The vertical difference is the algebraic difference between the ordinate of the center point of the graphic to be identified in the real-time image and the ordinate of the center point of the preset scanning area in the standard reference image. Its positive or negative sign indicates the adjustment method of the scanning direction of the barcode reader in the vertical direction.
[0042] Step 205: When the longitudinal difference is negative and the absolute value of the longitudinal difference is greater than the position adjustment threshold, generate guidance information prompting the reader to adjust the tilt angle upwards.
[0043] The position adjustment threshold is a preset maximum offset between the longitudinal difference between the center point coordinates of the graphic to be recognized in the real-time image and the center point coordinates of the preset scanning area. It determines whether the deviation between the reader's current pitch angle and the standard pitch angle reaches a preset tolerance value requiring manual adjustment. When the longitudinal deviation exceeds the position adjustment threshold, the reader's recognition accuracy and speed will significantly decrease. Specifically, the position adjustment threshold can be dynamically set based on the reader's field of view, the imaging size of the graphic to be recognized, or the imaging size of the preset scanning area. Field tests are used to determine when the reader's recognition accuracy begins to decrease significantly when the position deviation exceeds this threshold. For example, the position adjustment threshold can be 5% of the height of the preset scanning area in the standard reference image; that is, when the imaging height of the preset scanning area is 200 pixels, the position adjustment threshold is 10 pixels.
[0044] Specifically, a negative vertical difference indicates that the position of the graphic to be identified is vertically downward in the real-time image. This means that the reader's tilt angle is too large, and the reader's lens needs to be tilted upward to move the position of the graphic to be identified upward. For example, the adjustment guidance information could be "Please adjust the camera tilt angle upward."
[0045] Step 206: If the longitudinal difference is positive and the absolute value of the longitudinal difference is greater than the position adjustment threshold, generate guidance information prompting the reader to adjust the tilt angle downwards.
[0046] Specifically, a positive vertical difference indicates that the position of the graphic to be recognized in the real-time image is vertically too high. This means that the reader's tilt angle is too small, and the reader's lens needs to be lowered to move the position of the graphic downwards. For example, the adjustment guidance information could be "Please adjust the camera tilt angle downwards".
[0047] Step 207: Calculate the ratio of the imaging area of the graphic to be identified in the real-time image to the standard area of the graphic to be identified in the standard reference image, and obtain the area ratio.
[0048] In one feasible implementation, the real-time image can be converted to grayscale to obtain a grayscale image; the grayscale image can be binarized to obtain a binary image; contour extraction can be performed on the binary image to extract image contour information; a rectangular region conforming to the features of the graphic to be identified can be identified based on the image contour information, and the boundary coordinates of the graphic to be identified can be determined according to the identification result. The imaging area of the graphic to be identified in the real-time image can be calculated based on the boundary coordinates of the graphic to be identified. For example, the pixel length and pixel width of the rectangular region can be calculated first based on the boundary coordinates of the graphic to be identified, and then the pixel area of the graphic to be identified can be calculated according to the area formula. Then, the ratio of the pixel area of the graphic to be identified to the pixel area of the graphic to be identified in the pre-stored standard reference image can be calculated to obtain the area ratio.
[0049] Step 208: If the area ratio is greater than the standard ratio and the deviation between the area ratio and the standard ratio is greater than the size adjustment threshold, generate guidance information prompting the reader position to be adjusted backward.
[0050] The standard ratio is the ratio of the area of the graphic to be recognized in the real-time image to the area of the graphic to be recognized in the standard reference image under ideal conditions. It is generally set to 1, meaning that the area of the graphic to be recognized in the real-time image is equal to the area of the graphic to be recognized in the standard reference image. The size adjustment threshold determines whether the deviation between the current distance between the barcode reader and the graphic to be recognized and the standard distance reaches a preset tolerance value that requires manual adjustment. When the deviation between the area ratio and the standard ratio is greater than the size adjustment threshold, the recognition accuracy and speed of the barcode reader will decrease significantly. Specifically, the size adjustment threshold also needs to be determined through field testing. For example, the size deviation threshold can be set to 5%, meaning that when the area ratio is greater than 105% or less than 95%, the barcode reader position needs to be adjusted.
[0051] Specifically, based on the imaging principle of objects appearing larger when closer and smaller when farther away, if the area ratio is greater than the standard ratio and the deviation between the area ratio and the standard ratio exceeds the size adjustment threshold (e.g., the area ratio is greater than 105%), it indicates that the image to be recognized in the real-time image is too large, meaning the installation distance between the barcode reader and the image to be recognized is too small. In this case, the barcode reader needs to be moved backward. For example, the adjustment guidance information could be "Please adjust the camera position backward."
[0052] Step 209: If the area ratio is less than the standard ratio and the deviation between the area ratio and the standard ratio is greater than the size adjustment threshold, generate guidance information prompting the reader position to be adjusted forward.
[0053] Specifically, if the area ratio is less than the standard ratio and the deviation between the area ratio and the standard ratio is greater than the size adjustment threshold (e.g., the area ratio is less than 95%), it indicates that the graphic to be recognized in the real-time image is too small, meaning the installation distance between the barcode reader and the graphic to be recognized is too small. In this case, the barcode reader needs to be moved backward. For example, the adjustment guidance information could be "Please adjust the camera position forward".
[0054] Step 210: Display the real-time image and the standard reference image side-by-side on the human-computer interaction interface.
[0055] Specifically, real-time images and standard images can be displayed side-by-side on the human-computer interaction interface. For example, the human-computer interaction page can be arranged in a dual-viewport left-right column layout, with the real-time image displayed on the left and the standard reference image displayed on the right. The scaling ratio of the two images is equal, ensuring that the absolute display size of the image to be identified is consistent in both images, and that the top and bottom heights are aligned, making it easy for the naked eye to compare differences in area and position.
[0056] Step 211: Overlay and display the marker box at the corresponding coordinate position of the preset scanning area in the real-time image, and overlay and display the marker box at the corresponding coordinate position of the preset scanning area in the standard reference image, so that the display position of the marker box corresponds in the two images.
[0057] The display marker box is a rendered frame in the image display layer of the human-computer interaction interface, used to indicate the corresponding position of the preset scanning area in the real-time image and the standard reference image. Specifically, the coordinate position of the preset scanning area in the real-time image and the standard reference image is consistent in the imaging plane of the barcode reader. The display marker box can take several forms, such as drawing a highlighted red frame at the edge of the preset scanning area, or overlaying a dark semi-transparent layer mask outside the preset scanning area for reverse marking.
[0058] In this embodiment, the real-time image and the standard reference image are displayed side-by-side on the human-computer interaction interface. A marker box is superimposed on the corresponding coordinate position of the preset scanning area in the real-time image, and a marker box is superimposed on the corresponding coordinate position of the preset scanning area in the standard reference image, so that the display position of the marker box in the two images corresponds, which can provide more intuitive visual guidance and provide real-time visual feedback based on the operator's adjustment results, so that the operator can judge and further adjust the operation action on their own.
[0059] Step 212: Obtain the set position convergence threshold and size convergence threshold.
[0060] The positional convergence threshold is used to determine whether the longitudinal deviation between the coordinates of the center point of the graphic to be recognized and the coordinates of the center point of the preset scanning area is within an acceptable error range after the operator adjusts the reader's posture. The size convergence threshold is used to determine whether the deviation between the area ratio of the graphic to be recognized in the real-time image and the standard reference image and the standard ratio is within an acceptable error range. When the longitudinal deviation is less than the positional convergence threshold and the deviation between the area ratio and the standard ratio is less than the size convergence threshold, the reader's reading accuracy and efficiency are within an acceptable range, and no further adjustment is needed.
[0061] Step 213: If the preset frame images meet the preset conditions, determine that the reader position adjustment is complete.
[0062] A preset frame is a number of consecutive real-time image frames acquired by the operator after adjusting the barcode reader's position to determine whether the adjustment is complete. Specifically, when the operator manually determines that the barcode reader's physical position adjustment is complete, an adjustment completion signal can be issued, temporarily resuming normal production line operation. At this time, real-time images of the preset frame are continuously acquired, and each acquired real-time image is judged to meet preset conditions. If all real-time images meet the conditions, the barcode reader's position adjustment is determined to be complete. For example, assuming the barcode reader's acquisition frequency is 60 frames per second and the production line's operating speed is 300 pieces per minute, the preset frame can be set to 10 to 15 frames.
[0063] The preset conditions are the conditions that the continuously acquired preset frame real-time images must meet when the reader position adjustment is completed. These preset conditions include: the absolute value of the vertical difference between the center point coordinates of the graphic to be identified in the real-time image and the center point coordinates of the preset scanning area is less than or equal to the position convergence threshold; and the deviation between the ratio of the imaging area of the graphic to be identified in the real-time image and the imaging area of the graphic to be identified in the standard reference image and the standard ratio is less than or equal to the size convergence threshold.
[0064] For example, Figure 3 This is a schematic diagram of a human-computer interaction interface provided in an embodiment of the present invention. (See attached diagram.) Figure 3 The interface has three buttons at the bottom: "Start Diagnosis," "Confirm Calibration," and "Exit Mode." Clicking "Start Diagnosis" initiates the reader position adjustment program. The real-time image and the standard reference image are displayed side-by-side. The preset scanning area is marked with a dashed box, and the graphic to be recognized is the rectangular shaded area in the image. The real-time image is located on the left side of the human-machine interface, with the rectangular shaded area positioned slightly higher and extending beyond the upper edge of the dashed box. The standard reference image is located on the left side of the human-machine interface, with the rectangular shaded area centered within the dashed box. During adjustment, the real-time image on the human-machine interface updates dynamically and synchronously. Simultaneously, the "Operation Guide" box at the bottom of the human-machine interface displays guidance information dynamically determined in real-time based on the real-time and standard reference images, forming a closed loop of "observation-judgment-adjustment-feedback." When the operator recognizes that the real-time image status is basically consistent with the standard reference image, they can click "Confirm Calibration" to trigger the barcode reader position adjustment program to continuously collect several frames of real-time images of the product running to the designated workstation, and determine whether the barcode reader position adjustment is complete. If the adjustment is not complete, the guidance information is updated and the operator is instructed to continue the adjustment. When the adjustment is complete, the operator is prompted that "Adjustment Complete". The operator can click "Exit Mode" to end the barcode reader position adjustment program, so that the production line can resume normal production.
[0065] Figure 4 This is another flowchart illustrating the reader position adjustment method provided in this embodiment of the invention. (See attached diagram.) Figure 4After the production control system starts running, it first completes the benchmark calibration, that is, it collects and stores the standard reference image information. Then, the barcode reader position adjustment program enters the real-time monitoring loop. First, it acquires the real-time image and calculates the real-time position of the QR code. Then, it judges whether the position deviation exceeds the position adjustment threshold. If it exceeds the position adjustment threshold, it triggers an alarm on the human-machine interface and displays a graphical calibration guide for the operator to make manual adjustment. After that, it judges again whether the position deviation has been eliminated. If it has not been eliminated, it readjusts. If it has been eliminated, the alarm is lifted, the calibration is completed, and finally it returns to the real-time monitoring loop to continue running.
[0066] In this embodiment, the coordinates of the center point of the graphic to be recognized in the real-time image are extracted, and the vertical difference between the coordinates of the center point of the graphic to be recognized in the real-time image and the coordinates of the center point of the preset scanning area is calculated. If the absolute value of the vertical difference is greater than the position adjustment threshold, guidance information for adjusting the reader's pitch angle is generated based on the sign of the vertical difference. The ratio of the imaging area of the graphic to be recognized in the real-time image to the standard area of the graphic to be recognized in the standard reference image is calculated to obtain the area ratio. If the deviation between the area ratio and the standard ratio is greater than the size adjustment threshold, guidance information for adjusting the reader's position is generated based on the relative size relationship between the area ratio and the standard ratio. This reduces the amount of calculation and transforms the positional deviation of the graphic to be recognized in the image acquired by the reader into an operation instruction that the operator can understand, thus lowering the technical threshold for reader position adjustment. The real-time image and the standard reference image are displayed side-by-side on the human-computer interaction interface. The system overlays and displays identification boxes at the corresponding coordinate positions of the preset scanning area in both the real-time image and the standard reference image, providing more intuitive visual guidance and real-time visual feedback based on the operator's adjustment results. This allows operators to judge the magnitude of their adjustment actions independently. The system determines that the barcode reader position adjustment is complete when the absolute value of the vertical difference between the center point coordinates of the graphic to be recognized in the real-time image and the center point coordinates of the preset scanning area is less than or equal to the position convergence threshold, and the deviation between the ratio of the imaging area of the graphic to be recognized in the real-time image and the imaging area of the graphic to be recognized in the standard reference image and the standard ratio is less than or equal to the size convergence threshold. This automatically determines whether the barcode reader's installation position meets the requirements for normal operation of the industrial production line after manual adjustment, achieving automated acceptance of the adjustment results. This further ensures the accuracy of the adjustment and prevents unqualified position adjustment operations from causing repeated start-ups and shutdowns of the production line.
[0067] Figure 5 This is a schematic diagram of a reader position adjustment device provided in an embodiment of the present invention, as shown below. Figure 5 As shown, the device includes: The acquisition module 301 is used to control the barcode reader to acquire a real-time image containing the graphic to be identified in response to a barcode reading fault signal. The retrieval module 302 is used to retrieve a standard reference image acquired by the barcode reader in a standard posture, wherein the graphic to be recognized is centered within a preset scanning area. The calculation module 303 is used to calculate deviation information based on the relative positional relationship between the graphic to be identified and the preset scanning area in the real-time image; The generation module 304 is used to generate position adjustment guidance information based on the deviation information and display the position adjustment guidance information on the human-machine interface to guide the operator to adjust the physical position of the barcode reader.
[0068] In one embodiment, the generation module 304 displays position adjustment guidance information on the human-computer interaction interface, including: The real-time image and the standard reference image are displayed side-by-side on the human-computer interaction interface. A marker box is superimposed at the corresponding coordinate position of the preset scanning area in the real-time image, and a marker box is superimposed at the corresponding coordinate position of the preset scanning area in the standard reference image, so that the display position of the marker box corresponds in the two images.
[0069] In one embodiment, the calculation module 303 includes: The deviation acquisition submodule is used to acquire the deviation detection strategy configured according to the installation method of the barcode reader. The deviation detection strategy includes at least one of the following: detecting position deviation and detecting size deviation. The deviation calculation submodule is used to calculate deviation information according to the deviation detection strategy and the relative positional relationship between the graphic to be identified and the preset scanning area in the real-time image.
[0070] In one embodiment, the deviation calculation submodule, when the deviation detection strategy is to detect position deviation, calculates deviation information including: Extract the coordinates of the center point of the graphic to be identified in the real-time image; Calculate the longitudinal difference between the center point coordinates of the graphic to be identified in the real-time image and the center point coordinates of the preset scanning area.
[0071] In one embodiment, the generation module 304 generates position adjustment guidance information based on the deviation information, including: When the longitudinal difference is negative and the absolute value of the longitudinal difference is greater than the position adjustment threshold, a prompt message is generated to adjust the reader's pitch angle upwards. If the longitudinal difference is positive and the absolute value of the longitudinal difference is greater than the position adjustment threshold, a prompt message is generated to adjust the reader's tilt angle downwards.
[0072] In one embodiment, the deviation calculation submodule, when the deviation detection strategy is to detect dimensional deviation, calculates deviation information, including: The ratio of the area of the graphic to be identified in the real-time image to the standard area of the graphic to be identified in the standard reference image is calculated to obtain the area ratio.
[0073] In one embodiment, the generation module 304 generates position adjustment guidance information based on the deviation information, including: If the area ratio is greater than the standard ratio and the deviation between the area ratio and the standard ratio is greater than the size adjustment threshold, a prompt message is generated to adjust the reader position backward. If the area ratio is less than the standard ratio and the deviation between the area ratio and the standard ratio is greater than the size adjustment threshold, a prompt message is generated to guide the reader to be adjusted forward.
[0074] In one embodiment, when the deviation detection strategy includes detecting both positional deviation and dimensional deviation, the device further includes a determination module for: Obtain the set position convergence threshold and size convergence threshold; If the preset frame images meet the preset conditions in a continuous series, it is determined that the reader position adjustment is complete; The preset conditions include: the absolute value of the vertical difference between the center point coordinates of the graphic to be identified in the real-time image and the center point coordinates of the preset scanning area is less than or equal to the position convergence threshold, and the deviation between the ratio of the imaging area of the graphic to be identified in the real-time image and the imaging area of the graphic to be identified in the standard reference image and the standard ratio is less than or equal to the size convergence threshold.
[0075] In one embodiment, the device further includes a preprocessing module for calculating deviation information based on the relative positional relationship between the graphic to be identified and a preset scanning area in a real-time image: The real-time image is converted to grayscale to obtain a grayscale image; Binarize the grayscale image to obtain a binary image; Extract the contour information from a binary image; Based on image contour information, a rectangular region matching the features of the graphic to be identified is identified, and the boundary coordinates and center point coordinates of the graphic to be identified are determined according to the identification results. Among them, the boundary coordinates of the graphic to be identified in the real-time image are used to calculate the imaging area of the graphic to be identified in the real-time image.
[0076] In one embodiment, the device further includes a storage module for retrieving a standard reference image acquired by the reader in a standard orientation, wherein the graphic to be identified is centered within a preset scanning area: With the barcode reader in a standard orientation, control the barcode reader to acquire an image of the graphic to be recognized that is completely centered within the preset scanning area, and obtain a standard reference image; Record the coordinates of the center point of the preset scan area in the standard reference image; Calculate and store the imaging area of the shape to be identified in the standard reference image.
[0077] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional modules is merely an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the functional modules described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0078] The device of this invention acquires a real-time image containing a graphic to be identified and retrieves a standard reference image acquired by the barcode reader in a standard posture; it calculates deviation information based on the relative positional relationship between the graphic to be identified and the preset scanning area in the real-time image; it generates position adjustment guidance information based on the deviation information and displays the position adjustment guidance information on the human-machine interface to guide the operator to adjust the physical position of the barcode reader. It can intuitively and conveniently guide inexperienced operators through real-time images and adjustment guidance information, and achieve rapid calibration of the installation position of the barcode reader installed on the production line without hardware modification.
[0079] The following is for reference. Figure 6 It shows a schematic diagram of the structure of a computer system 600 suitable for implementing an electronic device according to embodiments of the present invention. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
[0080] like Figure 6 As shown, the computer system 600 includes a Central Processing Unit (CPU) 601, which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) 602 or programs loaded from storage section 608 into Random Access Memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the computer system 600. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An Input / Output (I / O) interface 605 is also connected to the bus 604.
[0081] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube, liquid crystal display, etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a modem, etc. Communication section 609 performs communication processing via a network such as the Internet. Drive 610 is also connected to I / O interface 605 as needed. Removable media 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 610 as needed so that computer programs read from them can be installed into storage section 608 as needed.
[0082] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined above in the system of this invention.
[0083] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, etc., or any suitable combination thereof.
[0084] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0085] The modules and / or units described in the embodiments of this invention can be implemented in software or hardware. The described modules and / or units can also be housed in a processor; for example, a processor can be described as including an acquisition module, a retrieval module, a calculation module, and a generation module. The names of these modules do not necessarily limit the module itself.
[0086] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: In response to a code reader failure signal, the system controls the code reader to acquire a real-time image containing the graphic to be recognized; retrieves a standard reference image acquired by the code reader in a standard posture, with the graphic to be recognized centered within a preset scanning area; calculates deviation information based on the relative positional relationship between the graphic to be recognized in the real-time image and the preset scanning area; generates position adjustment guidance information based on the deviation information and displays the position adjustment guidance information on the human-machine interface to guide the operator to adjust the physical position of the code reader.
[0087] The technical solution of this invention involves acquiring a real-time image containing the graphic to be identified and retrieving a standard reference image acquired by the barcode reader in a standard posture; calculating deviation information based on the relative positional relationship between the graphic to be identified and the preset scanning area in the real-time image; generating position adjustment guidance information based on the deviation information and displaying the position adjustment guidance information on the human-machine interface to guide the operator to adjust the physical position of the barcode reader. This allows for intuitive and convenient guidance for inexperienced operators through real-time images and adjustment guidance information, enabling rapid calibration of the barcode reader installation position on the production line without hardware modification.
[0088] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the reader position adjustment method as provided in any embodiment of this invention.
[0089] In the implementation of a computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages as well as conventional procedural programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including local area networks (LANs) or wide area networks (WANs), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0090] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0091] It should be noted that the collection, use, storage, sharing, and transfer of user personal information involved in the technical solution of this invention all comply with the provisions of relevant laws and regulations, and require notification to the user and obtaining the user's consent or authorization. Where applicable, user personal information has undergone de-identification and / or anonymization and / or encryption technical processing. In addition, a corresponding operation entry is provided for the user to choose to agree to or reject the automated decision result; if the user chooses to reject, the process proceeds to the expert decision-making process.
[0092] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for adjusting the position of a barcode reader, executed by a production line control system, the production line including barcode readers installed at workstations, the barcode readers being used to identify a graphic to be identified on a product arriving at the workstation, characterized in that, The method includes: In response to a code reading failure signal, the code reader is controlled to acquire a real-time image containing the graphic to be identified; Retrieve a standard reference image acquired by the barcode reader in a standard posture, wherein the graphic to be identified is centered within a preset scanning area; Based on the relative positional relationship between the graphic to be identified in the real-time image and the preset scanning area, deviation information is calculated; Based on the deviation information, position adjustment guidance information is generated and displayed on the human-machine interface to guide the operator to adjust the physical position of the barcode reader.
2. The method according to claim 1, characterized in that, Displaying the position adjustment guidance information on the human-computer interaction interface includes: The real-time image and the standard reference image are displayed side-by-side in the human-computer interaction interface. An identifier box is superimposed at the corresponding coordinate position of the preset scanning area in the real-time image, and the identifier box is also superimposed at the corresponding coordinate position of the preset scanning area in the standard reference image, so that the display position of the identifier box corresponds in the two images.
3. The method according to claim 1, characterized in that, Based on the relative positional relationship between the graphic to be identified in the real-time image and the preset scanning area, deviation information is calculated, including: Obtain a deviation detection strategy configured according to the installation method of the barcode reader, wherein the deviation detection strategy includes at least one of the following: detecting position deviation and detecting size deviation; The deviation information is calculated based on the deviation detection strategy and the relative positional relationship between the graphic to be identified and the preset scanning area in the real-time image.
4. The method according to claim 3, characterized in that, When the deviation detection strategy is to detect position deviation, the calculation of deviation information includes: Extract the coordinates of the center point of the graphic to be identified in the real-time image; Calculate the longitudinal difference between the center point coordinates of the graphic to be identified in the real-time image and the center point coordinates of the preset scanning area.
5. The method according to claim 4, characterized in that, Based on the deviation information, position adjustment guidance information is generated, including: When the longitudinal difference is negative and the absolute value of the longitudinal difference is greater than the position adjustment threshold, a prompt message is generated to adjust the reader's pitch angle upwards. If the longitudinal difference is positive and the absolute value of the longitudinal difference is greater than the position adjustment threshold, a prompt message is generated to adjust the reader's pitch angle downwards.
6. The method according to claim 3, characterized in that, When the deviation detection strategy is to detect dimensional deviations, the calculation of deviation information includes: The area ratio is obtained by calculating the ratio of the imaging area of the graphic to be identified in the real-time image to the standard area of the graphic to be identified in the standard reference image.
7. The method according to claim 6, characterized in that, Based on the deviation information, position adjustment guidance information is generated, including: If the area ratio is greater than the standard ratio and the deviation between the area ratio and the standard ratio is greater than the size adjustment threshold, a prompt message is generated to adjust the barcode reader position backward. If the area ratio is less than the standard ratio and the deviation between the area ratio and the standard ratio is greater than the size adjustment threshold, a prompt message is generated to adjust the reader position forward.
8. The method according to claim 2, characterized in that, When the deviation detection strategy includes both detecting positional deviation and detecting dimensional deviation, it further includes: Obtain the set position convergence threshold and size convergence threshold; If the preset frame images meet the preset conditions in a continuous series, it is determined that the reader position adjustment is complete; The preset conditions include: the absolute value of the vertical difference between the center point coordinates of the graphic to be identified in the real-time image and the center point coordinates of the preset scanning area is less than or equal to the position convergence threshold, and the deviation between the ratio of the imaging area of the graphic to be identified in the real-time image to the imaging area of the graphic to be identified in the standard reference image and the standard ratio is less than or equal to the size convergence threshold.
9. The method according to claim 1, characterized in that, Before calculating the deviation information based on the relative positional relationship between the graphic to be identified and the preset scanning area in the real-time image, the method further includes: The real-time image is converted to grayscale to obtain a grayscale image; The grayscale image is binarized to obtain a binary image; Contour extraction is performed on the binary image to extract image contour information; Based on the image contour information, a rectangular region conforming to the features of the graphic to be identified is identified, and the boundary coordinates and center point coordinates of the graphic to be identified are determined according to the identification result; The boundary coordinates of the graphic to be identified in the real-time image are used to calculate the imaging area of the graphic to be identified in the real-time image.
10. The method according to claim 1, characterized in that, Before retrieving the standard reference image acquired by the barcode reader in a standard orientation, wherein the graphic to be recognized is centered within a preset scanning area, the process further includes: With the barcode reader in a standard orientation, the barcode reader is controlled to acquire an image of the graphic to be identified that is completely centered within the preset scanning area, thus obtaining the standard reference image; Record the coordinates of the center point of the preset scanning area in the standard reference image; Calculate and store the imaging area of the graphic to be identified in the standard reference image.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the reader position adjustment method as described in any one of claims 1 to 10.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the reader position adjustment method as described in any one of claims 1 to 10.