Two-dimensional code recognition method and device, computer equipment and storage medium
By recording the first detection time and activating a dynamic detection time window in a dynamic scanning scenario, and combining stable conditions and maximum detection duration, the problem of low QR code recognition coverage in existing technologies is solved, achieving more efficient QR code recognition and resource management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-05-19
AI Technical Summary
Existing technologies cannot effectively recognize multiple QR codes in dynamic scanning scenarios, resulting in low recognition coverage and an inability to detect the user's mobile scanning intent, leading to unnecessary scanning terminations.
By recording the initial detection time, a dynamic detection time window is initiated, and detection continues until stable conditions are met or the maximum detection duration is reached. The QR code recognition result set is then output, and the user's behavioral intent is determined by combining the number of QR codes and the consistency of identifiers in consecutive frame images.
It significantly improves QR code recognition coverage, reduces unnecessary scanning time and resource consumption, achieves a balance between recognition efficiency and resource consumption, and the output results are highly consistent with the user's intent.
Smart Images

Figure CN122065855A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of QR code recognition technology, and in particular to a QR code recognition method, apparatus, computer equipment, and storage medium. Background Technology
[0002] With the development of mobile terminal image recognition technology, various QR code scanning and recognition technologies have emerged. These technologies typically rely on cameras to capture images in real time and use decoding algorithms to recognize QR codes within the field of view.
[0003] However, in dynamic scanning scenarios, related technologies often employ a trigger mechanism that terminates upon first recognition, meaning the scanning process ends immediately once a valid QR code is detected in a single frame of image. While this mechanism enables rapid response, it cannot achieve dynamic scanning, severely limiting the number of valid QR codes that can be recognized. Summary of the Invention
[0004] Therefore, it is necessary to provide a QR code recognition method, apparatus, computer device, and storage medium to address at least one of the aforementioned technical problems.
[0005] In a first aspect, embodiments of this application provide a QR code recognition method, the method comprising: Record the first detection time when a valid QR code is first detected; Based on the initial detection time, QR code detection is continuously performed within a preset dynamic detection time window; If the continuous detection results meet the preset stability conditions, the detection will be terminated early, and the QR code recognition result set at the termination time will be output; otherwise, the current QR code recognition result set will be output when the maximum detection time is reached.
[0006] In some embodiments, the QR code recognition method further includes: within a dynamic detection time window, if the number of valid QR codes detected for N consecutive frames of images is the same, then it is determined that the continuous detection result meets the stability condition; where N is a positive integer.
[0007] In some embodiments, the QR code recognition method further includes: within a dynamic detection time window, if the set of identifiers corresponding to valid QR codes detected for N consecutive frames of images is the same, then it is determined that the continuous detection result satisfies the stability condition; where N is a positive integer.
[0008] In some embodiments, when continuously performing QR code detection within a preset dynamic detection time window, the QR code recognition method further includes: performing QR code detection on the image frame corresponding to the current moment, and recording the timestamp of the corresponding image frame when a valid QR code is detected; If the difference between the timestamp and the first detection time is less than the dynamic detection time window, then continue to detect the QR code on the next image frame.
[0009] In some embodiments, the QR code recognition method further includes: if the difference between the timestamp and the first detection time is greater than the critical detection threshold and less than the maximum detection duration, then in each subsequent detection, it is determined whether the continuous detection result meets the stability condition.
[0010] In some embodiments, the QR code recognition method further includes: the QR code recognition result set at the termination time and the current QR code recognition result set are the recognition results of multiple valid QR codes contained in the image frame at the corresponding time.
[0011] In some embodiments, the QR code recognition method further includes: the maximum detection duration is the total duration of the dynamic detection time window.
[0012] In a second aspect, embodiments of this application provide a QR code recognition device, the device comprising: The storage module is used to record the first detection time of the first valid QR code detected. The detection module is used to continuously detect QR codes within a preset dynamic detection time window, based on the initial detection time. The processing module is used to terminate the detection early and output the QR code recognition result set at the termination time if the continuous detection results meet the preset stability conditions; otherwise, it outputs the current QR code recognition result set when the maximum detection time is reached.
[0013] In a third aspect, embodiments of this application provide a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the QR code recognition method provided in any embodiment of the first aspect of this application.
[0014] In a fourth aspect, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the QR code recognition method provided in any embodiment of the first aspect of this application.
[0015] The aforementioned QR code recognition method, device, computer equipment, and storage medium, by recording the initial detection time and using it to open a dynamic detection time window, can detect the user's continuous moving scanning actions. This allows for the recognition of more QR codes even after the user moves the camera, significantly improving recognition coverage. Simultaneously, by introducing a stability condition as the basis for early termination, it can intelligently understand the user's intention to stop moving the camera and end the detection when the user stabilizes the camera, reducing unnecessary scanning time waste. Furthermore, by setting a maximum detection duration as a termination guarantee mechanism, a clear time limit is set for the entire scanning process, preventing indefinite scanning due to the inability to meet stability conditions, ensuring controllable system resource consumption, and achieving a balance between recognition efficiency and resource consumption. Attached Figure Description
[0016] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a diagram illustrating the application environment of the QR code recognition method in some embodiments; Figure 2 This is a flowchart illustrating the QR code recognition method in some embodiments; Figure 3 This is a flowchart illustrating the step of recording image frame timestamps in some embodiments; Figure 4 Here are some structural block diagrams of the QR code recognition device in some embodiments; Figure 5 This is a diagram showing the internal structure of a computer device in some embodiments. Detailed Implementation
[0018] To make the technical solutions and advantages of this application clearer, the embodiments and related technical content of this application will be further described in detail below with reference to the accompanying drawings and text description. It should be understood that the embodiments described below are only used to explain the technical solutions of the embodiments of this application and are not intended to limit more possible implementations of this application.
[0019] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0020] The steps of the QR code recognition method provided in this application can be executed by a server or a terminal without any special restrictions.
[0021] For ease of understanding, Figure 1 An application environment is illustrated, in which server 101 performs the steps of a QR code recognition method. During execution, server 101 can communicate with terminal 102 via a network to obtain image frames sent by terminal 102. Server 101 can be implemented as a standalone server or a server cluster consisting of multiple servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, or portable wearable devices.
[0022] Servers can be implemented using at least one of the following hardware forms: programmable logic array (PLA), field-programmable gate array (FPGA), digital signal processor (DSP), application-specific integrated circuit (ASIC), general-purpose processor, or other programmable logic device.
[0023] Of course, the configuration method for travel service software provided in this application embodiment can also be applied to more scenarios not shown.
[0024] In a first aspect, embodiments of this application provide a QR code recognition method, which can be applied to... Figure 1 In the application environment shown, it can be applied to Figure 1 Taking terminal 102 as an example, in some embodiments, such as Figure 2 As shown, the QR code recognition method includes steps S201, S202, and S203 that can be executed by the server 101. Each step is described in detail below.
[0025] Step S201: Record the first detection time when a valid QR code is first detected.
[0026] In dynamic scanning scenarios, when a user opens their camera to scan multiple QR codes, they might move the camera to select the desired code or move it to include multiple QR codes in the scanning range simultaneously. However, related technologies typically trigger decoding immediately upon detecting any valid QR code and terminate the scanning process. This can result in the final scanned QR code not being the one the user intended, or preventing the user from scanning multiple QR codes at once.
[0027] In other words, the QR code scanning method under the relevant technology cannot sense the user's intention to move the camera, nor does it reserve a time window for continuous image acquisition, resulting in a large number of QR codes in the area covered by the camera's movement trajectory not being effectively recognized, which seriously reduces the multi-code recognition coverage rate.
[0028] In this application, the initial detection time refers to the time point at which the camera successfully detects the first valid QR code from the video stream after initiating the scanning process. Initial detection time T first It can be used as a baseline to initiate a dynamic, time-limited continuous detection process, which can mark the terminal switching from the state of searching for the first QR code to the state of searching for more QR codes within a limited time.
[0029] Step S202: Based on the initial detection time, continue to detect the QR code within the preset dynamic detection time window.
[0030] The dynamic detection time window is a preset time interval, starting from the first detection time T. first Within the dynamic detection time window, the terminal will not terminate the detection upon first detecting any QR code, but will continue to detect QR codes in subsequent image frames, thereby responding to the user's intention to move the camera to cover more QR codes.
[0031] Step S203: If the continuous detection results meet the preset stability conditions, the detection is terminated in advance, and the QR code recognition result set at the termination time is output; otherwise, when the maximum detection time is reached, the current QR code recognition result set is output.
[0032] The preset stability condition is used to determine whether the user's camera movement has stopped. When the continuous detection results meet the stability condition, it indicates that the user has found the target area and kept the camera stable. At this point, the detection can be ended early without waiting for the dynamic detection time window to end, thereby reducing the user's waiting time and resource consumption while ensuring multi-code recognition coverage.
[0033] Among them, the QR code recognition result set at the termination time and the current QR code recognition result set are the recognition results of multiple valid QR codes contained in the image frame at the corresponding time.
[0034] The QR code recognition result set at the termination time refers to the set of parsing results of all valid QR codes identified by the terminal from the image frame corresponding to the time point when the detection is terminated early. This result set represents all the QR code information that the terminal can capture when the camera movement tends to be stable and the field of view is fixed.
[0035] The current QR code recognition result set refers to the set of parsing results of all valid QR codes identified by the terminal from the last frame image when the maximum detection time is reached as a forced termination condition. This result set is the final and most comprehensive QR code recognition result provided by the terminal to the user within the maximum allowed time range, ensuring that even if convergence cannot be achieved in advance, a result that is as complete as possible can be output.
[0036] Understandably, regardless of how the scan is terminated, the final output is based on the recognition result of the corresponding image frame at the final moment, rather than a simple summation or deduplication of all recognition results throughout the entire scanning process. This ensures a high degree of consistency between the output result and the user's final intention.
[0037] For example, when a user scans an area, after the terminal first recognizes a valid QR code, it continuously detects QR codes according to a dynamic detection time window. At a certain point, if the terminal determines that the continuous detection results meet the stability condition, it captures the current frame (i.e., the image frame at the termination time), packages the parsed data (such as text information) of the QR codes recognized in that frame to form a "QR code recognition result set at the termination time," and outputs it. If the stability condition is not met, when the maximum detection time is reached, the terminal captures the last frame, packages the parsed data of all QR codes recognized in that frame to form a "current QR code recognition result set," and outputs it.
[0038] By explicitly defining the output as a single-frame image based on the final moment, the problem of duplicate data caused by the same QR code being repeatedly recognized in different frames during dynamic scanning is effectively avoided. The terminal also does not need to maintain historical recognition records spanning multiple time points; it only needs to process a single frame at the endpoint, reducing the requirements on system storage and computing power and improving the speed of result generation. Furthermore, the set of 2D recognition results output by the terminal strictly corresponds to the physical area the user ultimately intends to scan, achieving a high degree of consistency between the output and the user's visual perception, conforming to user intuition.
[0039] This application records the initial detection time and uses it to open a dynamic detection time window, enabling the recognition of continuous user movement during scanning. This allows for the recognition of more QR codes even after the user moves the camera, significantly improving recognition coverage. Simultaneously, by introducing a stability condition as a basis for early termination, the application intelligently understands the user's intention to stop moving the camera and ends detection when the user stabilizes the camera, reducing unnecessary scanning time waste. Furthermore, by setting a maximum detection duration as a termination guarantee mechanism, a clear time limit is set for the entire scanning process, preventing indefinite scanning due to the inability to meet stability conditions. This ensures controllable system resource consumption and achieves a balance between recognition efficiency and resource consumption.
[0040] In some embodiments, the QR code recognition method may further include the following steps: within a dynamic detection time window, if the number of valid QR codes detected for N consecutive frames of images is the same, then it is determined that the continuous detection result meets the stability condition.
[0041] Where N is a positive integer.
[0042] A series of N consecutive frames refers to a sequence of image frames captured by a camera that are sequentially linked in time.
[0043] Having the same number of valid QR codes means that the number of QR codes successfully detected in each of N consecutive frames remains consistent. This indicates that the user's movement of the camera gradually slows down and eventually stops, and the number of QR codes that can be covered within the camera's field of view tends to be constant. Therefore, the fact that the number of valid QR codes detected in multiple consecutive frames is the case that the user has stopped moving the camera and the field of view has stabilized.
[0044] For example, suppose that at a certain moment, the number of QR codes detected for five consecutive frames (N=5) is three. This indicates that in this recent short period, the user's mobile phone's field of view has not changed significantly and can stably cover three QR codes. Based on this, the terminal determines that the current continuous detection result meets the stability condition and then terminates the detection process early.
[0045] If the user keeps moving the phone slowly, causing the number of QR codes detected in consecutive frames to fluctuate between 2, 3, and 2, the detection process will not terminate prematurely but will continue to detect until the maximum detection time is reached.
[0046] The value of N can be set according to the actual situation, and this application does not impose any restrictions on it.
[0047] By using the clear and quantifiable criterion of the number of valid QR codes in N consecutive frames, the terminal has objective data to support its judgment of whether the user stops moving, avoiding errors caused by subjective or vague judgments. Once the number stabilizes, scanning is immediately terminated, ensuring that more QR codes are recognized while minimizing the user's waiting time.
[0048] Furthermore, the judgment logic is simple to calculate, requiring only the counting and comparison of the detection results for each frame of the image. It does not require complex image analysis or motion calculation, thus requiring low processing resources from the terminal. This facilitates efficient and low-power operation, meeting the actual needs of mobile applications.
[0049] In some optional embodiments, the QR code recognition method may further include the following steps: within a dynamic detection time window, if the set of identifiers corresponding to valid QR codes detected for N consecutive frames of images is the same, then it is determined that the continuous detection result satisfies the stability condition.
[0050] Where N is a positive integer.
[0051] Typically, QR codes are encoded with unique identifiers used to distinguish different entities, such as URLs (Uniform Resource Locators) or IDs (Identities).
[0052] If the set of identifiers corresponding to the valid QR codes detected in N consecutive frames of images is completely consistent, it means that the QR codes contained in the N consecutive frames of images have not increased, decreased or changed. This means that the camera has been continuously and accurately pointing at the same set of QR codes, reflecting a very clear scanning intention for a specific area.
[0053] For example, a user scans a display board containing QR codes A, B, and C. When the user finally stabilizes the camera at an area containing only QR codes A and B, the terminal detects that the set of identifiers recognized for five consecutive frames (N=5) is {A,B}. At this point, it can be determined that the continuous detection results meet the stability condition, the scanning is terminated early, and the recognition results for A and B are output. Conversely, if the user slightly shakes the camera, causing the set of consecutive frames to switch between {A,B} and {A,C}, even if the number stabilizes at two, the scanning will not terminate early because the content of the sets is different.
[0054] By comparing the identity of the identifier set rather than the simple quantity, the interference caused by slight camera shaking, where different QR codes alternately enter the field of view (i.e., the quantity is the same but the content is different), can be effectively eliminated, thus improving the matching degree between the output results and the user's true intention.
[0055] In some embodiments, such as Figure 3 As shown, when the terminal performs step 202, it may include steps S2021 and S2022.
[0056] Step S2021: Perform QR code detection on the image frame corresponding to the current time, and record the timestamp of the corresponding image frame when a valid QR code is detected.
[0057] Step S2022: If the difference between the timestamp and the first detection time is less than the dynamic detection time window, then continue to perform QR code detection on the next image frame.
[0058] The timestamp of the corresponding image frame refers to the acquisition time of each frame in which a valid QR code was successfully detected. If the difference is less than the dynamic detection time window, it indicates that the scanning process is still within the range allowed by the dynamic detection time window, and subsequent frames will not be analyzed continuously, thus enabling the search for more QR codes without interruption.
[0059] For example, assuming the dynamic detection time window is 2 seconds, the terminal in T firstA valid QR code is first detected at time 0ms. The terminal then processes the next frame and detects another valid QR code at 150ms, recording the timestamp 150ms and calculating 150ms - 0ms = 150ms. Since 150ms is less than the dynamic detection time window, the terminal continues scanning subsequent image frames. At 300ms, the terminal may detect a new valid QR code, recording the timestamp 300ms. The difference of 300ms is still less than 2s, so scanning continues… This process repeats until the time difference reaches or exceeds 2s, or the continuous detection results meet the aforementioned stable condition.
[0060] By recording a timestamp for each image frame that detects a valid QR code and comparing it with the initial detection time, the entire scanning process is placed within a precise time management framework. This ensures that the terminal can continue to work within the preset time range, providing a time guarantee for multi-code recognition. As long as the user continues to move the camera within the time window, the system will not stop scanning, directly overcoming the deficiency of existing technologies that terminate upon recognition.
[0061] In some embodiments, the QR code recognition method may further include the following steps: if the difference between the timestamp and the first detection time is greater than the critical detection threshold and less than the maximum detection duration, then in each subsequent detection, it is determined whether the continuous detection result meets the stability condition.
[0062] The critical detection threshold is a preset time point within the dynamic detection time window, which is later than the initial detection time but earlier than the maximum detection duration. The critical detection threshold divides the relatively long dynamic detection time window into two stages with different behavioral logics: in the mobile scanning stage before the critical detection threshold, the terminal mainly performs valid QR code detection; in the stage between the critical detection threshold and the maximum detection duration, the terminal continues to detect valid QR codes while initiating stability judgment.
[0063] Each subsequent detection refers to the period between entering the critical detection threshold and the maximum detection time. After the terminal processes each frame of an image containing a valid QR code, it will perform a stability condition evaluation.
[0064] For example, a dynamic detection time window of 2 seconds and a critical detection threshold of 1 second are set. The terminal first detects a valid QR code at 0 seconds. From 0 seconds to 1 second, the system is in a moving scanning state, focusing on quickly capturing and detecting QR codes in the field of view. When the time reaches 1 second (i.e., the difference is greater than the critical detection threshold), and it is still within the maximum detection time of 2 seconds, the terminal immediately performs a stability judgment (such as checking whether the continuous detection results of N consecutive frames meet the stability condition) for each image frame that detects a valid QR code (e.g., frames at 1.1 seconds, 1.2 seconds, 1.3 seconds, etc.). Once the condition is met in a certain judgment, the scanning is terminated immediately.
[0065] By introducing a critical detection threshold, the scanning process is refined into two targeted stages: mobile scanning and stability decision-making. This clarifies that the terminal does not perform costly stability checks throughout the entire scanning process, but only activates the mechanism during the final critical time period, achieving a balance between scanning functionality and computational resource consumption.
[0066] In some embodiments, the maximum detection duration is the total duration of the dynamic detection time window.
[0067] Maximum detection time refers to the maximum allowed scanning time from the first recognition of a valid QR code. This parameter ensures that the scanning process ends within a controllable time, regardless of user behavior, avoiding potential indefinite scanning due to failure to meet early termination conditions.
[0068] The total duration of the dynamic detection time window refers to the complete time span from the first detection time to the end of the dynamic detection time window.
[0069] Assuming the dynamic detection time window is preset to 2 seconds, the maximum detection duration is also set to 2 seconds. Starting from the moment a valid QR code is first detected, the terminal enters a dynamic detection period of 2 seconds. During this period, the terminal will attempt to terminate the detection early through stability checks. Regardless of whether it terminates early, once 2 seconds have elapsed since the first detection, the terminal will unconditionally terminate the scanning process. This is the end time of the dynamic detection time window, which is also the time when the maximum detection duration is reached.
[0070] By defining the maximum detection duration as the total duration of the dynamic detection time window, the time management logic of the entire method becomes highly unified and simplified. The terminal only needs to manage one core time parameter (such as 2 seconds) to simultaneously define the duration of dynamic detection and the trigger point for forced termination, reducing the complexity of the system and the difficulty of parameter configuration.
[0071] The following specific embodiment will be used to further illustrate the QR code recognition method provided in this application in detail.
[0072] Users scan a wall with multiple QR codes affixed to it using their mobile phones. Once the phone's camera is on, at time T... first The system detected a valid QR code 'a' for the first time. The system recorded T. first The system initiates a dynamic detection window with a preset duration of 2 seconds. During this window, the system continues detection: as the phone's camera moves, valid QR codes b and c are detected successively. At the 1.5-second mark, the user points the phone's camera at the area containing QR codes a, b, and c and keeps it stable. The system determines that the set of QR codes recognized up to 5 consecutive frames is {a, b, c}, satisfying the preset stability condition. Therefore, the system immediately terminates the scanning process early and outputs the set {a, b, c} as the recognition result to the user. If the user continues to move the phone rapidly, causing the system to fail to reach the stability condition, the system will terminate the scan at time T. first The process is forcibly terminated at the 2nd second (when the maximum detection time is reached), and all QR code results that can be recognized at that moment are output.
[0073] In the above process, once the system records the first detection time, it indicates that the user has begun to capture a valid target. At this point, maintaining the detection state instead of terminating it immediately can effectively avoid the problem of interrupting the scan due to a single successful identification.
[0074] By setting a dynamic detection time window and continuously performing QR code detection within that window, the system can accurately perceive the user's moving camera behavior. When the user continues to move the camera, the system does not immediately terminate upon the first recognition but maintains the detection state, demonstrating an understanding of the user's intention to continuously scan.
[0075] Achieving a stable condition means that the user's movement speed has slowed down to a certain level, and the camera's field of view has stabilized. At this point, the system terminates prematurely, avoiding unnecessary continuous detection while ensuring that the recognition result is output promptly after the user stops moving. This design allows the system to accurately capture the user's intention to scan the target area.
[0076] By setting a maximum detection duration and outputting the current result when that duration is reached, it ensures that as many QR codes as possible are recognized within a limited time. This feature works in conjunction with a dynamic detection time window to ensure that multiple QR codes can be continuously captured during rapid user movement, while avoiding resource waste through time constraints, thus achieving the technical effect of recognizing more QR codes in a shorter time.
[0077] It should be understood that, although Figure 2 and Figure 3The steps in the flowchart are shown sequentially according to the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Figure 2 and Figure 3 Unless otherwise expressly stated herein, the steps illustrated and other steps involved in the embodiments are not subject to strict order restrictions and may be performed in other orders. Furthermore, at least some steps in the foregoing embodiments may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but may be performed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but may be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.
[0078] In a second aspect, embodiments of this application provide a QR code recognition device, such as... Figure 4 As shown, the QR code recognition device 400 includes: a storage module 401, a detection module 402, and a processing module 403.
[0079] Storage module 401 is used to record the first detection time of the first valid QR code detected; The detection module 402 is used to continuously detect QR codes within a preset dynamic detection time window, based on the initial detection time. The processing module 403 is used to terminate the detection early and output the QR code recognition result set at the termination time if the continuous detection result meets the preset stability conditions; otherwise, it outputs the current QR code recognition result set when the maximum detection time is reached.
[0080] In some embodiments, the QR code recognition device 400 may include: The first judgment module (not shown) is used to determine that the continuous detection result meets the stability condition if the number of valid QR codes detected for N consecutive frames of images is the same within the dynamic detection time window; where N is a positive integer.
[0081] In some embodiments, the QR code recognition device 400 may include: The second judgment module (not shown) is used to determine that the continuous detection result satisfies the stability condition if the set of identifiers corresponding to the valid QR codes detected for N consecutive frames of images is the same within the dynamic detection time window; where N is a positive integer.
[0082] In some embodiments, the detection module 402 may include: The recording unit (not shown) is used to detect QR codes on the image frame corresponding to the current time, and record the timestamp of the corresponding image frame when a valid QR code is detected. The detection unit (not shown) is used to continue QR code detection on the next image frame if the difference between the timestamp and the first detection time is less than the dynamic detection time window.
[0083] In some embodiments, the QR code recognition device 400 may include: The trigger module (not shown) is used to determine whether the continuous detection result meets the stability condition in each subsequent detection if the difference between the timestamp and the first detection time is greater than the critical detection threshold and less than the maximum detection duration.
[0084] In some embodiments, the QR code recognition result set at the termination time and the current QR code recognition result set are the recognition results of multiple valid QR codes contained in the image frame at the corresponding time.
[0085] In some embodiments, the maximum detection duration is the total duration of the dynamic detection time window.
[0086] For further specific limitations regarding the QR code recognition device, please refer to the limitations of the QR code recognition method above. The QR code recognition device can also be used to perform more steps of the QR code recognition method in the embodiments of this application, which will not be repeated here. Each module in the above-described QR code recognition device can be implemented entirely or partially through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0087] In a third aspect, embodiments of this application provide a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the QR code recognition method provided in any embodiment of the first aspect of this application.
[0088] In some embodiments, the computer device may be a terminal, and its internal structure diagram may be as follows: Figure 4As shown. The computer device includes a processor, memory, network interface, display screen, and input device connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements the QR code recognition method in any embodiment of this document. The display screen can be a liquid crystal display or an e-ink display. The input device can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse, etc.
[0089] Those skilled in the art will understand that Figure 4 The structures shown are merely block diagrams of some structures related to the embodiments of this application and do not constitute a limitation on the computer devices on which the embodiments of this application are applied. Specific computer devices may include more or fewer components than those shown in the figures, or combine certain components, or have different component arrangements.
[0090] In a fourth aspect, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the QR code recognition method provided in any embodiment of the first aspect of this application.
[0091] The computer-readable storage medium may be Figure 4 The computer-readable storage medium in the computer device shown.
[0092] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The aforementioned computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments of this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0093] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0094] The above embodiments merely illustrate several implementation methods of this application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of protection of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the appended claims.
Claims
1. A QR code recognition method, characterized in that, The method includes: Record the first detection time when a valid QR code is first detected; Based on the initial detection time, QR code detection is continuously performed within a preset dynamic detection time window; If the continuous detection results meet the preset stability conditions, the detection will be terminated in advance, and the QR code recognition result set at the termination time will be output; otherwise, when the maximum detection time is reached, the current QR code recognition result set will be output.
2. The method according to claim 1, characterized in that, Also includes: Within the dynamic detection time window, if the number of valid QR codes detected for N consecutive frames of images is the same, then the continuous detection result is determined to meet the stability condition; where N is a positive integer.
3. The method according to claim 1, characterized in that, Also includes: Within the dynamic detection time window, if the set of identifiers corresponding to the valid QR codes detected for N consecutive frames of images is the same, then the continuous detection result is determined to satisfy the stability condition; where N is a positive integer.
4. The method according to claim 1, characterized in that, The step of continuously detecting QR codes within a preset dynamic detection time window includes: Perform QR code detection on the image frame corresponding to the current moment, and record the timestamp of the corresponding image frame when a valid QR code is detected; If the difference between the timestamp and the first detection time is less than the dynamic detection time window, then QR code detection continues on the next image frame.
5. The method according to claim 4, characterized in that, Also includes: If the difference between the timestamp and the first detection time is greater than the critical detection threshold and less than the maximum detection duration, then in each subsequent detection, it is determined whether the continuous detection result meets the stability condition.
6. The method according to claim 1, characterized in that, Also includes: The QR code recognition result set at the termination time and the current QR code recognition result set are the recognition results of multiple valid QR codes contained in the image frame at the corresponding time.
7. The method according to any one of claims 1 to 6, characterized in that, Also includes: The maximum detection duration is the total duration of the dynamic detection time window.
8. A QR code recognition device, characterized in that, The device includes: The storage module is used to record the first detection time of the first valid QR code detected. The detection module is used to continuously detect QR codes within a preset dynamic detection time window, based on the initial detection time. The processing module is used to terminate the detection early and output the QR code recognition result set at the termination time if the continuous detection results meet the preset stability conditions; otherwise, it outputs the current QR code recognition result set when the maximum detection time is reached.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.