CN112287702A - Code scanning method and device without external memory, scanning equipment and mobile terminal - Google Patents

Code scanning method and device without external memory, scanning equipment and mobile terminal Download PDF

Info

Publication number
CN112287702A
CN112287702A CN202010425823.4A CN202010425823A CN112287702A CN 112287702 A CN112287702 A CN 112287702A CN 202010425823 A CN202010425823 A CN 202010425823A CN 112287702 A CN112287702 A CN 112287702A
Authority
CN
China
Prior art keywords
scanning
code
information
image
image data
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.)
Granted
Application number
CN202010425823.4A
Other languages
Chinese (zh)
Other versions
CN112287702B (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.)
Zhuhai Jieli Technology Co Ltd
Original Assignee
Zhuhai Jieli 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 Zhuhai Jieli Technology Co Ltd filed Critical Zhuhai Jieli Technology Co Ltd
Priority to CN202010425823.4A priority Critical patent/CN112287702B/en
Publication of CN112287702A publication Critical patent/CN112287702A/en
Application granted granted Critical
Publication of CN112287702B publication Critical patent/CN112287702B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/10544Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum
    • G06K7/10821Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum further details of bar or optical code scanning devices
    • 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/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • 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/146Methods for optical code recognition the method including quality enhancement steps

Abstract

The invention discloses a code scanning method without an external memory, a device, scanning equipment and a mobile terminal, wherein the device comprises: the image reading module is used for sequentially reading the current frame images of the information codes, which are acquired by the camera, according to a preset sequence; the image data cached in the first cache region and the image data cached in the second cache region are image data of different positions in the current frame image; the first pipelining unit is used for reading image data in the current frame image, and the second pipelining unit is used for carrying out pixel information statistics on the image data read by the first pipelining unit to obtain statistical information; and the scanning module is used for scanning the information code according to the statistical information to obtain the scanning data of the information code. The positioning module can run in a flowing water mode efficiently, and code scanning efficiency is improved.

Description

