CN111582000B - Bar code positioning method, bar code positioning device and related equipment - Google Patents

Bar code positioning method, bar code positioning device and related equipment Download PDF

Info

Publication number
CN111582000B
CN111582000B CN201910122191.1A CN201910122191A CN111582000B CN 111582000 B CN111582000 B CN 111582000B CN 201910122191 A CN201910122191 A CN 201910122191A CN 111582000 B CN111582000 B CN 111582000B
Authority
CN
China
Prior art keywords
bar code
image
average value
area
gray average
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910122191.1A
Other languages
Chinese (zh)
Other versions
CN111582000A (en
Inventor
易帆
李功燕
许邵云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongke Weizhi Intelligent Manufacturing Technology Jiangsu Co ltd
Original Assignee
Zhongke Weizhi Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongke Weizhi Technology Co ltd filed Critical Zhongke Weizhi Technology Co ltd
Priority to CN201910122191.1A priority Critical patent/CN111582000B/en
Publication of CN111582000A publication Critical patent/CN111582000A/en
Application granted granted Critical
Publication of CN111582000B publication Critical patent/CN111582000B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1443Methods for optical code recognition including a method step for retrieval of the optical code locating of the code in an image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Image Analysis (AREA)

Abstract

The application discloses a bar code positioning method, which comprises the steps of receiving an image to be positioned acquired by image acquisition equipment; dividing the image to be positioned by an adaptive threshold algorithm to determine a face sheet area; performing edge detection on the surface sheet region by using a Sobel operator to obtain a gradient intensity map; positioning a bar code in the gradient intensity map, and determining a bar code area; the bar code positioning method can effectively improve the accuracy of bar code positioning and ensure the normal identification of the subsequent bar codes. The application also discloses a bar code positioning device, bar code positioning equipment and a computer readable storage medium, which have the beneficial effects.

Description

Bar code positioning method, bar code positioning device and related equipment
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a barcode positioning method, and also relates to a barcode positioning device, apparatus, and computer readable storage medium.
Background
Along with the development of information technology, the bar code technology is widely applied to various fields of automatic management, has the characteristics of accuracy, rapidness, convenience and economy, and brings great convenience to transaction management of various industries.
The bar code is a graphic identifier for expressing a set of information, and can specifically mark information such as the country of production, manufacturer, commodity name, date of production, book classification number, mail start location, category, date, etc. When the special identification equipment is used for identifying and detecting the bar code, various relevant information can be obtained, and in the bar code detection process, the positioning of the bar code becomes the most basic and important link.
In the existing bar code positioning process, firstly, a camera is utilized to acquire a bar code image, and further, the bar code image is positioned through technologies such as image processing and pattern recognition, so that the recognition and detection of bar codes in the bar code area are realized. However, when the camera is used for acquiring the bar code image, the background part irrelevant to the bar code, such as the background of an express bill, is inevitably taken, so that the interference of complex and changeable background noise is easily received in the bar code positioning process, the problem of inaccurate bar code positioning occurs, and the recognition and detection results of the subsequent bar codes are affected.
Therefore, how to effectively improve the accuracy of barcode positioning to ensure the normal identification of barcodes is a problem to be solved by those skilled in the art.
Disclosure of Invention
The application aims to provide a bar code positioning method which can effectively improve the accuracy of bar code positioning and ensure the normal identification of the subsequent bar codes; another object of the present application is to provide a bar code positioning device, apparatus and computer readable storage medium, which also have the above-mentioned advantageous effects.
In order to solve the technical problems, the application provides a bar code positioning method, which comprises the following steps:
receiving an image to be positioned acquired by image acquisition equipment;
dividing the image to be positioned by an adaptive threshold algorithm to determine a face sheet area;
performing edge detection on the surface sheet region by using a Sobel operator to obtain a gradient intensity map;
and (3) bar code positioning is carried out in the gradient intensity map, and bar code areas are determined.
Preferably, the method further includes, before the step of dividing the image to be localized by an adaptive threshold algorithm and determining the area of the face sheet, the steps of:
and carrying out gray level conversion on the image to be positioned to obtain a gray level image.
Preferably, the processing of dividing the image to be localized by an adaptive threshold algorithm to determine a face sheet area includes:
dividing the gray level image according to a preset dividing threshold value to obtain a first foreground image and a first background image;
calculating the gray average value of the first foreground image and the gray average value of the first background image;
calculating the average value of the gray average value of the first foreground image and the gray average value of the first background image to obtain a first segmentation threshold;
dividing the first foreground image according to the first dividing threshold value to obtain a second foreground image and a second background image;
calculating the gray average value of the second foreground image and the gray average value of the second background image;
judging whether the gray average value of the second foreground image is equal to the gray average value of the first foreground image or not, and whether the gray average value of the second background image is equal to the gray average value of the first background image or not;
if not, calculating the average value of the gray average value of the second foreground image and the average value of the gray average value of the first foreground image to obtain a second segmentation threshold; dividing the second foreground image according to the second dividing threshold value until the gray average value of the current foreground image is equal to the gray average value of the previous foreground image, and the gray average value of the current background image is equal to the gray average value of the previous background image;
and taking the current foreground image as the menu area.
Preferably, the processing of dividing the image to be localized by an adaptive threshold algorithm, after determining the area of the face sheet, further includes:
and carrying out normalization processing on the surface single region to obtain a standard surface single region.
Preferably, the performing edge detection on the surface sheet area by using a Sobel operator to obtain a gradient intensity map includes:
establishing an image coordinate system in the face sheet area;
establishing a preset number of Sobel operator groups in the image coordinate system according to preset angle intervals;
and sequentially carrying out edge detection on the single area by taking the start angle Sobel operator group as a starting point and the end angle Sobel operator group as an end point to obtain the gradient intensity map.
Preferably, the positioning of the bar code in the gradient intensity map, and determining the bar code area, includes:
carrying out Gaussian filtering treatment on the gradient intensity map to obtain a filtering map;
performing binarization processing on the filter map to obtain a binarized image;
performing expansion corrosion and void filling on the binary image through morphological operation to obtain a morphological image;
and determining the bar code area in the morphological image by using a maximum circumscribed rectangle algorithm.
Preferably, the method for positioning the bar code further comprises:
calculating a first deflection angle of the bar code area relative to the horizontal direction through a Hough transform algorithm;
calculating a second deflection angle of the bar code area relative to the horizontal direction through a contour searching algorithm;
calculating the average value of the first deflection angle and the second deflection angle;
and correcting the bar code area according to the average value to obtain a corrected bar code area.
In order to solve the technical problem, the application also provides a bar code positioning device, which comprises:
the image acquisition module is used for receiving the image to be positioned acquired by the image acquisition equipment;
the image segmentation module is used for carrying out segmentation processing on the image to be localized through a self-adaptive threshold algorithm to determine a face sheet area;
the edge detection module is used for carrying out edge detection on the face sheet area by utilizing a Sobel operator to obtain a gradient intensity graph;
and the bar code positioning module is used for positioning the bar code in the gradient intensity diagram and determining a bar code area.
In order to solve the technical problem, the present application further provides a barcode positioning device, including:
a memory for storing a computer program;
and the processor is used for realizing any one of the bar code positioning methods when executing the computer program.
To solve the above technical problem, the present application further provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of any one of the barcode positioning methods described above.
The application provides a bar code positioning method, which comprises the steps of receiving an image to be positioned, which is acquired by image acquisition equipment; dividing the image to be positioned by an adaptive threshold algorithm to determine a face sheet area; performing edge detection on the surface sheet region by using a Sobel operator to obtain a gradient intensity map; and (3) bar code positioning is carried out in the gradient intensity map, and bar code areas are determined.
Therefore, the barcode positioning method provided by the application can be used for dividing the image to be positioned by the self-adaptive threshold algorithm to obtain the area of the face sheet including the barcode after the image to be positioned is obtained and before the image to be positioned is positioned, so that the background part irrelevant to the barcode can be removed, various possible interferences such as the influence of burst noise interference, high gray level change complexity and the like caused by the background part can be effectively avoided, and further, the accuracy of the barcode positioning result can be greatly improved when the subsequent edge detection and positioning are carried out based on the area of the face sheet, thereby ensuring the normal proceeding of the subsequent barcode recognition process.
The bar code positioning device, the bar code positioning equipment and the computer readable storage medium provided by the application have the beneficial effects and are not repeated herein.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a bar code positioning method according to the present application;
FIG. 2 is a flow chart of a bar code correction method according to the present application;
FIG. 3 is a schematic diagram of a bar code positioning device according to the present application;
fig. 4 is a schematic structural diagram of a bar code positioning device according to the present application.
Detailed Description
The core of the application is to provide a bar code positioning method which can effectively improve the accuracy of bar code positioning and ensure the normal identification of the subsequent bar code; another core of the present application is to provide a bar code positioning device, apparatus and computer readable storage medium, which also have the above-mentioned advantageous effects.
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Referring to fig. 1, fig. 1 is a flow chart of a bar code positioning method provided by the present application, where the bar code positioning method may include:
s101: receiving an image to be positioned acquired by image acquisition equipment;
the method aims at acquiring an image to be positioned, wherein the image to be positioned is an image needing bar code positioning, the process can be realized based on image acquisition equipment, and the specific type and model of the image acquisition equipment are not limited, and the method can be a mobile terminal camera, a professional camera and the like; further, the image acquisition device can send the image to be positioned captured by the image acquisition device to a processor for realizing the bar code positioning function for subsequent flow.
S102: dividing an image to be positioned through a self-adaptive threshold algorithm to determine a face list area;
the method aims at realizing segmentation processing of the image to be positioned, and the specific implementation process can be realized based on an adaptive threshold algorithm, so that a face single region is obtained, wherein the face single region is a region which is used for filtering out irrelevant background parts in the image to be positioned and only comprises bar code information. For example, for a parcel, an express bill is typically attached to the parcel, but when image acquisition is performed based on an image acquisition device, only the operation of taking the express bill is generally difficult to achieve, so that most of the obtained images to be positioned include a part of the parcel, and due to the problems of uneven light, large gray level change and the like, the subsequent barcode positioning is likely to be greatly affected, and when the images to be positioned are subjected to segmentation processing through an adaptive threshold algorithm, an image only including the express bill, namely the above-mentioned area of the express bill, can be obtained.
For the adaptive threshold algorithm, the type of the corresponding threshold standard is not unique, for example, the type can be a median, a mean, gaussian convolution, and the like, and the implementation of the technical scheme is not affected.
As a preferred embodiment, the above-mentioned image to be located is subjected to segmentation processing by using an adaptive threshold algorithm, and before determining the area of the face sheet, the method may further include: and carrying out gray level conversion on the image to be positioned to obtain a gray level image.
Specifically, the images collected by the common image collecting device are mostly color photos, and the complexity of color change can bring great influence to the positioning work of the bar code, so that after the images to be positioned are obtained, the images can be subjected to gray level conversion to obtain corresponding gray level images, further, subsequent image segmentation operation can be performed based on the gray level images, and the accuracy of the positioning result of the bar code is effectively improved.
Preferably, the process of dividing the image to be positioned by the adaptive threshold algorithm to determine the area of the face sheet may specifically include: dividing the gray level image according to a preset dividing threshold value to obtain a first foreground image and a first background image; calculating a gray average value of the first foreground image and a gray average value of the first background image; calculating the average value of the gray average value of the first foreground image and the gray average value of the first background image to obtain a first segmentation threshold; dividing the first foreground image according to a first dividing threshold value to obtain a second foreground image and a second background image; calculating the gray average value of the second foreground image and the gray average value of the second background image; judging whether the gray average value of the second foreground image is equal to the gray average value of the first foreground image, and whether the gray average value of the second background image is equal to the gray average value of the first background image; if not, calculating the average value of the gray average value of the second foreground image and the average value of the gray average value of the first foreground image to obtain a second segmentation threshold value; dividing the second foreground image according to a second dividing threshold value until the gray average value of the current foreground image is equal to the gray average value of the previous foreground image and the gray average value of the current background image is equal to the gray average value of the previous background image; the current foreground image is taken as a menu area.
The process of obtaining the preset segmentation threshold may include: and calculating the maximum gray value and the minimum gray value of the gray map, calculating the average value of the maximum gray value and the minimum gray value, and taking the average value as the preset dividing threshold value.
The above image segmentation process is described in detail below by way of example:
firstly, acquiring a gray level image of an image to be positioned, and calculating a maximum gray level value X in the gray level image max And a minimum gray value X min Through T 0 =(X max +X min ) 2 obtaining a preset segmentation threshold T 0 The method comprises the steps of carrying out a first treatment on the surface of the Further, according to the preset segmentation threshold S 1 Dividing the gray scale map into foreground S 1 And background S 2 And calculates the foreground S 1 Is the gray average value a of (2) 1 And background S 2 Is the gray average value a of (2) 2 Thus, let t= (a 1 +a 2 ) 2 as a new segmentation threshold pair foreground S 1 Performing segmentation, and repeating the segmentation process until a 1 And a 2 No change occurs anymore, i.e. a obtained by the current iteration process 1 And a 2 Respectively with a obtained from the last iteration 1 And a 2 Equal, thus, it is stated that the foreground image currently obtained no longer includes a background portion unrelated to the bar code, i.e., the foreground image is a face-sheet region.
As a preferred embodiment, the above-mentioned image to be located is subjected to segmentation processing by an adaptive threshold algorithm, and after determining the area of the face sheet, the method may further include: and carrying out normalization processing on the face sheet area to obtain a standard face sheet area.
The step aims at realizing the normalization processing of the image, effectively simplifying the calculation and reducing the magnitude, and particularly can obtain a standard face single region within 800 x 600 of the obtained face single region normalization value, thereby being more convenient for the subsequent image edge detection and bar code positioning.
S103: performing edge detection on the face single region by using a Sobel operator to obtain a gradient intensity map;
the method aims at realizing edge detection of the face sheet area, and the specific implementation process can be realized based on a Sobel operator, so that a corresponding gradient map with stronger characteristics, namely the gradient intensity map, is further obtained.
As a preferred embodiment, the process of performing edge detection on the face sheet region by using the Sobel operator to obtain the gradient intensity map may specifically include: establishing an image coordinate system in the area of the face sheet; establishing a preset number of Sobel operator groups in an image coordinate system according to preset angle intervals; and sequentially carrying out edge detection on the surface single region by taking the starting angle Sobel operator group as a starting point and the ending angle Sobel operator group as an ending point to obtain a gradient intensity map.
In general, when the Sobel operator performs edge detection, the method is realized based on a group of Sobel operators, and in order to further ensure the accuracy of bar code positioning, a plurality of groups of Sobel operators are newly added to realize the acquisition of a gradient intensity map. Specifically, firstly, an image coordinate system is established in a face sheet area, and Sobel operator groups are set according to preset angle intervals, and of course, the specific values of the preset angle intervals and the number of Sobel operator groups are not specifically limited, for example, the preset angle intervals are set to be 30 degrees, the preset number is set to be 3 in the application, and therefore, the distribution situation of the 3 Sobel operator groups is as follows: sobel operator group of 0 degree direction (i.e., image coordinate system x-axis) and 90 degree direction (i.e., image coordinate system y-axis); 30-degree and 120-degree Sobel operator groups; sobel operator group in 60 degree direction and 150 degree direction. Further, with the start angle Sobel operator group (Sobel operator group in the 0 degree direction and the 90 degree direction) as a start point and the end angle Sobel operator group (Sobel operator group in the 60 degree direction and the 150 degree direction) as an end point, edge detection is sequentially performed on the opposite single region, that is, gradient graphs in two directions obtained by each Sobel operator group are subtracted sequentially, and therefore, the characteristics of the corresponding obtained gradient graphs are continuously enhanced, and a final gradient intensity graph is obtained.
S104: and (5) bar code positioning is carried out in the gradient intensity map, and bar code areas are determined.
This step aims at achieving the positioning of the bar code, so as to obtain the corresponding bar code area. Any of the prior art may be used for its specific positioning implementation, and the present application is not limited thereto.
Preferably, the process of positioning the bar code in the gradient intensity map and determining the bar code area may specifically include: carrying out Gaussian filtering treatment on the gradient intensity map to obtain a filtering map; performing binarization processing on the filter map to obtain a binarized image; performing expansion corrosion and void filling on the binary image through morphological operation to obtain a morphological image; and determining the bar code area in the morphological image by using a maximum circumscribed rectangle algorithm.
The application provides a specific bar code positioning realization method, in particular to a bar code region in a gradient intensity diagram obtained based on a Sobel operator has no obvious characteristics relative to other regions, therefore, the gradient intensity diagram can be firstly subjected to Gaussian filtering to obtain a corresponding filtering diagram so as to weaken an interference region of the gradient intensity diagram; further, the filtering diagram is subjected to binarization processing by utilizing a threshold value of 255 to obtain a binarized image, and at the moment, a bar code area on the binarized image is provided with gaps, so that the filtering diagram can be subjected to expansion corrosion and gap filling for a plurality of times through morphological operation to obtain a corresponding morphological image; and finally, finding all outlines in the morphological image by using a maximum circumscribed rectangle algorithm, and selecting the largest outline frame, wherein the area covered by the outline frame is a bar code area, thereby realizing the acquisition of the bar code area.
According to the bar code positioning method provided by the application, after the image to be positioned is obtained and before the bar code positioning is carried out, the image to be positioned is segmented through the self-adaptive threshold algorithm to obtain the face sheet area comprising the bar code, so that the background part irrelevant to the bar code can be removed, various possible interferences such as the influence of burst noise interference, high gray level change complexity and the like caused by the background part can be effectively avoided, and further, the accuracy of the bar code positioning result can be greatly improved when the subsequent edge detection and positioning are carried out based on the face sheet area, and the normal running of the subsequent bar code recognition process is ensured.
Generally, the barcode area obtained based on the positioning operation of the barcode has a certain angle deflection, so in order to facilitate the normal operation of the subsequent barcode identification process, the barcode identification method provided by the application increases the barcode correction process so as to improve the accuracy of barcode identification.
On the basis of the foregoing embodiments, as a preferred embodiment, please refer to fig. 2, fig. 2 is a flow chart of a bar code correction method provided by the present application, the bar code correction method may include:
s201: calculating a first deflection angle of the bar code area relative to the horizontal direction through a Hough transformation algorithm;
s202: calculating a second deflection angle of the bar code area relative to the horizontal direction through a contour searching algorithm;
s203: calculating the average value of the first deflection angle and the second deflection angle;
s204: and correcting the bar code area according to the average value to obtain a corrected bar code area.
The step combines the Hough transformation algorithm and the contour finding algorithm to determine the deflection angle of the bar code, calculates the deflection angle of the bar code based on the Hough transformation algorithm and the contour finding algorithm respectively, obtains a corresponding first deflection angle and a corresponding second deflection angle, further calculates the average value of the first deflection angle and the second deflection angle, and corrects the bar code area by taking the average value as the deflection angle of the bar code area, thereby obtaining the corrected bar code area and effectively reducing the deflection angle error. Wherein, the first deflection angle and the second deflection angle are relative to the horizontal direction. It should be noted that, the execution order of S201 and S202 is not limited, and the two may be executed simultaneously or sequentially, so that implementation of the technical scheme is not affected.
For the calculation of the first deflection angle, hough transformation can be directly performed in the obtained bar code area to find the black and white straight line, and the deflection angle between the bar code area and the horizontal direction is calculated, namely the first deflection angle is obtained.
For the calculation of the second deflection angle, as the inclination condition exists in the bar code area, firstly searching the bar code outline in the bar code area, fitting the bar code outline to an inclined rectangle, and obtaining the most compact external rectangle; further, the second deflection angle with respect to the horizontal direction can be determined from the long side of the most compact circumscribed rectangle. The process of searching the bar code outline may include: since the acquired bar code in the bar code area occupies the main body, the background information is less, and the bar code is formed by alternately arranging black and white bars, the black bar frame outline can be obtained by hollowing out the pixels in the black bars, specifically, each point in the bar code area can be traversed, one point in the encountering area is black (namely, the gray value is 255), and 8 adjacent points are black, which indicates that the point is an internal point, the point can be deleted, therefore, after traversing is completed, only edge pixel points are left, and the black bar frame outline is obtained; further, the bar code profiles are merged according to the similarity of the connected domains, and the merging conditions comprise: the main directions are consistent; the lengths in the horizontal direction are the same; the difference between the included angle formed by the connecting line of the centers of gravity of two adjacent subdomains and the horizontal axis and the included angle of the main direction is not more than 5 degrees; the distance between the circumscribed rectangles formed by two adjacent subfields is not more than the length of the two rectangles in the horizontal direction.
According to the bar code positioning method provided by the embodiment of the application, after bar code positioning is completed, the bar code area is further corrected, so that a more standard corrected bar code area is obtained, and the subsequent bar code recognition process is more convenient to carry out.
In order to solve the above-mentioned problems, please refer to fig. 3, fig. 3 is a schematic structural diagram of a bar code positioning device according to the present application, the bar code positioning device may include:
the image acquisition module 10 is used for receiving the image to be positioned acquired by the image acquisition equipment;
the image segmentation module 20 is used for carrying out segmentation processing on the image to be positioned through a self-adaptive threshold algorithm to determine a face list area;
the edge detection module 30 is configured to perform edge detection on the face sheet area by using a Sobel operator, so as to obtain a gradient intensity map;
and the bar code positioning module 40 is used for positioning the bar code in the gradient intensity map and determining the bar code area.
As a preferred embodiment, the bar code positioning device may further include:
the gray level conversion module is used for carrying out gray level conversion on the image to be positioned to obtain a gray level image.
As a preferred embodiment, the bar code positioning device may further include:
and the normalization module is used for carrying out normalization processing on the face single region to obtain a standard face single region.
As a preferred embodiment, the bar code positioning device may further include:
the bar code correction module is used for calculating a first deflection angle of the bar code area relative to the horizontal direction through a Hough transformation algorithm; calculating a second deflection angle of the bar code area relative to the horizontal direction through a contour searching algorithm; calculating the average value of the first deflection angle and the second deflection angle; and correcting the bar code area according to the average value to obtain a corrected bar code area.
For the description of the device provided by the present application, please refer to the above method embodiment, and the description of the present application is omitted herein.
In order to solve the above-mentioned problems, please refer to fig. 4, fig. 4 is a schematic structural diagram of a bar code positioning apparatus according to the present application, wherein the bar code positioning apparatus may comprise:
a memory 1 for storing a computer program;
a processor 2 for implementing the following steps when executing the computer program:
receiving an image to be positioned acquired by image acquisition equipment; dividing an image to be positioned through a self-adaptive threshold algorithm to determine a face list area; performing edge detection on the face single region by using a Sobel operator to obtain a gradient intensity map; and (5) bar code positioning is carried out in the gradient intensity map, and bar code areas are determined.
For the description of the apparatus provided by the present application, please refer to the above method embodiment, and the description of the present application is omitted herein.
To solve the above problems, the present application also provides a computer readable storage medium having a computer program stored thereon, the computer program when executed by a processor implementing the steps of:
receiving an image to be positioned acquired by image acquisition equipment; dividing an image to be positioned through a self-adaptive threshold algorithm to determine a face list area; performing edge detection on the face single region by using a Sobel operator to obtain a gradient intensity map; and (5) bar code positioning is carried out in the gradient intensity map, and bar code areas are determined.
The computer readable storage medium may include: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
For the description of the computer-readable storage medium provided by the present application, refer to the above method embodiments, and the disclosure is not repeated here.
In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The bar code positioning method, the bar code positioning device, the bar code positioning equipment and the computer readable storage medium provided by the application are described in detail above. The principles and embodiments of the present application have been described herein with reference to specific examples, the description of which is intended only to facilitate an understanding of the method of the present application and its core ideas. It should be noted that it will be apparent to those skilled in the art that various changes and modifications can be made herein without departing from the principles of the application, which also falls within the spirit and scope of the application as defined by the appended claims.

Claims (7)

1. A method of bar code positioning comprising:
receiving an image to be positioned acquired by image acquisition equipment;
dividing the image to be positioned by an adaptive threshold algorithm to determine a face sheet area;
performing edge detection on the surface sheet region by using a Sobel operator to obtain a gradient intensity map;
positioning a bar code in the gradient intensity map, and determining a bar code area;
the method comprises the steps of carrying out segmentation processing on the image to be localized by an adaptive threshold algorithm, and before determining a face sheet area, further comprises the following steps: performing gray level conversion on the image to be positioned to obtain a gray level image;
the method for determining the area of the face sheet includes the steps of:
dividing the gray level image according to a preset dividing threshold value to obtain a first foreground image and a first background image;
calculating the gray average value of the first foreground image and the gray average value of the first background image;
calculating the average value of the gray average value of the first foreground image and the gray average value of the first background image to obtain a first segmentation threshold;
dividing the first foreground image according to the first dividing threshold value to obtain a second foreground image and a second background image;
calculating the gray average value of the second foreground image and the gray average value of the second background image;
judging whether the gray average value of the second foreground image is equal to the gray average value of the first foreground image or not, and whether the gray average value of the second background image is equal to the gray average value of the first background image or not;
if not, calculating the average value of the gray average value of the second foreground image and the average value of the gray average value of the first foreground image to obtain a second segmentation threshold; dividing the second foreground image according to the second dividing threshold value until the gray average value of the current foreground image is equal to the gray average value of the previous foreground image, and the gray average value of the current background image is equal to the gray average value of the previous background image;
taking the current foreground image as the menu area;
wherein, still include:
calculating a first deflection angle of the bar code area relative to the horizontal direction through a Hough transform algorithm;
calculating a second deflection angle of the bar code area relative to the horizontal direction through a contour searching algorithm;
calculating the average value of the first deflection angle and the second deflection angle;
and correcting the bar code area according to the average value to obtain a corrected bar code area.
2. The bar code positioning method according to claim 1, wherein the dividing the image to be positioned by an adaptive threshold algorithm, after determining the area of the face sheet, further comprises:
and carrying out normalization processing on the surface single region to obtain a standard surface single region.
3. The bar code positioning method of claim 1, wherein the performing edge detection on the face sheet region by using a Sobel operator to obtain a gradient intensity map comprises:
establishing an image coordinate system in the face sheet area;
establishing a preset number of Sobel operator groups in the image coordinate system according to preset angle intervals;
and sequentially carrying out edge detection on the single area by taking the start angle Sobel operator group as a starting point and the end angle Sobel operator group as an end point to obtain the gradient intensity map.
4. The bar code positioning method of claim 1 wherein said performing bar code positioning in said gradient intensity map, determining bar code areas, comprises:
carrying out Gaussian filtering treatment on the gradient intensity map to obtain a filtering map;
performing binarization processing on the filter map to obtain a binarized image;
performing expansion corrosion and void filling on the binary image through morphological operation to obtain a morphological image;
and determining the bar code area in the morphological image by using a maximum circumscribed rectangle algorithm.
5. A bar code positioning device for implementing the bar code positioning method of any one of claims 1-4, the bar code positioning device comprising:
the image acquisition module is used for receiving the image to be positioned acquired by the image acquisition equipment;
the image segmentation module is used for carrying out segmentation processing on the image to be localized through a self-adaptive threshold algorithm to determine a face sheet area;
the edge detection module is used for carrying out edge detection on the face sheet area by utilizing a Sobel operator to obtain a gradient intensity graph;
and the bar code positioning module is used for positioning the bar code in the gradient intensity diagram and determining a bar code area.
6. A bar code positioning device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the bar code positioning method according to any one of claims 1 to 4 when executing said computer program.
7. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the bar code positioning method according to any of claims 1 to 4.
CN201910122191.1A 2019-02-19 2019-02-19 Bar code positioning method, bar code positioning device and related equipment Active CN111582000B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910122191.1A CN111582000B (en) 2019-02-19 2019-02-19 Bar code positioning method, bar code positioning device and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910122191.1A CN111582000B (en) 2019-02-19 2019-02-19 Bar code positioning method, bar code positioning device and related equipment

Publications (2)

Publication Number Publication Date
CN111582000A CN111582000A (en) 2020-08-25
CN111582000B true CN111582000B (en) 2023-09-12

Family

ID=72126017

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910122191.1A Active CN111582000B (en) 2019-02-19 2019-02-19 Bar code positioning method, bar code positioning device and related equipment

Country Status (1)

Country Link
CN (1) CN111582000B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112699704B (en) * 2021-01-08 2022-10-21 厦门理工学院 Method, device, equipment and storage device for detecting bar code
CN113160306A (en) * 2021-03-11 2021-07-23 中国科学院微电子研究所 Detection method, control system and terminal equipment for information of transmission object
CN113095102B (en) * 2021-03-31 2022-07-19 深圳市华汉伟业科技有限公司 Method for positioning bar code area
CN113627210A (en) * 2021-08-19 2021-11-09 南京华捷艾米软件科技有限公司 Method and device for generating bar code image, electronic equipment and storage medium
CN114299409B (en) * 2022-03-07 2022-07-01 中煤科工开采研究院有限公司 Underground personnel positioning method and device based on image recognition and depth information

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107403124A (en) * 2017-07-31 2017-11-28 苏州经贸职业技术学院 A kind of barcode detection recognition methods of view-based access control model image
CN107633192A (en) * 2017-08-22 2018-01-26 电子科技大学 Bar code segmentation and reading method under a kind of complex background based on machine vision
CN109101854A (en) * 2018-06-25 2018-12-28 华南理工大学 A kind of multiple barcode localization method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107403124A (en) * 2017-07-31 2017-11-28 苏州经贸职业技术学院 A kind of barcode detection recognition methods of view-based access control model image
CN107633192A (en) * 2017-08-22 2018-01-26 电子科技大学 Bar code segmentation and reading method under a kind of complex background based on machine vision
CN109101854A (en) * 2018-06-25 2018-12-28 华南理工大学 A kind of multiple barcode localization method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
朱贺.基于机器视觉的快递单地址自动识别研究.中国优秀硕士学位论文全文数据库.2019,正文第4章. *

Also Published As

Publication number Publication date
CN111582000A (en) 2020-08-25

Similar Documents

Publication Publication Date Title
CN111582000B (en) Bar code positioning method, bar code positioning device and related equipment
CN110866924B (en) Line structured light center line extraction method and storage medium
CN106960208B (en) Method and system for automatically segmenting and identifying instrument liquid crystal number
CN115908269B (en) Visual defect detection method, visual defect detection device, storage medium and computer equipment
CN111179243A (en) Small-size chip crack detection method and system based on computer vision
CN112419298B (en) Bolt node plate rust detection method, device, equipment and storage medium
CN111259908A (en) Machine vision-based steel coil number identification method, system, equipment and storage medium
CN112598922B (en) Parking space detection method, device, equipment and storage medium
CN115457063A (en) Method, device and equipment for extracting edge of circular hole of PCB (printed Circuit Board) and storage medium
CN114519714B (en) Method and system for judging smudgy defect of display screen
CN116152261B (en) Visual inspection system for quality of printed product
CN117094975A (en) Method and device for detecting surface defects of steel and electronic equipment
CN109784328B (en) Method for positioning bar code, terminal and computer readable storage medium
CN115587966A (en) Method and system for detecting whether parts are missing or not under condition of uneven illumination
CN117993406A (en) Automatic two-dimensional bar code identification and reading method and system
CN114004799A (en) Tire bar code identification method, system and equipment based on machine vision
CN111414912B (en) Method, device and equipment for identifying characteristic points of butt-joint type welding seam and storage medium
CN111178111A (en) Two-dimensional code detection method, electronic device, storage medium and system
CN112528741B (en) State identification method and device for transformer substation pressure plate
CN115830049A (en) Corner point detection method and device
CN115471650A (en) Gas pressure instrument reading method, device, equipment and medium
CN114862870A (en) Speckle pattern partitioning method, device, equipment and medium
CN109949245B (en) Cross laser detection positioning method and device, storage medium and computer equipment
CN113505811A (en) Machine vision imaging method for hub production
CN113793292A (en) Data processing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 214105 No. 299 Dacheng Road, Xishan District, Jiangsu, Wuxi

Applicant after: Zhongke Weizhi intelligent manufacturing technology Jiangsu Co.,Ltd.

Address before: 214105 No. 299 Dacheng Road, Xishan District, Jiangsu, Wuxi

Applicant before: ZHONGKE WEIZHI INTELLIGENT MANUFACTURING TECHNOLOGY JIANGSU Co.,Ltd.

CB02 Change of applicant information
TA01 Transfer of patent application right

Effective date of registration: 20200917

Address after: 214105 No. 299 Dacheng Road, Xishan District, Jiangsu, Wuxi

Applicant after: ZHONGKE WEIZHI INTELLIGENT MANUFACTURING TECHNOLOGY JIANGSU Co.,Ltd.

Address before: Zuchongzhi road Kunshan city 215347 Suzhou City, Jiangsu province No. 1699 building 7 floor

Applicant before: KUNSHAN BRANCH, INSTITUTE OF MICROELECTRONICS OF CHINESE ACADEMY OF SCIENCES

TA01 Transfer of patent application right
CB02 Change of applicant information

Address after: 214105 No. 979, Antai Third Road, Xishan District, Wuxi City, Jiangsu Province

Applicant after: Zhongke Weizhi Technology Co.,Ltd.

Address before: No. 299, Dacheng Road, Xishan District, Wuxi City, Jiangsu Province

Applicant before: Zhongke Weizhi intelligent manufacturing technology Jiangsu Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant