Two-dimensional code recognition method and device
Patent Information
- Application Number
- CN202310221177.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-08
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-03-08
AI Technical Summary
[0018]在本申请实施例中,能够在当前二维码识别失败的情况下,拍摄第一图片,第一图片包括第一区域和第二区域,第一区域为当前二维码所属的区域,第二区域为第一图片中除第一区域外的其他区域;将第一图片与二维码图片库中的全部图片进行匹配,显示N个第二图片,其中,第二图片为二维码图片库中与第一图片的相似度满足预设条件的图片;接收对目标图片的第一输入,目标图片为N个第二图片中的任一图片;响应于第一输入,识别目标图片中的目标二维码。
Smart Images

Figure CN116384423B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of electronic equipment technology, specifically relating to a QR code recognition method and device. Background Technology
[0002] With the widespread adoption of smart living, QR codes have become ubiquitous, allowing users to complete tasks with a simple scan, greatly enhancing convenience. However, QR code scanning conditions are relatively stringent; typically, the QR code surface needs to be flat and clean for successful recognition. Currently, there are instances where QR code images provided are dirty or damaged, leading to recognition failures. Summary of the Invention
[0003] The purpose of this application is to provide a QR code recognition method and apparatus that can improve the success rate of QR code recognition.
[0004] In a first aspect, embodiments of this application provide a QR code recognition method, the method comprising:
[0005] If the current QR code recognition fails, take a first image. The first image includes a first region and a second region. The first region is the region to which the current QR code belongs, and the second region is the other regions in the first image excluding the first region.
[0006] Match the first image with all images in the QR code image library and display N second images, where the second images are images in the QR code image library that meet the preset conditions for similarity with the first image, and N is a positive integer;
[0007] Receive the first input for the target image, which is any one of N second images;
[0008] In response to the first input, the target QR code in the target image is identified.
[0009] Secondly, embodiments of this application provide a QR code recognition device, the device comprising:
[0010] The camera module is used to capture a first image when the current QR code recognition fails. The first image includes a first region and a second region. The first region is the region to which the current QR code belongs, and the second region is the other regions in the first image excluding the first region.
[0011] The display module is used to match the first image with all images in the QR code image library and display N second images, where the second images are images in the QR code image library that meet the preset conditions of similarity with the first image, and N is a positive integer;
[0012] The receiving module is used to receive the first input of the target image, which is any one of N second images;
[0013] The recognition module is used to recognize the target QR code in the target image in response to the first input.
[0014] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0015] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0016] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.
[0017] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.
[0018] In this embodiment, when the current QR code recognition fails, a first image is captured. The first image includes a first region and a second region. The first region is the region to which the current QR code belongs, and the second region is the other regions in the first image excluding the first region. The first image is matched with all images in the QR code image library to display N second images, wherein the second images are images in the QR code image library whose similarity to the first image meets a preset condition. A first input for a target image is received, and the target image is any one of the N second images. In response to the first input, the target QR code in the target image is recognized.
[0019] In this way, when the current QR code recognition fails, a first image including the current QR code and related information can be captured. Then, N second images with high similarity to the first image can be matched from the QR code image library. Users can then select the target image from the second images and complete the recognition by recognizing the target QR code in the target image, effectively improving the success rate of QR code recognition. Attached Figure Description
[0020] Figure 1 This is a flowchart illustrating the QR code recognition method provided in an embodiment of this application;
[0021] Figure 2 This is a schematic diagram of the first image in the QR code recognition method provided in the embodiments of this application;
[0022] Figure 3 This is a schematic diagram of the interface of the electronic device in the QR code recognition method provided in the embodiments of this application;
[0023] Figure 4 This is a schematic diagram of the QR code image library in the QR code recognition method provided in the embodiments of this application;
[0024] Figure 5 This is a schematic diagram of the structure of the QR code recognition device provided in the embodiments of this application;
[0025] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;
[0026] Figure 7 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0027] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0028] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0029] The QR code recognition method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0030] Figure 1 This is a flowchart illustrating the QR code recognition method provided in an embodiment of this application. Figure 1 As shown, QR code recognition methods may include:
[0031] Step 101: If the current QR code recognition fails, take a first image. The first image includes a first region and a second region. The first region is the region to which the current QR code belongs, and the second region is the other regions in the first image excluding the first region.
[0032] In step 101, the user can scan the current QR code with an electronic device. If the electronic device prompts a scanning failure, or if the scanning time is too long and the corresponding recognition result is not displayed, it can be considered that the current QR code recognition has failed. At this time, the camera module of the electronic device can be used to capture a first image, wherein the first image can include a first area to which the current QR code belongs, and the first image can also include a second area other than the first area. The second area can include an area that describes the current QR code, such as text, icons, etc. associated with the current QR code, which are not specifically limited here.
[0033] like Figure 2 As shown, the first image may include the first region 201 to which the current QR code belongs, and may also include other regions besides the first region (i.e., the second region 202). Generally, the second region 202 usually includes some text or icon information, such as... Figure 2 The text "XX Hospital Entry Registration Code" displayed in the second area 202 indicates that the QR code in the first area 201 is used to register user information for entering XX Hospital.
[0034] Understandably, electronic devices can include mobile phones, laptops, tablets, smartwatches, educational devices, and other wearable smart devices.
[0035] Step 102: Match the first image with all images in the QR code image library and display N second images, where the second images are images in the QR code image library that meet the preset similarity conditions with the first image, and N is a positive integer.
[0036] Understandably, a QR code image library can store multiple images, each of which can include a QR code. In some examples, the image can be an image corresponding to a QR code that the user has successfully recognized in the past. For instance, after a QR code is successfully recognized, the user can take a picture containing the successfully recognized QR code and store it in the QR code image library.
[0037] Multiple images in the QR code image library can also be obtained from a cloud server. For example, based on the current location and / or current date of the electronic device, multiple images that meet the location and / or time criteria can be retrieved from the cloud, and each image can include a QR code that can be successfully recognized. The location and time criteria can be set according to actual needs and are not specifically limited here.
[0038] The first image can be matched one-to-one with all images in the QR code image library to identify images whose similarity to the first image meets preset conditions. These images are then displayed as N second images. Specifically, this can be done by matching the information indicated by the second region in the first image with the QR code information of each image, or by matching the current QR code image in the first region and the information indicated by the second region in the first image with the QR code image and QR code information of each image, thereby obtaining the similarity between each image and the first image.
[0039] Understandably, the preset conditions can be set according to actual needs. For example, multiple images can be sorted from highest to lowest similarity, and the top N images can be used as N second images. Alternatively, images with a similarity greater than a preset similarity threshold can be used as N second images. No specific limitations are made here.
[0040] Step 103: Receive the first input for the target image, which is any one of the N second images.
[0041] In step 103, the user can receive a first input from the user regarding the target image among the N second images. This first input can be a click on the target image, a voice command, or a specific gesture. The specific gesture can be determined based on actual usage needs, and this embodiment does not limit this. The specific gesture in this embodiment can be any one of the following: a single click, a swipe gesture, a drag gesture, a pressure-recognition gesture, a long press gesture, an area change gesture, a double press gesture, or a double tap gesture. The click input in this embodiment can be a single click, a double tap, or any number of clicks, and can also be a long press or a short press.
[0042] Users can further filter the displayed N second images to find target images that better meet the current QR code recognition requirements, thereby using the target images to assist in recognizing the current QR code.
[0043] Step 104: In response to the first input, identify the target QR code in the target image.
[0044] In step 104, in response to the first input, the target QR code in the target image can be identified.
[0045] It's understandable that the target image is a specific image selected by the user from a QR code image library. Since the QR code corresponding to each image in the library can be successfully recognized, the electronic device can successfully recognize the target QR code in the target image. Therefore, although the current QR code may fail to be recognized for some reason, the target QR code in the target image can assist in recognizing the current QR code, thereby improving the success rate of QR code recognition.
[0046] In this embodiment, the QR code recognition method can, in the event that the current QR code recognition fails, capture a first image. The first image includes a first region and a second region. The first region is the region to which the current QR code belongs, and the second region is the other regions in the first image excluding the first region. The first image is matched with all images in the QR code image library to display N second images, wherein the second images are images in the QR code image library whose similarity to the first image meets a preset condition. A first input is received for a target image, which is any one of the N second images. In response to the first input, the target QR code in the target image is recognized.
[0047] In this way, when the current QR code recognition fails, a first image including the current QR code and related information can be captured. Then, N second images with high similarity to the first image can be matched from the QR code image library. Users can then select the target image from the second images and complete the recognition by recognizing the target QR code in the target image, effectively improving the success rate of QR code recognition.
[0048] In some embodiments, each image in the QR code image library includes a third region and a fourth region. The third region is the region to which the QR code in each image belongs, and the fourth region is the other regions in each image besides the third region. Step 102 may also include the following steps:
[0049] The second region is matched with the fourth region of each image to determine N second images, wherein the similarity between the information indicated in the fourth region of the second image and the information indicated in the second region is greater than a first threshold.
[0050] Display N second images.
[0051] In this embodiment, as mentioned above, the first image may include a first region and a second region. Correspondingly, each image stored in the QR code image library may also include a third region and a fourth region, wherein the third region may be the region in the image to which the QR code belongs, and the fourth region may be any other region in the image besides the third region. The fourth region may also include some text or icons and other related information used to explain the QR code.
[0052] It is understandable that the current QR code may be blurred or distorted due to image damage or shooting angle, leading to recognition failure. Therefore, to ensure that a second image more similar to the first image is displayed, thereby improving the accuracy of QR code recognition, the second region of the first image can be matched with the fourth region of each image. For example, the non-QR code portion can be matched first, that is, the text or icons in the first image can be compared with the text or icons in each other image. From multiple images, N second images are identified whose similarity between the information indicated in the fourth region and the information indicated in the second region is greater than a first threshold. The value of the first threshold can be set according to actual needs and is not specifically limited here. As in the example above, when the current QR code image is... Figure 2 In this case, based on the information in section 202 of the QR code, all images related to "XX Hospital, Entry" can be identified from the QR code image library.
[0053] After that, as Figure 3 As shown, after determining N second images 301, these N second images 301 (such as image 1, image 2, image 3 and image 4) can be displayed.
[0054] In this way, the image can be divided into a QR code part and a non-QR code part. When the QR code part is damaged or blurred and cannot be recognized, the non-QR code part can be used to assist in matching, so as to identify N similar second images from the QR code image library, thereby improving the accuracy of QR code recognition.
[0055] In some embodiments, each image in the QR code image library includes a third region and a fourth region. The third region is the region to which the QR code in each image belongs, and the fourth region is the other regions in each image besides the third region. Step 102 may also include the following steps:
[0056] Match the second region with the fourth region of each image to determine M third images, where the information indicated in the fourth region of the third image is more similar to the information indicated in the second region than the second threshold.
[0057] Match the first region with the third region of each third image to determine N second images, where the information indicated by the third region of the third image is more similar to the information indicated by the first region than the third threshold, and M is a positive integer greater than or equal to N.
[0058] Display N second images.
[0059] In this embodiment, as mentioned above, the first image may include a first region and a second region. Correspondingly, each image stored in the QR code image library may also include a third region and a fourth region, where the third region may be the region in the image to which the QR code belongs, and the fourth region may be any region in the image other than the third region. The fourth region may also include some text or icons and other related information used to describe the QR code. As in the example above, when the current QR code image is... Figure 2 In this case, we can first determine all images related to "XX Hospital, Entry" from the QR code image library based on the QR code information in section 202. Then, we can further identify images from these images whose QR code images have a high similarity to the QR code image in the first image.
[0060] To ensure that a second image more similar to the first image is displayed, thereby improving the accuracy of QR code recognition, the second region can be matched with the fourth region of each image first. For example, non-QR code parts can be matched; that is, the text or icons in the first image are compared with the text or icons in each of the other images using keyword comparison. From multiple images, M third images are identified whose similarity between the information indicated by the fourth region and the information indicated by the second region is greater than a second threshold. The value of the second threshold can be set according to actual needs and is not specifically limited here.
[0061] Then, the first region can be matched with the third region of each third image. From the M third images, N second images are determined whose information indicated by the third region is more similar to the information indicated by the first region than the third threshold. The value of the third threshold can be set according to actual needs and is not specifically limited here.
[0062] like Figure 3 As shown, after determining N second images 301, these N second images 301 (such as image 1, image 2, image 3 and image 4) can be displayed.
[0063] In this way, the image can be divided into a QR code part and a non-QR code part. Then, the non-QR code part can be matched first to identify M similar third images. Then, N similar second images with QR code parts can be matched from the M images. This further ensures the similarity between the second images and the first image, thereby further improving the accuracy of QR code recognition.
[0064] In some examples, the QR code image library can also store attribute information (time information and / or location information) for each image. When displaying N second images, the attribute information corresponding to the N second images can be displayed simultaneously, so that users can filter out the target image that better meets their needs, thereby further improving the accuracy of QR code recognition.
[0065] In some embodiments, the QR code image library also stores attribute information for each image, including location information;
[0066] Step 102 above may also include the following steps:
[0067] Get current location information;
[0068] Compare the current location information with the location information of each second image;
[0069] Based on the comparison results, display N second images in the first order.
[0070] In this embodiment, the QR code image library can also store attribute information for each image, which may include location information. The location information of an image may refer to the location where the image was taken.
[0071] The current location information can be obtained based on the positioning system of electronic devices or other location acquisition methods. The location information of each of the N second images is compared with the current location information to determine the distance between the location information of each second image and the current location information.
[0072] Based on the comparison results, N second images can be displayed in first order. The first order can be set according to actual needs. For example, the N second images can be sorted in order of distance from nearest to farthest, so that the second image corresponding to the location information that is closer to the current location information can be displayed first.
[0073] In this way, the N second images can be sorted according to their attribute information, thus prioritizing the second image whose location information is closer to the current location information. This makes it easier for users to select target images that meet their requirements, thereby improving the convenience and success rate of QR code recognition.
[0074] In some examples, the attribute information may also include time information, which could refer to the time the image was captured. Alternatively, it could display N second images sequentially based on their time information. For instance, the time information of the N second images could be compared with the current time to determine the time difference between each second image's time and the current time. The N second images could then be sorted in ascending order of their time differences, thus prioritizing the display of the second image with a time more recent than the current time.
[0075] The system can also sequentially display N second images based on their time and location information. For example, the time information of each of the N second images can be compared with the current time to determine the time difference between them. Similarly, the location information of each of the N second images can be compared with the current location information to determine the distance between them. The priority of each second image can be determined based on the time difference, distance, and preset time and location weights, thus prioritizing the display of second images whose time and location information is closer to the current time and location.
[0076] In other examples, the attribute information may include location and time information. Based on the comparison between the current location information and the location information of each second image, N second images can be displayed in a first-order sequence, while simultaneously displaying the location and time information corresponding to each second image. For example... Figure 3 As shown, it can display N second images 301 and the time and location information of each second image 301.
[0077] In this way, the N second images can be sorted based on location information, so that the second images whose location information is closer to the current location information can be displayed first. The attribute information of each second image can also be displayed simultaneously to provide users with reference and further help users select target images that meet their requirements.
[0078] In some embodiments, the QR code recognition method may further include the following steps:
[0079] If the QR code is successfully recognized, take a picture. The picture includes a third area and a fourth area. The third area is used to display the successfully recognized QR code image, and the fourth area is used to display other content besides the successfully recognized QR code image.
[0080] Store the image in the QR code image library.
[0081] In this embodiment, an image can be captured if the QR code is successfully recognized. In other words, the image can be the image corresponding to the successfully recognized QR code. This image may include a third area displaying the successfully recognized QR code image, and a fourth area displaying other content besides the successfully recognized QR code image. The fourth area may include text or icons or other information related to the QR code. The image is stored in a QR code image library. Over time, the QR code image library can include multiple images, providing a foundation for assisting in the recognition of target images after subsequent QR code recognition failures.
[0082] In this way, the QR code image library can store multiple images containing QR codes that can be successfully recognized. Therefore, if the current QR code recognition fails, the library can be used to match and filter out the target image that meets the requirements for recognizing the target QR code in the target image, thereby improving the success rate of QR code recognition.
[0083] In some examples, when storing images in a QR code image library, the image's attribute information can also be retrieved, and both the image and its attribute information are stored in the library. In other words, each image in the QR code image library can be associated with time and / or location information. This storage of image attribute information in the library facilitates subsequent selection of more suitable target images by users, thereby improving the convenience and success rate of QR code recognition.
[0084] In some examples, such as Figure 4 As shown, the QR code image library can include images A, B, and C, etc., where images A, B, and C can be images. Each image can serve as an index, corresponding to the QR code portion (i.e., the third area), the non-QR code portion (i.e., the fourth area), the shooting time (i.e., time information), and the shooting location (i.e., location information) in the QR code image library. During the entire QR code recognition process, the corresponding information can be directly retrieved from the QR code image library to execute the corresponding steps, further simplifying the process and improving efficiency.
[0085] In other examples, the QR code image library can also store the recognition content corresponding to the QR code in each image. This recognition content can be what is displayed on the electronic device after successful QR code recognition. The above-mentioned response to the first input, recognizing the target QR code in the target image, can include the following steps: responding to the first input, determining the target recognition content corresponding to the target image; displaying the target recognition content. This eliminates the need to use the electronic device's scanning function to recognize the target QR code again, avoiding the risk of QR code recognition failure due to time intervals. Furthermore, by directly displaying the recognition content, time is saved in recognizing the target QR code, further improving the success rate and efficiency of QR code recognition.
[0086] The QR code recognition method provided in this application can be executed by a QR code recognition device. This application uses a QR code recognition device to perform the QR code recognition method as an example to illustrate the QR code recognition device provided in this application.
[0087] like Figure 5 As shown in the figure, this application embodiment also provides a QR code recognition device 500, which may include:
[0088] The shooting module 501 is used to take a first image when the current QR code recognition fails. The first image includes a first region and a second region. The first region is the region to which the current QR code belongs, and the second region is the other regions in the first image excluding the first region.
[0089] Display module 502 is used to match the first image with the QR code image library and display N second images, wherein the second images are images in the QR code image library that meet the preset conditions of similarity with the first image, and N is a positive integer;
[0090] The receiving module 503 is used to receive the first input to the target image, which is any one of N second images;
[0091] The recognition module 504 is used to recognize the target QR code in the target image in response to the first input.
[0092] In this way, when the current QR code recognition fails, a first image including the current QR code and related information can be captured. Then, N second images with high similarity to the first image can be matched from the QR code image library. Users can then select the target image from the second images and complete the recognition by recognizing the target QR code in the target image, effectively improving the success rate of QR code recognition.
[0093] In some embodiments, each image in the QR code image library includes a third region and a fourth region. The third region is the region to which the QR code in each image belongs, and the fourth region is the other regions in each image besides the third region. The display module 502 can also be used for:
[0094] The second region is matched with the fourth region of each image to determine N second images, wherein the similarity between the information indicated in the fourth region of the second image and the information indicated in the second region is greater than a first threshold.
[0095] Display N second images.
[0096] In this way, the image can be divided into a QR code part and a non-QR code part. When the QR code part is damaged or blurred and cannot be recognized, the non-QR code part can be used to assist in matching, so as to identify N similar second images from the QR code image library, thereby improving the accuracy of QR code recognition.
[0097] In some embodiments, each image in the QR code image library includes a third region and a fourth region. The third region is the region to which the QR code in each image belongs, and the fourth region is the other regions in each image besides the third region. The display module 502 can also be used for:
[0098] Match the second region with the fourth region of each image to determine M third images, where the information indicated in the fourth region of the third image is more similar to the information indicated in the second region than the second threshold.
[0099] Match the first region with the third region of each third image to determine N second images, where the information indicated by the third region of the third image is more similar to the information indicated by the first region than the third threshold, and M is a positive integer greater than or equal to N.
[0100] Display N second images.
[0101] In this way, the image can be divided into a QR code part and a non-QR code part. Then, the non-QR code part can be matched first to identify M similar third images. Then, N similar second images with QR code parts can be matched from the M images. This further ensures the similarity between the second images and the first image, thereby further improving the accuracy of QR code recognition.
[0102] In some embodiments, the QR code image library also stores attribute information for each image, including location information;
[0103] The display module 502 can also be used for:
[0104] Get current location information;
[0105] Compare the current location information with the location information of each second image;
[0106] Based on the comparison results, display N second images in the first order.
[0107] In this way, the N second images can be sorted according to their attribute information, so that the second image with location information that is closer to the current location information can be displayed first. This makes it easier for users to filter the target image that meets the requirements, thereby improving the convenience and success rate of QR code recognition.
[0108] In some embodiments, the imaging module 501 can also be used for:
[0109] If the QR code is successfully recognized, take a picture. The picture includes a third area and a fourth area. The third area is used to display the successfully recognized QR code image, and the fourth area is used to display other content besides the successfully recognized QR code image.
[0110] The QR code recognition device 500 may also include:
[0111] The storage module is used to store images to the QR code image library.
[0112] In this way, the QR code image library can store multiple images containing QR codes that can be successfully recognized. Therefore, if the current QR code recognition fails, the library can be used to match and filter out the target image that meets the requirements for recognizing the target QR code in the target image, thereby improving the success rate of QR code recognition.
[0113] The QR code recognition device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the specific type of device.
[0114] The QR code recognition device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0115] The QR code recognition device provided in this application embodiment can achieve... Figures 1 to 4 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.
[0116] Optionally, such as Figure 6 As shown, this application embodiment also provides an electronic device 600, including a processor 601 and a memory 602. The memory 602 stores a program or instructions that can run on the processor 601. When the program or instructions are executed by the processor 601, they implement the various steps of the above-described QR code recognition method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0117] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0118] Figure 7 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0119] The electronic device 700 includes, but is not limited to, components such as: radio frequency unit 701, network module 702, audio output unit 703, input unit 704, sensor 705, display unit 706, user input unit 707, interface unit 708, memory 709, and processor 710.
[0120] Those skilled in the art will understand that the electronic device 700 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 710 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 7 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0121] The processor 710 can be used to: capture a first image when the current QR code recognition fails, the first image including a first region and a second region, the first region being the region to which the current QR code belongs, and the second region being the other regions in the first image excluding the first region;
[0122] The display unit 706 can be used to: match the first image with the QR code image library and display N second images, wherein the second images are images in the QR code image library that meet the preset conditions for similarity with the first image, and N is a positive integer;
[0123] The user input unit 707 can be used to: receive a first input to a target image, wherein the target image is any one of N second images;
[0124] The processor 710 can also be used to: recognize a target QR code in a target image in response to a first input.
[0125] In this way, when the current QR code recognition fails, a first image including the current QR code and related information can be captured. Then, N second images with high similarity to the first image can be matched from the QR code image library. Users can then select the target image from the second images and complete the recognition by recognizing the target QR code in the target image, effectively improving the success rate of QR code recognition.
[0126] In some embodiments, each image in the QR code image library includes a third region and a fourth region. The third region is the area in each image to which the QR code belongs, and the fourth region is all other areas in each image except for the third region.
[0127] The processor 710 can also be used for:
[0128] The second region is matched with the fourth region of each image to determine N second images, wherein the similarity between the information indicated in the fourth region of the second image and the information indicated in the second region is greater than a first threshold.
[0129] Display unit 706 can also be used to display N second images.
[0130] In this way, the image can be divided into a QR code part and a non-QR code part. When the QR code part is damaged or blurred and cannot be recognized, the non-QR code part can be used to assist in matching, so as to identify N similar second images from the QR code image library, thereby improving the accuracy of QR code recognition.
[0131] In some embodiments, each image in the QR code image library includes a third region and a fourth region. The third region is the area in each image to which the QR code belongs, and the fourth region is all other areas in each image except for the third region.
[0132] The processor 710 can also be used for:
[0133] Match the second region with the fourth region of each image to determine M third images, where the information indicated in the fourth region of the third image is more similar to the information indicated in the second region than the second threshold.
[0134] Match the first region with the third region of each third image to determine N second images, where the information indicated by the third region of the third image is more similar to the information indicated by the first region than the third threshold, and M is a positive integer greater than or equal to N.
[0135] Display unit 706 can also be used to display N second images.
[0136] In this way, the image can be divided into a QR code part and a non-QR code part. Then, the non-QR code part can be matched first to identify M similar third images. Then, N similar second images with QR code parts can be matched from the M images. This further ensures the similarity between the second images and the first image, thereby further improving the accuracy of QR code recognition.
[0137] In some embodiments, the QR code image library also stores attribute information for each image, including location information. The processor 710 can also be used for:
[0138] Get current location information;
[0139] Compare the current location information with the location information of each second image;
[0140] The display unit 706 can also be used for:
[0141] Based on the comparison results, display N second images in the first order.
[0142] In this way, the N second images can be sorted according to their attribute information, so that the second image with location information that is closer to the current location information can be displayed first. This makes it easier for users to filter the target image that meets the requirements, thereby improving the convenience and success rate of QR code recognition.
[0143] In some embodiments, the attribute information includes time information and location information, and the processor 710 can also be used for:
[0144] If the QR code is successfully recognized, take a picture. The picture includes a third area and a fourth area. The third area is used to display the successfully recognized QR code image, and the fourth area is used to display other content besides the successfully recognized QR code image.
[0145] Store the image in the QR code image library.
[0146] In this way, the QR code image library can store multiple images containing QR codes that can be successfully recognized. Therefore, if the current QR code recognition fails, the library can be used to match and filter out the target image that meets the requirements for recognizing the target QR code in the target image, thereby improving the success rate of QR code recognition.
[0147] It should be understood that, in this embodiment, the input unit 704 may include a graphics processing unit (GPU) 7041 and a microphone 7042. The GPU 7041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 706 may include a display panel 7061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 707 includes at least one of a touch panel 7071 and other input devices 7072. The touch panel 7071 is also called a touch screen. The touch panel 7071 may include a touch detection device and a touch controller. Other input devices 7072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0148] The memory 709 can be used to store software programs and various data. The memory 709 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 709 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 709 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.
[0149] Processor 710 may include one or more processing units; optionally, processor 710 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 710.
[0150] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described QR code recognition method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0151] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0152] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described QR code recognition method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0153] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0154] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the QR code recognition method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0155] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0156] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0157] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A QR code recognition method, characterized in that, include: If the current QR code recognition fails, take a first image. The first image includes a first region and a second region. The first region is the region to which the current QR code belongs, and the second region is the other regions in the first image besides the first region. The first image is matched with all images in the QR code image library to display N second images, where the second images are images in the QR code image library that meet the preset conditions for similarity with the first image, and N is a positive integer; Receive a first input for a target image, wherein the target image is any one of the N second images; In response to the first input, the target QR code corresponding to the target image is identified; Each image in the QR code image library includes a third region and a fourth region. The third region is the area containing the QR code in each image, and the fourth region is all other areas in each image besides the third region. The process of matching the first image with all images in the QR code image library to display N second images includes: The second region is matched with the fourth region of each image to determine M third images, wherein the similarity between the information indicated in the fourth region of the third image and the information indicated in the second region is greater than a second threshold. The first region is matched with the third region of each of the third images to determine N second images, wherein the similarity between the information indicated in the third region of the third image and the information indicated in the first region is greater than a third threshold, and M is a positive integer and M is greater than or equal to N. Display the N second images.
2. The method according to claim 1, characterized in that, The QR code image library also stores attribute information for each image, including location information; The display of N second images includes: Get current location information; The current location information is compared with the location information of each of the second images; Based on the comparison results, the N second images are displayed in the first order.
3. The method according to claim 1, characterized in that, The method further includes: If the QR code is successfully recognized, an image is captured. The image includes a third region and a fourth region. The third region is used to display the successfully recognized QR code image, and the fourth region is used to display other content besides the successfully recognized QR code image. Store the image in the QR code image library.
4. A QR code recognition device, characterized in that, include: The camera module is used to capture a first image when the current QR code recognition fails. The first image includes a first region and a second region. The first region is the region to which the current QR code belongs, and the second region is the other regions in the first image excluding the first region. The display module is used to match the first image with all images in the QR code image library and display N second images, wherein the second images are images in the QR code image library that meet the preset conditions for similarity with the first image, and N is a positive integer; The receiving module is used to receive a first input to a target image, wherein the target image is any one of the N second images; The recognition module is used to recognize the target QR code in the target image in response to the first input; Each image in the QR code image library includes a third region and a fourth region. The third region is the area containing the QR code in each image, and the fourth region is all other areas in each image besides the third region. The display module is further used for: The second region is matched with the fourth region of each image to determine M third images, wherein the similarity between the information indicated in the fourth region of the third image and the information indicated in the second region is greater than a second threshold. The first region is matched with the third region of each of the third images to determine N second images, wherein the similarity between the information indicated in the third region of the third image and the information indicated in the first region is greater than a third threshold, and M is a positive integer and M is greater than or equal to N. Display the N second images.
5. The apparatus according to claim 4, characterized in that, The QR code image library also stores attribute information for each image, including location information; The display module is also used for: Get current location information; The current location information is compared with the location information of each of the second images; Based on the comparison results, the N second images are displayed in the first order.
6. The apparatus according to claim 4, characterized in that, The camera module is also used for: If the QR code is successfully recognized, an image is captured. The image includes a third region and a fourth region. The third region is used to display the successfully recognized QR code image, and the fourth region is used to display other content besides the successfully recognized QR code image. The device further includes: The storage module is used to store the image in a QR code image library.
Citation Information
Patent Citations
Information identification method and system, server and client
CN108491897A
Generating barcode and authenticating based on barcode
US20150227946A1