Detailed Description
The present invention will be described in further detail below with reference to the accompanying drawings.
In order that the above objects, features and advantages of the present invention can be more clearly understood, a detailed description of the present invention will be given below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth to provide a thorough understanding of the present invention, and the described embodiments are merely a subset of the embodiments of the present invention, rather than a complete embodiment. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
Referring to fig. 1, the present invention provides a code reading method, which is applied to an electronic device 10 communicatively connected to a camera device 20, for reading a mark on a workpiece photographed by the camera device 10. The electronic device 10 may be a production machine or a computer device. The camera device 20 may be an industrial camera. The code reading method comprises the following steps.
Step S101: and providing a user verification interface according to the response operation and verifying whether the user is a legal user or not according to the information input in the user verification interface.
Step S102: and when the user is a legal user, providing a human-computer interaction interface for the user to select the identification type, wherein the identification type comprises a two-dimensional code identification and a CNC dot matrix code identification. In an embodiment, the step S101 may not be included, and the human-machine interaction interface is directly provided.
Step S103: a workpiece image captured by the camera 20 is acquired, the workpiece image including a logo.
Step S104: and confirming the identification type selected by the user according to the operation of the user on the man-machine interaction interface.
Step S105: and identifying the two-dimensional code mark on the obtained industrial image according to a first image processing method or identifying the CNC dot matrix code mark on the obtained industrial image according to a second image processing method.
In an embodiment, the human-computer interaction interface is further configured to set basic information of the image reference parameter and the identifier. The basic information of the mark includes, but is not limited to, the position and size of the mark to be located on the workpiece. In an embodiment, the basic information of the identifier is obtained by loading a text file, and the text file is stored in a preset address. In another embodiment, the identified basic information is set through an input box displayed on the human-computer interaction interface. The image reference parameters include the spacing between marker points in the markers. In the two-dimensional code identification, the mark points refer to pixel points in the two-dimensional code identification. In the CNC dot matrix code identification, the mark points refer to sunken points in the CNC dot matrix code, and the CNC dot matrix code identification is formed by a plurality of sunken points processed through CNC.
In step S105, identification recognition on the industrial image is performed by applying the first image processing method or the second image processing method according to the image reference parameter and the basic information of the identification set on the human-computer interaction interface. In one embodiment, the valid users include a general user and an administrative user, and whether the user is the general user or the administrative user is verified according to information input by the user verification interface. When the verification user is a management user, the human-computer interaction interface allows the setting of the basic information of the image reference parameters and the identification, and when the verification user is a general user, the human-computer interaction interface does not allow the setting of the basic information of the image reference parameters and the identification, but displays the default basic information of the image reference parameters and the identification.
Specifically, when the confirmed identification type is the two-dimensional code identification, a figure limited area on the acquired workpiece image is determined according to the position and the size of the two-dimensional code identification on the workpiece, the determined figure limited area is subjected to image processing to determine the minimum value and the maximum value range of matrix points and the maximum value and the minimum value range of the intervals between the matrix points in the figure limited area, and the size of black and white pixel points and the intervals between the pixel points in the matrix space are determined through a figure pixel proportion coefficient. And finally, processing by adopting an international universal coding and decoding principle, and extracting the information in the image limited area to obtain the composition information of the two-dimensional code identifier. In addition, the appearance color of the workpiece can brighten or darken the graphic background of the two-dimensional code identification, the appearance color of the workpiece can be set on a human-computer interaction interface, and the background in the workpiece image is subjected to denoising processing before the identification through reading the appearance color information of the workpiece, so that the identification accuracy of the two-dimensional code identification is improved.
When the confirmed identification type is the CNC dot matrix code identification, determining a figure limited area on the acquired workpiece image according to the position and the size of the CNC dot matrix code identification on the workpiece, carrying out image processing on the determined figure limited area to determine the range of the minimum value and the maximum value of matrix points and the range of the maximum value and the minimum value of the space between the matrix points in the figure limited area, and determining the size of the matrix points and the space between the matrix points through the figure pixel proportionality coefficient. Then, according to the dotting direction in the CNC process, carrying out direction sequencing on the CNC dot matrix codes (for example, a mode that 3 rows and 11 columns carry out direction sequencing from right to left and from top to bottom), and presetting the maximum image scaling and the minimum image scaling, and identifying the marking points of the industrial image. Then, similarity judgment is carried out on the identified images of the marking points according to parameters such as point outlines, shapes, sizes and the like. If the similarity value is larger than the set value, the mark point is confirmed to be an effective point, and the coordinate position information of the effective point is recorded. And finally, compiling the identified effective points according to the encoding principle of the lattice structure, and analyzing the composition information of the CNC lattice code identifier, such as the composition information consisting of coordinates [0,5], [1,0], [1,2], [1,4], [1,9], [2,0], [2,1], [2,3] and [2,9 ].
Step S106: displaying information of the identified logo.
Step S107: storing an identification record to a predetermined address, the identification record including information of the identified identification. In one embodiment, the predetermined address is set by a path setting operation on the human-computer interaction interface. In another embodiment, the predetermined address is a default address. The predetermined address may be an address in the electronic device or an address in a server communicatively connected to the electronic device. The mark record can also comprise workpiece information and standard information of the mark, wherein the workpiece information comprises the name of the workpiece and the manufacturing process of the mark, such as assembly, sand blasting, station milling and the like, and the standard information comprises a standard position and a standard size which the mark should have.
Please refer to fig. 2 for a schematic structural diagram of an electronic device 10 according to the present invention and fig. 3 for a block diagram of a code reading system 30 according to the present invention.
The electronic device 10 is connected in communication with the camera device 20, and is configured to receive the workpiece image acquired by the camera device 20. The electronic device 10 includes, but is not limited to, a processor 12, a memory 14, and a computer program 16 stored in the memory 14 and executable on the processor 12, the computer program 16 including a code-reading program. The processor 12, when executing the computer program 16, implements steps S101 to S107 of the code reading method shown in fig. 1. Alternatively, the processor 12, when executing the computer program 16, implements the functionality of the code reading system 30 shown in fig. 3.
It will be understood by those skilled in the art that the schematic diagram is merely an example of the electronic apparatus 10, and does not constitute a limitation of the electronic apparatus 10, and may include more or less components than those shown, or combine some components, or different components, for example, the electronic apparatus 10 may further include input and output devices, network access devices, buses, and the like.
The Processor 12 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor 12 may be any conventional processor or the like, the processor 12 being the control center of the electronic device 10 and connecting the various parts of the overall electronic device 10 using various interfaces and lines.
The memory 14 may be used for storing the computer program 16 and/or the module/unit, and the processor 12 may implement various functions of the electronic device 10 by running or executing the computer program and/or the module/unit stored in the memory 14 and calling data stored in the memory 14. The memory 14 may include high speed random access memory and may also include non-volatile memory such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
The code reading system 30 operates in the electronic device 10. The code reading system 30 may comprise a plurality of functional modules comprised of program code segments. The program code of the various program segments of the code reading system 30 may be stored in the memory 14 of the electronic device 10 and executed by the at least one processor 12 to implement the code reading.
In this embodiment, the code reading system 30 is divided into a plurality of functional modules according to the functions performed by the code reading system, and the functional modules include an interface display module 31, a verification module 32, an image acquisition module 33, an identifier type confirmation module 34, an identification module 35, an information display module 36, and a storage module 37. The module referred to herein is a series of computer program segments capable of being executed by at least one processor and capable of performing a fixed function and is stored in memory 14. It will be appreciated that in other embodiments, the modules may also be program instructions or firmware (firmware) that are resident in the processor 12.
The interface display module 31 is configured to provide a user authentication interface in response to an operation. The verification module 32 is configured to verify whether the user is a valid user according to the information input in the user verification interface. The interface display module 31 is further configured to provide a human-computer interaction interface for the user to select an identifier type when the user is a valid user, where the identifier type includes a two-dimensional code identifier and a CNC dot matrix code identifier. The image acquiring module 33 is configured to acquire a workpiece image captured by the image capturing device, where the workpiece image includes an identifier. The identification type confirming module 34 is used for confirming the identification type selected by the user according to the operation of the user on the man-machine interaction interface. The recognition module 35 is configured to recognize the two-dimensional code identifier on the obtained industrial image according to a first image processing method or recognize the CNC dot matrix code identifier on the obtained industrial image according to a second image processing method. The information display module 36 is configured to display information of the identified identifier. The storage module 37 is configured to store an identifier record to a predetermined address, where the identifier record includes information of the identified identifier.
The integrated modules/units of the electronic device 10, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and which, when executed by a processor, may implement the steps of the above-described embodiments of the method. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like.
The code reading method, the electronic device and the storage medium can identify different types of identifiers according to the selected identifier types, and are convenient to operate and high in applicability.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. Several units or means recited in the apparatus claims may also be embodied by one and the same item or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.