Code scanning method and device without external memory, scanning equipment and mobile terminal
Technical Field
The invention relates to the technical field of image processing, in particular to a code scanning method and device without an external memory, scanning equipment and a mobile terminal.
Background
In recent years, due to the rise of mobile internet and mobile payment, two-dimensional codes and bar codes are more widely used, and the demand of scanning equipment is also more and more increased. Generally, a device supporting two-dimensional code and barcode scanning needs to have a large-capacity external memory to buffer image data used in the receiving and decoding processes, which undoubtedly increases the cost of the scanning terminal device.
Taking a bar code as an example, the conventional bar code identification has three processes: positioning a barcode region of a source image, performing rotation processing on the positioned barcode region image, and performing binarization analysis on the rotated image. In the field of bar code scanning, the requirement on real-time performance is high, and how to rapidly analyze the bar code is an important research field.
In the prior art, there is a scheme of scanning according to a bar code inclination angle to avoid rotating a bar code region image, for example, patent application with publication number CN110659529A discloses a bar code identification method, which obtains a bar code image, scans the bar code image line by line to obtain coordinates of black pixels, determines an inclination angle of a bar code according to the coordinates of the black pixels, and scans the bar code along the inclination angle to obtain binarized bar code information. Although the scheme can improve the real-time performance to a certain extent, the scheme still needs an external memory with large capacity to buffer and receive and decode image data; when the scanning device shakes, the scanning device needs to acquire images again and calculate angles, on one hand, very large storage resource overhead is needed, and external storage pressure is increased, and on the other hand, the real-time performance of the scanning device is still poor.
Therefore, how to improve the code scanning efficiency without an external memory is an urgent technical problem to be solved.
Disclosure of Invention
Based on the above situation, a main object of the present invention is to provide a code scanning method and apparatus without an external memory, a scanning device and a mobile terminal, so as to improve code scanning efficiency without an external memory.
To achieve the above object, according to a first aspect, an embodiment of the present invention discloses a code scanning apparatus without an external memory, including:
the image reading module is used for sequentially reading the current frame images of the information codes, which are acquired by the camera, according to a preset sequence; the cache region comprises a first cache region and a second cache region, and the first cache region and the second cache region are respectively connected with the image reading module; the image data cached in the first cache region and the image data cached in the second cache region are image data of different positions in the current frame image; the positioning module comprises a first flow unit and a second flow unit, and reads and processes image data in the current frame image from the first buffer area and the second buffer area in a time-sharing manner; the first flow unit is used for reading image data in a current frame image and calculating pixel information of each pixel point, the second flow unit carries out pixel information statistics on the image data read by the first flow unit to obtain statistical information, and the statistical information comprises: the relative position and/or the presentation angle of the information code in the current frame image; and the scanning module is used for acquiring the next frame of image of the information code according to the statistical information and scanning the code to obtain the scanning data of the information code.
Optionally, during the period that the first buffer area buffers the image data in the current frame image, the positioning module reads and processes the image data in the current frame image from the second buffer area; or, during the period that the second buffer area buffers the image data in the current frame image, the positioning module reads and processes the image data in the current frame image from the first buffer area.
Optionally, the first pipelining unit reads the image data from the first buffer area or the second buffer area sequentially K times; wherein K is a positive integer; during the ith reading of the image data by the first pipelining unit, the second pipelining unit carries out pixel information statistics on the image data read by the first pipelining unit for the jth time to obtain sub-statistical information of the jth time, wherein the statistical information is a collection of the sub-statistical information of each time; wherein i and j are positive integers less than or equal to K, and j is less than or equal to i.
Optionally, the method further comprises: the third cache region is respectively connected with the second pipeline unit and the scanning module; the third cache region is used for caching the sub-statistical information output by the second pipeline unit at each time to obtain statistical information; and the scanning module acquires the statistical information from the third cache region.
Optionally, the first streaming unit reads image data of less than or equal to 5 lines at a time from the first buffer area or the second buffer area.
Optionally, the image reading module is further configured to block the current frame image according to a preset size; the first buffer area and the second buffer area buffer each block of image data by block.
Optionally, the scanning module is configured to generate a corresponding scanning manner according to the relative position and/or the presentation angle, so as to acquire and scan the next frame of image on the information code, and obtain scanning data of the information code.
Optionally, the statistical information further includes: the kind of the information code; the types of information codes include: a bar code or two-dimensional code; when the information code is a bar code, the scanning module generates a scanning line with a corresponding angle according to the presenting angle of the bar code in the current frame image, so that the scanning angle of the scanning line is matched with the presenting angle to acquire and scan the next frame image, and the scanning data of the bar code is obtained.
Optionally, the statistical information further includes: the kind of the information code; the types of information codes include: a bar code or two-dimensional code; when the information code is a two-dimensional code, the scanning module performs binarization evaluation in an area corresponding to a next frame image at the relative position according to the relative position of the two-dimensional code in the current frame image to obtain scanning data of the two-dimensional code.
Optionally, the method further comprises:
the fourth cache area is connected with the scanning module; the fourth buffer area is used for buffering the scanning data of the information code.
According to a second aspect, an embodiment of the present invention discloses a code scanning method, including:
step S100, scanning the information code by adopting the code scanning device of the first aspect to obtain the scanning data of the information code; and step S200, analyzing the scanning data to obtain the information represented by the information code.
According to a third aspect, an embodiment of the present invention discloses a code scanning method without an external memory, including:
step S1, reading the current frame image of the information code collected by the camera in sequence according to a preset sequence; step S2, caching the image data in the current frame image into a first cache region and a second cache region in a time-sharing manner; the image data cached in the first cache region and the image data cached in the second cache region are image data of different positions in the current frame image; step S3, the first pipeline unit and the second pipeline unit read and process the image data in the current frame image from the first buffer area and the second buffer area in a time sharing way; the first flow unit is used for reading image data and calculating pixel information of each pixel point, and during the period, the second flow unit carries out pixel information statistics on the image data read by the first flow unit to obtain statistical information; and step S4, scanning the information code according to the statistical information to obtain the scanning data of the information code.
According to a fourth aspect, an embodiment of the present invention discloses a scanning apparatus, including:
the camera is used for collecting the image of the information code; the code scanning device without the external memory of the first aspect.
According to a fifth aspect, an embodiment of the present invention discloses a mobile terminal, where the terminal has an image capturing device, and the terminal further includes:
the code scanning device without the external memory in the first aspect is connected with the image acquisition device; the image acquisition device is used for acquiring images of the information codes and sending the images to the code scanning device without an external memory.
According to a sixth aspect, an embodiment of the present invention discloses an integrated circuit, on which a plurality of circuit modules are integrated, the plurality of circuit modules being configured to implement the functions of the code scanning apparatus without an external memory according to the first aspect, and/or the plurality of circuit modules being configured to implement the code scanning method according to the second aspect.
According to a seventh aspect, an embodiment of the present invention discloses a chip for a scanning device, where the chip integrates a plurality of functional modules, the plurality of functional modules are used to implement the functions of the code scanning apparatus without an external memory according to the first aspect, and/or the plurality of functional modules are used to implement the code scanning method according to the second aspect.
[ PROBLEMS ] the present invention
According to the code scanning method without the external memory, the device, the scanning equipment and the mobile terminal disclosed by the embodiment of the invention, the image reading module sequentially reads the current frame image of the information code acquired by the camera according to a preset sequence, caches the image data in the current frame image through the first cache region and the second cache region, and the image data buffered by the first buffer area and the image data buffered by the second buffer area are image data of different positions in the current frame image, when the image data in the current frame image can be read and processed from the first buffer area and the second buffer area in a time-sharing way through the positioning module, the first flow unit reads the image data and calculates the pixel information of each pixel point, the second flow unit carries out the pixel information statistics on the image data read by the first flow unit to obtain statistical information, enabling the first pipelining unit and the second pipelining unit to synchronously process image data at different positions; and the first flow water unit and the second flow water unit are used for processing different working procedures respectively, so that the positioning module can run in a flowing water mode efficiently, and the code scanning efficiency is improved.
As an optional scheme, the sub-statistical information output by the second pipeline unit and obtained at each time is cached by the third cache region, and the scanning module obtains the statistical information from the third cache region, so that the scanning module can quickly and effectively obtain the statistical information on the premise of no external memory, and scans the information code based on the statistical information to obtain the scanning data of the information code.
As an optional scheme, the image reading module is further configured to block the current frame image according to a preset size; the first buffer area and the second buffer area buffer each block of image data by block. Therefore, the buffer space of the first buffer area and the second buffer area can be further reduced, namely, the buffer space required by code scanning is further reduced.
As an optional scheme, the scanning module generates a scanning line with a corresponding angle according to the presentation angle of the barcode in the current frame image, so that the scanning angle of the scanning line matches the presentation angle to acquire and scan the next frame image, and scanning data of the barcode is obtained. Therefore, the complex rotation operation of the acquired image is avoided, namely, the next frame image of the whole frame does not need to be stored; and because the scanning angle of the scanning line is matched with the presentation angle to acquire and scan the next frame of image, the scanning can be realized, the scanning data can be obtained while scanning, and the scanning efficiency is improved.
As an optional scheme, the scanning module performs binarization evaluation in an area corresponding to a next frame image at the relative position according to the relative position of the two-dimensional code in the current frame image, so as to obtain scanning data of the two-dimensional code. Therefore, the pertinence of the binarization evaluation area can be improved, and the noise influence caused by the area outside the area is reduced.
Other advantages of the present invention will be described in the detailed description, and those skilled in the art will understand the technical features and technical solutions presented in the description.
Drawings
Embodiments according to the present invention will be described below with reference to the accompanying drawings. In the figure:
FIG. 1 is a schematic structural diagram of a code scanning apparatus without an external memory according to the present disclosure;
FIG. 2 is a schematic diagram of a barcode according to the present disclosure;
FIG. 3 is a schematic waveform diagram of a barcode according to the present disclosure;
FIG. 4 is a schematic view illustrating a scanning process of a barcode according to the present embodiment;
FIG. 5 is a schematic diagram of a process of scanning a barcode with a scan line according to the disclosure of this embodiment;
FIG. 6 is a flowchart illustrating a code scanning method disclosed in this embodiment;
fig. 7 illustrates a code scanning method without an external memory according to the present embodiment.
Detailed Description
In order to improve code scanning efficiency without an external memory, the present embodiment discloses a code scanning device without an external memory, please refer to fig. 1, which is a schematic structural diagram of a code scanning device without an external memory disclosed in the present embodiment, and the code scanning device without an external memory includes: image reading module 1, buffer 2, orientation module 3 and scanning module 4, wherein:
the image reading module 1 is used for sequentially reading the current frame images of the information codes, which are acquired by the camera according to a preset sequence. In this embodiment, the information code may be a two-dimensional code or a barcode. In a specific implementation process, the image reading module 1 is electrically connected with the cameras, and sequentially reads the current frame images in a manner of reading electric signals sent by the cameras. The camera may be, for example, a cmos camera, and in this embodiment, the predetermined sequence may be from top to bottom and from left to right to sequentially read the current frame images collected by the camera.
The buffer area 2 includes a first buffer area 21 and a second buffer area 22, wherein the first buffer area 21 and the second buffer area 22 are respectively connected to the image reading module 1. The first buffer area 21 and the second buffer area 22 buffer the image data in the current frame image in a time-sharing manner, and the image data buffered by the first buffer area 21 and the image data buffered by the second buffer area 22 are image data at different positions in the current frame image. Specifically, in the process of reading the image data of the current frame image, the image reading module 1 buffers a part of the read image data into the first buffer area 21, and buffers another part of the read image data into the second buffer area 22, so as to buffer the image data of the current frame image into the first buffer area 21 and the second buffer area 22, respectively. In a specific implementation process, the first cache region 21 and the second cache region 22 may be obtained by partitioning the same cache, or different caches may be configured for the first cache region 21 and the second cache region 22 respectively. In a specific implementation, the caching of the first cache region 21 and the second cache region 22 may be implemented by, for example, an SRAM.
The positioning module 3 includes a first pipeline unit 31 and a second pipeline unit 32, and the positioning module 3 reads and processes image data in the current frame image from the first buffer area 21 and the second buffer area 22 in a time-sharing manner. Specifically, after the first buffer area 21 is full of image data, the positioning module 3 may read and process the image data in the first buffer area 21, and during this period, the image reading module 1 continues to read the image data of the current frame image and buffers the read image data in the second buffer area 22, so that the positioning module 3 can synchronously read and process the image data and buffer the image data in the buffer area 2.
In this embodiment, the first pipelining unit 31 is configured to read image data in a current frame image and calculate pixel information of each pixel point, and the second pipelining unit 32 performs pixel information statistics on the image data read by the first pipelining unit 31 to obtain statistical information. In this embodiment, the pixel information may be information such as an amplitude and an angle of each pixel point. In this embodiment, the statistical information may include a relative position and/or a presentation angle of the information code in the current frame image, that is, angle information, position information, and the like of the information code, for example, center points of the barcode and the two-dimensional code, an angle direction of the barcode, and the like are evaluated through edge information. Specifically, the second pipeline unit 32 performs pixel information statistics on the read image data to obtain statistical information, and during the period, the first pipeline unit 31 reads new image data from the buffer 2 and calculates pixel information of each pixel point in the new image data. Therefore, the first pipelining unit 31 and the second pipelining unit 32 can perform related processing on the image data in parallel and in a division manner, and the data processing efficiency is improved.
In a specific implementation, the first pipeline unit 31 and the second pipeline unit 32 of the positioning module 3 may be implemented by digital circuits. In a specific implementation process, the second pipeline unit 32 may determine the optimal amplitude, the optimal angle, and other information based on the amplitude, the angle, and other information of each pixel point, and thus may determine the statistical information such as the relative position, the presentation angle, and the like in the current frame image.
The scanning module 4 is used for acquiring the next frame of image of the information code according to the statistical information and scanning the code to obtain the scanning data of the information code. In this embodiment, after the positioning module 3 obtains the statistical information according to the current frame image, the scanning module 4 determines the scanning mode based on the statistical information, and acquires and scans the next frame image in the appropriate scanning mode to obtain the scanning data of the information code. In this embodiment, the scan data of the information code can be obtained by positioning the current frame image and scanning the next frame image.
In an alternative embodiment, during the period that the first buffer area 21 buffers the image data in the current frame image, the positioning module 3 reads and processes the image data in the current frame image from the second buffer area 22; or, during the period that the second buffer area 22 buffers the image data in the current frame image, the positioning module 3 reads and processes the image data in the current frame image from the first buffer area 21. As an example, the image reading module 1 sequentially reads image data of a current frame image in a predetermined order, and buffers the read image data to the first buffer area 21; after the space of the first buffer area 21 is full of the read image data, the image reading module 1 continues to read the image data and buffers the newly read image data into the second buffer area 22, and at the same time, the positioning module 3 reads and processes the image data in the current frame image from the first buffer area 21.
In order to reduce the data processing amount of the positioning module 3, in a specific embodiment, the first pipeline unit 31 sequentially reads the image data from the first buffer area 21 or the second buffer area 22K times, where K is a positive integer. This reduces the data processing amount of the positioning module 3 at a time, and reduces the load.
In order to coordinate the work flow of allocating the first pipeline unit 31 and the second pipeline unit 32, in a specific embodiment, during the ith reading of the image data by the first pipeline unit 31, the second pipeline unit 32 performs pixel information statistics on the jth read image data by the first pipeline unit 31 to obtain jth sub-statistical information, where the statistical information is a collection of the sub-statistical information of each time; wherein i and j are positive integers less than or equal to K, and j is less than or equal to i. In this embodiment, the sub-statistical information refers to statistical information obtained by performing pixel information statistics on the image data each time by the second pipeline unit 32. That is, the first pipeline unit 31 reads a part of data each time, the second pipeline unit 32 performs pixel information statistics on the data read before the first pipeline unit 31 to obtain sub-statistical information, and the second pipeline unit 32 processes the sub-statistical information to obtain the statistical information of the current frame image.
In a preferred embodiment, j is i-1, that is, during the ith reading of the image data by the first pipelining unit 31, the second pipelining unit 32 performs pixel information statistics on the (i-1) th read image data by the first pipelining unit 31 to obtain the (i-1) th sub-statistical information.
It should be noted that in the implementation process, when i is equal to K, that is, the first pipeline unit 31 reads the last data in the first buffer area 21 (or the second buffer area 22), and does not start to read the data in the second buffer area 22 (or the first buffer area 21), at this time, the second pipeline unit 32 processes the data of the (i-1) th time; after the second pipeline unit 32 finishes processing the (i-1) th data, the first pipeline unit 31 starts to read the data in the second buffer 22 (or the first buffer 21), and at this time, the second pipeline unit 32 starts to process the ith data.
It should be noted that, in the specific implementation process, the calculation speed of the positioning module for processing data each time is faster than the speed of acquiring the current frame image from the cmos, otherwise, a bandwidth error report is performed, and at this time, the current frame image data needs to be discarded.
In order to reduce the data processing pressure of the first pipeline unit 31 and the second pipeline unit 32, in an alternative embodiment, the first pipeline unit 31 reads less than or equal to 5 lines of image data from the first buffer area 21 or the second buffer area 22 at a time. Specifically, in the case of 2 rows, the first pipeline unit 31 reads 2 rows of data from the first buffer 21 (or the second buffer 22) each time, and the second pipeline unit 32 processes the data of the last 2 rows.
In order to cache the statistical information, in an optional embodiment, the code scanning apparatus without external memory further includes: the third cache region 23, the third cache region 23 is connected with the second pipeline unit 32 and the scanning module 4 respectively; the third buffer area 23 is configured to buffer sub-statistical information output by the second pipeline unit 32 for each time to obtain statistical information; the scanning module 4 obtains statistical information from the third buffer 23. In a specific implementation process, the third buffer area 23 may share one buffer with the first buffer area 21 and the second buffer area 22, or may configure one buffer separately. When the buffer is separately configured for separately configuring the third buffer area 23, it may be implemented by, for example, DDR, and thus, the buffered data may be periodically updated.
In order to further reduce the buffer space, in an optional embodiment, the image reading module 1 is further configured to block the current frame image according to a preset size; the first buffer area 21 and the second buffer area 22 buffer each block of image data by block at a time division. Specifically, 1, a frame of image is collected from the cmos camera, which is generally 640 × 480, and the image with 640 × 480 size is divided into 32 × 32 size by taking the preset size of the block as an example, so that there are 20 blocks in the horizontal direction and 15 blocks in the vertical direction. When the image data of each block is cached in a time-sharing manner, as an example, the 1 st block is stored in the first buffer area 21, the 2 nd block is stored in the second buffer area 22, the 3 rd block is stored in the first buffer area 21, the 4 th block is stored in the second buffer area 22, and so on, the image data of each block is cached in the first buffer area 21 and the second buffer area 22 in a time-sharing manner. The storage overhead of the first buffer area 21 and the second buffer area 22 is: 640 × 32byte ═ 20KB, where 640 is the width of the current frame image and 32 is the height of the current frame image; the total memory overhead of the first buffer 21 and the second buffer 22 is 2 × 20KB — 40 KB. In addition, the space required for statistical information caching is about 3KB, and the angle and the amplitude of each image block can be cached.
In a particular embodiment, the statistical information includes: the relative position and/or the angle of presentation of the information code in the current frame image. The scanning module 4 is configured to generate a corresponding scanning mode according to the relative position and/or the presentation angle, so as to perform acquisition scanning on the next frame of image on the information code, and obtain scanning data of the information code. Specifically, the statistical information further includes a type of information code, and the type of information code includes: a bar code or a two-dimensional code.
In an embodiment, when the information code is a barcode, the scanning module 4 generates a scanning line with a corresponding angle according to a presentation angle of the barcode in the current frame image, so that the scanning angle of the scanning line matches the presentation angle to acquire and scan the next frame image, and obtain scanning data of the barcode.
In this embodiment, the angle of the scanning line is adjusted to adapt to the angle of the barcode, and on the one hand, the storage space can be reduced compared with a mode that the whole frame of image is rotated to adapt to the scanning line after the whole frame of image is acquired; on the other hand, a larger amount of calculation due to rotation of the entire frame image can be reduced.
In another embodiment, when the information code is a two-dimensional code, the scanning module 4 performs binarization evaluation in an area corresponding to a next frame image at the relative position according to the relative position of the two-dimensional code in the current frame image, so as to obtain scanning data of the two-dimensional code.
In the embodiment, the binarization evaluation is performed in the region corresponding to the next frame of image, so that more noise can be avoided, the data processing efficiency is improved, and the two-dimensional code identification precision is improved.
In an optional embodiment, the method further comprises: the fourth cache region 24, the fourth cache region 24 is connected with the scanning module 4; the fourth buffer 24 is used for buffering the scanning data of the information code. Specifically, the fourth buffer 24 may be implemented by a buffer, and the scanned data of the information code is cached by the fourth buffer 24, so that the processor may directly obtain the scanned data from the fourth buffer 24 and perform subsequent identification.
To facilitate the understanding of the working of the scanning module 4 by the skilled person:
a first part: scanning process for bar code
Referring to fig. 2, a schematic diagram of a barcode according to the present disclosure is shown, in fig. 2, a thick solid line is a scan line, and a striped line segment is a barcode.
The positioning module 3 determines the information code as the bar code according to the current frame image, and the statistical information such as the position and the direction of the estimated bar code, the scanning module 4 generates a scanning line according to the statistical information, the scanning line passes through the whole bar code along the direction indicated by the thick solid line, the value of the pixel point corresponding to each straight line is extracted, and the oscillogram of the bar code is obtained for the next decoding algorithm.
Please refer to fig. 3, which is a schematic waveform diagram of a barcode disclosed in this embodiment, and fig. 4, which is a schematic scan flow diagram of a barcode disclosed in this embodiment, the following describes the generating steps of the scan lines by generating one of the scan lines:
(1) and acquiring the central point and the angle of the next frame image from the statistical information of the current frame image. Thus, the scan line is determined, and specifically, the position of the scan line can be described by the linear equation y ═ ax + b, where a and b are constants, and specifically, after the angle of the barcode is determined, the values of a and b can be determined. The start point (x0, y0) and end point (x1, y1) of a scan line, and the scan direction of the line, e.g., whether it is left to right or right to left, are determined by the equations of a straight line.
(2) The position (xs, xe) of the point on the scanning line where the first line is located in the next frame image is calculated. Please refer to fig. 5, which is a schematic diagram of a process of scanning a barcode with a scan line disclosed in this embodiment, in fig. 5, a left side is a schematic diagram of the scan line on the barcode, and a right side is a buffer cache schematic diagram. Three pixel points (gray filled boxes) are positioned on the scanning line at the right of the first row on the bar code, and two variables (xs, xe) are adopted to describe the three pixel points, wherein xs represents the initial position of the effective pixel, and xe represents the end position of the pixel.
(3) Sequentially receiving pixel points of the next row;
(4) judging whether the pixel point is in the range described by (xs, xe):
if yes, caching the corresponding pixel value to the corresponding position of the scan line buffer according to the direction of the scan line (as shown by an arrow line in FIG. 5);
if not, jumping to (3) to repeatedly calculate the positions (xs, xe) of the points on the scanning lines until all the line data receiving processing of the frame image is completed.
A second part: scanning process of two-dimensional code
In a specific implementation process, the two-dimensional code may be scanned in a binarization evaluation manner, and specifically, after a specific position of the two-dimensional code is located based on a current frame image, binarization is performed on a specific position of a next frame image. Binarization can adopt a threshold evaluation mode based on an image block, and if the size of the image block is N multiplied by N, 2x N rows of internal buffers are consumed. The general flow is as follows:
(1) receive the first row of pixels in the first N rows and buffer them into the first N inner rows of sram, and calculate the sums of every N pixels, buffer the values of these sums in the row (if the image resolution is 640x480, then there are 640/N sums in total).
(2) And receiving the pixel points of the second line in the first N lines, and simultaneously calculating the sum of every other N pixel points and adding the buffered N pixel points in the previous line.
(3) And (5) continuing to execute the step (2) until all the N rows receive the calculation. When all the received images are received, the average of the 480/N image blocks in the N rows is known by the sum.
(4) Continuing to execute the steps (1), (2) and (3) to cache in the sram of the second N lines,
(5) and (4) reading each pixel point from the first N rows while executing the step (4), comparing the pixel point with the average value of the corresponding image block, wherein the image average value is m- (sum/(N) and the average value m is used as the threshold value of the current image block. And traversing the pixel points of the current image block, if the value of the pixel point is more than or equal to m, binarizing the changed point into 255, otherwise binarizing the point into 0.
According to the steps, circularly receiving N rows of pixel points, caching the pixel points to an internal sram of 2x N rows, calculating a summation and average value while receiving, reading another N rows of pixel points while receiving one N row, comparing the average value, and outputting a binary value.
Referring to fig. 6, a flowchart of a code scanning method disclosed in this embodiment is shown, where the code scanning method includes:
step S100, scanning the information code by using the code scanning apparatus disclosed in any of the above embodiments to obtain the scanned data of the information code.
And step S200, analyzing the scanning data to obtain the information represented by the information code. In a specific embodiment, the parsing of the scan data may be implemented by means of software. In particular, for bar codes, peaks and valleys in the bar code waveform can be analyzed to decode the waveform into numbers. For the two-dimensional code, image data after binarization is read, and information of the two-dimensional code is decoded.
Referring to fig. 7, the present embodiment discloses a code scanning method without an external memory, which includes:
and step S1, sequentially reading the current frame images of the information codes, which are acquired by the camera, according to a preset sequence.
In step S2, the image data in the current frame image is time-shared and buffered in the first buffer area 21 and the second buffer area 22. The image data cached in the first buffer area 21 and the image data cached in the second buffer area 22 are image data at different positions in the current frame image.
In step S3, the first pipeline unit 31 and the second pipeline unit 32 read and process the image data in the current frame image from the first buffer area 21 and the second buffer area 22 in a time-sharing manner. The first pipelining unit 31 is configured to read image data and calculate pixel information of each pixel, and during the period, the second pipelining unit 32 performs pixel information statistics on the image data read by the first pipelining unit 31 to obtain statistical information.
And step S4, scanning the information code according to the statistical information to obtain the scanning data of the information code.
The embodiment also discloses a scanning device, including:
the camera is used for collecting the image of the information code; the code scanning device without the external memory disclosed in any of the above embodiments.
The embodiment further discloses a mobile terminal, where the terminal has an image acquisition device, the mobile terminal may be, for example, a mobile phone, a tablet, or a terminal device of other specific image acquisition devices, and the mobile terminal further includes:
the code scanning device without the external memory disclosed by any embodiment is connected with the image acquisition device; the image acquisition device is used for acquiring images of the information codes and sending the images to the code scanning device without an external memory.
The embodiment further discloses an integrated circuit, wherein a plurality of circuit modules are integrated on the integrated circuit, the plurality of circuit modules are used for realizing the functions of the code scanning device without the external memory disclosed in any embodiment, and/or the plurality of circuit modules are used for realizing the code scanning method disclosed in any embodiment.
The embodiment also discloses a chip for the scanning device, wherein the chip integrates a plurality of functional modules, the functional modules are used for realizing the functions of the code scanning device without the external memory disclosed in any embodiment, and/or the functional modules are used for realizing the code scanning method disclosed in any embodiment.
The chip disclosed by the embodiment only needs to adopt the built-in sram of about 150k to decode the two-dimensional code and the bar code, and does not need external storage equipment such as a large-capacity external SDRAM (synchronous dynamic random access memory) or a DDR (double data rate), so that the equipment cost is saved, and the product competitiveness is improved.
According to the code scanning method without the external memory, the device, the scanning equipment and the mobile terminal disclosed by the embodiment of the invention, the image reading module sequentially reads the current frame image of the information code acquired by the camera according to a preset sequence, caches the image data in the current frame image through the first cache region and the second cache region, and the image data buffered by the first buffer area and the image data buffered by the second buffer area are image data of different positions in the current frame image, when the image data in the current frame image can be read and processed from the first buffer area and the second buffer area in a time-sharing way through the positioning module, the first flow unit reads the image data and calculates the pixel information of each pixel point, the second flow unit carries out the pixel information statistics on the image data read by the first flow unit to obtain statistical information, enabling the first pipelining unit and the second pipelining unit to synchronously process image data at different positions; and the first flow water unit and the second flow water unit are used for processing different working procedures respectively, so that the positioning module can run in a flowing water mode efficiently, and the code scanning efficiency is improved.
As an optional scheme, the sub-statistical information output by the second pipeline unit and obtained at each time is cached by the third cache region, and the scanning module obtains the statistical information from the third cache region, so that the scanning module can quickly and effectively obtain the statistical information on the premise of no external memory, and scans the information code based on the statistical information to obtain the scanning data of the information code.
As an optional scheme, the image reading module is further configured to block the current frame image according to a preset size; the first buffer area and the second buffer area buffer each block of image data by block. Therefore, the buffer space of the first buffer area and the second buffer area can be further reduced, namely, the buffer space required by code scanning is further reduced.
As an optional scheme, the scanning module generates a scanning line with a corresponding angle according to the presentation angle of the barcode in the current frame image, so that the scanning angle of the scanning line matches the presentation angle to acquire and scan the next frame image, and scanning data of the barcode is obtained. Therefore, the complex rotation operation of the acquired image is avoided, namely, the next frame image of the whole frame does not need to be stored; and because the scanning angle of the scanning line is matched with the presentation angle to acquire and scan the next frame of image, the scanning can be realized, the scanning data can be obtained while scanning, and the scanning efficiency is improved.
As an optional scheme, the scanning module performs binarization evaluation in an area corresponding to a next frame image at the relative position according to the relative position of the two-dimensional code in the current frame image, so as to obtain scanning data of the two-dimensional code. Therefore, the pertinence of the binarization evaluation area can be improved, and the noise influence caused by the area outside the area is reduced.
It will be appreciated by those skilled in the art that the above-described preferred embodiments may be freely combined, superimposed, without conflict.
It will be understood that the embodiments described above are illustrative only and not restrictive, and that various obvious and equivalent modifications and substitutions for details described herein may be made by those skilled in the art without departing from the basic principles of the invention.

Claims (16)

1. A code scanning apparatus without an external memory, comprising:
the image reading module (1) is used for sequentially reading the current frame images of the information codes, which are acquired by the camera, according to a preset sequence;
the image reading device comprises a buffer area (2), wherein the buffer area (2) comprises a first buffer area (21) and a second buffer area (22), and the first buffer area (21) and the second buffer area (22) are respectively connected with the image reading module (1); the first buffer area (21) and the second buffer area (22) buffer the image data in the current frame image in a time-sharing manner, and the image data buffered by the first buffer area (21) and the image data buffered by the second buffer area (22) are image data at different positions in the current frame image;
the positioning module (3) comprises a first pipelining unit (31) and a second pipelining unit (32), and the positioning module (3) reads and processes image data in the current frame image from the first buffer area (21) and the second buffer area (22) in a time-sharing manner; the first pipelining unit (31) is configured to read image data in the current frame image and calculate pixel information of each pixel point, the second pipelining unit (32) performs pixel information statistics on the image data read by the first pipelining unit (31) to obtain statistical information, and the statistical information includes: the relative position and/or the presentation angle of the information code in the current frame image;
and the scanning module (4) is used for acquiring the next frame of image of the information code according to the statistical information and scanning the code to obtain the scanning data of the information code.
2. The code scanning device without external memory as claimed in claim 1, wherein during the first buffer area (21) buffers the image data in the current frame image, the positioning module (3) reads and processes the image data in the current frame image from the second buffer area (22); or, during the period that the second buffer area (22) buffers the image data in the current frame image, the positioning module (3) reads and processes the image data in the current frame image from the first buffer area (21).
3. The code scanning device without external memory according to claim 1, wherein the first streaming unit (31) sequentially reads image data from the first buffer (21) or the second buffer (22) K times; wherein K is a positive integer;
during the ith reading of the image data by the first pipelining unit (31), the second pipelining unit (32) performs pixel information statistics on the image data read by the jth reading of the first pipelining unit (31) to obtain jth sub-statistical information, wherein the statistical information is a collection of the sub-statistical information of each time; wherein i and j are positive integers less than or equal to K, and j is less than or equal to i.
4. The code scanning apparatus without external memory according to claim 3, further comprising:
the third cache region (23) is respectively connected with the second pipeline unit (32) and the scanning module (4); the third cache region (23) is configured to cache the sub-statistical information output by the second pipeline unit (32) at each time to obtain the statistical information;
the scanning module (4) obtains the statistical information from the third buffer (23).
5. The code scanning apparatus without external memory according to claim 3, wherein the first streaming unit (31) reads less than or equal to 5 lines of image data from the first buffer (21) or the second buffer (22) at a time.
6. The code scanning device without external memory according to any of claims 1-5,
the image reading module (1) is further used for partitioning the current frame image according to a preset size;
the first buffer area (21) and the second buffer area (22) buffer each block of image data in a time-sharing manner.
7. The code scanning device without external memory according to any of claims 1-6,
the scanning module (4) is used for generating a corresponding scanning mode according to the relative position and/or the presentation angle so as to acquire and scan the next frame of image of the information code to obtain the scanning data of the information code.
8. The code-scanning apparatus without external memory according to claim 7, wherein the statistical information further comprises: a kind of the information code; the types of the information codes include: a bar code or two-dimensional code;
when the information code is a bar code, the scanning module (4) generates a scanning line with a corresponding angle according to the presenting angle of the bar code in the current frame image, so that the scanning angle of the scanning line is matched with the presenting angle to acquire and scan the next frame image, and the scanning data of the bar code is obtained.
9. The code-scanning apparatus without external memory according to claim 7, wherein the statistical information further comprises: a kind of the information code; the types of the information codes include: a bar code or two-dimensional code;
when the information code is a two-dimensional code, the scanning module (4) performs binarization evaluation on the region corresponding to the next frame image at the relative position according to the relative position of the two-dimensional code in the current frame image to obtain the scanning data of the two-dimensional code.
10. The code-scanning apparatus without external memory of claim 7, further comprising:
a fourth buffer (24) connected to the scanning module (4); the fourth buffer area (24) is used for buffering the scanning data of the information code.
11. A method for scanning a code, comprising:
step S100, scanning an information code by using the code scanning device according to any one of claims 1 to 10 to obtain scanning data of the information code;
and step S200, analyzing the scanning data to obtain the information represented by the information code.
12. A code scanning method without an external memory is characterized by comprising the following steps:
step S1, reading the current frame image of the information code collected by the camera in sequence according to a preset sequence;
step S2, caching the image data in the current frame image to the first buffer area (21) and the second buffer area (22) in a time-sharing manner; the image data cached in the first cache region (21) and the image data cached in the second cache region (22) are image data of different positions in the current frame image;
step S3, reading and processing the image data in the current frame image from the first buffer area (21) and the second buffer area (22) by the first pipeline unit (31) and the second pipeline unit (32) in a time-sharing manner; the first pipelining unit (31) is used for reading image data and calculating pixel information of each pixel point, and during the period, the second pipelining unit (32) performs pixel information statistics on the image data read by the first pipelining unit (31) to obtain statistical information;
and step S4, scanning the information code according to the statistical information to obtain the scanning data of the information code.
13. A scanning device, characterized by comprising:
the camera is used for collecting the image of the information code;
the code scanning apparatus without external memory according to any of claims 1-10.
14. A mobile terminal, the terminal has an image acquisition device, characterized in that, the terminal further includes:
the code scanning device without the external memory according to any one of claims 1 to 10, connected with the image acquisition device;
the image acquisition device is used for acquiring images of information codes and sending the images to the code scanning device without the external memory.
15. An integrated circuit, characterized in that a plurality of circuit modules are integrated on the integrated circuit, the circuit modules are used for realizing the functions of the code scanning device without the external memory according to any one of claims 1-10, and/or the circuit modules are used for realizing the code scanning method according to claim 11.
16. A chip for a scanning device, wherein the chip integrates a plurality of functional modules, the functional modules are used for realizing the functions of the code scanning device without the external memory according to any one of claims 1 to 10, and/or the functional modules are used for realizing the code scanning method according to claim 11.
CN202010425823.4A 2020-05-19 2020-05-19 Code scanning method and device without external memory, scanning equipment and mobile terminal Active CN112287702B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010425823.4A CN112287702B (en) 2020-05-19 2020-05-19 Code scanning method and device without external memory, scanning equipment and mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010425823.4A CN112287702B (en) 2020-05-19 2020-05-19 Code scanning method and device without external memory, scanning equipment and mobile terminal

Publications (2)

Publication Number Publication Date
CN112287702A true CN112287702A (en) 2021-01-29
CN112287702B CN112287702B (en) 2023-03-14

Family

ID=74421109

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010425823.4A Active CN112287702B (en) 2020-05-19 2020-05-19 Code scanning method and device without external memory, scanning equipment and mobile terminal

Country Status (1)

Country Link
CN (1) CN112287702B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115081467A (en) * 2022-07-22 2022-09-20 深圳市成为信息股份有限公司 Method for collecting original image by handset, handset and storage medium
CN116028383A (en) * 2022-08-22 2023-04-28 荣耀终端有限公司 Cache management method and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103218174A (en) * 2013-03-29 2013-07-24 航天恒星科技有限公司 IO (Input Output) double-buffer interactive multicore processing method for remote sensing image
CN104899542A (en) * 2015-05-27 2015-09-09 广州市韦尔讯信息科技有限公司 Image-type CMOS barcode rapid recognition method and apparatus
US20180278948A1 (en) * 2017-03-23 2018-09-27 Qualcomm Incorporated Tile-based processing for video coding
CN108632624A (en) * 2017-12-18 2018-10-09 百富计算机技术(深圳)有限公司 Image processing method, device, terminal device and readable storage medium storing program for executing
CN110659529A (en) * 2019-09-03 2020-01-07 珠海市杰理科技股份有限公司 Bar code identification method and device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103218174A (en) * 2013-03-29 2013-07-24 航天恒星科技有限公司 IO (Input Output) double-buffer interactive multicore processing method for remote sensing image
CN104899542A (en) * 2015-05-27 2015-09-09 广州市韦尔讯信息科技有限公司 Image-type CMOS barcode rapid recognition method and apparatus
US20180278948A1 (en) * 2017-03-23 2018-09-27 Qualcomm Incorporated Tile-based processing for video coding
CN108632624A (en) * 2017-12-18 2018-10-09 百富计算机技术(深圳)有限公司 Image processing method, device, terminal device and readable storage medium storing program for executing
CN110659529A (en) * 2019-09-03 2020-01-07 珠海市杰理科技股份有限公司 Bar code identification method and device, computer equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115081467A (en) * 2022-07-22 2022-09-20 深圳市成为信息股份有限公司 Method for collecting original image by handset, handset and storage medium
CN115081467B (en) * 2022-07-22 2023-02-03 深圳市成为信息股份有限公司 Method for collecting original image by handset, handset and storage medium
CN116028383A (en) * 2022-08-22 2023-04-28 荣耀终端有限公司 Cache management method and electronic equipment
CN116028383B (en) * 2022-08-22 2023-10-20 荣耀终端有限公司 Cache management method and electronic equipment

Also Published As

Publication number Publication date
CN112287702B (en) 2023-03-14

Similar Documents

Publication Publication Date Title
KR101836071B1 (en) Method and system for recognizing information
CN106296578B (en) Image processing method and device
JP5567035B2 (en) System and method for capturing and detecting barcodes using a vision-on-chip processor
US10242434B1 (en) Compensating for geometric distortion of images in constrained processing environments
CN112287702B (en) Code scanning method and device without external memory, scanning equipment and mobile terminal
US9600744B2 (en) Adaptive interest rate control for visual search
JP3150707B2 (en) Omnidirectional barcode detector
US7383994B2 (en) Methods and systems for forming images of moving optical codes
CN108875535B (en) Image detection method, device and system and storage medium
CN107886026B (en) graphic code processing method and device
CN110263680B (en) Image processing method, device and system and storage medium
US10783618B2 (en) Compensating for geometric distortion of images in constrained processing environments
JP2012226608A (en) Image processing device, control method of image processing device, and program
CN111242926A (en) Focus detection method and device and electronic equipment
US8194930B2 (en) Image processing apparatus and method for real-time motion detection
CN110555863A (en) moving object detection method and device and computer readable storage medium
CN112052702A (en) Method and device for identifying two-dimensional code
JP4271378B2 (en) Imaging device
CN111209908A (en) Method and device for updating label box, storage medium and computer equipment
WO2015023318A2 (en) Depth image compression and decompression utilizing depth and amplitude data
KR101192365B1 (en) System and method for detecting of face
CN112330618A (en) Image offset detection method, device and storage medium
CN111242051A (en) Vehicle identification optimization method and device and storage medium
JP6384365B2 (en) Pulse measuring device and control method thereof
CN113612922A (en) Video processing method and device, electronic equipment and computer readable 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
CB02 Change of applicant information

Address after: 519075 No. 333, Kexing Road, Xiangzhou District, Zhuhai City, Guangdong Province

Applicant after: ZHUHAI JIELI TECHNOLOGY Co.,Ltd.

Address before: Floor 1-107, building 904, ShiJiHua Road, Zhuhai City, Guangdong Province

Applicant before: ZHUHAI JIELI TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant