Barcode information reading method and apparatus, and medium and device
By obtaining the display interface attribute information of the target application, and using a gyroscope or affine transformation matrix to correct image jitter, the problem of barcode picture blur caused by device jitter is solved, and efficient barcode information reading is achieved.
Patent Information
- Application Number
- PCT/CN2024/100681
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-01
- Filing Date
- 2024-06-21
- Publication Date
- 2025-08-07
AI Technical Summary
During the process of reading barcode information through third-party application software, the device shakes cause the barcode picture to be blurred, affecting the reading of barcode information.
By obtaining the display interface attribute information of the target application, determining whether to perform anti-shake processing, using a gyroscope or an affine transformation matrix to correct image jitter, obtain the target screen after anti-shake processing, and perform barcode decoding.
In the specified scanning scenario, anti-shake processing of the scanned screen is realized without affecting the picture quality of other non-scanning scenes, and the reading efficiency of barcode information is improved.
Smart Images

Figure CN2024100681_07082025_PF_FP_ABST
Abstract
Description
Barcode information reading method, device, medium and equipment
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on February 1, 2024, with application number 202410149716.1 and invention name “Barcode Information Reading Method, Device, Medium and Equipment”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to a barcode information reading method, device, medium and equipment. Background Art
[0003] A barcode is a graphic identifier used to represent a specific set of information. It consists of a series of black bars (lines) and white spaces, and according to specific encoding rules, represents information including numbers, letters, or other identifiers. Barcodes are mainly divided into two types. The most common type of barcode is a one-dimensional barcode, which encodes information along a horizontal line. Common one-dimensional barcodes include Code 39, Code 128, UPC (Universal Product Code), and EAN (International Article Number). The other type is a two-dimensional barcode, which encodes information in both horizontal and vertical directions, so it can store more data.
[0004] In current barcode scanning scenarios, most users first launch an application software that provides a barcode scanning function on the electronic device, use the application software to call the electronic device's own camera, then use the camera to obtain a preview image, and perform barcode detection, barcode decoding, and other actions to obtain barcode information. However, due to the constraints of the barcode scanning scenario, the application software that provides the barcode scanning function can only simply obtain image data when calling the electronic device's camera. It lacks the authority to call other image processing capabilities in the electronic device that can improve the quality of barcode scanning. As a result, if the user shakes the electronic device while holding it, the barcode cannot be quickly and effectively recognized, affecting the reading of barcode information.
[0005] Application Contents
[0006] The embodiments of the present application provide a barcode information reading method, apparatus, medium and device. The barcode information reading method provided by the embodiments of the present application is used to solve the problem that the barcode image is easily blurred due to device jitter during the current process of reading barcode information through third-party application software, thereby affecting the reading of barcode information.
[0007] On the one hand, an embodiment of the present application provides a barcode information reading method, which is applied to an electronic device. The barcode information reading method includes:
[0008] In response to an activation operation of a scanning function for a target application, displaying a display interface currently corresponding to the target application;
[0009] Acquiring attribute information of the display interface and a picture to be scanned that appears on the display interface, and determining whether to perform anti-shake processing on the picture to be scanned based on the attribute information, and obtaining a determination result;
[0010] If the judgment result is yes, performing anti-shake processing on the image to be scanned to obtain a target image after anti-shake processing;
[0011] The target screen is decoded by the code scanning module of the target application to read the barcode information in the target screen.
[0012] In the barcode information reading method described in an embodiment of the present application, the attribute information includes the application package name and application activity name of the target application, and determining whether to perform anti-shake processing on the image to be scanned based on the attribute information includes:
[0013] determining, based on a target attribute group consisting of an application package name and an application activity name of the target application, whether the target attribute group exists in a preset list, the preset list being used to record attribute groups that meet the requirements of anti-shake processing;
[0014] If the target attribute group exists in the preset list, it is determined that anti-shake processing needs to be performed on the image to be scanned.
[0015] In the barcode information reading method described in an embodiment of the present application, the electronic device includes a gyroscope, and the anti-shake processing is performed on the image to be scanned to obtain the target image after the anti-shake processing, including:
[0016] Acquiring angular velocity data corresponding to the gyroscope when the image to be scanned is captured;
[0017] Calculating, based on the angular velocity data, a compensation value required for each pixel in the image to be scanned, the compensation value being used to offset a jitter effect on the image to be scanned caused by movement of the electronic device;
[0018] The position and direction of each pixel in the image to be scanned are adjusted based on the compensation value to obtain a target image after anti-shake processing.
[0019] In the barcode information reading method described in the embodiment of the present application, the angular velocity data includes angular velocities obtained in three dimensions, and the calculation of the compensation value required for each pixel in the image to be scanned based on the angular velocity data includes:
[0020] constructing an angular velocity vector according to the angular velocities obtained in three dimensions;
[0021] Determining a time interval required for the electronic device to collect the image to be scanned;
[0022] The angular velocity vector is multiplied by the time interval to obtain the compensation value required for each pixel in the image to be scanned.
[0023] In the barcode information reading method described in the embodiment of the present application, performing anti-shake processing on the image to be scanned to obtain the target image after anti-shake processing includes:
[0024] Acquire an image sequence containing the picture to be scanned, and construct an affine transformation matrix according to the image sequence;
[0025] The position and direction of each pixel in the image to be scanned are adjusted by the affine transformation matrix to obtain a target image after anti-shake processing.
[0026] In the barcode information reading method described in the embodiment of the present application, constructing an affine transformation matrix according to the image sequence includes:
[0027] Calculate the eigenvector containing the coordinates of the feature points in each frame of image, and construct an augmented matrix based on the eigenvector;
[0028] Preset parameters included in the augmented matrix are estimated, and an affine transformation matrix is constructed using the preset parameters.
[0029] In the barcode information reading method described in the embodiment of the present application, before determining whether to perform anti-shake processing on the image to be scanned based on the attribute information, the method further includes:
[0030] Obtaining the target environment brightness value when the image to be scanned is captured;
[0031] Determining a target image exposure value corresponding to the target ambient brightness value according to a preset mapping relationship between the ambient brightness value and the image exposure value;
[0032] Exposure processing is performed on the image to be scanned according to the target exposure value.
[0033] Accordingly, another embodiment of the present application further provides a barcode information reading device, the barcode information reading device comprising:
[0034] An operation response module, configured to display a display interface currently corresponding to a target application in response to an operation to activate a scanning function for the target application;
[0035] a data acquisition module, configured to acquire attribute information of the display interface and a picture to be scanned that appears on the display interface, and determine whether to perform anti-shake processing on the picture to be scanned based on the attribute information, and obtain a determination result;
[0036] an image processing module, configured to, if the judgment result is yes, perform anti-shake processing on the image to be scanned to obtain a target image after anti-shake processing;
[0037] The information reading module is used to perform a decoding operation on the target screen through the barcode scanning module of the target application to read the barcode information in the target screen.
[0038] Correspondingly, another aspect of the embodiment of the present application further provides a storage medium, which stores a plurality of instructions suitable for loading by a processor to execute the barcode information reading method as described above.
[0039] Correspondingly, on the other hand, an embodiment of the present application further provides a terminal device, including a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions to execute the barcode information reading method as described above.
[0040] The embodiment of the present application provides a barcode information reading method, device, medium and equipment, which displays the current display interface corresponding to the target application in response to the start operation of the scanning function for the target application; obtains the attribute information of the display interface and the screen to be scanned that appears in the display interface, and determines whether to perform anti-shake processing on the screen to be scanned according to the attribute information to obtain a judgment result; if the judgment result is yes, performs anti-shake processing on the screen to be scanned to obtain the target screen after anti-shake processing; and decodes the target screen through the scanning module of the target application to read the barcode information in the target screen. Utilizing the barcode information reading method provided by the embodiment of the present application, by obtaining the attribute information of the display interface corresponding to the target application, it is automatically determined whether to perform anti-shake processing on the screen to be scanned according to the attribute information, thereby achieving anti-shake processing on the screen to be scanned in a specified scanning scenario without affecting the picture quality of other non-scanning scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] To more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present application. Those skilled in the art can also derive other drawings based on these drawings without inventive effort.
[0042] FIG1 is a flow chart of a barcode information reading method provided in an embodiment of the present application.
[0043] FIG2 is another flow chart of the barcode information reading method provided in an embodiment of the present application.
[0044] FIG3 is a schematic diagram of a target display interface in an embodiment of the present application.
[0045] FIG4 is a schematic diagram of the structure of a barcode information reading device provided in an embodiment of the present application.
[0046] FIG5 is another schematic diagram of the structure of the barcode information reading device provided in an embodiment of the present application.
[0047] FIG6 is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0049] It should be noted that the following is a brief introduction to the background of this plan:
[0050] This solution mainly focuses on how to solve the technical problem that "the current process of reading barcode information through third-party application software is prone to blurring the barcode image due to device shaking, which affects the reading of the barcode information." It is understandable that in the current code scanning scenario, most people first open the application software that provides the code scanning function on the electronic device, use the application software to call the electronic device's own camera, and then obtain the preview image through the camera, and perform barcode detection, barcode decoding and other actions to obtain the barcode information. In the above solution, due to the constraints of the code scanning scenario, the application software that provides the code scanning function can only simply obtain image data when calling the electronic device's camera, and lacks the authority to call other image processing capabilities in the electronic device that can improve the quality of code scanning. As a result, when the user holds the electronic device and the device shakes, the barcode cannot be quickly and effectively identified, affecting the reading of the barcode information.
[0051] To address the above technical issues, embodiments of the present application provide a barcode information reading method. The barcode information reading method provided in embodiments of the present application automatically determines whether to perform anti-shake processing on the image to be scanned by obtaining attribute information of the display interface corresponding to the target application based on the attribute information, thereby enabling anti-shake processing on the image to be scanned in a specified scanning scenario without affecting the image quality in other non-scanning scenarios.
[0052] Please refer to Figures 1-2. Figure 1 is a flow chart of the barcode information reading method provided in an embodiment of the present application. Figure 2 is another flow chart of the barcode information reading method provided in an embodiment of the present application. The barcode information reading method is applied to a terminal device. Optionally, the terminal device is a terminal or a server. Optionally, the server is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the terminal is a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, smart voice interaction device, smart home appliance and car terminal, etc., but is not limited to this.
[0053] In one embodiment, the method may include the following steps:
[0054] Step 101 : In response to an activation operation of a scanning function for a target application, a display interface currently corresponding to the target application is displayed.
[0055] It should be explained that a barcode is a graphic identifier used to express a specific set of information. It consists of a series of black bars (lines) and white spaces, and represents information containing numbers, letters or other identifiers according to specific coding rules. Barcodes are mainly divided into two types. The most common type of barcode is a one-dimensional barcode, which encodes information along a horizontal line. Common one-dimensional barcodes include Code 39, Code 128, UPC (Universal Product Code) and EAN (International Article Number). The other type is a two-dimensional barcode, which encodes information in both horizontal and vertical directions and can therefore store more data. It should be noted that this solution can be applied to scenarios where various types of barcodes are scanned to read barcode information, and the specific type of barcode is not limited in this solution.
[0056] In a feasible scenario, the user can hold a barcode scanner, mobile phone, tablet or other electronic device with a scanning function to aim at the barcode to perform a scanning operation. For most electronic devices, the scanning function provided by the application is required to perform the scanning operation. The user needs to turn on the scanning function of the target application on the electronic device before he can aim the scanning end of the electronic device (such as a camera) at the barcode to perform the scanning operation. At this time, the display interface currently corresponding to the target application will be displayed on the electronic device. It should be noted that the display interface currently corresponding to the target application usually includes the picture within the current visible range of the scanning end and other preset function controls.
[0057] Step 102: Acquire attribute information of the display interface and the picture to be scanned that appears in the display interface, and determine whether to perform anti-shake processing on the picture to be scanned based on the attribute information to obtain a determination result.
[0058] It should be noted that the barcode information reading method provided by this solution is an improvement proposed to address the problems existing in current barcode scanning scenarios. In current barcode scanning scenarios, most users first open the application software that provides the barcode scanning function on the electronic device, use the application software to call the electronic device's own camera, and then obtain a preview image through the camera, and perform barcode detection, barcode decoding and other actions to obtain the barcode information. However, in the above solution, due to the constraints of the barcode scanning scenario, the application software that provides the barcode scanning function can only simply obtain image data when calling the electronic device's camera, and lacks the authority to call other image processing capabilities in the electronic device that can improve the quality of scanning. As a result, when the user holds the electronic device and the device shakes, the barcode cannot be quickly and effectively identified, affecting the reading of the barcode information.
[0059] It should be further explained that when electronic devices use the regular shooting function to shoot, in order to prevent the image from being shaken and blurred due to the user's unstable holding of the device, an image stabilization processing function is usually added to the electronic device. The function can be turned on or off according to the user's needs to improve the problem of blurry images caused by device shaking. However, since most image stabilization processing technologies are achieved at the expense of image quality, the image after image stabilization processing usually has a problem of reduced image quality. Therefore, most image stabilization processing is spontaneously enabled by the user and is not enabled by default. Therefore, most device manufacturers will not allow application software to actively enable image stabilization processing functions.
[0060] To ensure that stabilization processing is performed on the scanned image only in designated scanning scenarios, without affecting the image quality in other non-scanning scenarios (such as using the device camera for video chatting, filming, and other activities within an application), this embodiment obtains attribute information of the target application's display interface, determines whether stabilization processing should be performed on the scanned image based on the attribute information, and then determines whether stabilization processing should be performed on the scanned image based on the judgment result. Specifically, the target attribute group, consisting of the target application's application package name and application activity name, is determined to be in a preset list. The preset list is used to record attribute groups that meet the stabilization processing requirements. If the target attribute group is in the preset list, stabilization processing is determined to be required for the scanned image.
[0061] For example, as shown in FIG3 , the display interface of the “xx” application is obtained through the system's hardware abstraction layer to obtain the attribute information of the “xx” application, and the application package name of the “xx” application is obtained as “com.xx.mm”, and the application activity name is “com.xx.mm.plugin.scanner.ui.BaseScanUI”. If the target attribute group consisting of the application package name and the application activity name exists in the preset list, it is marked as the current scanning scene, and anti-shake processing is required for the scanned image.
[0062] Step 103: If the judgment result is yes, anti-shake processing is performed on the image to be scanned to obtain a target image after anti-shake processing.
[0063] In this embodiment, if the judgment result shows that the image to be scanned needs to be anti-shake processed, the jitter data of the electronic device when collecting the image to be scanned is obtained, and the image to be scanned is compensated based on the jitter data to obtain the target image after anti-shake processing.
[0064] In one embodiment, if the determination result indicates that anti-shake processing is required for the image to be scanned, and the current electronic device has a gyroscope, the jitter data is the angular velocity data of the gyroscope when the image to be scanned is captured. Based on the angular velocity data, a compensation value is calculated for each pixel in the image to be scanned. The compensation value is used to offset the jitter of the image to be scanned caused by the movement of the electronic device. Based on the compensation value, the position and orientation of each pixel in the image to be scanned are adjusted to obtain an image after anti-shake processing.
[0065] It should be noted that angular velocity data includes angular velocities along three dimensions: the x-axis, the y-axis, and the z-axis. An angular velocity vector is constructed based on the angular velocities obtained in these three dimensions. This determines the time interval required for the electronic device to capture the image to be scanned. Multiplying the angular velocity vector by the time interval yields the compensation value required for each pixel in the image to be scanned, which is used to adjust the position and orientation of each pixel in the image to be scanned.
[0066] In some embodiments, if the determination result indicates that the image to be scanned requires stabilization, and the current electronic device does not have a gyroscope, the stabilization data is obtained by acquiring an image sequence containing the image to be scanned and constructing an affine transformation matrix based on the image sequence. The affine transformation matrix is used to transform each pixel in the image to be scanned to correct the image's position and shape, aligning the current frame with the previous frame to obtain a target image after stabilization, thereby reducing image stabilization.
[0067] It should be further explained that in order to obtain the affine transformation matrix, it is necessary to calculate the eigenvector containing the coordinates of the feature points in each frame image, construct an augmented matrix based on the eigenvector, estimate the preset parameters contained in the augmented matrix, and construct the affine transformation matrix through the preset parameters.
[0068] The preset parameters include: a horizontal scaling factor a, a horizontal shear factor b, a horizontal translation c, a vertical shear factor d, a vertical scaling factor e, and a vertical translation f.
[0069] Step 104 : decoding the target screen through the barcode scanning module of the target application to read the barcode information in the target screen.
[0070] In this embodiment, after the screen to be scanned is anti-shake processed by the system layer to obtain the target screen, the system layer returns the target screen to the target application, so that the target application can perform operations such as color gamut conversion, barcode detection and positioning, and barcode decoding on the target screen through the code scanning module, thereby obtaining the barcode information in the target screen.
[0071] In some embodiments, before determining whether to perform anti-shake processing on the image to be scanned based on the attribute information, the method further includes the following steps:
[0072] Obtain the target environment brightness value when the image to be scanned is captured; determine the target image exposure value corresponding to the target environment brightness value based on a preset mapping relationship between the environment brightness value and the image exposure value; and perform exposure processing on the image to be scanned according to the target exposure value.
[0073] In this embodiment, in a scanning scenario where the image quality can be ignored, by associating the image exposure value with the ambient brightness value of the shooting scene, the scanning process only needs to pay attention to the ambient light factor and not the image quality, so as to improve the barcode information reading speed.
[0074] All of the above optional technical solutions can be combined in any way to form optional embodiments of the present application, and will not be described in detail here.
[0075] During specific implementation, the present application is not limited by the execution order of the various steps described. If no conflict occurs, some steps can be performed in other orders or simultaneously.
[0076] From the above, it can be seen that the barcode information reading method provided in the embodiment of the present application displays the display interface currently corresponding to the target application in response to the start operation of the scanning function for the target application; obtains the attribute information of the display interface and the screen to be scanned that appears in the display interface, and determines whether to perform anti-shake processing on the screen to be scanned based on the attribute information to obtain a judgment result; if the judgment result is yes, then performs anti-shake processing on the screen to be scanned to obtain the target screen after anti-shake processing; and decodes the target screen through the scanning module of the target application to read the barcode information in the target screen. Using the barcode information reading method provided in the embodiment of the present application, through
[0077] An embodiment of the present application further provides a barcode information reading device, which can be integrated into a terminal device.
[0078] Please refer to Figure 4, which is a schematic diagram of the structure of a barcode information reading device provided in an embodiment of the present application. The barcode information reading device 30 may include:
[0079] An operation response module 31 is configured to display a display interface currently corresponding to a target application in response to an activation operation of a scanning function for the target application;
[0080] A data acquisition module 32 is configured to acquire attribute information of the display interface and a picture to be scanned that appears on the display interface, and determine whether to perform anti-shake processing on the picture to be scanned based on the attribute information, and obtain a determination result;
[0081] The image processing module 33 is configured to perform anti-shake processing on the image to be scanned to obtain a target image after anti-shake processing if the judgment result is yes;
[0082] The information reading module 34 is configured to perform a decoding operation on the target screen through the barcode scanning module of the target application to read the barcode information in the target screen.
[0083] In some embodiments, the attribute information includes the application package name and application activity name of the target application. The screen processing module 33 is used to determine whether the target attribute group constituted by the application package name and application activity name of the target application exists in a preset list, and the preset list is used to record attribute groups that meet the requirements of anti-shake processing; if the target attribute group exists in the preset list, it is determined that anti-shake processing needs to be performed on the screen to be scanned.
[0084] In some embodiments, the electronic device includes a gyroscope, and the image processing module 33 is used to obtain angular velocity data corresponding to the gyroscope when the image to be scanned is captured; based on the angular velocity data, the compensation value required for each pixel point in the image to be scanned is calculated respectively, and the compensation value is used to offset the jitter effect of the image to be scanned caused by the movement of the electronic device; based on the compensation value, the position and direction of each pixel point in the image to be scanned are adjusted to obtain the target image after anti-shake processing.
[0085] In some embodiments, the angular velocity data includes angular velocities obtained in three dimensions, and the image processing module 33 is used to construct an angular velocity vector based on the angular velocities obtained in three dimensions; determine the time interval required for the electronic device to collect the image to be scanned; and multiply the angular velocity vector by the time interval to obtain the compensation value required for each pixel in the image to be scanned.
[0086] In some embodiments, the image processing module 33 is used to obtain an image sequence containing the image to be scanned, and construct an affine transformation matrix based on the image sequence; the position and direction of each pixel point in the image to be scanned are adjusted by the affine transformation matrix to obtain the target image after anti-shake processing.
[0087] In some embodiments, the image processing module 33 is used to calculate the feature vector containing the coordinates of its feature points in each frame image, construct an augmented matrix based on the feature vector; estimate the preset parameters contained in the augmented matrix, and construct an affine transformation matrix through the preset parameters.
[0088] In some embodiments, the device also includes a preprocessing module for obtaining the target environmental brightness value when the image to be scanned is captured; determining the target image exposure value corresponding to the target environmental brightness value based on a preset mapping relationship between the environmental brightness value and the image exposure value; and performing exposure processing on the image to be scanned according to the target exposure value.
[0089] During specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same entity or several entities.
[0090] As can be seen from the above, the barcode information reading device 30 provided in the embodiment of the present application, wherein the operation response module 31 is used to respond to the start operation of the scanning function for the target application, and display the display interface currently corresponding to the target application; the data acquisition module 32 is used to obtain the attribute information of the display interface and the screen to be scanned that appears in the display interface, and judge whether to perform anti-shake processing on the screen to be scanned according to the attribute information to obtain a judgment result; the screen processing module 33 is used to perform anti-shake processing on the screen to be scanned if the judgment result is yes, and obtain the target screen after anti-shake processing; the information reading module 34 is used to perform a decoding operation on the target screen through the scanning module of the target application to read the barcode information in the target screen.
[0091] Please refer to Figure 5, which is another schematic diagram of the structure of the barcode information reading device provided in an embodiment of the present application. The barcode information reading device 30 includes a memory 120, one or more processors 180, and one or more application programs, wherein the one or more application programs are stored in the memory 120 and configured to be executed by the processor 180; the processor 180 may include an operation response module 31, a data acquisition module 32, an image processing module 33, and an information reading module 34. For example, the structure and connection relationship of the above components can be as follows:
[0092] The memory 120 can be used to store applications and data. The applications stored in the memory 120 include executable code. The applications can be composed of various functional modules. The processor 180 executes various functional applications and data processing by running the applications stored in the memory 120. In addition, the memory 120 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 120 may also include a memory controller to provide the processor 180 with access to the memory 120.
[0093] Processor 180 is the control center of the device, connecting all components of the terminal using various interfaces and circuits. It executes or runs applications stored in memory 120 and accesses data stored in memory 120 to perform various device functions and process data, thereby providing overall monitoring of the device. Optionally, processor 180 may include one or more processing cores; preferably, processor 180 may integrate an application processor and a modem processor, with the application processor primarily processing the operating system, user interface, and application programs.
[0094] Specifically, in this embodiment, the processor 180 loads the executable code corresponding to one or more application processes into the memory 120 according to the following instructions, and the processor 180 runs the application stored in the memory 120 to implement various functions:
[0095] An operation response instruction, configured to display a display interface currently corresponding to a target application in response to an operation to activate a scanning function for the target application;
[0096] a data acquisition instruction for acquiring attribute information of the display interface and a picture to be scanned that appears on the display interface, and determining whether to perform anti-shake processing on the picture to be scanned based on the attribute information, and obtaining a determination result;
[0097] a picture processing instruction for performing anti-shake processing on the picture to be scanned to obtain a target picture after anti-shake processing if the judgment result is yes;
[0098] The information reading instruction is used to perform a decoding operation on the target screen through the barcode scanning module of the target application to read the barcode information in the target screen.
[0099] In some embodiments, the attribute information includes the application package name and application activity name of the target application, and the screen processing instruction is used to determine whether the target attribute group composed of the application package name and application activity name of the target application exists in a preset list, and the preset list is used to record attribute groups that meet the requirements of anti-shake processing; if the target attribute group exists in the preset list, it is determined that anti-shake processing needs to be performed on the screen to be scanned.
[0100] In some embodiments, the electronic device includes a gyroscope, and the image processing instruction is used to obtain angular velocity data corresponding to the gyroscope when the image to be scanned is captured; based on the angular velocity data, the compensation value required for each pixel point in the image to be scanned is calculated respectively, and the compensation value is used to offset the jitter effect of the image to be scanned caused by the movement of the electronic device; based on the compensation value, the position and direction of each pixel point in the image to be scanned are adjusted to obtain the target image after anti-shake processing.
[0101] In some embodiments, the angular velocity data includes angular velocities obtained in three dimensions, and the image processing instructions are used to construct an angular velocity vector based on the angular velocities obtained in three dimensions; determine the time interval required for the electronic device to collect the image to be scanned; and multiply the angular velocity vector by the time interval to obtain the compensation value required for each pixel in the image to be scanned.
[0102] In some embodiments, the picture processing instruction is used to obtain an image sequence containing the picture to be scanned, and construct an affine transformation matrix based on the image sequence; the position and direction of each pixel point in the picture to be scanned are adjusted by the affine transformation matrix to obtain the target picture after anti-shake processing.
[0103] In some embodiments, the image processing instructions are used to calculate the feature vector containing the coordinates of the feature points in each frame image, and construct an augmented matrix based on the feature vector; estimate the preset parameters contained in the augmented matrix, and construct an affine transformation matrix through the preset parameters.
[0104] In some embodiments, the program also includes preprocessing instructions for obtaining the target ambient brightness value when the image to be scanned is captured; determining the target image exposure value corresponding to the target ambient brightness value based on a preset mapping relationship between the ambient brightness value and the image exposure value; and performing exposure processing on the image to be scanned according to the target exposure value.
[0105] The present application also provides a terminal device, which may be a server, a smart phone, a computer, a tablet computer, or the like.
[0106] Please refer to Figure 6, which shows a schematic diagram of the structure of a terminal device provided in an embodiment of the present application, which can be used to implement the barcode information reading method provided in the above embodiment. The terminal device 1200 can be a television, a smart phone, or a tablet computer.
[0107] As shown in FIG6 , the terminal device 1200 may include an RF (Radio Frequency) circuit 110, a memory 120 including one or more (only one is shown in the figure) computer-readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a transmission module 170, a processor 180 including one or more (only one is shown in the figure) processing cores, and a power supply 190. It will be understood by those skilled in the art that the structure of the terminal device 1200 shown in FIG6 does not constitute a limitation on the terminal device 1200, and the terminal device 1200 may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0108] RF circuit 110 is used to receive and transmit electromagnetic waves, converting them into electrical signals, thereby enabling communication with a communications network or other devices. RF circuit 110 may include various existing circuit components for performing these functions, such as an antenna, a radio frequency transceiver, a digital signal processor, an encryption / decryption chip, a subscriber identity module (SIM) card, and memory. RF circuit 110 can communicate with various networks, such as the Internet, an intranet, or a wireless network, or with other devices via a wireless network.
[0109] The memory 120 can be used to store software programs and modules, such as the program instructions / modules corresponding to the barcode information reading method in the above-mentioned embodiment. The processor 180 executes various functional applications and data processing by running the software programs and modules stored in the memory 120. It can automatically select a vibration reminder mode to read barcode information based on the current scene of the terminal device. This can not only ensure that scenes such as meetings are not disturbed, but also ensure that users can be aware of incoming calls, thereby enhancing the intelligence of the terminal device. The memory 120 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 120 may further include a memory remotely located relative to the processor 180, and these remote memories can be connected to the terminal device 1200 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0110] The input unit 130 can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical, or trackball signal input related to user settings and function control. Specifically, the input unit 130 may include a touch-sensitive surface 131 and other input devices 132. The touch-sensitive surface 131, also known as a touch display or touchpad, can collect user touch operations on or near it (for example, operations performed by a user using a finger, stylus, or any other suitable object or accessory on or near the touch-sensitive surface 131) and drive corresponding connected devices according to a pre-set program. Optionally, the touch-sensitive surface 131 may include a touch detection device and a touch controller. The touch detection device detects the user's touch position and detects signals generated by the touch operation, transmitting the signals to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 180. It can also receive and execute commands from the processor 180. In addition, the touch-sensitive surface 131 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface 131, the input unit 130 can also include other input devices 132. Specifically, the other input devices 132 can include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power keys, etc.), a trackball, a mouse, a joystick, and the like.
[0111] The display unit 140 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the terminal device 1200. These graphical user interfaces can be composed of graphics, text, icons, videos, and any combination thereof. The display unit 140 may include a display panel 141. Optionally, the display panel 141 can be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Furthermore, the touch-sensitive surface 131 can cover the display panel 141. When the touch-sensitive surface 131 detects a touch operation on or near it, it transmits the information to the processor 180 to determine the type of touch event. The processor 180 then provides a corresponding visual output on the display panel 141 based on the type of touch event. Although in Figure 6, the touch-sensitive surface 131 and the display panel 141 are implemented as two independent components to implement input and output functions, in some embodiments, the touch-sensitive surface 131 and the display panel 141 can be integrated to implement input and output functions.
[0112] The terminal device 1200 may also include at least one sensor 150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 141 and / or the backlight when the terminal device 1200 is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that recognize the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the terminal device 1200, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be described here.
[0113] The audio circuit 160, speaker 161, and microphone 162 provide an audio interface between the user and the terminal device 1200. The audio circuit 160 can convert received audio data into electrical signals and transmit them to the speaker 161, which then converts them into sound signals for output. Meanwhile, the microphone 162 converts collected sound signals into electrical signals, which are then received by the audio circuit 160 and converted into audio data. The audio data is then processed by the processor 180 and transmitted via the RF circuit 110 to, for example, another terminal. Alternatively, the audio data can be output to the memory 120 for further processing. The audio circuit 160 may also include an earphone jack to allow communication between an external headset and the terminal device 1200.
[0114] The terminal device 1200 can help users send and receive emails, browse web pages, and access streaming media through the transmission module 170 (e.g., a Wi-Fi module), providing users with wireless broadband Internet access. Although FIG6 shows the transmission module 170, it is understood that it is not a necessary component of the terminal device 1200 and can be omitted as needed without changing the essence of the invention.
[0115] Processor 180 is the control center of terminal device 1200. It connects all components of the phone using various interfaces and circuits. By running or executing software programs and / or modules stored in memory 120 and accessing data stored in memory 120, it executes various functions of terminal device 1200 and processes data, thereby providing overall monitoring of the phone. Optionally, processor 180 may include one or more processing cores. In some embodiments, processor 180 may integrate an application processor and a modem processor. The application processor primarily handles the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 180.
[0116] The terminal device 1200 also includes a power supply 190 for supplying power to various components. In some embodiments, the power supply can be logically connected to the processor 180 via a power management system, thereby enabling the power management system to manage discharge and power consumption. The power supply 190 can also include any components such as one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, and a power status indicator.
[0117] Although not shown, the terminal device 1200 may further include a camera (such as a front camera, a rear camera), a Bluetooth module, etc., which will not be described in detail here. Specifically, in this embodiment, the display unit 140 of the terminal device 1200 is a touch screen display, and the terminal device 1200 also includes a memory 120 and one or more programs, wherein one or more programs are stored in the memory 120 and are configured to be executed by one or more processors 180. The one or more programs include instructions for performing the following operations:
[0118] An operation response instruction, configured to display a display interface currently corresponding to a target application in response to an operation to activate a scanning function for the target application;
[0119] a data acquisition instruction for acquiring attribute information of the display interface and a picture to be scanned that appears on the display interface, and determining whether to perform anti-shake processing on the picture to be scanned based on the attribute information, and obtaining a determination result;
[0120] a picture processing instruction for performing anti-shake processing on the picture to be scanned to obtain a target picture after anti-shake processing if the judgment result is yes;
[0121] The information reading instruction is used to perform a decoding operation on the target screen through the barcode scanning module of the target application to read the barcode information in the target screen.
[0122] In some embodiments, the attribute information includes the application package name and application activity name of the target application, and the screen processing instruction is used to determine whether the target attribute group composed of the application package name and application activity name of the target application exists in a preset list, and the preset list is used to record attribute groups that meet the requirements of anti-shake processing; if the target attribute group exists in the preset list, it is determined that anti-shake processing needs to be performed on the screen to be scanned.
[0123] In some embodiments, the electronic device includes a gyroscope, and the image processing instruction is used to obtain angular velocity data corresponding to the gyroscope when the image to be scanned is captured; based on the angular velocity data, the compensation value required for each pixel point in the image to be scanned is calculated respectively, and the compensation value is used to offset the jitter effect of the image to be scanned caused by the movement of the electronic device; based on the compensation value, the position and direction of each pixel point in the image to be scanned are adjusted to obtain the target image after anti-shake processing.
[0124] In some embodiments, the angular velocity data includes angular velocities obtained in three dimensions, and the image processing instructions are used to construct an angular velocity vector based on the angular velocities obtained in three dimensions; determine the time interval required for the electronic device to collect the image to be scanned; and multiply the angular velocity vector by the time interval to obtain the compensation value required for each pixel in the image to be scanned.
[0125] In some embodiments, the picture processing instruction is used to obtain an image sequence containing the picture to be scanned, and construct an affine transformation matrix based on the image sequence; the position and direction of each pixel point in the picture to be scanned are adjusted by the affine transformation matrix to obtain the target picture after anti-shake processing.
[0126] In some embodiments, the image processing instructions are used to calculate the feature vector containing the coordinates of the feature points in each frame image, and construct an augmented matrix based on the feature vector; estimate the preset parameters contained in the augmented matrix, and construct an affine transformation matrix through the preset parameters.
[0127] In some embodiments, the program also includes preprocessing instructions for obtaining the target ambient brightness value when the image to be scanned is captured; determining the target image exposure value corresponding to the target ambient brightness value based on a preset mapping relationship between the ambient brightness value and the image exposure value; and performing exposure processing on the image to be scanned according to the target exposure value.
[0128] The present application also provides a terminal device, which may be a smartphone, computer, or other device.
[0129] As can be seen from the above, the embodiment of the present application provides a terminal device 1200, and the terminal device 1200 performs the following steps:
[0130] In response to an activation operation of a scanning function for a target application, displaying a display interface currently corresponding to the target application;
[0131] Acquiring attribute information of the display interface and a picture to be scanned that appears on the display interface, and determining whether to perform anti-shake processing on the picture to be scanned based on the attribute information, and obtaining a determination result;
[0132] If the judgment result is yes, performing anti-shake processing on the image to be scanned to obtain a target image after anti-shake processing;
[0133] The target screen is decoded by the code scanning module of the target application to read the barcode information in the target screen.
[0134] An embodiment of the present application further provides a storage medium, wherein a computer program is stored in the storage medium. When the computer program is run on a computer, the computer executes the barcode information reading method described in any one of the above embodiments.
[0135] It should be noted that, with respect to the barcode information reading method described herein, a person skilled in the art will understand that all or part of the process of implementing the barcode information reading method described in the embodiments of the present application can be accomplished by controlling related hardware through a computer program. The computer program can be stored in a computer-readable storage medium, such as a memory of a terminal device, and executed by at least one processor in the terminal device. During execution, the program may include the process of the embodiments of the barcode information reading method. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), or the like.
[0136] For the barcode information reading device of the embodiment of the present application, its various functional modules can be integrated into a single processing chip, or each module can exist physically separately, or two or more modules can be integrated into a single module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium, such as a read-only memory, a magnetic disk, or an optical disk.
[0137] The above describes in detail the barcode information reading method, apparatus, medium, and device provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is intended only to facilitate understanding of the method and core concepts of the present application. Furthermore, those skilled in the art will appreciate that variations in the specific implementation methods and scope of application may occur based on the concepts of the present application. Therefore, the contents of this specification should not be construed as limiting the present application.
Claims
1. A barcode information reading method, applied to electronic equipment, wherein: include: In response to an activation operation of a scanning function for a target application, displaying a display interface currently corresponding to the target application; Acquiring attribute information of the display interface and a picture to be scanned that appears on the display interface, and determining whether to perform anti-shake processing on the picture to be scanned based on the attribute information, and obtaining a determination result; If the judgment result is yes, performing anti-shake processing on the image to be scanned to obtain a target image after anti-shake processing; The target screen is decoded by the code scanning module of the target application to read the barcode information in the target screen.
2. The barcode information reading method according to claim 1, wherein: The attribute information includes the application package name and application activity name of the target application.
3. The barcode information reading method according to claim 2, wherein: The determining, according to the attribute information, whether to perform anti-shake processing on the image to be scanned includes: determining, based on a target attribute group consisting of an application package name and an application activity name of the target application, whether the target attribute group exists in a preset list, the preset list being used to record attribute groups that meet the requirements of anti-shake processing; If the target attribute group exists in the preset list, it is determined that anti-shake processing needs to be performed on the image to be scanned.
4. The barcode information reading method according to claim 1, wherein: The electronic device includes a gyroscope, and the anti-shake processing is performed on the image to be scanned to obtain a target image after the anti-shake processing, including: Acquiring angular velocity data corresponding to the gyroscope when the image to be scanned is captured; Calculating, based on the angular velocity data, a compensation value required for each pixel in the image to be scanned, the compensation value being used to offset a jitter effect on the image to be scanned caused by movement of the electronic device; The position and direction of each pixel in the image to be scanned are adjusted based on the compensation value to obtain a target image after anti-shake processing.
5. The barcode information reading method according to claim 4, wherein: The angular velocity data includes angular velocities obtained in three dimensions.
6. The barcode information reading method according to claim 5, wherein: Calculating the compensation value required for each pixel in the image to be scanned based on the angular velocity data includes: constructing an angular velocity vector according to the angular velocities obtained in three dimensions; Determining a time interval required for the electronic device to collect the image to be scanned; The angular velocity vector is multiplied by the time interval to obtain the compensation value required for each pixel in the image to be scanned.
7. The barcode information reading method according to claim 6, wherein: The three dimensions are the x-axis, the y-axis, and the z-axis.
8. The barcode information reading method according to claim 1, wherein: The anti-shake processing is performed on the image to be scanned to obtain a target image after the anti-shake processing, including: Acquire an image sequence containing the picture to be scanned, and construct an affine transformation matrix according to the image sequence; The position and direction of each pixel in the image to be scanned are adjusted by the affine transformation matrix to obtain a target image after anti-shake processing.
9. The barcode information reading method according to claim 8, wherein: The constructing an affine transformation matrix according to the image sequence includes: Calculate the eigenvector containing the coordinates of the feature points in each frame of image, and construct an augmented matrix based on the eigenvector; Preset parameters included in the augmented matrix are estimated, and an affine transformation matrix is constructed using the preset parameters.
10. The barcode information reading method according to claim 9, wherein: The preset parameters include: a horizontal scaling factor a, a horizontal shear factor b, a horizontal translation amount c, a vertical shear factor d, a vertical scaling factor e, and a vertical translation amount f.
11. The barcode information reading method according to claim 1, wherein: Before determining whether to perform anti-shake processing on the image to be scanned according to the attribute information, the method further includes: Obtaining the target environment brightness value when the image to be scanned is captured; Determining a target image exposure value corresponding to the target ambient brightness value according to a preset mapping relationship between the ambient brightness value and the image exposure value; Exposure processing is performed on the image to be scanned according to the target exposure value.
12. A barcode information reading device, wherein: include: The operation response module is used to respond to the start operation of the scanning function for the target application and display the The current display interface corresponding to the target application; a data acquisition module, configured to acquire attribute information of the display interface and a picture to be scanned that appears on the display interface, and determine whether to perform anti-shake processing on the picture to be scanned based on the attribute information, and obtain a determination result; an image processing module, configured to, if the judgment result is yes, perform anti-shake processing on the image to be scanned to obtain a target image after anti-shake processing; The information reading module is used to perform a decoding operation on the target screen through the barcode scanning module of the target application to read the barcode information in the target screen.
13. The barcode information reading device according to claim 12, wherein: The attribute information includes the application package name and application activity name of the target application.
14. The barcode information reading device according to claim 13, wherein: The data acquisition module is configured to determine, based on a target attribute group consisting of an application package name and an application activity name of the target application, whether the target attribute group exists in a preset list, wherein the preset list is used to record attribute groups that meet the requirements of the anti-shake processing; if the target attribute group exists in the preset list, it is determined that the image to be scanned needs to be anti-shake processed.
15. The barcode information reading device according to claim 12, wherein: The image processing module is used to obtain the angular velocity data corresponding to the gyroscope when the image to be scanned is captured; based on the angular velocity data, calculate the compensation value required for each pixel point in the image to be scanned, and the compensation value is used to offset the jitter effect of the image to be scanned caused by the movement of the electronic device; based on the compensation value, adjust the position and direction of each pixel point in the image to be scanned to obtain the target image after anti-shake processing.
16. The barcode information reading device according to claim 15, wherein: The angular velocity data includes angular velocities obtained in three dimensions.
17. The barcode information reading device according to claim 16, wherein: The image processing module is used to construct an angular velocity vector based on the angular velocity obtained in three dimensions; determine the time interval required for the electronic device to collect the image to be scanned; and multiply the angular velocity vector by the time interval to obtain the compensation value required for each pixel in the image to be scanned.
18. The barcode information reading device according to claim 17, wherein: The three dimensions are the x-axis, the y-axis, and the z-axis.
19. A computer-readable storage medium, wherein: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the barcode information reading method according to any one of claims 1 to 11.
20. A terminal device, wherein: The invention comprises a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions to execute the barcode information reading method according to any one of claims 1 to 11.
Citation Information
Patent Citations
An interface display method and terminal equipment
CN109829707A
Barcode recognition method and device and medium
CN114138787A
Method and device for scanning two-dimensional code
CN115130489A
Object scanning method and device, electronic equipment and storage medium
CN116011474A
Image processing method and device and storage medium
CN117135454A