Two-dimensional code decoding algorithm comparison verification method
Technical Field
The invention relates to the field of two-dimensional code decoding algorithms, in particular to a verification method based on a two-dimensional code algorithm comparison verification system.
Background
For a newly developed two-dimensional code decoding algorithm, the decoding capability of the two-dimensional code decoding algorithm is verified and compared with the decoding capability of other two-dimensional code decoding algorithms. The decoding capability of the first-developed two-dimensional code decoding algorithm is strong, and the decoding capability of the existing code scanning gun in the market is the same or inferior.
The existing comparison and verification usually adopts a manual mode to carry out respective decoding by using two decoding algorithms, and then the decoding results are compared. The method has the technical problems of low accuracy of comparison results and complex and fussy method caused by inconsistent decoding conditions and environments. Therefore, it is necessary to provide a two-dimensional code decoding algorithm comparison verification system with high comparison result accuracy and high automation degree.
Disclosure of Invention
The invention aims to solve the technical problems of low accuracy of comparison results and complex and fussy operation in the prior art. The novel two-dimensional code decoding algorithm comparison verification system has the characteristics of high automation degree and high accuracy of comparison results.
In order to solve the technical problems, the technical scheme is as follows:
a two-dimensional code algorithm comparison verification system comprises a code scanning gun, a switch circuit switching device, an ARM processor and an upper computer, wherein the switch circuit switching device is connected with the code scanning gun and is also connected with an MIPI decoding device and an FPGA chip; the ARM processor is also connected with the MIPI decoding device, the upper computer and the FPGA chip; the MIPI decoding device is also connected with the FPGA chip; the FPGA chip is used for controlling the switching device of the switch circuit and comprises a FLASH module; the code scanning gun comprises a CMOS sensor, and the CMOS sensor is connected with a central processing unit of the code scanning gun through the switching circuit switching device; a code scanning gun button connected with the code scanning gun central processing unit; the code scanning gun button is also connected with the ARM processor; the code scanning gun central processing unit is also connected with the upper computer; the switching circuit switching device comprises an alternative switch and is used for controlling and selecting the connection of the CMOS sensor, the MIPI decoding device and the code scanning gun central processing unit; the MIPI decoding device is used for bidirectional data conversion, and the bidirectional data are converted into parallel port MIPI and MIPI parallel port; the upper computer is used for comparing image quality, calculating and controlling the ARM processor and the code scanning gun central processing unit.
In the above scheme, for optimization, further, the line length from the CMOS sensor to the central processing unit of the code scanning gun through the switch circuit switching device is equal to the line length from the CMOS sensor to the ARM processor through the switch circuit switching device and the MIPI decoding device.
Further, the alternative switch comprises a first switch unit, a second switch unit and a third switch unit; the second switch unit and the third switch unit are connected in parallel and then connected with the first switch unit; the first switch and the second switch unit are used for controlling the CMOS sensor to be connected with the MIPI decoding device; and the third switch unit is used for controlling the CMOS sensor to be connected with the code scanning gun central processing unit.
Further, the two-dimensional code algorithm comparison and verification system further comprises a three-axis motor connected with the upper computer, a support connected with the three-axis motor, and an LCD1 connected with the FLASH, wherein the support is used for accelerating the code scanning gun; the LCD1 is used for displaying two-dimensional code pictures in the storage and FLASH; the three-axis motor is used for adjusting the relative position of the CMOS sensor of the code scanning gun and the LCD1 and comprises an X-axis motor, a Y-axis motor and a Z-axis motor; the Z-axis motor is used for adjusting the height of the horizontal table from the camera; the X-axis motor is used for adjusting the deflection angle of the Z-axis horizontal table on the X axis; and the Y-axis motor is used for adjusting the deflection angle of the Y-axis horizontal table on the Y axis.
The invention also provides a use method of the comparison verification system based on the two-dimensional code algorithm, which comprises the following steps:
(1) detecting early-stage parameters by using an oscilloscope, wherein the early-stage parameters comprise the size of an image received by the code scanning gun and the output signal format of a CMOS (complementary metal oxide semiconductor) sensor, and the output signal format of the CMOS sensor is MIPI or parallel port;
(2) connecting a hardware circuit to form a two-dimensional code algorithm comparison verification system;
(3) aligning an external two-dimensional code picture by using a code scanning gun, acquiring two-dimensional code picture data by using a CMOS (complementary metal oxide semiconductor) sensor in the code scanning gun, respectively decoding and processing the acquired data by using a central processing unit and an ARM (advanced RISC machines) processor of the code scanning gun, and performing MIPI-parallel port conversion by using the MIPI decoding device if the output data of the CMOS sensor is MIPI;
(4) and printing the decoded result signal to an upper computer, comparing the image quality of the printing result, and obtaining a comparison verification result according to the image quality comparison.
In the foregoing solution, for optimization, the step (3) further includes the following steps:
(A) pre-storing a two-dimension code picture in FLASH as an internal two-dimension code picture;
(B) pressing a button of the code scanning gun to manually call an internal two-dimensional code picture stored in FLASH to be displayed on the LCD1, manually controlling the code scanning gun to align the two-dimensional code picture in the LCD1, and acquiring two-dimensional code picture data by a CMOS sensor;
(C) the code scanning gun central processing unit and the ARM processor decode and process collected data respectively, the data received by the code scanning gun central processing unit are MIPI, and the MIPI decoding device performs parallel port-MIPI conversion.
Further, the step (B) further comprises:
(a) the upper computer controls an automatic mode to start, and a two-dimensional code picture is sequentially called from the FLASH to be displayed on the LCD1 as the information of the internal two-dimensional code picture;
(b) a three-axis motor is arranged to control the position and the distance of the code scanning gun CMOS sensor to correspond to those of the LCD 1;
(c) the ARM processor controls a CMOS sensor in the code scanning gun to acquire two-dimensional code picture data.
Further, the providing a three-axis motor includes: a Z-axis motor is arranged, and the height of the horizontal platform from the camera is adjusted; setting a deflection angle of an X-axis motor horizontal table on an X axis, using a gravity acceleration detection angle and comparing the gravity acceleration detection angle with a set threshold value, entering the next step if the gravity acceleration detection angle is not less than a set threshold value XS, and repeating the step if the gravity acceleration detection angle is not less than the set threshold value XS; and setting a deflection angle of a Y-axis motor horizontal table on a Y axis, using a gravity acceleration detection angle and comparing the gravity acceleration detection angle with a set threshold value, entering the next step if the gravity acceleration detection angle is not less than the set threshold value YS, and repeating the step if the gravity acceleration detection angle is not less than the set threshold value YS.
Further, the size detection of the received image of the code scanning gun comprises measuring two signals HS and VS by using an oscilloscope, and calculating the size of the received image of the code scanning gun.
Further, the detecting the output signal format of the CMOS sensor comprises measuring the output signal of the CMOS sensor by using an oscilloscope, wherein the output signal is a parallel port output signal if the output signal is a D0-D7/HS/VS/PLCK signal; the output signals are in the form of CLK _ N/CLKP, D0_ N/D0_ P differential pairs, which are MIPI signals.
The invention can monitor the output signal of the CMOS sensor carried by the code scanning gun through the switch board of the switch circuit, the signal output by the CMOS sensor is not only connected to the central processing unit of the code scanning gun, but also connected to the ARM processor, and the ARM processor stores the two-dimensional code decoding algorithm to be compared. After the code scanning gun aligns the two-dimensional code, a key on the code scanning gun is pressed, a system carried by the code scanning gun starts to acquire data for decoding, and meanwhile, a hardware system of the code scanning gun acquires current data for decoding.
In order to improve the precision of the comparison result, the lengths of the two paths of wires can be controlled to be appropriate and equal, and the identity of the environment and the data can be improved.
The invention has the beneficial effects that:
the first effect is that the accuracy of the comparison result is improved;
the second effect is that the automation degree of the test is improved, and the convenience is improved;
and thirdly, the labor cost is reduced due to the fact that the automatic testing degree is improved.
Drawings
The invention is further illustrated with reference to the following figures and examples.
Fig. 1 is a schematic diagram of a two-dimensional code decoding algorithm comparison verification system.
Fig. 2 is a schematic data flow diagram of a comparison verification test performed according to an external two-dimensional code picture.
Fig. 3 is a schematic flow chart of a comparison verification test performed according to an external two-dimensional code picture.
Fig. 4 is a schematic view of data flow of a comparison verification test performed according to a prestored two-dimensional code picture.
Fig. 5 is a schematic flow chart of manual calling in a comparison verification test according to a prestored two-dimensional code picture.
Fig. 6 is a schematic flow chart of automatic calling in a comparison verification test according to a prestored two-dimensional code picture.
In the drawing, 1-a first switching unit, 2-a second switching unit, and 3-a third switching unit.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail with reference to the following embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Example 1.
The embodiment provides a two-dimensional code algorithm comparison verification system and a using method thereof. The two-dimensional code algorithm comparison and verification system comprises a code scanning gun, a switch circuit switching device, an ARM processor and an upper computer, wherein the switch circuit switching device is connected with the code scanning gun, and is also connected with an MIPI decoding device and an FPGA chip; the ARM processor is also connected with the MIPI decoding device, the upper computer and the FPGA chip; the MIPI decoding device is also connected with the FPGA chip; the FPGA chip is used for controlling the switching device of the switch circuit and comprises a FLASH module; the code scanning gun comprises a CMOS sensor, and the CMOS sensor is connected with a central processing unit of the code scanning gun through the switching circuit switching device; a code scanning gun button connected with the code scanning gun central processing unit; the code scanning gun button is also connected with the ARM processor; the code scanning gun central processing unit is also connected with the upper computer; the switching circuit switching device comprises an alternative switch and is used for controlling and selecting the connection of the CMOS sensor, the MIPI decoding device and the code scanning gun central processing unit; the MIPI decoding device is used for bidirectional data conversion, and the bidirectional data are converted into parallel port MIPI and MIPI parallel port; the upper computer is used for comparing image quality, calculating and controlling the ARM processor and the code scanning gun central processing unit. The upper computer can adopt a PC. Ensures that the two systems simultaneously carry out decoding comparison verification under the same environment and the same frame of image
Preferably, the length of a line from the CMOS sensor to the central processor of the code scanning gun through the switching circuit switching device is equal to the length of a line from the CMOS sensor to the ARM processor through the switching circuit switching device and the MIPI decoding device. The accuracy and the identity of environment and two-dimensional code decoding data can be improved, and errors of comparison verification results are reduced. The consistency of the environment and the two-dimensional code image is improved.
Preferably, the first switch unit, the second switch unit and the third switch unit can be adopted as the alternative switch; the second switch unit and the third switch unit are connected in parallel and then connected with the first switch unit; the first switch and the second switch unit are used for controlling the CMOS sensor to be connected with the MIPI decoding device; and the third switch unit is used for controlling the CMOS sensor to be connected with the code scanning gun central processing unit. The switching function can be implemented in more detail by 3 switching units.
Preferably, the two-dimensional code algorithm comparison and verification system further comprises an LCD1 connected with the FLASH, a three-axis motor connected with an upper computer, a support connected with the three-axis motor, and a code scanning gun, wherein the LCD1 is used for testing the two-dimensional code pictures stored in the FLASH according to the inside, the three-axis motor is used for automatically testing the two-dimensional code pictures stored in the FLASH according to the inside, and the support is used for accelerating the code scanning gun; the LCD1 is used for displaying two-dimensional code pictures in the storage and FLASH; the three-axis motor is used for adjusting the relative position of the CMOS sensor of the code scanning gun and the LCD1 and comprises an X-axis motor, a Y-axis motor and a Z-axis motor; the Z-axis motor is used for adjusting the height of the horizontal table from the camera; the X-axis motor is used for adjusting the deflection angle of the Z-axis horizontal table on the X axis; and the Y-axis motor is used for adjusting the deflection angle of the Y-axis horizontal table on the Y axis. The automation degree of the test can be improved, the test complexity is further reduced, and the labor cost is reduced.
Referring to fig. 2 and 3, fig. 2 is a signal flow chart, and fig. 3 is a flow chart of an operation method.
The embodiment also provides a use method of the comparison verification system based on the two-dimensional code algorithm, which comprises the following steps:
(1) detecting early-stage parameters by using an oscilloscope, wherein the early-stage parameters comprise the size of an image received by the code scanning gun and the output signal format of a CMOS (complementary metal oxide semiconductor) sensor, and the output signal format of the CMOS sensor is MIPI or parallel port; the method specifically comprises the following steps: the detection of the size of the image received by the code scanning gun comprises the steps of measuring two signals HS and VS by using an oscilloscope, and calculating the size of the image received by the code scanning gun; the detection of the output signal format of the CMOS sensor comprises the steps of measuring the output signal of the CMOS sensor by using an oscilloscope, wherein the output signal is a parallel port output signal if the output signal is a D0-D7/HS/VS/PLCK signal; the output signals are in the forms of CLK _ N/CLKP and D0_ N/D0_ P differential pairs, and are MIPI signals;
(2) connecting a hardware circuit to form a two-dimensional code algorithm comparison verification system;
(3) aligning an external two-dimensional code picture by using a code scanning gun, acquiring two-dimensional code picture data by using a CMOS (complementary metal oxide semiconductor) sensor in the code scanning gun, respectively decoding and processing the acquired data by using a central processing unit and an ARM (advanced RISC machines) processor of the code scanning gun, and performing MIPI-parallel port conversion by using the MIPI decoding device if the output data of the CMOS sensor is MIPI;
(4) and printing the decoded result signal to an upper computer, comparing the image quality of the printing result, and obtaining a comparison verification result according to the image quality comparison.
The step (3) further comprises the following steps of testing the two-dimensional code picture stored in the FLASH according to the inside:
(A) pre-storing a two-dimension code picture in FLASH as an internal two-dimension code picture;
(B) the manual calling mode is that the internal two-dimensional code picture stored in the FLASH is manually called and displayed on the LCD1 by pressing a button of the code scanning gun, the code scanning gun is controlled by a hand to be aligned with the two-dimensional code picture in the LCD1, and the CMOS sensor acquires the data of the two-dimensional code picture;
(C) the code scanning gun central processing unit and the ARM processor decode and process collected data respectively, the data received by the code scanning gun central processing unit are MIPI, and the MIPI decoding device performs parallel port-MIPI conversion.
The step (B) also comprises an automatic calling mode, comprising the following steps:
(a) the upper computer controls an automatic mode to start, and a two-dimensional code picture is sequentially called from the FLASH to be displayed on the LCD1 as the information of the internal two-dimensional code picture;
(b) a three-axis motor is arranged to control the position and the distance of the code scanning gun CMOS sensor to correspond to those of the LCD 1;
(c) the ARM processor controls a CMOS sensor in the code scanning gun to acquire two-dimensional code picture data.
The method for setting the relative position of the CMOS sensor and the LCD1 in the automatic adjusting mode specifically comprises the steps of setting a Z-axis motor and adjusting the height of a horizontal platform from a camera; setting a deflection angle of an X-axis motor horizontal table on an X axis, using a gravity acceleration detection angle and comparing the gravity acceleration detection angle with a set threshold value, entering the next step if the gravity acceleration detection angle is not less than a set threshold value XS, and repeating the step if the gravity acceleration detection angle is not less than the set threshold value XS; and setting a deflection angle of a Y-axis motor horizontal table on a Y axis, using a gravity acceleration detection angle and comparing the gravity acceleration detection angle with a set threshold value, entering the next step if the gravity acceleration detection angle is not less than the set threshold value YS, and repeating the step if the gravity acceleration detection angle is not less than the set threshold value YS.
Although the illustrative embodiments of the present invention have been described above to enable those skilled in the art to understand the present invention, the present invention is not limited to the scope of the embodiments, and it is apparent to those skilled in the art that all the inventive concepts using the present invention are protected as long as they can be changed within the spirit and scope of the present invention as defined and defined by the appended claims.