Method for zooming in QR code, and electronic device
By dynamically calculating and adjusting the amplification factor of QR codes in electronic devices, the problem of slow and inaccurate recognition when scanning small QR codes is solved, achieving a more efficient scanning process and lower power consumption.
Patent Information
- Application Number
- PCT/CN2023/134074
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-27
- Filing Date
- 2023-11-24
- Publication Date
- 2024-09-06
AI Technical Summary
When scanning smaller QR codes, existing technology is difficult to effectively enlarge the QR code, resulting in slow and inaccurate recognition.
Collect images through electronic devices, calculate the amplification factor of the QR code, and dynamically adjust the magnification to improve the scanning speed and accuracy. If the recognition fails, multiple amplification factors are integrated to improve the recognition success rate and reduce power consumption.
It improves the scanning rate and accuracy of QR codes, reduces power consumption, and ensures the recognition success rate in different time periods.
Smart Images

Figure CN2023134074_06092024_PF_FP
Abstract
Description
Method and electronic device for magnifying QR code
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 27, 2023, with application number 202310227006.1 and invention name “A method and electronic device for enlarging a QR code”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present application relate to the field of terminal technology, and in particular to a method for magnifying a QR code and an electronic device. Background Art
[0003] A QR code (quick response code, QR code) is a black and white graphic that records data and information, using specific geometric shapes arranged in a regular pattern on a two-dimensional plane. Currently, due to its efficiency and speed, QR codes are an important means of information transmission in the mobile internet era and are widely used in various scenarios. For example, users use electronic devices to scan QR codes for mobile payments.
[0004] However, for smaller QR codes, the QR code needs to be magnified before it can be recognized during the scanning process.
[0005] Summary of the Invention
[0006] The present application provides a method and electronic device for magnifying a QR code, which can improve the speed and accuracy of code scanning.
[0007] The embodiments of this application adopt the following technical solutions:
[0008] In a first aspect, a method for magnifying a QR code is provided. The method is applied to an electronic device, the electronic device including a first application that provides a QR code scanning function. The method comprises: in response to a user initiating the QR code scanning function of the first application, the electronic device capturing an image; the electronic device acquiring the captured first image; the first image including a first QR code; the electronic device recognizing the first QR code and calculating a first target magnification factor based on the first image; the electronic device capturing a second image based on the first target magnification factor; the second image including a second QR code, the proportion of the second QR code in the second image being greater than the proportion of the first QR code in the first image. If the electronic device fails to recognize the second QR code within a first time period, the electronic device capturing the captured second image and calculating a second target magnification factor based on the second image; the electronic device calculating a fourth target magnification factor based on the second target magnification factor and a third target magnification factor provided by the first application; the electronic device capturing a third image based on the fourth target magnification factor; the third image including a third QR code, the proportion of the third QR code in the third image being greater than the proportion of the second QR code in the second image.
[0009] Based on the first aspect, the electronic device first calculates a first target magnification factor using the first image, and then captures an image based on the first target magnification factor. That is, during the subsequent image capture process, the QR code is magnified based on the first target magnification factor, thereby improving the scanning rate and accuracy. Furthermore, if the electronic device does not recognize the QR code within the first time period, that is, the recognition fails, the electronic device calculates a second target magnification factor based on the second image, and then calculates a fourth target magnification factor based on the second target magnification factor and the third target magnification factor provided by the first application. That is, during the subsequent image capture process, the QR code is magnified based on the fourth target magnification factor, thereby further improving the scanning rate.
[0010] That is, using the solution of this application, the QR code is magnified based on the magnification factor calculated by the electronic device during a first time period. If the electronic device fails to recognize the code, the magnification factor calculated by the electronic device and the magnification factor increased by the first application are combined during a second time period, and the QR code is magnified using the combined magnification factor.
[0011] In an implementation of the first aspect, the method further includes: the electronic device fails to recognize the third QR code within the second time period, and the electronic device captures a fourth image according to a third target magnification factor; wherein the fourth image includes a fourth QR code, and the proportion of the fourth QR code in the fourth image is greater than the proportion of the third QR code in the third image.
[0012] In this implementation, if the electronic device does not recognize the QR code within the second time period, the electronic device captures the image according to the third target magnification factor, that is, in the subsequent image capture process, it stops calculating the magnification factor and enlarges the QR code based on the magnification factor provided by the first application to achieve the purpose of reducing power consumption.
[0013] In an implementation of the first aspect, the method also includes: in response to the user starting the function of scanning the QR code of the first application, the electronic device starts timing; when the timing duration exceeds a first threshold, the first time period ends and enters the second time period; when the timing duration exceeds a second threshold, the second time period ends.
[0014] In this implementation, the first time period may be 0 to 5 seconds, and the second time period may be 5 to 10 seconds, that is, the first threshold is equal to 5, and the second threshold is equal to 10. It can be seen that in this application, the electronic device first uses the calculated magnification factor to amplify the QR code in the first time period; and uses the fused magnification factor to amplify the QR code in the second time period.
[0015] In an implementation of the first aspect, calculating a first target magnification coefficient based on a first image includes: an electronic device obtaining first position data of a first two-dimensional code and second position data of the first image; the electronic device determining a target distance between a circumscribed rectangle of the first two-dimensional code and an edge of the first image based on the first position data and the second position data; the electronic device determining a first area of a circumscribed rectangle of the first two-dimensional code and a second area of the first image based on the first position data and the second position data; and the electronic device calculating the first target magnification coefficient based on the target distance, the second position data, the first area, and the second area.
[0016] In this implementation, the first position data includes the pixel coordinates of two diagonal vertices within the bounding rectangle of the QR code; the second position data includes the pixel coordinates of two diagonal vertices within the first image. In this application, pixel coordinates refer to coordinates in a first pixel coordinate system, which is a coordinate system established by the electronic device based on the vertices of the first image.
[0017] In an implementation of the first aspect, the electronic device calculates a first target magnification coefficient based on the target distance, the second position data, the first area, and the second area, including: the electronic device calculates the first magnification coefficient according to the target distance and the second position data; the electronic device calculates the second magnification coefficient according to the first area and the second area; the electronic device selects the minimum coefficient of the first magnification coefficient and the second magnification coefficient as the first target magnification coefficient.
[0018] In this implementation, the first amplification coefficient may be the amplification coefficient A1 of the present application, and the second amplification coefficient may be the amplification coefficient A2 of the present application.
[0019] In an implementation of the first aspect, the electronic device calculates a first target magnification coefficient based on the target distance, the second position data, the first area, and the second area, including: the electronic device calculates the first magnification coefficient according to the target distance and the second position data; the electronic device calculates the second magnification coefficient according to the first area and the second area; the electronic device selects the minimum coefficient of the first magnification coefficient and the second magnification coefficient as the third magnification coefficient; the electronic device obtains a fourth magnification coefficient and selects the maximum coefficient of the third magnification coefficient and the fourth magnification coefficient as the first magnification coefficient; wherein the fourth magnification coefficient is used to indicate the magnification coefficient used by the electronic device when it last captured an image.
[0020] In this implementation, the fourth magnification coefficient may be a magnification coefficient previously calculated by the mobile phone; or a magnification coefficient currently calculated by the mobile phone.
[0021] In an implementation of the first aspect, the target distance includes a first target distance and a second target distance, and the electronic device determines the target distance between the circumscribed rectangle of the first two-dimensional code and the edge of the first image based on the first position data and the second position data, including: the electronic device calculates a first distance from the left edge of the circumscribed rectangle of the first two-dimensional code to the left edge of the first image in the first direction, and a second distance from the right edge of the circumscribed rectangle of the first two-dimensional code to the right edge of the first image, and takes the maximum distance between the first distance and the second distance as the first target distance; the electronic device calculates a third distance from the upper edge of the circumscribed rectangle of the first two-dimensional code to the upper edge of the first image in the second direction, and a fourth distance from the lower edge of the circumscribed rectangle of the first two-dimensional code to the lower edge of the first image, and takes the larger distance between the third distance and the fourth distance as the second target distance; wherein, the first direction is perpendicular to the second direction.
[0022] In this implementation, the first distance may be w1, the second distance may be w2; the first target distance may be W in this application. max = w2. The third distance can be h1, the fourth distance can be h2, and the second target distance can be H in this application. max =h2.
[0023] In an implementation of the first aspect, the electronic device calculates a first magnification factor based on the target distance and the second position data, including: the electronic device calculates a first ratio between the first target distance and a length of the first image in a first direction, and a second ratio between the second target distance and a length of the first image in a second direction; and the electronic device uses the minimum value between the first ratio and the second ratio as the first magnification factor.
[0024] In a second aspect, an electronic device is provided that has the functionality to implement the method described in the first aspect. This functionality can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the functionality described above.
[0025] In a third aspect, an electronic device is provided, comprising a first application that provides a function of scanning a QR code. The electronic device comprises: a display screen, a memory, and one or more processors; the display screen is configured to display an image captured by a camera or an image generated by the processor; the memory stores computer program code, the computer program code comprising computer instructions that, when executed by the processor, cause the electronic device to perform the following steps: in response to a user initiating the function of scanning a QR code in the first application, the electronic device captures an image; the electronic device acquires a captured first image; the first image includes a first QR code; the electronic device recognizes the first QR code and calculates a first target magnification factor based on the first image; the electronic device captures a second image based on the first target magnification factor; the second image includes a second QR code, the proportion of the second QR code in the second image being greater than the proportion of the first QR code in the first image. If the electronic device fails to recognize the second QR code within a first time period, the electronic device acquires the captured second image and calculates a second target magnification factor based on the second image; the electronic device calculates a fourth target magnification factor based on the second target magnification factor and a third target magnification factor provided by the first application; the electronic device captures a third image based on the fourth target magnification factor; the third image includes a third QR code, the proportion of the third QR code in the third image being greater than the proportion of the second QR code in the second image.
[0026] In one implementation of the third aspect, when the computer instructions are executed by the processor, the electronic device further performs the following steps: the electronic device fails to recognize the third QR code within the second time period, and the electronic device captures a fourth image based on a third target magnification factor; wherein the fourth image includes a fourth QR code, and the proportion of the fourth QR code in the fourth image is greater than the proportion of the third QR code in the third image.
[0027] In one implementation of the third aspect, when the computer instructions are executed by the processor, the electronic device also performs the following steps: in response to the user starting the first application to scan the QR code function, the electronic device starts timing; when the timing duration exceeds a first threshold, the first time period ends and enters the second time period; when the timing duration exceeds a second threshold, the second time period ends.
[0028] In an implementation of the third aspect, when the computer instructions are executed by the processor, the electronic device specifically performs the following steps: the electronic device obtains the first position data of the first two-dimensional code and the second position data of the first image; the electronic device determines the target distance between the circumscribed rectangle of the first two-dimensional code and the edge of the first image based on the first position data and the second position data; the electronic device determines the first area of the circumscribed rectangle of the first two-dimensional code and the second area of the first image based on the first position data and the second position data; the electronic device calculates the first target magnification factor based on the target distance, the second position data, the first area and the second area.
[0029] In one implementation of the third aspect, when the computer instructions are executed by the processor, the electronic device specifically performs the following steps: the electronic device calculates a first magnification coefficient based on the target distance and the second position data; the electronic device calculates a second magnification coefficient based on the first area and the second area; the electronic device selects the minimum coefficient between the first magnification coefficient and the second magnification coefficient as the first target magnification coefficient.
[0030] In an implementation of the third aspect, when the computer instructions are executed by the processor, the electronic device specifically performs the following steps: the electronic device calculates a first magnification coefficient based on the target distance and the second position data; the electronic device calculates a second magnification coefficient based on the first area and the second area; the electronic device selects the minimum coefficient of the first magnification coefficient and the second magnification coefficient as the third magnification coefficient; the electronic device obtains a fourth magnification coefficient and selects the maximum coefficient of the third magnification coefficient and the fourth magnification coefficient as the first magnification coefficient; wherein the fourth magnification coefficient is used to indicate the magnification coefficient used by the electronic device when it last captured an image.
[0031] In an implementation of the third aspect, when the computer instructions are executed by the processor, the electronic device specifically performs the following steps: the electronic device calculates a first distance from the left edge of the circumscribed rectangle of the first two-dimensional code to the left edge of the first image in the first direction, and a second distance from the right edge of the circumscribed rectangle of the first two-dimensional code to the right edge of the first image, and uses the maximum distance between the first distance and the second distance as the first target distance; the electronic device calculates a third distance from the upper edge of the circumscribed rectangle of the first two-dimensional code to the upper edge of the first image in the second direction, and a fourth distance from the lower edge of the circumscribed rectangle of the first two-dimensional code to the lower edge of the first image, and uses the larger distance between the third distance and the fourth distance as the second target distance; wherein, the first direction is perpendicular to the second direction.
[0032] In one implementation of the third aspect, when the computer instructions are executed by a processor, the electronic device specifically performs the following steps: the electronic device calculates a first ratio between a first target distance and a length of the first image in a first direction, and a second ratio between a second target distance and a length of the first image in a second direction; and the electronic device uses the minimum value between the first ratio and the second ratio as a first magnification factor.
[0033] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on the computer, the computer can execute any one of the methods in the first aspect.
[0034] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any one of the methods described in the first aspect.
[0035] Among them, the technical effects brought about by any design method in the second to fifth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] FIG1 is a schematic diagram of an interface for scanning a QR code provided in an embodiment of the present application;
[0037] FIG2 is a schematic structural diagram of a mobile phone provided in an embodiment of the present application;
[0038] FIG3 is a schematic diagram of a software framework of a mobile phone provided in an embodiment of the present application;
[0039] FIG4 is a flow chart of a method for magnifying a QR code according to an embodiment of the present application;
[0040] FIG5 is a schematic diagram of calculating the amplification factor R in different time periods provided by an embodiment of the present application;
[0041] FIG6 is a second flow chart of a method for magnifying a QR code provided in an embodiment of the present application;
[0042] FIG7 is a schematic diagram of pixel coordinates of a QR code and an image in a pixel coordinate system provided by an embodiment of the present application;
[0043] FIG8 is a third flow chart of a method for magnifying a QR code according to an embodiment of the present application;
[0044] FIG9 is a fourth flow chart of a method for magnifying a QR code according to an embodiment of the present application;
[0045] FIG10 is a fifth flow chart of a method for magnifying a QR code provided in an embodiment of the present application;
[0046] FIG11 is a schematic diagram of another interface for scanning a QR code provided in an embodiment of the present application;
[0047] FIG12 is a sixth flow chart of a method for magnifying a QR code according to an embodiment of the present application;
[0048] FIG13 is a schematic structural diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to enable those skilled in the art to better understand the solutions of the embodiments of the present application, the technical solutions 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. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative efforts should fall within the scope of protection of this application.
[0050] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.
[0051] The embodiments of the present application are applicable to scenarios requiring QR code scanning. A scenario requiring QR code scanning may involve a user using a code scanning device to scan an existing QR code, such as scanning a QR code presented by a merchant when shopping. The code scanning device may be an electronic device such as a barcode scanner, a subway gate, or a mobile phone. This application does not specifically limit the type of code scanning device.
[0052] Taking a mobile phone as an example, the mobile phone includes an application for scanning a QR code. The user can open the application in the mobile phone to trigger the mobile phone to scan the QR code. Or other payment applications, etc.
[0053] For example, as shown in FIG1 (a), when a user scans a QR code with a mobile phone, the mobile phone can call Click "Scan" in the app, and the "Scan" interface is displayed for scanning the QR code. As shown in Figure 1 (b), if the size of the QR code scanned by the mobile phone is small, the mobile phone needs to enlarge the QR code during the scanning process to facilitate recognition of the QR code.
[0054] It can be understood that the "Scan" mentioned in the embodiment of the present application has the function of scanning QR codes. "Scan" can also have other names. The name "Scan" does not constitute a limitation on its function. It is explained here uniformly and will not be repeated below.
[0055] In some embodiments, if the mobile phone does not have the function of magnifying the QR code, the QR code cannot be magnified, resulting in difficulty in QR code recognition. In other embodiments, the mobile phone can call a corresponding application, such as The application uses a pre-set magnification factor to magnify the QR code. However, since the magnification factor pre-set by the application is a fixed value, there will be a problem of poor magnification effect (such as too large or too small) for QR codes of different sizes. For example, as shown in (c) in Figure 1, after the mobile phone uses the magnification factor pre-set by the application to magnify the QR code, the displayed QR code is still small, resulting in the mobile phone still not being able to recognize the QR code. In this case, the mobile phone will again use the magnification factor pre-set by the application to magnify the QR code until the mobile phone can recognize the QR code. In this way, it will take a long time for the mobile phone to recognize the QR code, resulting in slow QR code recognition.
[0056] In response to the above technical problems, the present application provides a method for magnifying a QR code. When an electronic device scans a QR code, the electronic device first captures a frame of image. Then, based on the position of the QR code and the position of the image, the electronic device can obtain a magnification factor corresponding to the QR code. Then, the electronic device magnifies the QR code based on the magnification factor. Because the magnification factor is calculated by the electronic device based on the position of the QR code and the position of the image in a frame of image captured in real time, the QR code can be magnified to an appropriate position in the image, thereby enhancing the speed and accuracy of code scanning.
[0057] Illustratively, an embodiment of the present application provides a method for magnifying a QR code, which can be applied to an electronic device that provides the function of scanning a QR code. The electronic device can be a mobile phone, a barcode scanner, a subway gate, a tablet computer, a smart watch, a desktop computer, a laptop computer, a handheld computer, a notebook computer, a vehicle-mounted device, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) or virtual reality (VR) device, etc. The embodiment of the present application does not impose any special restrictions on the specific form of the electronic device.
[0058] Taking the above-mentioned electronic device as a mobile phone as an example, please refer to Figure 2, which is a structural diagram of a mobile phone 100 provided in an embodiment of the present application. As shown in Figure 2, the mobile phone 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a positioning module 181, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195, etc.
[0059] It should be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the mobile phone 100. In other embodiments, the mobile phone 100 may include more or fewer components than shown, or may combine or separate certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0060] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0061] The controller can be the nerve center and command center of the mobile phone 100. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0062] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0063] In some embodiments, the processor 110 may include one or more interfaces. It should be understood that the interface connection relationships between the modules illustrated in this embodiment are merely illustrative and do not constitute a structural limitation on the mobile phone 100. In other embodiments, the mobile phone 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.
[0064] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. While charging the battery 142, the charging management module 140 can also power the electronic device through the power management module 141.
[0065] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to provide power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, and the wireless communication module 160.
[0066] The wireless communication function of the mobile phone 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0067] Mobile phone 100 implements display functionality through a GPU, display screen 194, and an application processor. The GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0068] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini-LED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc.
[0069] The mobile phone 100 can realize the shooting function through the ISP, camera 193, video codec, GPU, display 194 and application processor.
[0070] The ISP processes data fed back by camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and converted into a visible image. The ISP can also perform algorithmic optimization on image noise, brightness, and color. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 193.
[0071] The camera 193 is used to capture still images or videos. The object is captured through the lens and the optical image is projected 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 ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or other format.
[0072] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when an electronic device selects a frequency, the DSP performs a Fourier transform on the frequency energy.
[0073] Video codecs are used to compress or decompress digital video. Mobile phone 100 may support one or more video codecs. This allows the electronic device to play or record videos in a variety of encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.
[0074] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU enables intelligent cognitive applications in electronic devices, such as image recognition, face recognition, speech recognition, and text comprehension.
[0075] The mobile phone 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0076] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. The speaker 170A, also known as a "speaker," is used to convert audio electrical signals into sound signals. The receiver 170B, also known as a "handset," is used to convert audio electrical signals into sound signals. The microphone 170C, also known as a "microphone" or "microphone," is used to convert sound signals into electrical signals. The headphone jack 170D is used to connect wired headphones.
[0077] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, audio, video, and other files can be stored on the external memory card.
[0078] The internal memory 121 can be used to store computer executable program code, which includes instructions. The processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 121. For example, in an embodiment of the present application, the processor 110 can execute instructions stored in the internal memory 121, and the internal memory 121 can include a program storage area and a data storage area.
[0079] The program storage area may store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 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, a universal flash storage (UFS), etc.
[0080] Buttons 190 include a power button and volume buttons. Motor 191 can be used for incoming call vibration alerts and touch vibration feedback. Indicator 192 can be an indicator light that can be used to indicate charging status, power level changes, messages, missed calls, notifications, etc.
[0081] SIM card interface 195 is used to connect a SIM card. A SIM card can be connected to and disconnected from the electronic device by inserting or removing it from SIM card interface 195. An electronic device may support one or N SIM card interfaces, where N is a positive integer greater than 1. SIM card interface 195 can support Nano SIM cards, Micro SIM cards, and SIM cards.
[0082] The methods in the following embodiments can all be implemented in an electronic device having the above hardware structure. In the following embodiments, the electronic device is taken as a mobile phone 100 as an example to introduce the methods of the embodiments of the present application.
[0083] FIG3 is a software block diagram of the mobile phone 100 according to an embodiment of the present application.
[0084] The software system of the mobile phone 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture or a cloud architecture. Taking the system as an example, the software structure of the mobile phone 100 is exemplarily described.
[0085] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, The system is divided from top to bottom into: application layer, application framework layer, hardware abstraction layer (HAL) and driver layer. For example, in other operating systems (such as system, etc.), as long as the functions implemented by each functional module are similar to those of the embodiments of the present application, the solution of the present application can also be implemented.
[0086] The application layer can include a series of application packages.
[0087] As shown in FIG3 , the application layer may include applications such as camera, gallery, calendar, call, map, navigation, Bluetooth, music, video, and short message.
[0088] In the embodiment of the present application, an application with a QR code scanning function may be installed in the application layer, for example, When the user needs to scan the QR code, the phone can call or Click "Scan" in the app, and the "Scan" interface will be displayed for scanning the QR code.
[0089] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0090] As shown in FIG3 , the application framework layer may include a window manager, a content provider, a view system, a resource manager, a notification manager, etc., and the embodiments of the present application do not impose any restrictions on this.
[0091] For example, the window manager is used to manage windowed applications. It can obtain the display size, determine whether a status bar exists, lock the screen, take screenshots, and more. The content provider is used to store and retrieve data and make it accessible to applications. This data can include video, images, audio, incoming and outgoing calls, browsing history and bookmarks, and a phone book. The view system can be used to construct the application's display interface. Each display interface can be composed of one or more controls. Generally speaking, controls can include icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, and other interface elements. The resource manager provides applications with various resources, such as localized strings, icons, images, layout files, and video files. The notification manager enables applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically, requiring no user interaction. For example, the notification manager is used to notify users of download completions and message reminders. The notification manager can also display notifications in the system's top status bar in the form of icons or scrolling text, such as notifications from background applications, or in the form of dialog windows. For example, a text message may be displayed in the status bar, a prompt sound may be emitted, the indicator light may flash, etc.
[0092] The Hardware Abstraction Layer (HAL) is an interface layer between the kernel and the hardware that abstracts the hardware. In some embodiments, the HAL includes a Hardware Abstraction Layer Interface Definition Language (HIDL) interface. The HAL may include a Camera HAL, an Audio HAL, a Wi-Fi HAL, and so on.
[0093] The driver layer is located below the hardware abstraction layer and is the layer between hardware and software. The driver layer includes at least display driver, camera driver, audio driver, sensor driver, etc., which are not limited in this embodiment of the application.
[0094] The embodiment of the present application introduces the working principle of the method of implementing the embodiment of the present application in each software layer in the mobile phone in conjunction with Figure 3.
[0095] In the embodiment of the present application, as shown in FIG3 , For example, a camera service may be provided in the application framework layer. Apps can start the Camera Service by calling a pre-defined API. During operation, the Camera Service interacts with the Camera HAL within the Hardware Abstraction Layer (HAL). The Camera HAL is responsible for interacting with the phone's hardware devices (such as the camera) that implement the QR code scanning function. While hiding the implementation details of the relevant hardware devices (such as the specific magnification algorithm), the Camera HAL provides the Android system with an interface for accessing the relevant hardware devices.
[0096] For example, when When the app starts scanning QR codes, Applications can send relevant control commands (such as scan commands or scan flags) to the Camera Service. The Camera Service can then send the received control commands to the Camera HAL, which then calls the camera driver in the driver layer based on the received control commands. The camera driver then drives the camera and other hardware devices to capture images in response to the control commands. For example, the camera can pass the captured images to the Camera HAL via the camera driver at a certain frame rate. The process of transmitting control commands within the operating system can be seen in the specific transmission process of the scan command in Figure 3.
[0097] Among them, the multiple frames of images passed by the camera driver to the Camera HAL based on the code scanning command can form a preview stream, and the Camera HAL can obtain the detection stream after processing the preview stream. Among them, the preview stream is used to display on the code scanning interface. For example, the Camera HAL reports the preview stream to application, After the application receives the preview stream, it displays the preview stream on the QR code scanning interface.
[0098] The detection stream is used to calculate the magnification factor of the image captured by the camera. For example, on the one hand, the Camera HAL uses the image in the detection stream to calculate the magnification factor (or magnification factor A, where the specific calculation process of the magnification factor A can refer to the description of the corresponding content in the subsequent embodiments). On the other hand, the Camera HAL can report the detection stream to the Camera Service through the Camera Service. application, After receiving the detection stream, the application identifies the QR code of the image in the detection stream and sends the preset magnification factor (or magnification factor B) to the Camera HAL through the Camera Service.
[0099] It should be noted that the above preset magnification factor can be The application is based on real-time calculation of images collected by the camera, or it can be A pre-set fixed coefficient is applied, and this embodiment of the present application does not limit this.
[0100] Furthermore, the Camera HAL sends the calculated magnification factor A and / or the obtained magnification factor B to the camera driver, which drives the camera to continue capturing images according to the magnification factor A and / or the magnification factor B, and amplifies the QR code in the subsequently captured image.
[0101] Exemplarily, the camera driver may use optical zoom to amplify the QR code in the subsequently collected image. Alternatively, the camera driver may also use digital zoom to amplify the QR code in the subsequently collected image. Optical zoom refers to the camera driver driving the motor in the camera to move according to the magnification factor A and / or the magnification factor B to change the distance between the lens in the camera and the image (i.e., the focal length), thereby amplifying the QR code in the subsequently collected image. Digital zoom refers to the camera driver changing the resolution of the QR code in the image, increasing the area of each pixel of the QR code in the image, so that the area of the QR code becomes larger in the image, thereby achieving the effect of amplifying the QR code.
[0102] It is understandable that the multiple frames of images captured by the camera driver according to the magnification factor A and / or the magnification factor B can form a new preview stream; wherein the QR code of the image in the new preview stream is magnified. Subsequently, the camera driver reports the new preview stream to application, After the application receives the preview stream, it displays the new preview stream on the code scanning interface for easy The app recognizes the QR code.
[0103] In some embodiments, as shown in FIG4 in conjunction with FIG3, after the Camera HAL receives the preview stream reported by the camera driver, it processes the preview stream to obtain a detection stream. Then, the Camera HAL calculates the amplification factor A based on the detection stream; on the other hand, the Camera HAL The application obtains the magnification factor B. Subsequently, the Camera HAL transmits the magnification factors A and B to the intelligent decision-making algorithm, which calculates the final magnification factor R based on the magnification factors A and / or B. Furthermore, the Camera HAL transmits the magnification factor R to the camera driver, which drives the camera to capture an image based on the magnification factor R and amplifies the QR code in the captured image.
[0104] It should be understood that in the embodiment of the present application, the Camera HAL can transmit the magnification factor A and the magnification factor B to the intelligent decision-making algorithm, and the intelligent decision-making algorithm can obtain the final magnification factor R based on the magnification factor A and the magnification factor B. The intelligent decision-making algorithm can be set at any layer in the mobile phone software system, such as the intelligent decision-making algorithm can be set in the Camera HAL in the hardware abstraction layer; or the intelligent decision-making algorithm can be set in the Camera Service in the application framework layer. The embodiment of the present application does not impose specific restrictions on this.
[0105] Exemplarily, the intelligent decision algorithm may determine different magnification factors R based on the scan time. For example, if the scan time is within a first time period, the intelligent decision algorithm blocks magnification factor B and uses magnification factor A as magnification factor R. Correspondingly, if the scan time is within a second time period, the intelligent decision algorithm uses a fusion strategy to fuse magnification factor A and magnification factor B to obtain magnification factor R. Correspondingly, if the scan time is within a third time period, the intelligent decision algorithm blocks magnification factor A and uses magnification factor B as magnification factor R.
[0106] Among them, the first time period is less than or equal to the first threshold, the second time period is greater than the first threshold and less than or equal to the second threshold, and the third time period is greater than the second threshold. It should be noted that this application does not specifically limit the first threshold and the second threshold, and the actual setting shall prevail. Taking the first threshold as 5s and the second threshold as 10s as an example, the first time period can be: T1≤5s; the second time period can be: 5s<T2≤10s; the third time period can be: T3>10s.
[0107] For example, the corresponding relationship between the intelligent decision algorithm and the output magnification coefficient R according to the scanning time can be shown in the following Table 1:
[0108] Table 1
[0109] It should be noted that Table 1 above is only an example in the embodiment of the present application and does not constitute a limitation of the present application. In the embodiment of the present application, the processing flow of the intelligent decision algorithm outputting the amplification factor R according to the scanning time can be referred to the detailed description in the following embodiment and will not be repeated here.
[0110] In some embodiments, when the Camera HAL receives a scan command, it can trigger the phone to start a timer. If the timer does not exceed a first duration, the intelligent decision-making algorithm outputs a magnification factor of R = A. If the timer exceeds the first duration, the intelligent decision-making algorithm outputs a magnification factor of R = (A + B) / 2. If the timer exceeds a second duration, the intelligent decision-making algorithm outputs a magnification factor of R = B. For example, the first duration of the timer can be set to 5 seconds, and the second duration can be set to 10 seconds.
[0111] It is understood that the detection stream includes multiple frames of images captured by the camera. In some embodiments, the Camera HAL calculates an amplification factor A based on each frame of the image. In other embodiments, the Camera HAL calculates an amplification factor A every preset number of frames.
[0112] For example, the Camera HAL calculates a magnification factor A for each frame. For example, the Camera HAL passes the magnification factor A calculated for each frame to the intelligent decision-making algorithm. However, to reduce power consumption, in some embodiments, the Camera HAL may pass the magnification factor A to the intelligent decision-making algorithm every preset number of frames. It should be noted that this application does not impose a specific limit on the preset number of frames, which is subject to the actual setting. For example, the preset number of frames may be 20 frames.
[0113] Taking the example of Camera HAL transmitting the amplification factor A to the intelligent decision-making algorithm every 20 frames, for example, assuming that the camera captures 30 frames of images per second, then in the first time period (i.e., T1≤5s), the camera captures at most images from the 1st frame to the 150th frame; in the second time period (i.e., 5<T2≤10s), the camera captures at most images from the 151st frame to the 300th frame; in the third time period (T3>10s), the camera captures at most images after the 301st frame.
[0114] On this basis, as shown in Figure 5, during the first time period, after the camera captures the first frame, the Camera HAL calculates the magnification factor A1 based on the detection stream of the first frame and passes this magnification factor A1 to the intelligent decision-making algorithm. Similarly, after the camera captures the 21st frame, the Camera HAL calculates the magnification factor A21 based on the detection stream of the 21st frame and passes this magnification factor A1 to the intelligent decision-making algorithm. This continues in this manner until the camera captures the 141st frame, at which point the Camera HAL calculates the magnification factor A141 based on the detection stream of the 141st frame and passes this magnification factor A141 to the intelligent decision-making algorithm.
[0115] Accordingly, during the first time period, each time the intelligent decision-making algorithm receives amplification factor A from the Camera HAL, the intelligent decision-making algorithm uses amplification factor A as amplification factor R and passes the amplification factor R to the preview stream to amplify the QR code in the preview stream. For example, after receiving amplification factor A1 from the Camera HAL, the intelligent decision-making algorithm uses the amplification factor A1 as amplification factor R. For another example, after receiving amplification factor A21 from the Camera HAL, the intelligent decision-making algorithm uses the amplification factor A21 as amplification factor R. For another example, after receiving amplification factor A141 from the Camera HAL, the intelligent decision-making algorithm uses the amplification factor A141 as amplification factor R.
[0116] It should be understood that the Camera HAL passes the calculated amplification factor A to the intelligent decision-making algorithm every 20 frames. During the first time period, the Camera HAL last passed amplification factor of A141 to the intelligent decision-making algorithm. Based on this, the Camera HAL next passes amplification factor of A161 to the intelligent decision-making algorithm.
[0117] However, since the magnification coefficient R determined by the intelligent decision-making algorithm in the second time period is R = (A + B) / 2, that is, the magnification coefficient A and the magnification coefficient B are merged to obtain the magnification coefficient R, which is different from the method of determining the magnification coefficient R in the first time period. Therefore, in some embodiments, in the second time period, the intelligent decision-making algorithm can determine the magnification coefficient R starting from the 151st frame, and pass the magnification coefficient R to the preview stream to amplify the QR code in the preview stream. Based on this, in an embodiment of the present application, in the second time period, when the intelligent decision-making algorithm determines the magnification coefficient R for the first time, the magnification coefficient A received for the last time can be used. Among them, the magnification coefficient A received for the last time is the magnification coefficient A141 passed by the Camera HAL to the intelligent decision-making algorithm for the last time in the first time period.
[0118] In other words, in the embodiment of the present application, during the second time period, the amplification factor first determined by the intelligent decision-making algorithm is R = (A141 + B) / 2.
[0119] Accordingly, during the second time period, after the camera captures the 161st frame, the Camera HAL calculates the amplification factor A161 based on the detection stream of the 161st frame and passes this amplification factor A161 to the intelligent decision-making algorithm. In other words, during the second time period, the intelligent decision-making algorithm first receives the amplification factor A161. Based on this, the intelligent decision-making algorithm then determines the amplification factor R = (A161 + B) / 2.
[0120] It should be noted that the magnification factor A used by the intelligent decision-making algorithm to determine the magnification factor R during the second time period can be referred to as the second target magnification factor. That is, the second target magnification factor is the magnification factor used by the mobile phone when magnifying the QR code every preset number of frames during the first time period. For example, the second target magnification factor can be the magnification factor used by the mobile phone the last time it magnified the QR code during the first time period, that is, the second target magnification factor can be the aforementioned magnification factor A141.
[0121] Still as shown in FIG5 , in the third time period, the amplification factor R=B determined by the intelligent decision algorithm, that is, the Camera HAL stops calculating the amplification factor A and does not need to transmit the amplification factor A to the intelligent decision algorithm.
[0122] The embodiment of the present application provides a method for magnifying a QR code, which can be applied to a mobile phone that can scan a QR code and includes a camera. As shown in FIG6 , the method may include S201 to S204.
[0123] S201: In response to a user starting a function of scanning a QR code, a mobile phone captures a first image frame through a camera.
[0124] For example, as shown in FIG1(a), in response to the user's operation of the "Scan" button, the mobile phone starts the function of scanning the QR code and captures a frame of the first image as shown in FIG1(b) through the camera.
[0125] Exemplarily, in conjunction with FIG3, in response to the user's The operation of the "Scan" button in the application, The application can send a scan command to the Camera Service. The Camera Service can then send the received scan command to the Camera HAL. The Camera HAL then calls the camera driver in the driver layer based on the received scan command. The camera driver then drives the camera and other hardware devices to capture an image in response to the scan command, i.e., capture a first frame of image. For example, the multiple frames of image captured by the camera can form the detection stream and preview stream shown in Figure 4 above.
[0126] S202: The mobile phone obtains first position data of the QR code in the first image and second position data of the first image. The first position data may include pixel coordinates of two vertices located on a diagonal line in a circumscribed rectangle of the QR code, and the second position data includes pixel coordinates of two vertices located on a diagonal line in the first image.
[0127] In this application, pixel coordinates refer to coordinates in a first pixel coordinate system, which is a coordinate system established by the mobile phone based on the vertices of the first image.
[0128] It should be noted that the bounding rectangle of a QR code refers to the maximum range of the QR code expressed in two-dimensional coordinates. This refers to a rectangle whose lower bounds are defined by the maximum horizontal coordinate, minimum horizontal coordinate, maximum vertical coordinate, and minimum vertical coordinate of each vertex within the given QR code shape. The bounding rectangle may also be called the minimum bounding rectangle, minimum bounding rectangle, minimum containing rectangle, or minimum enclosing rectangle.
[0129] In some embodiments, the mobile phone may use an artificial intelligence (AI) algorithm to obtain the first position data of the QR code in the first image and the second position data of the first image; alternatively, the mobile phone may use an image processing algorithm to obtain the first position data of the QR code in the first image and the second position data of the first image. This application does not specifically limit the method for obtaining the first position data and the second position data.
[0130] Please refer to Figure 7, which shows a first pixel coordinate system (u, v) established by the mobile phone based on the vertices of the first image. For example, as shown in Figure 7, the mobile phone can obtain the pixel coordinates of two vertices located on the diagonal in the circumscribed rectangle of the QR code in the first pixel coordinate system based on the established first pixel coordinate system (u, v), thereby obtaining the first position data of the QR code in the first image. Correspondingly, the mobile phone can also obtain the pixel coordinates of two vertices located on the diagonal in the first image in the first pixel coordinate system based on the established first pixel coordinate system (u, v), thereby obtaining the second position data of the first image.
[0131] It should be noted that the first position data of the QR code in the first image can be the pixel coordinates of two vertices on any diagonal line in the circumscribed rectangle of the QR code in the first pixel coordinate system; correspondingly, the second position data of the first image can be the pixel coordinates of two vertices on any diagonal line in the first image in the first pixel coordinate system, and the embodiments of the present application do not limit this.
[0132] For example, as shown in FIG7 , the pixel coordinates of two vertices located on a diagonal line in the circumscribed rectangle of the QR code in the first pixel coordinate system may be (1500, 200) and (300, 800), respectively. The pixel coordinates of two vertices located on a diagonal line in the first image in the first pixel coordinate system may be (2000, 0) and (0, 1500), respectively.
[0133] S203: The mobile phone calculates a first target magnification coefficient according to the first position data and the second position data.
[0134] For example, in S202, after receiving the detection stream, the mobile phone's Camera HAL obtains the first position data of the QR code in each frame of image (i.e., each first image frame) and the second position data of the first image frame. Based on this, in S203, for each first image frame, the mobile phone's Camera HAL calculates the first target magnification factor based on the first position data and the second position data corresponding to each first image frame.
[0135] The embodiment of the present application introduces a method for calculating a first target magnification coefficient from a frame of a first image. For example, as shown in FIG8 , S203 may specifically include S2031 - S2033.
[0136] S2031. The mobile phone calculates a first magnification factor according to the distance between the circumscribed rectangle of the QR code and the edge of the first image, and the length and width of the first image.
[0137] Exemplarily, the process of the mobile phone calculating the first amplification factor may include Sa-Sc.
[0138] Sa: The mobile phone calculates the distances between the four sides of the circumscribed rectangle of the QR code and the edge of the first image based on the first position data of the QR code in the first image and the second position data of the first image.
[0139] For example, the mobile phone can calculate a first distance (e.g., w1) from the left edge of the circumscribed rectangle of the QR code to the left edge of the first image in a first direction, and a second distance (e.g., w2) from the right edge of the circumscribed rectangle of the QR code to the right edge of the first image. Accordingly, the mobile phone can calculate a third distance (e.g., h1) from the upper edge of the circumscribed rectangle of the QR code to the upper edge of the first image in a second direction, and a fourth distance (e.g., h2) from the lower edge of the circumscribed rectangle of the QR code to the lower edge of the first image. The first direction is perpendicular to the second direction.
[0140] As shown in FIG7 , the first direction may be the u direction in the first pixel coordinate system, and the second direction may be the v direction in the first pixel coordinate system. Furthermore, in the embodiment of the present application, the orientation or positional relationship indicated by the left edge and right edge, upper edge and lower edge, etc., is based on the orientation or positional relationship shown in FIG7 , where the left edge and right edge are two opposite orientations in the first direction; and the upper edge and lower edge are two opposite orientations in the second direction.
[0141] For example, as shown in Figure 7, the first position data of the QR code in the first image indicates that the pixel coordinates of the two vertices located on the diagonal in the circumscribed rectangle of the QR code are (1500, 200) and (300, 800) in the first pixel coordinate system. The second position data of the first image indicates that the pixel coordinates of the two vertices located on the diagonal in the first image are (2000, 0) and (0, 1500) in the first pixel coordinate system. Based on the pixel coordinates shown in Figure 7, the mobile phone can obtain the distances between the four sides of the circumscribed rectangle of the QR code and the edge of the first image, respectively: w1=300, w2=500, h1=200, h2=500.
[0142] It can be understood that w1 and w2 are used to indicate the length distance between the circumscribed rectangle of the QR code and the edge of the first image, and h1 and h2 are used to indicate the width distance between the circumscribed rectangle of the QR code and the edge of the first image.
[0143] Sb: The phone selects the maximum value of the length distance and the maximum value of the width distance.
[0144] For example, the maximum value in the length distance can be expressed as follows: max =max(w1, w2); The maximum value in the width distance can be expressed as follows: H max=max(h1, h2). For example, based on w1, w2, h1 and h2 calculated in step Sa, it can be known that the maximum value W in the length distance max = w2, the maximum value H in the width distance max =h2.
[0145] Sc: The mobile phone calculates the ratio of the length of the first image to the maximum value of the length distance, and the ratio of the width of the first image to the maximum value of the width distance, and selects the minimum value of the ratio as the first magnification factor.
[0146] For example, based on the pixel coordinates of two vertices located on a diagonal line in the first image shown in FIG. 7 , the lengths of the first image can be obtained as W=2000 and H=1500.
[0147] For example, the first amplification factor can be expressed as follows: A1=min(W / W max , H / H max ); where W / W max Represents the ratio of the length of the first image to the maximum length distance; H / H max It represents the ratio of the width of the first image to the maximum value of the width distance; A1 represents the first magnification coefficient.
[0148] S2032. The mobile phone calculates a second magnification coefficient according to the first area of the circumscribed rectangle of the QR code and the second area of the first image.
[0149] For example, in S2031, the mobile phone may obtain the distances between the four sides of the circumscribed rectangle of the QR code and the edges of the first image, as well as the length and width of the first image. For example, as shown in Figure 7, the distances between the four sides of the circumscribed rectangle of the QR code and the edges of the first image are w1, w2, h1, and h2, respectively; the length and width of the first image are W and H, respectively. Based on this, the process of calculating the second magnification factor by the mobile phone may include S1-S3.
[0150] S1: The mobile phone calculates the length and width of the circumscribed rectangle of the QR code according to the distances between the four sides of the circumscribed rectangle of the QR code and the edge of the first image, and the length and width of the first image.
[0151] Exemplarily, the length of the circumscribed rectangle of the QR code can be expressed as follows: Wq = W-w1-w2; where Wq represents the length of the circumscribed rectangle of the QR code; W represents the length of the first image; w1 and w2 represent the length distance between the circumscribed rectangle of the QR code and the edge of the first image.
[0152] Correspondingly, the width of the circumscribed rectangle of the QR code can be expressed as follows: Hq = H-h1-h2; where Hq represents the width of the circumscribed rectangle of the QR code; H represents the width of the first image; h1 and h2 represent the width distance between the circumscribed rectangle of the QR code and the first image.
[0153] S2: The mobile phone calculates a first area of a circumscribed rectangle of the QR code and a second area of the first image.
[0154] For example, in S1, the mobile phone has calculated the length and width of the circumscribed rectangle of the QR code; on this basis, the first area of the circumscribed rectangle of the QR code can be expressed as follows: Sq = Wq × Hq; where Sq represents the first area; Wq represents the length of the circumscribed rectangle of the QR code; Hq represents the width of the circumscribed rectangle of the QR code.
[0155] Correspondingly, the second area of the first image can be expressed as follows: S=W×H, where S represents the second area; W represents the length of the first image; and H represents the width of the first image.
[0156] S3: The mobile phone calculates a second magnification coefficient according to the first area and the second area.
[0157] For example, the mobile phone can calculate the ratio of the first area to the second area to obtain the second magnification coefficient. For example, the second magnification coefficient can be expressed as follows: A2 = Sq / S, where A2 represents the second magnification coefficient, Sq represents the first area, and S represents the second area.
[0158] S2033. The mobile phone calculates a first target magnification factor according to the first magnification factor and the second magnification factor.
[0159] In some embodiments, the mobile phone may select the minimum of the first and second magnification coefficients as the first target magnification coefficient. For example, the first target magnification coefficient may be expressed as follows: A = min(A1, A2); where A represents the first target magnification coefficient, A1 represents the first magnification coefficient, and A2 represents the second magnification coefficient.
[0160] In other embodiments, the mobile phone selects the minimum coefficient of the first magnification coefficient and the second magnification coefficient as the third magnification coefficient, and then the mobile phone obtains the fourth magnification coefficient and selects the maximum coefficient of the third magnification coefficient and the fourth magnification coefficient as the first target magnification coefficient.
[0161] The fourth magnification factor refers to the magnification factor used by the mobile phone when magnifying the QR code last time. For example, the fourth magnification factor can be a magnification factor calculated by the mobile phone last time; or a magnification factor currently calculated by the mobile phone.
[0162] For example, the third amplification factor can be expressed as follows: A3=min(A1, A2); wherein A3 represents the third amplification factor, A1 represents the first amplification factor, and A2 represents the second amplification factor. The first target amplification factor can be expressed as follows: A=max(A3, A'); wherein A represents the first target amplification factor, A3 represents the third amplification factor, and A' represents the fourth amplification factor.
[0163] In the above embodiment, the mobile phone uses the maximum coefficient between the magnification coefficient A' used when the QR code was magnified last time and the third magnification coefficient A3 calculated this time as the first target magnification coefficient, and then uses the first target magnification coefficient to magnify the QR code, which can reduce the magnification fluctuations generated when the mobile phone magnifies the QR code.
[0164] S204: The mobile phone magnifies the QR code using the first target magnification factor.
[0165] Exemplarily, as shown in FIG3 , the Camera HAL in the mobile phone sends the first target magnification coefficient to the camera driver, which drives the camera to continue capturing images according to the first target magnification coefficient and amplifies the QR code in the subsequently captured image.
[0166] Subsequently, the camera driver drives the camera to continue to capture images according to the first target magnification factor. The multiple frames of images subsequently captured by the camera driver can form a new preview stream; that is, the QR code of the image in the new preview stream has been magnified. Further, the camera driver reports the new preview stream to the application, After the application receives the preview stream, it displays the new preview stream on the code scanning interface for easy The app recognizes the QR code.
[0167] In some embodiments, the mobile phone can calculate a first target magnification factor based on each frame of image captured by the camera. The mobile phone then magnifies the QR code in each subsequent frame of image captured by the camera based on the first target magnification factor calculated for each frame of image. For example, the mobile phone calculates the first target magnification factor based on the first frame of image captured by the camera; then, the mobile phone captures the second frame of image based on the first target magnification factor and magnifies the QR code in the second frame of image; accordingly, the mobile phone calculates the next first target magnification factor based on the second frame of image captured by the camera.
[0168] In other embodiments, the mobile phone calculates a first target magnification factor based on each frame of image captured by the camera. The mobile phone then magnifies the QR code in each subsequent frame of image captured by the camera at predetermined intervals. For example, the mobile phone calculates the first target magnification factor based on the first frame of image captured by the camera; then, the mobile phone captures the second frame of image based on the first target magnification factor and magnifies the QR code in the second frame of image. Similarly, the mobile phone calculates the first target magnification factor based on the 21st frame of image captured by the camera; then, the mobile phone captures the 22nd frame of image based on the first target magnification factor and magnifies the QR code in the 22nd frame of image.
[0169] For example, taking the preset number of frames as 20 frames, for example, after the camera captures the first image of the first frame, the mobile phone calculates the magnification coefficient A1 based on the first image of the first frame. Then, the mobile phone uses the magnification coefficient A1 to capture the second image frame and amplifies the QR code in the second image frame. Correspondingly, after the camera captures the first image of the 21st frame, the mobile phone calculates the magnification coefficient A21 based on the first image of the 21st frame. Then, the mobile phone uses the magnification coefficient A21 to capture the 22nd image frame and amplifies the QR code in the 22nd image frame. In this way, in this embodiment of the present application, the mobile phone can amplify the QR code once every 20 frames until the mobile phone successfully recognizes the QR code.
[0170] It can be seen that in this solution, the mobile phone calculates the first target magnification coefficient corresponding to each frame of the first image captured by the camera. In addition, when calculating the first target magnification coefficient, the mobile phone obtains it based on the first position data of the QR code in the first image and the second position data of the first image, so that the calculated first target magnification coefficient is relatively accurate, which can improve the scanning effect of the mobile phone within a certain period of time. In summary, the method of the embodiment of the present application can enhance the speed and accuracy of scanning QR codes during the process of mobile phone scanning.
[0171] In the above embodiment, after the mobile phone captures a frame of the first image through the camera, the mobile phone can calculate the first target magnification coefficient based on the first position data of the circumscribed rectangle of the QR code in the first image and the second position data of the first image, and use the first target magnification coefficient (i.e., the above magnification coefficient A) to magnify the QR code. In the case where a preset magnification coefficient (i.e., the above-mentioned magnification coefficient B, or the third target magnification coefficient) is provided by the first application, in order to improve the scanning efficiency of the mobile phone within a certain period of time, in an embodiment of the present application, the mobile phone can also obtain the magnification coefficient B provided by the first application, and based on the magnification coefficient A calculated by the mobile phone, use the intelligent decision engine algorithm to obtain the optimal magnification coefficient (i.e., the above-mentioned magnification coefficient R, or the third target magnification coefficient), and then use the optimal magnification coefficient to enlarge the QR code.
[0172] For example, as shown in Figure 9, after a mobile phone captures a first image frame through its camera, it calculates a magnification factor A based on the first position data of the QR code's circumscribed rectangle in the first image and the second position data of the first image, and obtains a magnification factor B provided by the first application. The mobile phone then uses an intelligent decision engine algorithm to determine a magnification factor R based on magnification factors A and B, and amplifies the QR code using this magnification factor R. During the process of the mobile phone scanning the QR code, the intelligent decision algorithm can use different strategies to determine the magnification factor R during different scanning time periods.
[0173] For example, as still shown in Figure 9, when the mobile phone is scanning the QR code, the mobile phone can adopt the priority strategy to obtain the amplification coefficient R in the first time period; if the mobile phone does not recognize the QR code in the first time period, it will continue to adopt the fusion strategy to obtain the amplification coefficient R in the second time period; if the mobile phone does not recognize the QR code in the second time period, it will continue to adopt the energy-saving strategy to obtain the amplification coefficient R in the third time period.
[0174] The priority strategy means that the phone blocks amplification factor B and uses amplification factor A as amplification factor R. The fusion strategy means that the phone combines amplification factors A and B to obtain amplification factor R (for example, R = (A + B) / 2). The energy-saving strategy means that the phone stops calculating amplification factor A and uses amplification factor B as amplification factor R.
[0175] That is, in the embodiment of the present application, as shown in FIG10 , when the mobile phone scans the QR code, it first amplifies the QR code using a magnification factor A during a first time period. If the mobile phone does not recognize the QR code during the first time period, it continues to amplify the QR code using a magnification factor (A+B) / 2 during a second time period. If the mobile phone does not recognize the QR code during the second time period, it continues to amplify the QR code using a magnification factor B during a third time period.
[0176] It should be understood that if the mobile phone still fails to recognize the QR code within the third time period, the mobile phone will display a result of unsuccessful scanning on the scanning interface. Among them, the reasons for unsuccessful scanning may include: missing QR code, blurred QR code or network abnormality, etc., which are not limited in this application.
[0177] It should be noted that after multiple verifications, when a mobile phone scans a QR code, the probability of successfully recognizing the QR code reaches 80% when the QR code is magnified using a magnification factor of A. When the QR code is magnified using a magnification factor of (A+B) / 2, the probability of successfully recognizing the QR code reaches 90%.
[0178] In this way, using the method of the embodiment of the present application, when the mobile phone is scanning the QR code, the magnification factor A is used to amplify the QR code within the first time period, which can enhance the speed and accuracy of the code scanning; the magnification factor (A+B) / 2 is used to amplify the QR code within the second time period, which can further enhance the speed and accuracy of the code scanning; within the third time period, the mobile phone stops calculating the amplification factor A and uses the amplification factor B to amplify the QR code, which can achieve the purpose of reducing power consumption.
[0179] Exemplarily, using the method of an embodiment of the present application, when a mobile phone is scanning a QR code, as shown in Figure 11 (a), if the size of the QR code is small, the mobile phone can quickly enlarge the QR code to a suitable position, such as the position shown in Figure 11 (b), so that the mobile phone can quickly recognize the QR code, thereby enhancing the speed and accuracy of scanning.
[0180] It should be emphasized that if the phone fails to recognize the QR code within the first time period, it will amplify the QR code using a magnification factor of (A+B) / 2 during the second time period. It should be understood that the magnification factor (A+B) / 2 is obtained by the phone fusing the magnification factors A and B. The magnification factor A used when the phone first fuses the magnification factors A and B during the second time period is the magnification factor used the phone last time it magnified the QR code during the first time period.
[0181] For example, as shown in FIG5 , the magnification coefficient used by the mobile phone when it magnified the QR code for the last time in the first time period is A141, so the magnification coefficient R=(A141+B) / 2 determined for the first time in the second time period by the mobile phone.
[0182] An embodiment of the present application provides a method for magnifying a QR code. This method can be applied to the aforementioned electronic device, such as a mobile phone. The mobile phone includes a first application that provides a QR code scanning function. For example, as shown in FIG12 , the method may include the following steps: S301-S307.
[0183] S301: In response to a user starting a function of scanning a QR code in a first application, a mobile phone captures an image.
[0184] For example, the first application may be a third-party application. For example, the first application may be the above-mentioned For example, as shown in FIG1(a), in response to the user's The operation of the "Scan" button in the application, The app starts scanning QR codes.
[0185] Furthermore, as shown in Figure 3, After the application starts the function of scanning QR code, The application sends the scan code command to the camera driver through the Camera Service and Camera HAL, and the camera driver starts capturing images.
[0186] S302: The mobile phone acquires a first image; the first image includes a first QR code.
[0187] Exemplarily, the first image may be the first frame image, that is, the first frame image captured by the camera at a certain frame rate, wherein the first QR code may be the QR code in the first frame image.
[0188] S303: The mobile phone recognizes the first QR code and calculates a first target magnification factor based on the first image.
[0189] For example, the multiple frames of images captured by the camera can form a preview stream, and the images in the preview stream include the first QR code. For example, as shown in FIG3 , on the one hand, the camera driver reports the preview stream to the Camera HAL and the Camera Service through the Camera HAL and the Camera Service. Application, by The application displays the preview stream on the code scanning interface and identifies the first QR code included in the preview stream. The camera driver reports the preview stream to the Camera HAL, which processes the preview stream to generate a detection stream that includes the first image. The Camera HAL then calculates the first target magnification factor based on the first image in the detection stream.
[0190] For example, the Camera HAL may obtain the first position data of the first QR code and the second position data of the first image, and calculate a first target magnification factor based on the first position data and the second position data, wherein the first target magnification factor may be, for example, the magnification factor A in the above embodiment.
[0191] It should be noted that the specific implementation process of calculating the first target magnification coefficient can refer to the above embodiment, which will not be described in detail here.
[0192] S304. The mobile phone captures a second image according to the first target magnification factor; the second image includes a second QR code, and the proportion of the second QR code in the second image is greater than the proportion of the first QR code in the first image.
[0193] For example, the second image may be the second frame image in the above embodiment, that is, the second frame image captured by the camera at a certain frame rate, wherein the second QR code may be the QR code in the second frame image.
[0194] Exemplarily, as shown in FIG3 , after the Camera HAL calculates the first target magnification coefficient based on the first image in the detection stream, the Camera HAL sends the first target magnification coefficient to the camera driver, which drives the camera to capture the second image according to the first target magnification coefficient.
[0195] For example, the camera driver adjusts the distance (i.e., focal length) between the camera lens and the QR code based on the first target magnification factor, thereby changing the camera's focal length and continuing to capture the second image. Alternatively, the camera driver increases the area of each pixel in the second image captured by the camera based on the first target magnification factor, thereby increasing the area of the second QR code. In both approaches, the second QR code in the second image captured by the camera is enlarged, i.e., the second QR code is magnified, so that the proportion of the second QR code in the second image is greater than the proportion of the first QR code in the first image.
[0196] S305: If the mobile phone does not recognize the second QR code within the first time period, the mobile phone acquires a captured second image and calculates a second target magnification factor based on the second image.
[0197] The second target magnification coefficient may be the magnification coefficient A in the above embodiment. It should be noted that the specific implementation of the mobile phone calculating the second target magnification coefficient based on the second image can refer to the above embodiment and will not be described in detail here.
[0198] S306: The mobile phone calculates a fourth target magnification coefficient according to the second target magnification coefficient and the third target magnification coefficient provided by the first application.
[0199] The third target magnification factor may be the magnification factor B in the above embodiment, and the fourth target magnification factor may be the magnification factor R in the above embodiment. In S306, the mobile phone may calculate the fourth target magnification factor using a fusion strategy, that is, the mobile phone uses the average of the second target magnification factor and the third target magnification factor as the fourth target magnification factor.
[0200] S307. The mobile phone captures a third image according to the fourth target magnification factor; the third image includes a third QR code, and the proportion of the third QR code in the third image is greater than the proportion of the second QR code in the second image.
[0201] For example, the description of S307 may refer to the above S304, which will not be described in detail here.
[0202] Furthermore, the mobile phone does not recognize the third QR code within the second time period, and the mobile phone captures a fourth image according to the third target magnification factor; wherein, the fourth image includes a fourth QR code, and the proportion of the fourth QR code in the fourth image is greater than the proportion of the third QR code in the third image.
[0203] In summary, in this embodiment of the present application, the mobile phone calculates a first target magnification factor (i.e., the aforementioned magnification factor A) based on the image captured by the camera during a first time period, and subsequently captures images using the first target magnification factor. In other words, during the first time period, the mobile phone employs the aforementioned priority strategy, preferentially magnifying the QR code based on the first target magnification factor calculated from the image, to improve the speed and accuracy of code scanning.
[0204] Furthermore, if the mobile phone fails to recognize the QR code within the first time period (i.e., recognition fails), the mobile phone calculates a second target magnification factor (i.e., the aforementioned magnification factor A) based on the image captured by the camera and a third target magnification factor (i.e., the aforementioned magnification factor B) provided by the first application within the second time period, calculates the third target magnification factor (i.e., the aforementioned magnification factor R), and subsequently captures an image using magnification factor B. In other words, within the second time period, the mobile phone employs the aforementioned fusion strategy, fusing the second target magnification factor calculated based on the image with the third target magnification factor provided by the first application, and uses the fused magnification factor to magnify the QR code, further improving the accuracy of code scanning.
[0205] Furthermore, if the mobile phone fails to recognize the QR code within the second time period (i.e., recognition fails), the mobile phone captures an image based on the third target magnification factor. In other words, if the mobile phone still fails to recognize the QR code within the second time period, the mobile phone no longer calculates magnification factor A based on the captured image, but instead captures the image using magnification factor B provided by the first application. This means that the QR code is magnified using magnification factor B, thereby reducing power consumption.
[0206] It should be noted that the contents recorded in each embodiment of the present application can explain and illustrate the technical solutions in other embodiments of the present application, and the technical features recorded in each embodiment can also be applied in other embodiments and combined with the technical features in other embodiments to form a new solution. The present application only lists several embodiments for illustration, and does not mean that the present application is strictly limited to this.
[0207] An embodiment of the present application provides an electronic device that supports the function of scanning a QR code. The electronic device includes: a display screen, a memory, and one or more processors. The display screen is used to display an image captured by a camera or an image generated by the processor. The memory stores computer program code, which includes computer instructions. When the computer instructions are executed by the processor, the electronic device performs the various functions or steps performed in the mobile phone described above. The structure of the electronic device can refer to the structure of the mobile phone 100 shown in Figure 2.
[0208] The present application also provides a chip system, as shown in FIG13 . The chip system 1100 includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 may be the processor 110 shown in FIG2 of the above embodiment. The interface circuit 1102 may be, for example, an interface circuit between the processor and an external memory, or an interface circuit between the processor and the internal memory 121.
[0209] The processor 1101 and the interface circuit 1102 can be interconnected via lines. For example, the interface circuit 1102 can be used to receive signals from other devices (such as the memory of the mobile phone 100). For another example, the interface circuit 1102 can be used to send signals to other devices (such as the processor 1101). Exemplarily, the interface circuit 1102 can read instructions stored in the memory and send the instructions to the processor 1101. When the instructions are executed by the processor 1101, the electronic device can execute the various steps executed by the mobile phone in the above embodiment. Of course, the chip system can also include other discrete components, which is not specifically limited in the embodiments of the present application.
[0210] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the various functions or steps executed by the mobile phone in the above method embodiment.
[0211] The embodiment of the present application further provides a computer program product, which, when executed on a computer, enables the computer to execute the functions or steps executed by the mobile phone in the above method embodiment.
[0212] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0213] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0214] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0215] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0216] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0217] The above content is only a specific embodiment of this application, but the scope of protection of this application is not limited to this. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A method for magnifying a QR code, characterized in that: Applied in an electronic device, the electronic device includes a first application, and the first application provides a function of scanning a two-dimensional code; the method includes: In response to the user starting the function of scanning the QR code of the first application, the electronic device captures a first image; the first image includes a first QR code; The electronic device recognizes the first two-dimensional code and calculates a first target magnification factor based on the first image; The electronic device collects a second image according to the first target magnification factor; the second image includes a second two-dimensional code, and a proportion of the second two-dimensional code in the second image is greater than a proportion of the first two-dimensional code in the first image; The electronic device fails to recognize the second two-dimensional code within a first time period, and the electronic device calculates a second target magnification factor based on the second image; The electronic device determines a fourth target magnification factor according to the second target magnification factor and a third target magnification factor provided by the first application; The electronic device captures a third image according to the fourth target magnification factor; the third image includes a third two-dimensional code, and a proportion of the third two-dimensional code in the third image is greater than a proportion of the second two-dimensional code in the second image.
2. The method according to claim 1, characterized in that The method further comprises: The electronic device fails to recognize the third two-dimensional code within the second time period, and the electronic device captures a fourth image according to the third target magnification factor; The fourth image includes a fourth two-dimensional code, and a proportion of the fourth two-dimensional code in the fourth image is greater than a proportion of the third two-dimensional code in the third image.
3. The method according to claim 2, characterized in that The method further comprises: In response to the user starting the function of scanning the QR code of the first application, the electronic device starts timing; When the timing duration exceeds the first threshold, the first time period ends and enters the second time period; When the timing duration exceeds a second threshold, the second time period ends.
4. The method according to any one of claims 1 to 3, characterized in that The calculating a first target magnification factor based on the first image includes: The electronic device acquires first position data of the first two-dimensional code and second position data of the first image; The electronic device determines a target distance between a circumscribed rectangle of the first two-dimensional code and an edge of the first image according to the first position data and the second position data; The electronic device determines a first area of a circumscribed rectangle of the first two-dimensional code and a second area of the first image according to the first position data and the second position data; The electronic device calculates the first target magnification factor based on the target distance, the second position data, the first area, and the second area.
5. The method according to claim 4, characterized in that The electronic device calculates the first target magnification factor based on the target distance, the second position data, the first area, and the second area, including: The electronic device calculates a first magnification factor according to the target distance and the second position data; The electronic device calculates a second magnification factor according to the first area and the second area; The electronic device uses the minimum coefficient between the first amplification coefficient and the second amplification coefficient as the first target amplification coefficient.
6. The method according to claim 4, characterized in that The electronic device calculates the first target magnification factor based on the target distance, the second position data, the first area, and the second area, including: The electronic device calculates a first magnification factor according to the target distance and the second position data; The electronic device calculates a second magnification factor according to the first area and the second area; The electronic device selects the minimum coefficient between the first amplification coefficient and the second amplification coefficient as the third amplification coefficient; The electronic device acquires a fourth magnification factor, and selects a maximum coefficient between the third magnification factor and the fourth magnification factor as the first target magnification factor; The fourth magnification factor is the magnification factor used by the electronic device when it last captured an image.
7. The method according to any one of claims 4 to 6, characterized in that: The target distance includes a first target distance and a second target distance; the electronic device determines the target distance between the circumscribed rectangle of the first two-dimensional code and the edge of the first image according to the first position data and the second position data, including: The electronic device calculates a first distance from a left edge of a circumscribed rectangle of the first two-dimensional code to a left edge of the first image in a first direction, and a second distance from a right edge of a circumscribed rectangle of the first two-dimensional code to a right edge of the first image, and uses the maximum distance between the first distance and the second distance as the first target distance; The electronic device calculates a third distance from an upper edge of a circumscribed rectangle of the first two-dimensional code to an upper edge of the first image, and a fourth distance from a lower edge of a circumscribed rectangle of the first two-dimensional code to a lower edge of the first image in a second direction, and uses a maximum distance between the third distance and the fourth distance as the second target distance; The first direction is perpendicular to the second direction.
8. The method according to claim 7, characterized in that The electronic device calculates a first magnification factor according to the target distance and the second position data, including: The electronic device calculates a first ratio between the first target distance and the length of the first image in the first direction, and a second ratio between the second target distance and the length of the first image in the second direction; The electronic device uses the minimum value between the first ratio and the second ratio as the first amplification factor.
9. An electronic device, characterized in that: The electronic device includes a first application, and the first application provides a function of scanning a QR code; the electronic device includes: a display screen, a memory, and one or more processors; The display screen is used to display an image captured by a camera or an image generated by a processor; the memory stores computer program code, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The method comprises computer instructions; when the computer instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 8.
Citation Information
Patent Citations
Code scanning method and device, mobile terminal and storage medium
CN110443330A
Two-dimensional code recognition method and device
CN111767752A
Method and device for identifying two-dimensional code
CN115329795A
Method for amplifying two-dimensional code and electronic equipment
CN116306733A
Image processing apparatus, image processing method, and storage medium storing program
US20210142022A1
