Method and terminal device for enhancing display of two-dimensional code
By receiving user operation events in the terminal device and triggering QR code detection, the contrast and brightness of the screen image are automatically adjusted, solving the problem that the terminal device cannot automatically enhance the display of QR codes, improving the probability of QR code recognition and simplifying User operations.
Patent Information
- Application Number
- CN202110889849.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-04
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-08-04
AI Technical Summary
In the existing technology, terminal equipment cannot automatically enhance the display of QR codes when the light is dim or the quality of the scanning equipment is average. As a result, users need to manually adjust display parameters to facilitate QR code recognition, which is a complicated operation.
By receiving user operation events, it triggers QR code detection on the screen image, and automatically increases the contrast and brightness when the QR code is detected to achieve enhanced display processing of the QR code.
In situations where the light is dim or the quality of the scanning device is average, the probability of the QR code being recognized by external devices is increased, simplifying user operations and reducing system load.
Smart Images

Figure CN113641431B
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a method and terminal device for enhancing the display of a two-dimensional code. Background Art
[0002] Due to the limitations of screen display characteristics, when displaying different images, the optimal display parameters required by the terminal device are not fixed. This is more obvious for ink screens. Its display parameters such as contrast, saturation, brightness, etc. need to be adjusted according to actual conditions. According to actual tests, in dim light or with average scanning equipment quality, the QR code displayed on the page cannot be easily recognized by external devices, such as subway QR code scanners. Therefore, it is necessary to enhance the display of pages with QR codes.
[0003] In the prior art, some applications can only enhance the display of the fixed interface that displays the QR code in the application, while applications that do not have the enhanced display function will not automatically enhance the display of the QR code in their pages. For applications that cannot automatically enhance the display of the QR code, users are often required to manually adjust the display parameters of the terminal device so that the QR code recognition device can recognize the QR code. Manually adjusting the display parameters is complicated. Summary of the invention
[0004] The purpose of the present application is to provide a method and terminal device for enhancing the display of a two-dimensional code, so as to solve the problem in the prior art that users are often required to manually adjust the display parameters of the terminal device to enhance the display of the two-dimensional code.
[0005] In a first aspect, the present application provides a method for enhancing display of a two-dimensional code, the method comprising:
[0006] Receiving a first user operation event;
[0007] Based on the first user operation event, triggering an operation of performing QR code detection on the screen image;
[0008] If a two-dimensional code is detected from the screen image, enhanced display processing is performed on the screen image.
[0009] In some embodiments, the triggering of the operation of performing QR code detection on the screen image based on the first user operation event includes:
[0010] Based on the first user operation event, setting a trigger waiting time;
[0011] When the trigger waiting time is reached, the operation of performing QR code detection on the screen image is triggered.
[0012] In some embodiments, before the operation of triggering the two-dimensional code detection on the screen image, the method further includes:
[0013] It is determined that no second user operation event is received before the trigger waiting time is reached.
[0014] In some embodiments, before the operation of triggering the two-dimensional code detection on the screen image, the method further includes:
[0015] If a second user operation event is received before the trigger waiting time is reached, the operation of performing two-dimensional code detection on the screen image triggered by the first user operation event is abandoned.
[0016] In some embodiments, the performing QR code detection on the screen image includes:
[0017] The following operations are performed for N consecutive cycles until a QR code is detected or N cycles are completed, where N is a positive integer:
[0018] Acquire the latest synthesized page image as the screen image;
[0019] Detecting whether the screen image contains a QR code;
[0020] Wherein, if a QR code is detected in any one of the N consecutive cycles, it is determined that a QR code is detected from the screen image;
[0021] If no two-dimensional code is detected in the N cycles, it is determined that no two-dimensional code is detected from the screen image.
[0022] In some embodiments, before triggering the QR code detection on the screen image, the method further includes: storing the currently displayed image as the screen image into a cache;
[0023] The performing of QR code detection on the screen image specifically includes:
[0024] Check if the cached screen image contains a QR code.
[0025] In some embodiments, before triggering the QR code detection on the screen image, the method further includes: storing the currently displayed image as the screen image into a cache;
[0026] The performing of QR code detection on the screen image specifically includes:
[0027] If there is no image to be displayed being synthesized or received, then checking whether the screen image in the cache contains a QR code;
[0028] If the image to be displayed is currently being synthesized or received, the following operations are performed for N consecutive cycles until a QR code is detected or N cycles are completed, where N is a positive integer:
[0029] Acquire the latest synthesized page image as the screen image;
[0030] Detecting whether the screen image contains a QR code;
[0031] Wherein, if a QR code is detected in any one of the N consecutive cycles, it is determined that a QR code is detected from the screen image;
[0032] If no two-dimensional code is detected in the N cycles, it is determined that no two-dimensional code is detected from the screen image.
[0033] In some embodiments, the performing enhanced display processing on the screen image includes:
[0034] Increase the contrast of the screen image and / or increase the brightness of the terminal device.
[0035] In some embodiments, the performing enhanced display processing on the screen image includes:
[0036] Displaying a user operation interface on the interface of the screen image;
[0037] Based on the user operation of confirming the enhanced display of the user operation interface, the contrast of the terminal device is increased, and / or the brightness of the terminal device is increased.
[0038] In a second aspect, the present application provides a terminal device, including:
[0039] Display, processor and memory;
[0040] The display is used to display a QR code;
[0041] The memory is used to store the processor executable instructions;
[0042] The processor is configured to execute the instructions to implement the method for enhanced display of a two-dimensional code as described in any one of the first aspects above.
[0043] In a third aspect, the present application provides a computer-readable storage medium. When the instructions in the computer-readable storage medium are executed by a terminal device, the terminal device can execute the method for enhanced display of a two-dimensional code as described in any one of the first aspects above.
[0044] In the example of the present application, by detecting the QR code on the screen interface, it is automatically identified whether there is a QR code on the screen interface, and the display effect of the detected QR code image is automatically enhanced, so that in dim light or when the quality of the scanning device is average, the probability of the QR code image being recognized by an external device can be increased.
[0045] In addition, in an embodiment of the present application, a trigger waiting time is set during the process of automatic detection of QR codes on screen images, so that when the user performs frequent and rapid operations, the QR code detection operation will not be frequently triggered, thereby effectively reducing the system load.
[0046] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. Obviously, the drawings introduced below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0048] Figure 1 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0049] Figure 2 A software structure diagram of a terminal device provided in an embodiment of the present application;
[0050] Figure 3 A schematic diagram of an application scenario provided for an embodiment of the present application;
[0051] Figure 4 A schematic diagram of a flow chart of a method for enhancing the display of a two-dimensional code provided in an embodiment of the present application;
[0052] Figure 5 A schematic diagram of a process for triggering a QR code detection on a screen image provided in an embodiment of the present application;
[0053] Figure 6 A schematic diagram of a flow chart of a second method of triggering QR code detection on a screen image provided in an embodiment of the present application;
[0054] Figure 7 A schematic diagram of a synchronization frame detection process provided in an embodiment of the present application;
[0055] Figure 8 A schematic diagram of a process for asynchronous frame detection provided in an embodiment of the present application;
[0056] Fig. 9 A schematic diagram of a process for performing mixed frame detection and enhanced display processing on a screen image provided in an embodiment of the present application;
[0057] Fig.10 A diagram of a user operation interface provided in an embodiment of the present application;
[0058] Fig.11 A software module diagram provided for an embodiment of the present application;
[0059] Fig.12 A schematic diagram of an action receiver provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Among them, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0061] Furthermore, in the description of the embodiments of the present application, unless otherwise specified, “ / ” means or. For example, A / B can mean A or B. The “and / or” in the text is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “plurality” refers to two or more than two.
[0062] In the following, the terms "first", "second", and "second" are used for descriptive purposes only and should not be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first", "second", and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more.
[0063] In the related art, some applications can only enhance the display of the fixed interface of the QR code in the application, while applications without enhanced display function will not automatically enhance the display of the QR code in its page. For applications that cannot automatically enhance the display of the QR code, users are often required to manually adjust the display parameters of the terminal device so that the QR code recognition device can recognize the QR code. Manually adjusting the display parameters is complicated. Therefore, this application proposes a method for enhancing the display of QR codes.
[0064] The inventive concept of the present application can be summarized as follows: In the embodiments of the present application, the detection of a QR code on the screen interface can be triggered based on a user operation event, and the detection can automatically identify whether a QR code exists in the screen interface. When a QR code exists, the display parameters of the terminal device can be adjusted to achieve enhanced display of the QR code. Therefore, in the embodiments of the present application, the solution can be implemented in the terminal device system, so that any application does not need to develop a solution for automatic enhancement of the QR code separately. For users, the present application can automatically detect the QR code and enhance the display without the user manually adjusting the display parameters, thereby simplifying user operations.
[0065] After introducing the inventive concept of the present application, the terminal device provided by the present application will be described below. Figure 1 FIG. 1 shows a schematic diagram of the structure of a terminal device 100. It should be understood that Figure 1 The terminal device 100 shown is only an example, and the terminal device 100 may have more Figure 1 The more or less components shown in the figure can be combined with two or more components, or can have different component configurations. The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.
[0066] Figure 1 FIG. 1 is a block diagram showing a hardware configuration of a terminal device 100 according to an exemplary embodiment. Figure 1 As shown, the terminal device 100 includes: a radio frequency (RF) circuit 110, a memory 120, a display unit 130, a camera 140, a sensor 150, an audio circuit 160, a wireless fidelity (Wi-Fi) module 170, a processor 180, a Bluetooth module 181, and a power supply 190 and other components.
[0067] The RF circuit 110 can be used to receive and send signals during the process of sending and receiving information or making calls. It can receive downlink data from the base station and hand it over to the processor 180 for processing; it can send uplink data to the base station. Generally, the RF circuit includes but is not limited to antennas, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer and other devices.
[0068] The memory 120 can be used to store software programs and data. The processor 180 executes various functions and data processing of the terminal device 100 by running the software programs or data stored in the memory 120. The memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. The memory 120 stores an operating system that enables the terminal device 100 to run. In the present application, the memory 120 can store an operating system and various application programs, and can also store program codes for executing the method described in the embodiments of the present application.
[0069] The display unit 130 may be used to receive input digital or character information and generate signal input related to user settings and function control of the terminal device 100. Specifically, the display unit 130 may include a touch screen 131 disposed on the front of the terminal device 100, which may collect user touch operations on or near it, such as clicking a button, dragging a scroll box, etc.
[0070] The display unit 130 can also be used to display information input by the user or information provided to the user and a graphical user interface (GUI) of various menus of the terminal device 100. Specifically, the display unit 130 may include a display screen 132 disposed on the front of the terminal device 100. The display screen 132 may be configured in the form of a liquid crystal display, a light emitting diode, etc. The display unit 130 may be used to display an interface containing a QR code in the present application, such as an interface of a browser application.
[0071] The touch screen 131 may be covered on the display screen 132, or the touch screen 131 and the display screen 132 may be integrated to realize the input and output functions of the terminal device 100, and the integrated touch screen may be referred to as a touch display screen. In the present application, the display unit 130 may display the application and the corresponding operation steps.
[0072] The camera 140 can be used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then passed to the processor 180 for conversion into a digital image signal.
[0073] The terminal device 100 may further include at least one sensor 150, such as an acceleration sensor 151, a distance sensor 152, a fingerprint sensor 153, and a temperature sensor 154. The terminal device 100 may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, a light sensor, and a motion sensor.
[0074] The audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the terminal device 100. The audio circuit 160 can transmit the electrical signal converted from the received audio data to the speaker 161, which is converted into a sound signal for output. The terminal device 100 can also be configured with a volume button for adjusting the volume of the sound signal. On the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 160 and converted into audio data, and then outputs the audio data to the RF circuit 110 to send to, for example, another terminal device, or outputs the audio data to the memory 120 for further processing. In this application, the microphone 162 can obtain the user's voice.
[0075] Wi-Fi is a short-range wireless transmission technology. The terminal device 100 can help users send and receive emails, browse web pages, and access streaming media through the Wi-Fi module 170, which provides users with wireless broadband Internet access.
[0076] The processor 180 is the control center of the terminal device 100. It uses various interfaces and lines to connect various parts of the entire terminal device. It executes various functions of the terminal device 100 and processes data by running or executing software programs stored in the memory 120 and calling data stored in the memory 120. In some embodiments, the processor 180 may include one or more processing units; the processor 180 may also integrate an application processor and a baseband processor, wherein the application processor mainly processes an operating system, a user interface, and an application program, and the baseband processor mainly processes wireless communications. It is understandable that the above-mentioned baseband processor may not be integrated into the processor 180. In the present application, the processor 180 can run an operating system, an application program, a user interface display and a touch response, as well as the method for enhancing the display of a two-dimensional code described in the embodiment of the present application. In addition, the processor 180 is coupled to the display unit 130.
[0077] The Bluetooth module 181 is used to exchange information with other Bluetooth devices having Bluetooth modules through the Bluetooth protocol. For example, the terminal device 100 can establish a Bluetooth connection with a wearable electronic device (such as a smart watch) that also has a Bluetooth module through the Bluetooth module 181 to exchange data.
[0078] The terminal device 100 also includes a power supply 190 (such as a battery) for supplying power to various components. The power supply can be logically connected to the processor 180 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption. The terminal device 100 can also be configured with a power button for powering on and off the terminal device, as well as locking the screen and other functions.
[0079] Figure 2 It is a software structure block diagram of the terminal device 100 according to an embodiment of the present application.
[0080] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system can be divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
[0081] The application layer can include a series of application packages.
[0082] like Figure 2 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
[0083] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0084] like Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0085] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0086] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, short messages, etc.
[0087] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a short message notification icon can include a view for displaying text and a view for displaying images.
[0088] The phone manager is used to provide communication functions of the terminal device 100, such as management of call status (including connection, disconnection, etc.).
[0089] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, etc.
[0090] The notification manager enables applications to display notification information (such as message summaries and message contents) in the status bar. It can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, the terminal device vibrates, the indicator light flashes, etc.
[0091] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0092] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0093] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0094] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0095] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0096] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0097] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0098] A 2D (animation mode) graphics engine is a drawing engine for 2D drawing.
[0099] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0100] The following is an illustrative description of the workflow of the software and hardware of the terminal device 100 in conjunction with user input events.
[0101] When the touch screen 131 receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, timestamp of the touch operation, and other information). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the kernel layer, identifies the input event, and then triggers the QR code detection of the screen image to determine whether to adjust the display parameters of the terminal device.
[0102] The terminal device 100 in the embodiment of the present application may be an electronic device including but not limited to a mobile terminal, a desktop computer, a mobile computer, a tablet computer, a home vital sign data collection device (such as a blood pressure monitor), a television, and the like.
[0103] The following is a brief introduction to the application scenarios to which the technical solutions of the embodiments of the present application can be applied. It should be noted that the application scenarios introduced below are only used to illustrate the embodiments of the present application and are not limited. In specific implementation, the technical solutions provided by the embodiments of the present application can be flexibly applied according to actual needs.
[0104] like Figure 3 FIG. 3 shows a schematic diagram of an application scenario provided by an embodiment of the present application. The application scenario diagram includes a network 301, a terminal device 302, and an external device 303. Among them:
[0105] The terminal device 302 can obtain the page to be displayed based on the user operation, and any page in the embodiment of the present application can be identified as a screen image. For example, a page acquisition request can be sent to the network 301. The network 301 provides a page containing a QR code to the terminal device 302 for display based on the page acquisition request.
[0106] The terminal device 302 is used to perform a two-dimensional code detection operation and a two-dimensional code enhanced display operation on the screen image based on the triggering of a user operation event.
[0107] The external device 303 is used to identify the QR code image provided by the terminal device 302, including but not limited to electronic devices such as subway QR code scanners, bus QR code scanners, and medical insurance QR code scanners.
[0108] Of course, the method provided in the embodiment of the present application is not limited to Figure 3The application scenarios shown can also be used in other possible application scenarios, and the embodiments of the present application are not limited thereto. Figure 3 The functions that can be implemented by each device in the application scenario shown will be described in the subsequent method embodiments, and will not be described in detail here.
[0109] In order to facilitate understanding of the method for enhanced display of a two-dimensional code provided in the embodiment of the present application, it is further explained below with reference to the accompanying drawings.
[0110] like Figure 4 FIG. 1 is a flow chart of a method for enhancing the display of a two-dimensional code provided in an embodiment of the present application, comprising the following steps:
[0111] Step 401: receiving a first user operation event;
[0112] In some embodiments, user operation events include but are not limited to the following events: any pressing, sliding and lifting actions of the user; changes in screen display mode, such as the dark mode and light mode of the screen. The specific mode can be determined by the developer and this application does not limit this; user click events on the navigation keys (back, home page, recent tasks).
[0113] Step 402: triggering an operation of performing a QR code detection on a screen image based on a first user operation event;
[0114] In some embodiments, after the user stops operating the screen, the QR code may be displayed with a certain delay due to the influence of application design, network environment or system performance. In order to accurately obtain the screen image, the embodiment of the present application can perform delay detection. During implementation, the embodiment of the present application can set the trigger waiting time T2 after receiving the user operation event; when the trigger waiting time T2 is reached, the operation of performing QR code detection on the screen image is triggered.
[0115] Of course, in another embodiment, the trigger waiting time can be a fixed time or can be adjusted dynamically according to the situation. For example, the ratio of the number of times the QR code is detected within a period of time to the total number of user operation events within the period of time can be automatically adjusted dynamically. The closer the ratio is to 1, the shorter the trigger waiting time is; conversely, the closer the ratio is to 0, the longer the trigger waiting time is.
[0116] The smaller the trigger waiting time is, the shorter the waiting time will be and the faster the triggering frequency will be.
[0117] The trigger waiting time can be set in the main thread. Of course, in another embodiment, if a reported user operation event is received, a sub-thread can be created, and the trigger waiting time can be set by the sub-thread. Creating a sub-thread can improve the utilization rate of a multi-core CPU (central processing unit).
[0118] After setting the trigger waiting time T2, the intermediate implementation method to triggering the two-dimensional code detection can be configured as needed. The present application provides the following two implementation methods for illustration.
[0119] like Figure 5 As shown, it is a first implementation method of triggering the two-dimensional code detection of the screen image, wherein:
[0120] Step 501: Create a sub-thread, which is used to delay triggering of QR code detection.
[0121] Step 502: The child thread enters the wait state (hereinafter referred to as state 1).
[0122] Step 503: After receiving the user operation event, the main thread triggers the child thread to enter the active state (state 2).
[0123] Among them, after the main thread receives the user operation event, it records the system time reported this time, sets the QR code detection signal to true, and applies a notify semaphore to the child thread. After receiving the semaphore, the child thread enters state 2, and the main thread notifies the child thread to trigger the waiting time T2.
[0124] Step 504: The child thread obtains the trigger waiting time T2 from the main thread, sets the timer to count the time T2, and then enters the wait state (state three).
[0125] At this time, in some embodiments, user operations have a certain degree of randomness, and sometimes users will frequently operate within a period of time, so user operation events will be frequently generated. When the main thread detects the first user operation event, it may receive the second user operation event, and at this time, it may frequently trigger the detection of the QR code, increasing the system load. Therefore, in the embodiment of the present application, some user operation events can be filtered to avoid frequent detection. When implemented, it can be as follows Figure 5 As shown in step 505: the main thread receives the user operation event again.
[0126] Step 506: The main thread records the current system time.
[0127] Step 507: The main thread determines whether the time interval between the current system time and the last recorded user operation event is less than the threshold. If the time interval between two user operation events is greater than the threshold, it means that no user operation event has been received during the timing to the trigger waiting time. Then, before receiving a new user operation event, the trigger waiting time will be counted first. When the trigger waiting time is reached, the child thread will enter the active state (state four) in step 508. Then, in step 509: the child thread triggers the detection of the QR code. Among them, the triggering method can be implemented as the child thread modifying the mStatus (global variable) semaphore. Then the mStatus semaphore can be scanned in real time. If the mStatus semaphore changes, it means that the screen image needs to be detected by the QR code.
[0128] Among them, a Flag (two-dimensional code recognition binary loop trigger flag) will be set when the child thread is created, and the initial value is 0x100000. When the trigger waiting time is reached, the value of Flag will be inverted and logically operated with Mode (current display mode of the screen), and then the value of Flag will be assigned to the mStatus semaphore, causing the mStatus semaphore to change. For example: Mode = 0x203, then combined with Flag is 0x100203, the next time is 0x203, and the next time is 0x100203, and the cycle continues. Each time the Flag value changes, the mStatus semaphore will change, and then trigger the operation of two-dimensional code detection on the screen image.
[0129] Continuing to explain, if the time interval between two user operation events is greater than or equal to the threshold, the QR code detection will be triggered first based on the previous user operation event, and for the newly received user operation event, step 502 will be executed to trigger the child thread to enter the state and start timing the trigger delay waiting time required for the new user operation event.
[0130] If the time interval between two user operation events is less than the threshold, the child thread is in state three, the timing of the trigger delay waiting time is interrupted, and the child thread switches from state three to state one.
[0131] Of course, in another embodiment, if the time interval between two user operation events is less than the threshold, the sub-thread may be triggered to restart the timing of the trigger waiting time based on the new user operation event. In this way, when user operation events occur frequently, the timing will be continuously restarted, and the sub-thread will stay in the third state, which can also reduce the operation of QR code detection.
[0132] like Figure 6 As shown, it is a second implementation method of triggering the two-dimensional code detection of the screen image, wherein:
[0133] Step 601: Create a sub-thread, which is used to delay triggering QR code detection.
[0134] Step 602: The child thread enters the wait state (state 1).
[0135] Step 603: After receiving the user operation event, the main thread triggers the child thread to enter the active state (state 2).
[0136] Among them, after the main thread receives the user operation event, it records the system time reported this time, sets the QR code detection signal to true, and applies a notify semaphore to the child thread. After receiving the semaphore, the child thread enters state 2, and the main thread notifies the child thread to trigger the waiting time T2.
[0137] Step 604: The child thread obtains the trigger waiting time T2 from the main thread, sets the timer to count the time T2, and then enters the wait state (state three).
[0138] At this time, in some embodiments, user operations have a certain degree of randomness, and sometimes users will frequently operate within a period of time, so user operation events will be frequently generated. When the main thread detects the first user operation event, it may receive the second user operation event, and at this time, it may frequently trigger the detection of the QR code, increasing the system load. Therefore, in the embodiment of the present application, some user operation events can be filtered to avoid frequent detection. When implemented, it can be as follows Figure 6 As shown in step 605: the main thread receives the user operation event again.
[0139] Step 606: The main thread records the current system time.
[0140] Step 607: Determine whether the time interval between the current system time and the last recorded time is less than a threshold.
[0141] If the time interval between the current system time and the last recorded time is less than the threshold, it means that the second user operation event is received before the time reaches the trigger waiting time, then the QR code detection signal is set to false in step 608, and the notify semaphore is applied to the child thread to wake up the child thread. At this time, in step 610, the child thread enters state 4. Then in step 611, the child thread reads the QR code detection signal as false, and enters state 1, waiting to be awakened by the next user operation event.
[0142] If the time interval between the current system time and the last record is greater than or equal to the threshold, in step 609, the main thread sets the two-dimensional code detection signal to true and applies the notify semaphore to the child thread to wake up the child thread, and the child thread enters state four. At this time, in step 611, the child thread reads the two-dimensional code detection signal as true, then in step 612, the child thread triggers the detection of the two-dimensional code. Among them, the triggering method can be implemented as the child thread modifying the mStatus (global variable) semaphore. Then the mStatus semaphore can be scanned in real time. If the mStatus semaphore changes, it means that the screen image needs to be detected by the two-dimensional code.
[0143] In summary, in an embodiment of the present application, before the operation of performing QR code detection on the screen image can be triggered, it is determined whether a second user operation event is received before the trigger waiting time is reached. If the second user operation event is not received, the QR code detection on the screen image can be triggered based on the first user operation event. If the second user operation event is received, the execution of the first user operation event to trigger the QR code detection is abandoned. In short, if the time interval between two adjacent operation events is short, it means that the user is operating frequently, and the page content displayed on the screen may also change frequently. At this time, the QR code detection can be abandoned.
[0144] Based on the above description, the embodiment of the present application can delay the operation of performing QR code detection on the screen image by setting the trigger waiting time. On the one hand, it can ensure that a suitable screen image can be obtained for detection, and on the other hand, it can alleviate the system burden caused by frequently triggering QR code detection.
[0145] In some embodiments, after triggering the operation of performing QR code detection on the screen image, a suitable screen image can be obtained for detection. Several optional detection methods are provided in the embodiments of the present application, including synchronous frame detection, asynchronous frame detection, mixed frame detection, etc. These detection methods are described below:
[0146] 1. Synchronous frame detection
[0147] The basic concept of synchronous frame detection is to perform real-time detection of the currently displayed image. This detection method is particularly suitable for situations where the page content is constantly changing. In order to ensure the accuracy of the detection, N detection cycles are provided in the synchronous frame detection in the embodiment of the present application, where N is a positive integer. If it is detected in each detection cycle that a screen image is currently being synthesized, the synthesis of the screen image being synthesized is waited for to be completed, and the synthesized image is used as the screen image for QR code detection. If it is detected that no screen image is currently being synthesized, the image displayed in the current cycle is used as the screen image for QR code detection. If a QR code is detected in any cycle within N consecutive cycles, it is determined that a QR code is detected from the image. If no QR code is detected within N consecutive cycles, it is determined that no QR code is detected from the screen image.
[0148] In a possible implementation manner, the implementation manner of synchronization frame detection is as follows: Figure 7 As shown, the following steps are included:
[0149] In step 701, the detection cycle is counted.
[0150] In step 702 , it is determined whether the count of the current detection cycle is less than or equal to N. If it is greater than N, step 705 is executed; if it is less than or equal to N, step 703 is executed.
[0151] In step 703, the latest synthesized page image is obtained as a screen image.
[0152] like Figure 7 As shown, it can be implemented as step 7031 to detect whether there is an image being synthesized currently, if yes, execute step 7032, if not, execute step 7033.
[0153] In step 7032, the synthesis of the image being synthesized is waited for to be completed, and the synthesized image is obtained as the screen image.
[0154] In step 7033, the currently displayed image is obtained as a screen image.
[0155] In step 704, it is detected whether the screen image contains a two-dimensional code. If a two-dimensional code is detected from the screen image, step 705 is executed. If no two-dimensional code is detected from the screen image, the process returns to step 701 to update the count and start the next detection cycle.
[0156] In step 705, the operation ends.
[0157] In order to further understand the synchronization frame detection, an example is given below for illustration.
[0158] Assume that the detection signal is reported after a delay of n seconds, and the synchronization frame detection is performed at the n+0th second, the n+1th second, the n+2th second, and the n+4th second. Assume that the initial frame is the 0th frame, and the corresponding relationship between the detection time point and the synchronization frame is shown in Table 1:
[0159] Table 1
[0160]
[0161]
[0162] The selection of the detection time point takes into account real-time performance and power consumption level. The above data is only an example. In actual use, the detection interval and number of detections can be changed according to real-time requirements.
[0163] 2. Asynchronous frame detection
[0164] The basic concept of asynchronous frame detection is to detect the cached image after monitoring the change of the mStatus signal. This detection method is particularly suitable for the situation where the page content is in a static state. In order to ensure the accuracy of the detection, in the embodiment of the present application, before triggering the operation of performing QR code detection on the screen image, the currently displayed image is stored in the cache as the screen image. After triggering the QR code detection on the screen image in the asynchronous frame detection, it is detected whether there is currently a screen image being synthesized. If it is detected that no screen image is currently being synthesized, it is detected whether the screen image in the cache contains a QR code. If it is detected that a screen image is currently being synthesized, the synthesized image is placed in the cache, and it is detected whether the screen image in the cache contains a QR code.
[0165] In a possible implementation, the implementation of asynchronous frame detection is as follows: Figure 8 As shown, the following steps are included:
[0166] In step 801, the currently displayed image is acquired as a screen image.
[0167] In step 802, it is determined whether there is an image in the cache buffer. If yes, step 803 is executed, if not, step 804 is executed.
[0168] In step 803, the image in the cache is cleared.
[0169] In step 804, the screen image is stored in a cache.
[0170] In step 805, the operation of performing two-dimensional code detection on the screen image is triggered to detect whether there is a screen image being synthesized. If yes, step 806 is executed, and if not, step 807 is executed.
[0171] In step 806, the synthesized image is put into a cache.
[0172] In step 807, it is detected whether the screen image in the cache contains a QR code.
[0173] 3. Mixed frame detection
[0174] As the name implies, hybrid frame detection means that either asynchronous frame detection or synchronous frame detection may be used. When implementing, the detection method to be used can be determined according to the situation of the page image. The basic idea is that if the page content changes dynamically, synchronous frame detection is suitable, and if the page content is almost unchanged, asynchronous frame detection is suitable.
[0175] During implementation, whether the page content changes dynamically or remains unchanged can be determined based on whether there is an image to be displayed being synthesized or received.
[0176] In order to ensure the accuracy of the detection, in the embodiment of the present application, before triggering the QR code detection on the screen image, the currently displayed image is stored in the cache as the screen image. When the QR code detection on the screen image is triggered in the asynchronous frame detection, it is detected whether the screen image in the cache contains the QR code. In the synchronous frame detection, N detection cycles are provided, where N is a positive integer. In each detection cycle, the latest synthesized page image is used as the screen image for QR code detection. If a QR code is detected in any cycle within N consecutive cycles, it is determined that a QR code is detected from the image. If no QR code is detected within N consecutive cycles, it is determined that no QR code is detected from the screen image.
[0177] In a possible implementation, the implementation of mixed frame detection is as follows Fig. 9 As shown, the following steps are included:
[0178] In step 904, the current frame image is acquired as a screen image.
[0179] In step 905, the screen image is stored in a buffer.
[0180] In step 906: query the detection notification sent by the child thread.
[0181] In step 907: determine whether the screen image is notified to perform a two-dimensional code detection. If yes, execute step 908; if not, execute step 904.
[0182] Step 908: Determine whether there is an image to be displayed being synthesized or received. If not, execute step 909; if yes, execute step 910.
[0183] Step 909: Perform synchronization frame detection (the specific operation is as shown in the above synchronization frame detection).
[0184] Step 910: Execute asynchronous frame detection (the specific operation is as shown in the above asynchronous frame detection).
[0185] Based on the previous description, synchronous frame detection is the most commonly used method, which is suitable for dynamic images and performs real-time detection on the currently displayed image with high real-time performance; asynchronous frame detection is suitable for still images and performs detection on cached images. Hybrid frame detection satisfies the detection of both dynamic and still images. The three detection methods can be used to determine whether the current screen image contains a QR code image.
[0186] In summary, after the screen image is detected, in step 403: if a QR code is detected from the screen image, the screen image is enhanced and displayed.
[0187] In some embodiments, in order to increase the probability that the external device can recognize the QR code image displayed on the page under dim light or average scanning device quality conditions, the embodiments of the present application enhance the display processing of the screen image by increasing the contrast of the screen image and / or increasing the brightness of the terminal device. Fig. 9 As shown, the specific steps include:
[0188] Step 911: Determine whether a two-dimensional code image is detected. If a two-dimensional code image is detected, execute step 912; if no two-dimensional code image is detected, execute step 914.
[0189] Step 912: Save the original contrast and backlight.
[0190] Step 913: Set new contrast and backlight.
[0191] Among them, in the embodiment of the present application, the new contrast and backlight can be set to the maximum value. Of course, in another embodiment, it can also be adjusted in other ways, which are applicable to the embodiment of the present application, such as increasing the contrast and backlight by 50%.
[0192] Step 914: Restore the original contrast and backlight.
[0193] In some embodiments, the screen image is enhanced and displayed, and a user operation interface may be displayed on the screen image interface; based on the user operation of the user operation interface confirming the enhanced display, the contrast of the screen image is increased, and / or the brightness of the terminal device is increased. Fig.10 The figure shows the user operation interface. The user can click the light bulb-shaped button in the upper right corner to adjust the image contrast and the backlight of the terminal device. Using this method, the user does not need to open other interfaces for operation, but only needs to click buttons on the user operation interface displayed on this interface, which simplifies the user's operation.
[0194] Based on the above description, the embodiment of the present application can automatically enhance the display of the QR code page, and can also allow the user to adjust the display of the QR code interface by himself. Thus, the probability of the external device recognizing the QR code image displayed on the page can be increased in dim light or when the scanning device quality is average.
[0195] like Fig.11 The software module diagram provided by the embodiment of the present application is shown in FIG. The method of the embodiment of the present application is implemented in the system server process, and the main submodules include an operation detection module, a core service module, an algorithm identification module, and an interface processing module.
[0196] The operation detection module contains an action receiver. Fig.12 The following is a schematic diagram of an action receiver provided in an embodiment of the present application:
[0197] Action receivers are created when user operation events are generated, and receive user operations in the following three ways:
[0198] Method 1) User operation screen: Use the A1 method to monitor any pressing, sliding and lifting actions of the user, and pass these actions to EpdManagerService (core service).
[0199] Method 2) User operation of navigation keys: Use the A2 method to monitor the user's click events on the navigation keys (back, home page, recent tasks), and pass these events to EpdManagerService.
[0200] Method 3) User switches display mode: Use the A3 method to monitor the change of screen display mode and pass this event to EpdManagerService.
[0201] The action receiving and reporting principle is to pass the user event to the core service EpdManagerService after the Android native function is executed. This process is executed in the main thread. The main thread completes the user event report and notifies the child thread. The main thread currently enters the idle state (releases the lock) and can start processing the next user event report.
[0202] The action receiver reports the user operation event to the operation processor in the core service module. The operation processor is used to receive the user event reported by the action receiver, open a child thread, set the wake-up time of the delay trigger, and apply a notify signal to the delay trigger.
[0203] The delay trigger is used to receive the signal transmitted by the operation processor, determine the thread wake-up time according to the trigger waiting time, and notify the signal processor in the algorithm recognition module to detect the QR code.
[0204] The signal processor can identify the trigger detection signal sent by the delayed trigger, detect whether it is a synchronous signal or an asynchronous signal, and send it to the image recognizer to detect the two-dimensional code image.
[0205] The image recognizer uses a public and mature algorithm to scan and recognize the QR code image and feeds the recognition result value back to the signal processor. At the same time, if a QR code image is detected, the signal is sent to the display enhancer of the interface processing module.
[0206] The display enhancer adjusts the display parameters of the terminal device according to the recognition result of the image recognizer.
[0207] Similar parts between the embodiments provided in this application can be referenced to each other. The specific implementation methods provided above are only a few examples under the general concept of this application and do not constitute a limitation on the protection scope of this application. For those skilled in the art, any other implementation methods expanded based on the scheme of this application without creative work belong to the protection scope of this application.
[0208] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0209] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0210] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0211] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0212] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for enhancing the display of a two-dimensional code, It is characterized in that The method comprises: Receiving a first user operation event; Based on the first user operation event, trigger the operation of performing QR code detection on the screen image; wherein, based on the first user operation event, trigger the operation of performing QR code detection on the screen image, including: based on the first user operation event, set the trigger waiting time; when the timing reaches the trigger waiting time, trigger the operation of performing QR code detection on the screen image; the trigger waiting time is dynamically adjusted according to the ratio of the number of QR codes detected within a period of time and the total number of the first user operation events within the period of time; the ratio is inversely proportional to the trigger waiting time; wherein, when the timing reaches the trigger waiting time, triggering the operation of performing QR code detection on the screen image, includes: creating a child thread, the child thread is used to delay the triggering of QR code detection; the child thread enters state one; after the main thread receives the user operation event, it records the current system time and triggers the child thread to enter state two; the child thread obtains the trigger waiting time T2 from the main thread, sets the timer to count T2, and then enters state three; the main thread receives the user operation event again; the main thread records the current system time; the main thread Determine whether the system time interval between the current system time and the last recorded user operation event is less than a threshold; if the system time interval between two user operation events is greater than the threshold, the child thread enters state four; the child thread modifies the global variable mStatus semaphore to trigger the detection of the QR code; if the time interval between two user operation events is less than the threshold, the child thread interrupts the timing of the trigger waiting time and switches from state three to state one; wherein, when entering state one, the child thread is in a wait state, waiting for the main thread to be triggered; when entering state two, the child thread is in an active state, obtains the trigger waiting time T2 from the main thread, and sets the timer timing T2; when entering state three, the child thread re-enters the wait state from the active state, and continuously times the trigger waiting time T2 until the trigger waiting time T2 is reached, and enters state four; when entering state four, the child thread enters the active state from the wait state, modifies the global variable mStatus semaphore, and then triggers the detection of the QR code; If a two-dimensional code is detected from the screen image, enhanced display processing is performed on the screen image.
2. The method according to claim 1, It is characterized in that Before the operation of triggering the two-dimensional code detection on the screen image, the method further includes: It is determined that no second user operation event is received before the trigger waiting time is reached.
3. The method according to claim 2, It is characterized in that The method further comprises: If a second user operation event is received before the trigger waiting time is reached, the operation of performing two-dimensional code detection on the screen image triggered by the first user operation event is abandoned.
4. The method according to claim 1, It is characterized in that The performing of QR code detection on the screen image includes: The following operations are performed for N consecutive cycles until a QR code is detected or N cycles are completed, where N is a positive integer: Acquire the latest synthesized page image as the screen image; Detecting whether the screen image contains a QR code; Wherein, if a QR code is detected in any one of the N consecutive cycles, it is determined that a QR code is detected from the screen image; If no two-dimensional code is detected in the N cycles, it is determined that no two-dimensional code is detected from the screen image.
5. The method according to claim 1, It is characterized in that Before triggering the two-dimensional code detection on the screen image, the method further includes: storing the currently displayed image as the screen image into a cache; The performing of QR code detection on the screen image specifically includes: Check if the cached screen image contains a QR code.
6. The method according to claim 1, It is characterized in that Before triggering the two-dimensional code detection on the screen image, the method further includes: storing the currently displayed image as the screen image into a cache; The performing of QR code detection on the screen image specifically includes: If there is no image to be displayed being synthesized or received, then checking whether the screen image in the cache contains a QR code; If the image to be displayed is currently being synthesized or received, the following operations are performed for N consecutive cycles until a QR code is detected or N cycles are completed, where N is a positive integer: Acquire the latest synthesized page image as the screen image; Detecting whether the screen image contains a QR code; Wherein, if a QR code is detected in any one of the N consecutive cycles, it is determined that a QR code is detected from the screen image; If no two-dimensional code is detected in the N cycles, it is determined that no two-dimensional code is detected from the screen image.
7. The method according to any one of claims 1 to 6, It is characterized in that The step of performing enhanced display processing on the screen image comprises: Increase the contrast of the screen image and / or increase the brightness of the terminal device.
8. The method according to any one of claims 1 to 6, It is characterized in that The step of performing enhanced display processing on the screen image comprises: Displaying a user operation interface on the interface of the screen image; Based on the user operation of confirming the enhanced display of the user operation interface, the contrast of the terminal device is increased, and / or the brightness of the terminal device is increased.
9. A terminal device, It is characterized in that include: Display, processor and memory; The display is used to display a QR code; The memory is used to store the processor executable instructions; The processor is configured to execute the instructions to implement the method for enhanced display of a two-dimensional code according to any one of claims 1 to 8.
