Graphic code recognition method, device, computer equipment and storage medium

By displaying the image partially on the screen and intercepting it, the problem of low accuracy in graphic code recognition is solved, and more efficient and accurate graphic code recognition is achieved.

CN115796212BActive Publication Date: 2025-08-26TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111053933.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-09
Publication Date
2025-08-26
Estimated Expiration
2041-09-09

AI Technical Summary

Technical Problem

In the prior art, the accuracy of graphic code recognition is low, especially when the image size is large, it is difficult to effectively identify the graphic code.

Method used

When displaying the target image on the screen, when judging that the image display method is a local display and the size measurement value is greater than the standard measurement value, the image area displayed in the target image in the screen is intercepted to obtain a local display image, and the graphics code is recognized based on the local display image.

Benefits of technology

It improves the accuracy and efficiency of graphic code recognition, saves computer resources, reduces feature loss due to direct compression, and improves the recognition success rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115796212B_ABST
    Figure CN115796212B_ABST
Patent Text Reader

Abstract

The present application relates to a method, apparatus, computer equipment and storage medium for graphic code recognition. The graphic code recognition method provided by the present application can be applied to various scenarios such as cloud technology, AI (Artificial Intelligence), smart transportation and vehicle-mounted. The method comprises: displaying a target image on a screen; obtaining an image display mode of the target image in response to a graphic code recognition instruction for the target image; when the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value, intercepting the image area displayed on the screen in the target image to obtain a partial display image; performing graphic code recognition based on the partial display image to obtain a graphic code recognition result corresponding to the target image. The use of this method can improve the accuracy of graphic code recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer device, and storage medium for recognizing a graphic code. Background Art

[0002] With the rapid development of Internet technology, in order to improve the convenience of obtaining information and information security, people have proposed to encode information through specific geometric shapes to store or represent various types of data, such as QR codes or barcodes.

[0003] In practical applications, the image of the graphic code is captured by a camera to identify the graphic code, so that information corresponding to the graphic code can be obtained. For example, by identifying a QR code in an image, the information contained in the QR code can be obtained.

[0004] However, since images containing graphic codes may be diverse, it is difficult to recognize a QR code from an image, resulting in low accuracy in graphic code recognition. Summary of the Invention

[0005] Based on this, it is necessary to provide a graphic code recognition method, device, computer equipment and storage medium that can improve the accuracy of graphic code recognition in order to solve the above technical problems.

[0006] A method for recognizing a graphic code, the method comprising: displaying a target image on a screen; obtaining an image display mode of the target image in response to a graphic code recognition instruction for the target image; when the image display mode is partial display and a size measurement value of the target image is greater than a standard measurement value, intercepting an image area of ​​the target image displayed on the screen to obtain a partial display image; and performing graphic code recognition based on the partial display image to obtain a graphic code recognition result corresponding to the target image.

[0007] A graphic code recognition device, the device comprising: a target image display module for displaying a target image on a screen; an image display mode acquisition module for acquiring the image display mode of the target image in response to a graphic code recognition instruction for the target image; a partial display image acquisition module for intercepting an image area of ​​the target image displayed on the screen to obtain a partial display image when the image display mode is partial display and a size measurement value of the target image is greater than a standard measurement value; and a graphic code recognition result acquisition module for performing graphic code recognition based on the partial display image to obtain a graphic code recognition result corresponding to the target image.

[0008] In some embodiments, the partial display image obtaining module includes: a size comparison result obtaining unit, which is used to obtain the size comparison result of the size measurement value of the target image and the standard measurement value when it is determined that the image display mode is partial display; and a partial display image obtaining unit, which is used to intercept the image area displayed on the screen in the target image when the size comparison result indicates that the size measurement value of the target image is greater than the standard measurement value to obtain a partial display image.

[0009] In some embodiments, the size measurement value includes an image size ratio, and the standard measurement value includes a screen size ratio; the size comparison result acquisition unit is further used to obtain the image size ratio of the target image between different size dimensions, and obtain the screen size ratio of the screen between different size dimensions; compare the image size ratio with the screen size ratio to obtain a size comparison result.

[0010] In some embodiments, the device further includes: an image magnification prompt information display module, which is used to display image magnification prompt information corresponding to the target image when the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, and the image magnification prompt information is used to prompt the enlarged display of the graphic code area of ​​the target image; a display mode switching module, which is used to enlarge and display the target image when a magnification operation on the target image is detected, and when it is determined that the image display mode is switched to partial display, enter the step of intercepting the image area of ​​the target image displayed on the screen to obtain a partial display image.

[0011] In some embodiments, the image magnification prompt information display module includes: an image resolution acquisition unit, used to obtain the image resolution of the target image when the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value; an image magnification prompt information display unit, used to display the image magnification prompt information corresponding to the target image when the image resolution is greater than the resolution threshold.

[0012] In some embodiments, the device also includes: a compressed image acquisition module, which is used to compress the target image according to the resolution compression index when the image resolution is less than the resolution threshold to obtain a compressed image; and a graphic code recognition module, which is used to perform graphic code recognition on the compressed image to obtain a graphic code recognition result.

[0013] In some embodiments, the device further includes: a target graphic code recognition result acquisition module, which is used to determine the current display area in the target image in response to the graphic code recognition result acquisition operation, and obtain the target graphic code recognition result to be displayed based on the current display area; and a target graphic code recognition result display module, which is used to display the target graphic code recognition result.

[0014] In some embodiments, the target graphic code recognition result acquisition module includes:

[0015] a first target graphic code recognition result obtaining unit, configured to, when a corresponding valid graphic code recognition result exists in the current display area, use the valid graphic code recognition result corresponding to the current display area as a target graphic code recognition result;

[0016] The second target graphic code recognition result obtaining unit is configured to use the valid historical graphic code recognition result corresponding to the target image as the target graphic code recognition result when there is no corresponding valid graphic code recognition result in the current display area.

[0017] In some embodiments, the first target graphic code recognition result obtaining unit is further used to determine a local display image whose overlap with the current display area is greater than an overlap threshold as an overlapping display area; when a valid graphic code recognition result is identified in the overlapping display area, it is determined that a corresponding valid graphic code recognition result exists in the current display area, and the valid graphic code recognition result corresponding to the current display area is used as the target graphic code recognition result.

[0018] In some embodiments, the device further includes: an entry hiding module, which is used to hide the entry for obtaining the graphic code result of the target image when it is determined based on the graphic code recognition result that no graphic code exists in the target image; a moving operation response module, which is used to, in response to a moving operation on the target image, re-enter the step of capturing the image area displayed on the screen in the target image to obtain a partial display image, so as to perform graphic code recognition again; and an entry display module, which is used to display the entry for obtaining the graphic code result of the target image when it is determined based on the graphic code recognition result obtained by re-recognition that a graphic code exists in the target image.

[0019] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned graphic code recognition method when executing the computer program.

[0020] A computer-readable storage medium stores a computer program, which implements the steps of the above-mentioned graphic code recognition method when executed by a processor.

[0021] In some embodiments, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of each of the above method embodiments.

[0022] The above-mentioned graphic code recognition method, device, computer equipment and storage medium display a target image on the screen, and in response to a graphic code recognition instruction for the target image, obtain an image display mode of the target image. When the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value, the image area displayed on the screen in the target image is intercepted to obtain a partial display image, and graphic code recognition is performed based on the partial display image to obtain a graphic code recognition result corresponding to the target image. Since the size measurement value of the target image is greater than the standard measurement value, it means that the image size is larger. The partial display image is obtained by interception, so it can save computer resources occupied by recognition and improve the recognition efficiency of image-based graphic code recognition. Moreover, since the graphic code contained in the partial intercepted image can be more obvious, the recognition accuracy can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 A diagram showing an application environment of a graphic code recognition method in some embodiments;

[0024] Figure 2 Schematic diagram of the flow of a method for recognizing a graphic code in some embodiments;

[0025] Figure 3 is a schematic diagram of displaying a long image on a screen in some embodiments;

[0026] Figure 4 is a schematic diagram of displaying a wide image on a screen in some embodiments;

[0027] Figure 5 is a schematic diagram of displaying an enlarged wide image on a screen in some embodiments;

[0028] Figure 6 A schematic diagram of displaying image magnification prompt information on a screen in some embodiments;

[0029] Figure 7 A schematic diagram of displaying image magnification prompt information on a screen in some embodiments;

[0030] Figure 8 A schematic diagram of a schematic diagram of graphic code recognition in some embodiments;

[0031] Figure 9A schematic diagram showing an entry for obtaining a graphic code result in some embodiments;

[0032] Figure 10 Schematic diagram of the flow of a method for recognizing a graphic code in some embodiments;

[0033] Figure 11 is a structural block diagram of a graphic code recognition device in some embodiments;

[0034] Figure 12 is a diagram of the internal structure of a computer device in some embodiments;

[0035] Figure 13 1 is a diagram of the internal structure of a computer device in some embodiments. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0037] The graphic code recognition method provided in this application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 via a network. The terminal 102 may be installed with application software, such as instant messaging software or shopping applications, and the terminal 102 displays images obtained through the application software.

[0038] Specifically, the terminal 102 displays a target image on the screen. In response to a graphic code recognition instruction for the target image, the terminal 102 obtains an image display mode for the target image. When the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value, the terminal 102 captures the image area displayed on the screen of the target image to obtain a partial display image. Graphic code recognition is performed based on the partial display image to obtain a graphic code recognition result corresponding to the target image. The graphic code recognition result can be obtained by the terminal 102 or by the server 104. For example, when the terminal 102 obtains the partial display image, the terminal 102 can send a graphic code recognition request to the server 104, and the graphic code recognition request can include the partial display image. The server 104 can perform graphic code recognition on the partial display image in response to the graphic code recognition request to obtain a graphic code recognition result corresponding to the target image. The server 104 can store the graphic code recognition result and return the graphic code recognition result to the terminal 102.

[0039] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, vehicle-mounted terminals, tablet computers, and portable wearable devices, and the server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0040] In some embodiments, as Figure 2 As shown, a graphic code recognition method is provided, which is applied to Figure 1 Taking the terminal 102 in FIG. 1 as an example, the method includes the following steps:

[0041] S202, displaying the target image on the screen.

[0042] The target image can be an image stored in the terminal or obtained by the terminal from another device, such as an image received by an application installed in the terminal, such as an image received by an instant messaging application installed in the terminal. The screen refers to the display device installed on the terminal. For example, if the terminal is a mobile phone, the screen is the mobile phone screen, and if the terminal is a laptop, the screen is the laptop screen.

[0043] The target image may include a graphic code. A graphic code is a graphic generated by encoding characters or strings that express meaning. Graphic codes can include at least one of a barcode, a QR code, or a mini-program code. A barcode is a graphic identifier that represents a set of information by arranging multiple black bars and spaces of varying widths according to a specific encoding rule. Common barcodes are parallel patterns of black bars and spaces with significantly different reflectivities. A QR code, on the other hand, is a barcode that uses a specific geometric pattern to record data symbols in a two-dimensional plane using alternating black and white patterns distributed according to a specific pattern. A QR code is a graphic that uses a specific geometric pattern to record data symbols in a two-dimensional plane using alternating black and white patterns distributed according to a specific pattern. By recognizing a graphic code, the information carried by the graphic code can be obtained. For example, QR code recognition can decode and read the information contained in the QR code. For example, if the information carried by the graphic code is a website, recognizing the graphic code can obtain the website address carried by the graphic code. By decoding the graphic code, the information corresponding to the graphic code before encoding can be obtained. For example, if the text "ABC" is encoded as a QR code, decoding the QR code can obtain the text "ABC". A QR code is a coding method that can store more information than a traditional barcode.

[0044] Specifically, the terminal can display the target image on the screen according to the target image display method. For example, when previewing the image, the picture preview page corresponding to the target image can be displayed on the screen. The target image display method can be pre-set. For example, the target image display method can be any one of a partial display method and a full display method. Partial display means that a part of the target image but not the whole is displayed on the screen, that is, there is an image area in the target image that is not displayed on the screen. The full display method means that the entire area of ​​the target image is displayed on the screen, that is, there is no image area in the target image that is not displayed on the screen.

[0045] In some embodiments, the target image display method can be determined according to the image type, and the image type includes large images and non-large images. The large image can include at least one of a long image or a wide image, wherein the long image refers to an image whose image aspect ratio is greater than the aspect ratio threshold, and the wide image refers to an image whose image aspect ratio is greater than the aspect ratio threshold. The aspect ratio threshold can be preset or determined according to the screen aspect ratio, for example, the aspect ratio threshold is positively correlated with the screen aspect ratio, and the aspect ratio threshold can be, for example, twice the screen aspect ratio. The aspect ratio threshold can be preset or determined according to the screen aspect ratio, for example, the aspect ratio threshold is positively correlated with the screen aspect ratio, and the aspect ratio threshold can be, for example, twice the screen aspect ratio. For example, when the screen aspect ratio is 16:9, if the target image is an activity poster picture with a resolution of 1001*8198 and a QR code at the bottom, wherein the single digits of 1001 and 8198 are 1001 represents the pixel size of the width, and 8198 represents the pixel size of the height. Since the ratio of 8198:1001 is greater than twice the ratio of 16:9, the target image is a wide image. For example, if the screen aspect ratio is 9:16, and the target image is a picture containing a QR code with a resolution of 1330*771, where 1330 and 771 represent pixels, 1330 represents the pixel size of the width, and 771 represents the pixel size of the height, since the ratio of 1330:771 is greater than twice the ratio of 9:16, the target image is a long image. When the terminal determines that the target image is a long image, it determines the target image display mode to be partial display mode, and displays the target image on the screen in this partial display mode. When the terminal determines that the target image is a wide image, it determines the target image display mode to be full display mode, and displays the target image on the screen in this full display mode.

[0046] The screen aspect ratio is the ratio of the screen's width to its height. The screen height ratio is the ratio of the screen's height to its width. The image aspect ratio is the ratio of the target image's width to its height. The image height ratio is the ratio of the target image's height to its width.

[0047] like Figure 3As shown in the figure, a schematic diagram of displaying the length in a partial display manner is shown. As can be seen from the figure, the image is not fully displayed on the screen, such as Figure 4 As shown, a schematic diagram of displaying a wide image in full display mode is shown. As can be seen from the figure, the image is fully displayed on the screen, and the upper and lower areas of the screen are filled with blank spaces. For a wide image that is fully displayed on the screen, if a screenshot is taken and the image obtained by the screenshot is subjected to graphic code recognition, the difficulty of graphic code recognition increases because the screenshot image includes blank areas. Therefore, for a wide image that is fully displayed on the screen, graphic code recognition can be performed on the wide image itself, or the user can be instructed to zoom in on the width, zoom in on the wide image and display it on the screen, then take a screenshot of the screen, and use the screenshot to perform graphic code recognition, thereby improving the accuracy of graphic code recognition.

[0048] S204 , in response to the graphic code recognition instruction for the target image, obtaining an image display mode of the target image.

[0049] The graphic code recognition instruction is used to instruct to perform graphic code recognition on the target image. The image display mode can be either full display or partial display.

[0050] Specifically, the graphical code recognition instruction can be automatically triggered by the terminal. When the terminal displays the target image on the screen, the terminal can automatically trigger the graphical code recognition instruction. The graphical code recognition instruction can also be triggered by a user operation. For example, when the terminal obtains a graphical code recognition operation on the target image, the graphical code recognition instruction can be triggered. The graphical code recognition operation is used to trigger the graphical code recognition instruction. The graphical code recognition operation can be, for example, any of the following operations: clicking, double-clicking, or sliding on the target image. The graphical code recognition instruction can also be triggered in response to an operation to move the image.

[0051] In some embodiments, the terminal may display a graphic code recognition control, and when the terminal obtains a triggering operation on the graphic code recognition control, it determines that a graphic code recognition instruction is obtained.

[0052] In some embodiments, the terminal may, in response to a graphic code recognition instruction for a target image, obtain an image display mode of the target image, determine a recognition image corresponding to the target image based on the image display mode of the target image, and obtain a recognition result obtained by recognizing the recognition image as a graphic code recognition result for the target image. The recognition image refers to an image for which graphic code recognition is to be performed, and the recognition image is determined based on the target image. For example, the target image may be used as the recognition image, or an image region within the target image may be used as the recognition image.

[0053] S206 , when the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value, the image area displayed on the screen in the target image is intercepted to obtain a partial display image.

[0054] The partially displayed image includes the portion of the target image displayed on the screen. The size measurement value can be obtained based on image size information, which can include at least one of the image width, image height, image aspect ratio, or image height-to-width ratio. The standard measurement value can be preset or determined based on the screen size information. The screen size information can include at least one of the screen width, screen height, screen aspect ratio, or screen height-to-width ratio. The partially displayed image includes the image area of ​​the target image displayed on the screen.

[0055] Specifically, the terminal can respond to a graphic code recognition instruction for the target image to obtain the image display mode of the target image. When it is determined that the image display mode of the target image is a partial display mode, the size measurement value of the target image is determined based on the image size information, and the size measurement value is compared with the standard measurement value based on the screen size information. When it is determined that the size measurement value is greater than the standard measurement value, the image area displayed on the screen in the target image is captured to obtain a partial display image.

[0056] In some embodiments, when the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value, the image area of ​​the target image displayed on the screen is captured, and the step of obtaining the partial display image includes: when the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value, triggering a screenshot instruction, and in response to the screenshot instruction, capturing the content displayed on the screen to obtain a partial display image, and the partial display image includes the image area of ​​the target image displayed on the screen.

[0057] In some embodiments, the terminal may determine a metric threshold based on a standard metric value. The metric threshold is positively correlated with the standard metric value. For example, a target multiple of the standard metric value may be used as the metric threshold. The target multiple can be preset or set as needed, for example, 2. The terminal may compare the size metric value with the metric threshold. If the size metric value is determined to be greater than the metric threshold, the terminal captures the image area displayed on the screen within the target image to obtain a partial display image. A positive correlation means that, with other conditions remaining unchanged, two variables change in the same direction. When one variable changes from large to small, the other variable also changes from large to small. It should be understood that a positive correlation here means that the direction of change is consistent, but does not require that a slight change in one variable necessarily causes a change in the other. For example, when variable a is between 10 and 20, variable b is set to 100, and when variable a is between 20 and 30, variable b is set to 120. In this way, both a and b change in the same direction: when a increases, b also increases. However, when a is within the range of 10 to 20, b may not change.

[0058] In some embodiments, the size measurement value includes the image aspect ratio, and the standard measurement value includes the screen aspect ratio. The terminal can compare the image aspect ratio with the screen aspect ratio. When it is determined that the image aspect ratio is greater than the screen aspect ratio, the image area displayed on the screen in the target image is cut out to obtain a partially displayed image.

[0059] In some embodiments, the size measurement value includes the image aspect ratio, the standard measurement value includes the screen aspect ratio, and the measurement value threshold includes the aspect ratio threshold. The terminal can determine the aspect ratio threshold based on the screen aspect ratio, compare the image aspect ratio with the aspect ratio threshold, and when it is determined that the image aspect ratio is greater than the aspect ratio threshold, that is, when it is determined that the target image is a long image, the image area displayed on the screen in the target image is cut out to obtain a partially displayed image.

[0060] In some embodiments, the size measurement value includes the image aspect ratio, the standard measurement value includes the screen aspect ratio, and the measurement value threshold includes the aspect ratio threshold. The terminal can determine the aspect ratio threshold based on the screen aspect ratio, compare the image aspect ratio with the aspect ratio threshold, and when it is determined that the image aspect ratio is greater than the aspect ratio threshold, that is, when it is determined that the target image is a wide image, the image area displayed on the screen in the target image is cut out to obtain a partially displayed image.

[0061] In some embodiments, the terminal may compare the image aspect ratio with an aspect ratio threshold, and compare the image width ratio with an aspect ratio threshold. When either the image aspect ratio is greater than the aspect ratio threshold or the image width ratio is greater than the aspect ratio threshold, that is, when the target image is a long image or the target image is a wide image, the image area displayed on the screen in the target image is captured to obtain a partially displayed image.

[0062] S208: Perform graphic code recognition based on the partial display image to obtain a graphic code recognition result corresponding to the target image.

[0063] Among them, the graphic code recognition result is the result obtained by performing graphic code recognition. When the target image includes a graphic code, the graphic code recognition result corresponding to the target image is used to indicate that the target image includes a graphic code, and the graphic code recognition result corresponding to the target image may include the result obtained by parsing the graphic code in the target image. When the target image does not include a graphic code, the graphic code recognition result corresponding to the target image is used to indicate that no graphic code exists in the target image.

[0064] Specifically, the terminal may perform graphic code recognition on the partial display image and use the recognition result as the graphic code recognition result corresponding to the target image. The terminal may store the graphic code recognition result and may also send the graphic code recognition result to a server, which may store the graphic code recognition result. The terminal may perform image compression processing on the partial display image to obtain a compressed partial display image, perform graphic code recognition on the compressed partial display image, and use the recognition result as the graphic code recognition result corresponding to the target image.

[0065] In some embodiments, the terminal may send a partial display image to a server, which may recognize the partial display image and use the recognition result as the graphic code recognition result corresponding to the target image. The server may store the graphic code recognition result and return the graphic code recognition result to the terminal. The server may perform image compression on the partial display image to obtain a compressed partial display image, perform graphic code recognition on the compressed partial display image, and use the recognition result as the graphic code recognition result corresponding to the target image. Taking a screenshot of the partial display image before compression and using the partial display image for graphic code recognition, rather than directly compressing the target image, can reduce recognition failures caused by feature loss due to direct compression of the target image, thereby improving the accuracy of graphic code recognition.

[0066] In some embodiments, a graphic code recognition module may be stored in the terminal, and the terminal may use a graphic code recognition model to perform graphic code recognition. The graphic code recognition model is a module for recognizing graphic codes, such as a module for recognizing QR codes. The graphic code recognition model may be a QBar interface, and the terminal may call the QBar interface to perform graphic code recognition.

[0067] In some embodiments, when the terminal obtains the graphic code recognition result acquisition operation, the terminal may obtain the graphic code recognition result and display the graphic code recognition result.

[0068] In some embodiments, when the graphic code recognition result indicates the presence of a graphic code, the graphic code recognition result can be referred to as a valid recognition result. The terminal obtains the graphic code recognition result obtained by performing graphic code recognition on the partial display image. When the graphic code recognition result is a valid recognition result, a correspondence is established between the partial display image and the graphic code recognition result, and the correspondence is stored. Of course, the correspondence between the partial display image and the graphic code recognition result can also be established by the service, and the server can send the established correspondence to the terminal. The target image can include one or more graphic codes, the partial display image can have one or more, and the partial display image may or may not include a graphic code. The graphic code recognition result corresponding to the target image can include the graphic code recognition results obtained by recognizing each partial display image.

[0069] In the above-mentioned graphic code recognition method, a target image is displayed on the screen, and in response to a graphic code recognition instruction for the target image, an image display mode of the target image is obtained. When the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value, the image area displayed on the screen in the target image is intercepted to obtain a partial display image, and graphic code recognition is performed based on the partial display image to obtain a graphic code recognition result corresponding to the target image. Since the size measurement value of the target image is greater than the standard measurement value, it means that the image size is larger. The partial display image is obtained by interception, so it can save computer resources occupied by recognition and improve the recognition efficiency of image-based graphic code recognition. Moreover, since the graphic code contained in the partial intercepted image can be more obvious, the recognition accuracy can be improved.

[0070] In some embodiments, when the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value, the image area displayed on the screen in the target image is captured to obtain a partial display image, including: when it is determined that the image display mode is partial display, obtaining a size comparison result between the size measurement value of the target image and the standard measurement value; when the size comparison result indicates that the size measurement value of the target image is greater than the standard measurement value, capturing the image area displayed on the screen in the target image to obtain a partial display image.

[0071] The size comparison result is a result obtained by comparing the size measurement value with the standard measurement value. The size measurement value may include an image size ratio, which may include at least one of an image aspect ratio or an image height-to-width ratio. The standard measurement value includes a screen size ratio, which may include at least one of a screen aspect ratio or a screen height-to-width ratio.

[0072] Specifically, when the terminal determines that the image display mode is partial display, the terminal obtains and compares the size measurement value of the target image with the standard measurement value to obtain a size comparison result. If the size measurement value is determined to be greater than the standard measurement value, the terminal intercepts the image area displayed on the screen in the target image to obtain a partial display image. For example, the terminal may compare the image aspect ratio with the screen aspect ratio, and the image height ratio with the screen aspect ratio. If the image aspect ratio is greater than the screen aspect ratio or the image height ratio is greater than the screen aspect ratio, the terminal intercepts the image area displayed on the screen in the target image to obtain a partial display image.

[0073] In some embodiments, the terminal may compare the size measurement value of the target image with the standard measurement value. When it is determined that the size measurement value is greater than a target multiple of the standard measurement value, the image area of ​​the target image displayed on the screen is captured to obtain a partial display image.

[0074] In this embodiment, when it is determined that the image display mode is partial display, a size comparison result between the size measurement value of the target image and the standard measurement value is obtained. When the size comparison result indicates that the size measurement value of the target image is greater than the standard measurement value, the image area displayed on the screen in the target image is intercepted to obtain a partial display image. When the image size is large, the partial display image can be obtained. Therefore, when the image size is large, the partial display image is used for graphic code recognition instead of the target image, thereby improving the accuracy of graphic code recognition.

[0075] In some embodiments, the size measurement value includes an image size ratio, and the standard measurement value includes a screen size ratio; obtaining a size comparison result between the size measurement value of the target image and the standard measurement value includes: obtaining an image size ratio of the target image between different size dimensions, obtaining a screen size ratio of the screen between different size dimensions; comparing the image size ratio with the screen size ratio to obtain a size comparison result.

[0076] The size dimension includes width and height, the image size ratio includes at least one of the image aspect ratio or the image height-to-width ratio, and the screen size ratio includes at least one of the screen aspect ratio or the screen height-to-width ratio. The size comparison result is obtained by comparing the image size ratio with the screen size ratio.

[0077] Specifically, the size comparison result may include at least one of an aspect ratio comparison result or a height-to-width ratio comparison result. The terminal may compare the image aspect ratio with the screen aspect ratio to obtain the aspect ratio comparison result. The terminal may compare the image height-to-width ratio with the screen aspect ratio to obtain the aspect ratio comparison result. When the image aspect ratio is greater than the screen aspect ratio or the image height-to-width ratio is greater than the screen aspect ratio, the image area of ​​the target image displayed on the screen is cropped to obtain a partially displayed image.

[0078] In some embodiments, when the image display mode is partial display and the image size ratio is greater than the screen size ratio, the image area of ​​the target image displayed on the screen is cut out to obtain the partial display image. For example, when the image display mode is partial display, when the image aspect ratio is greater than the screen aspect ratio or the image height aspect ratio is greater than the screen height aspect ratio, the image area of ​​the target image displayed on the screen is cut out to obtain the partial display image.

[0079] In this embodiment, the image size ratio of the target image between different size dimensions is obtained, the screen size ratio of the screen between different size dimensions is obtained, the image size ratio is compared with the screen size ratio, and the size comparison result is obtained. Comparing the size ratios can accurately reflect the relationship between the image size and the screen size.

[0080] In some embodiments, when the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, the image magnification prompt information corresponding to the target image is displayed, and the image magnification prompt information is used to prompt the enlarged display of the graphic code area of ​​the target image; when a magnification operation on the target image is detected, the target image is magnified and displayed. When it is determined that the image display mode is switched to partial display, the step of capturing the image area displayed on the screen in the target image is entered to obtain a partial display image.

[0081] The image magnification prompt is used to prompt the user to magnify the graphic code area of ​​the target image. The location where the image magnification prompt is displayed can be pre-set, for example, within the image display area (the image display area refers to the area occupied by the image on the screen). The image magnification prompt can also be displayed outside the image display area. The location of the image magnification prompt can also be set as needed. The image magnification prompt can be pre-set, for example, "Please magnify the image to facilitate identification of the graphic code within the image." The graphic code area refers to the area of ​​the image containing the graphic code.

[0082] The target image enlarging operation may include enlarging the width of the target image, enlarging the height, or enlarging both the width and height. For example, when a enlarging operation on the target image is detected, the target image is enlarged proportionally, that is, the width and height of the target image are enlarged by the same multiples.

[0083] Specifically, when the terminal determines that the image display mode of the target image is full display, the terminal can compare the size measurement value of the target image with the standard measurement value, for example, the image size ratio can be compared with the screen size ratio. When it is determined that the size measurement value is greater than the standard measurement value, the image magnification prompt information corresponding to the target image is triggered. When the terminal detects the magnification operation on the target image, the terminal magnifies and displays the target image. Since the target image before magnification is fully displayed, the target image after magnification may be converted from full display to partial display. When the image is converted from full display to partial display, the target image meets the condition that "the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value". Therefore, the terminal can intercept the image area displayed on the screen in the target image to obtain a partial display image, so as to perform graphic code recognition based on the partial display image. Figure 5 As shown, the display target image is switched from full display to partial display.

[0084] In some embodiments, when the image display mode is full display, the terminal may compare the size measurement value with a measurement value threshold. If the size measurement value is determined to be greater than the measurement value threshold, an image zoom prompt corresponding to the target image may be displayed. For example, if the size measurement value is the image aspect ratio, the standard measurement value is the screen aspect ratio, and the measurement value threshold is the aspect ratio threshold, the terminal may compare the image aspect ratio with the aspect ratio threshold. If the image aspect ratio is determined to be greater than the aspect ratio threshold, an image zoom prompt corresponding to the target image may be displayed.

[0085] In some embodiments, when the target image is a wide image and the image display mode of the target image is full display, an image zoom prompt message may be displayed. For example, Figure 6As shown, an interface diagram of displaying image magnification prompt information in some embodiments is shown, and image A is displayed in full display mode on the screen. When the terminal determines that the image aspect ratio of image A is greater than the target multiple of the screen aspect ratio, that is, when image A is determined to be a wide image, the image magnification prompt information "Please enlarge the image to facilitate the identification of the graphic code in the image" is displayed.

[0086] In some embodiments, when the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, the terminal obtains the image resolution of the target image and, based on the image resolution of the target image, determines whether to display image magnification prompt information corresponding to the target image. For example, the terminal may compare the image resolution of the target image with a resolution threshold. When it is determined that the image resolution is greater than the resolution threshold, the image magnification prompt information corresponding to the target image is displayed. When it is determined that the image resolution is less than the resolution threshold, the image magnification prompt information corresponding to the target image is not displayed. The resolution threshold can be preset or determined based on the screen resolution. For example, the resolution threshold can be positively correlated with the screen resolution, and the resolution threshold can be, for example, twice the screen resolution. Screen resolution refers to the resolution of the screen.

[0087] In this embodiment, when the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, the image magnification prompt information corresponding to the target image is displayed. The image magnification prompt information is used to prompt the enlarged display of the graphic code area of ​​the target image. When a magnification operation on the target image is detected, the target image is magnified and displayed. When it is determined that the image display mode is switched to partial display, the step of intercepting the image area displayed on the screen in the target image is entered to obtain a partial display image. This realizes the use of the image magnification prompt information to guide the user to magnify the graphic code area in the image, thereby improving the accuracy of graphic code recognition.

[0088] In some embodiments, when the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, displaying the image magnification prompt information corresponding to the target image includes: when the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, obtaining the image resolution of the target image; when the image resolution is greater than the resolution threshold, displaying the image magnification prompt information corresponding to the target image.

[0089] The resolution threshold may be preset or determined according to the screen resolution. For example, the resolution threshold may be positively correlated with the screen resolution, and the resolution threshold may be, for example, twice the screen resolution. The screen resolution refers to the resolution of the screen.

[0090] Specifically, the terminal may obtain an image display mode of the target image, and when it is determined that the image display mode of the target image is full display, compare the size measurement value of the target image with the standard measurement value, and when it is determined that the size measurement value is greater than the standard measurement value, obtain the image resolution of the target image, compare the image resolution with the resolution threshold, and when it is determined that the image resolution is greater than the resolution threshold, display the image zoom prompt information corresponding to the target image. Of course, the terminal may first compare the size measurement value with the standard measurement value. For example, the terminal may compare the size measurement value of the target image with the standard measurement value, and when it is determined that the size measurement value is greater than the standard measurement value, obtain the image display mode of the target image, and when it is determined that the image display mode of the target image is full display, obtain the image resolution of the target image, compare the image resolution with the resolution threshold, and when it is determined that the image resolution is greater than the resolution threshold, display the image zoom prompt information corresponding to the target image.

[0091] For example, Figure 7 As shown, an interface diagram of displaying image magnification prompt information in some embodiments is shown. Image A is displayed in full display mode on the screen. When the terminal determines that the size measurement value of image A is greater than the standard measurement value, the resolution of image A is judged. When the resolution of image A is greater than the resolution threshold, the image magnification prompt information "The resolution of the image is too large, please enlarge the image to facilitate the recognition of the graphic code in the image" is displayed.

[0092] In this embodiment, when the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, the image resolution of the target image is obtained. When the image resolution is greater than the resolution threshold, the image magnification prompt information corresponding to the target image is displayed. This ensures that the image magnification prompt information is displayed only when the image resolution is large, thereby reducing the display of unnecessary image magnification prompt information, reducing interference to users, and improving user experience.

[0093] When the image is fully displayed on the screen and the image size is large, if the image resolution is large, if the image is directly identified as a graphic code, it will not be recognized normally due to the large amount of data. If the screen is directly captured, the amount of data of the captured image is also very large, and the QR code in the image cannot be correctly identified. The graphic code recognition method provided in the embodiment of the present application can be used to enlarge the image when the resolution is large, and then a screenshot can be taken for recognition after enlargement, thereby improving the accuracy of graphic code recognition.

[0094] In some embodiments, the method further includes: when the image resolution is less than a resolution threshold, compressing the target image according to a resolution compression index to obtain a compressed image; and performing graphic code recognition on the compressed image to obtain a graphic code recognition result.

[0095] Resolution (Pixels Per Inch) refers to the number of pixels per inch. A resolution compression index is an indicator used to compress the resolution of an image. A compressed image is an image obtained by compressing the resolution of a target image. Since compressing the resolution of an image compresses the pixels of the image, the resolution compression index can also be called a pixel compression index. The resolution compression index can be a resolution, for example, the resolution of the compressed image. The resolution compression index can be preset, for example, 1920 pixels.

[0096] Specifically, the resolution compression index can be a pixel size threshold, which can be, for example, 1920 pixels. When the image resolution is less than the resolution threshold, the target image is compressed according to the resolution compression index. The step of obtaining a compressed image includes: when the image resolution is less than the resolution threshold, obtaining the pixel size corresponding to the long side of the target image as the long side pixel size, comparing the long side pixel size with the pixel size threshold, and when the long side pixel size is greater than the pixel size threshold, compressing the target image to obtain a compressed image, where the pixel size of the long side of the compressed image is less than or equal to the pixel size threshold. The long side refers to the larger of the width and height of the image. For example, if the width of a graphic is greater than the height of the image, the long side refers to the width of the image. The width refers to the width of the width, and the height refers to the height of the height. The width refers to the horizontal side, and the height refers to the vertical side. For example, if the image resolution is 1001*8198 and the pixel size threshold is 1920 pixels, then after proportional compression, the image resolution becomes 235*1920.

[0097] like Figure 8 As shown, when performing image recognition, first check whether the image is fully displayed on the screen. When it is determined that the image is partially displayed, screenshot recognition is performed, otherwise the image features may be lost and the QR code recognition may be difficult. Then check whether the aspect ratio of the image exceeds twice the aspect ratio of the screen or whether the height-to-width ratio of the image exceeds twice the height-to-width ratio of the screen. If so, the image is marked as a large image and screenshot recognition is performed. If there is a large image mark, the current visible area of ​​the screen is captured. Otherwise, the image itself is used for the next step of processing to determine whether the long side of the image exceeds 1920 pixels. 1920 pixels is the pixel size threshold. If it exceeds, the long side of the image is proportionally compressed to 1920 pixels, and the Qbar interface is called for recognition. That is, when the aspect ratio of the image exceeds twice the aspect ratio of the screen or the height-to-width ratio of the image exceeds twice the height-to-width ratio of the screen, if the long side of the image exceeds 1920 pixels, the image is compressed and the compressed image is used for QR code recognition.

[0098] In some embodiments, when the pixel size of the long side is smaller than the pixel size threshold, the terminal may perform image recognition on the target image to obtain a graphic code recognition result.

[0099] In this embodiment, when the image resolution is less than the resolution threshold, the target image is compressed according to the resolution compression index to obtain a compressed image, and graphic code recognition is performed on the compressed image to obtain a graphic code recognition result. By compressing the image, the amount of image data is reduced, memory usage is saved, and the efficiency of graphic code recognition is improved.

[0100] In some embodiments, the method further includes: in response to the graphic code recognition result acquisition operation, determining the current display area in the target image, acquiring the target graphic code recognition result to be displayed based on the current display area; and displaying the target graphic code recognition result.

[0101] The graphic code recognition result acquisition operation is used to obtain the graphic code recognition result. The current display area refers to the image area within the target image currently displayed on the screen. The current display area may or may not contain a graphic code. The target graphic code recognition result is a valid recognition result.

[0102] Specifically, the terminal obtains a graphic code recognition result obtained by performing graphic code recognition on a partial display image. When the graphic code recognition result is a valid recognition result, a correspondence is established between the partial display image and the graphic code recognition result, and the correspondence is stored. The terminal can display a graphic code result acquisition entry. When a trigger operation is received on the graphic code result acquisition entry, the terminal determines that a graphic code recognition result acquisition operation has been obtained. Based on the correspondence between the partial display image and the graphic code recognition result, the terminal determines whether there is a graphic code recognition result corresponding to the current display area. For example, the terminal matches the current display area with the partial display image in the correspondence. When the match is consistent, the graphic code recognition result corresponding to the matching partial display image is used as the target graphic code recognition result to be displayed. When the match is inconsistent, the terminal can select a target graphic code recognition result from the valid recognition results corresponding to the target image, for example, the most recently recognized valid recognition result can be used as the target graphic code recognition result.

[0103] In some embodiments, when the terminal determines that there is a valid recognition result in the target image, the graphic code result acquisition entrance is displayed; when the terminal determines that there is no valid recognition result in the target image, the graphic code result acquisition entrance is hidden.

[0104] In some embodiments, the graphic code result acquisition entrance can be triggered by an entrance display operation. The entrance display operation is used to trigger the display of the graphic code result acquisition entrance. The entrance display operation can be, for example, a long press operation. When the terminal determines that there is a valid recognition result in the target image, when the terminal detects the entrance display operation, the graphic code result acquisition entrance is displayed.

[0105] In this embodiment, in response to the graphic code recognition result acquisition operation, the current display area in the target image is determined, the target graphic code recognition result to be displayed is acquired based on the current display area, and the target graphic code recognition result is displayed. Therefore, when the target image includes multiple graphic codes, the graphic code recognition result corresponding to the graphic code corresponding to the current display area can be displayed preferentially, thereby improving the display effect of the graphic code recognition result.

[0106] In some embodiments, obtaining the target graphic code recognition result to be displayed based on the current display area includes: when there is a corresponding valid graphic code recognition result in the current display area, using the valid graphic code recognition result corresponding to the current display area as the target graphic code recognition result; when there is no corresponding valid graphic code recognition result in the current display area, using the valid historical graphic code recognition result corresponding to the target image as the target graphic code recognition result.

[0107] The valid graphic code recognition result refers to a valid recognition result, and the valid historical graphic code recognition result refers to a valid recognition result that has been recognized from the target image.

[0108] Specifically, the terminal can obtain a correspondence between a partial display image and a graphic code recognition result, where the graphic code recognition result in the correspondence is a valid recognition result. The terminal then matches the current display area with the partial display image in the correspondence. If the match is successful, it is determined that a corresponding valid graphic code recognition result exists in the current display area. The graphic code recognition result corresponding to the successfully matched partial display image is used as the valid graphic code recognition result corresponding to the current display area, and the graphic code recognition result corresponding to the successfully matched partial display image is used as the target graphic code recognition result. For example, when image area A of the target image is displayed on the screen, and a QR code exists in image area A, if the terminal receives a graphic code recognition result acquisition operation, the QR code recognition result corresponding to the QR code in image area A can be displayed. For another example, when image area A of the target image is displayed on the screen, and a QR code does not exist in image area A, if the terminal receives a graphic code recognition result acquisition operation, the QR code recognition result corresponding to the QR code in other areas of the target image can be displayed.

[0109] Among them, when the matching fails, the terminal can obtain the graphic code recognition result from the corresponding relationship as the target graphic code recognition result. For example, any graphic code recognition result in the corresponding relationship can be used as the target graphic code recognition result, or the target graphic code recognition result can be selected from the corresponding relationship based on the time when the recognition result is obtained. The time when the recognition result is obtained refers to the time when the graphic code recognition result is obtained. For example, the most recent graphic code recognition result can be used as the target graphic code recognition result.

[0110] In this embodiment, when a corresponding graphic code recognition result exists in the current display area, the valid graphic code recognition result corresponding to the current display area is used as the target graphic code recognition result. When a corresponding valid graphic code recognition result does not exist in the current display area, the valid historical graphic code recognition result corresponding to the target image is used as the target graphic code recognition result. Therefore, when the target image includes multiple graphic codes, the graphic code recognition result corresponding to the graphic code corresponding to the current display area can be displayed first, thereby improving the display effect of the graphic code recognition result.

[0111] In some embodiments, when a corresponding valid graphic code recognition result exists in the current display area, taking the valid graphic code recognition result corresponding to the current display area as the target graphic code recognition result includes: determining a local display image whose overlap with the current display area is greater than an overlap threshold as the overlapping display area; when a valid graphic code recognition result is identified in the overlapping display area, determining that a corresponding valid graphic code recognition result exists in the current display area, and taking the valid graphic code recognition result corresponding to the current display area as the target graphic code recognition result.

[0112] The overlap refers to the degree of overlap between image regions. The overlap threshold can be preset or set as needed, for example, 65%.

[0113] Specifically, before performing graphic code recognition on the current display area, the terminal can calculate the degree of overlap between the current display area and the local display image for which graphic code recognition has been completed, and compare the degree of overlap with the overlap threshold. When the degree of overlap is greater than the overlap threshold, the local display image with an overlap greater than the overlap threshold is used as the overlapping display area. When there is a graphic code recognition result obtained by recognition in the overlapping display area, it is determined that there is a corresponding graphic code recognition result in the current display area, and the graphic code recognition result corresponding to the current display area is used as the target graphic code recognition result.

[0114] In some embodiments, before performing graphic code recognition on the current display area, the terminal may calculate the degree of overlap between the current display area and a partial display image that has already been recognized and obtained a valid recognition result, compare the overlap with an overlap threshold, and when the overlap exceeds the overlap threshold, use the partial display image with the overlap greater than the overlap threshold as the overlapping display area, and use the valid recognition result of the overlapping display area as the graphic code recognition result for the current display area. For example, if the first move is to the upper left corner and a recognition result is obtained, and then the subsequent move is to the upper left corner again, even if the move positions are not completely consistent, the result obtained from the previous recognition can be used.

[0115] In some embodiments, when the overlapping display area is not obtained or the graphic code recognition result of the overlapping display area is invalid, the invalid graphic code recognition result indicates that there is no graphic code in the local display area. The terminal can capture the current display area, such as performing a screenshot operation, to obtain a local display image, and obtain the graphic code recognition result obtained by recognizing the local display image as the graphic code recognition result corresponding to the current display area.

[0116] In this embodiment, a local display image whose degree of overlap with the current display area is greater than an overlap threshold is determined as the overlapping display area. When a valid graphic code recognition result is obtained by identifying the overlapping display area, it is determined that a corresponding valid graphic code recognition result exists in the current display area, and the valid graphic code recognition result corresponding to the current display area is used as the target graphic code recognition result, thereby reducing unnecessary graphic code recognition and improving graphic code recognition efficiency.

[0117] In some embodiments, the method further includes: when it is determined based on the graphic code recognition result that no graphic code exists in the target image, hiding the graphic code result acquisition entrance of the target image; in response to a move operation on the target image, again entering the step of intercepting the image area displayed on the screen in the target image to obtain a partial display image, so as to perform graphic code recognition again; when it is determined based on the graphic code recognition result obtained by the re-recognition that a graphic code exists in the target image, displaying the graphic code result acquisition entrance of the target image.

[0118] In the process of displaying a target image, if the target image is partially displayed, the image area displayed on the screen may change when the target image is moved. Therefore, after the movement, the terminal can re-capture the image area on the screen to obtain a new partial display image to obtain the graphic code recognition result of the new partial display image. Therefore, there can be multiple partial display images. When the graphic code display result of the partial display image is a valid recognition result, it means that the partial display image includes the graphic code. When the graphic code display result of the partial display image is an invalid recognition result, it means that the partial display image does not include the graphic code. Hiding the graphic code result acquisition entrance means not displaying the graphic code result acquisition entrance.

[0119] Specifically, the terminal can obtain the graphic code recognition results corresponding to each partially displayed image that has been recognized. When each graphic code recognition result is an invalid recognition result, it is determined that there is no graphic code in the target image. The terminal can hide the graphic code result acquisition entrance, that is, not display the graphic code result acquisition entrance.

[0120] In some embodiments, when the graphic code recognition results corresponding to the respective partial display images that have been identified are all invalid recognition results, if the terminal obtains a move operation on the target image, the terminal can capture the image area displayed on the screen again, such as performing a screenshot operation, to obtain a new partial display image, perform graphic code recognition on the new partial display image to obtain a graphic code recognition result, or obtain the graphic code recognition result obtained by recognizing the new partial display image from the server. If the graphic code recognition result obtained by recognizing the new partial display image is a valid identification code, it indicates that there is a graphic code in the new partial display image, and therefore it also indicates that there is a graphic code in the target image. At this time, the terminal can display the graphic code result acquisition entrance of the target image.

[0121] In some embodiments, the graphic code result acquisition entrance can be triggered by an entrance display operation. The entrance display operation is used to trigger the display of the graphic code result acquisition entrance. The entrance display operation can be, for example, a long press operation. When the terminal determines that there is a valid recognition result in the target image, when the terminal detects the entrance display operation, the graphic code result acquisition entrance is displayed.

[0122] Take the graphic code as an example, such as Figure 9As shown, the terminal displays a long image on the screen, and the display effect is shown in (a). The terminal intercepts the screen in (a) to obtain a partial display image a, performs QR code recognition on the partial display image a, and obtains the QR code recognition result corresponding to the partial display image a. In response to the move operation, the terminal displays the long image after the move, and the display effect is shown in (b). The terminal intercepts the screen in (b) to obtain a new partial display image b, performs QR code recognition on the partial display image b, and obtains the QR code recognition result corresponding to the partial display image b. Since the partial display image a does not include a QR code, the QR code recognition result corresponding to the partial display image a indicates that there is no QR code. Since the partial display image b includes a QR code, the QR code recognition result corresponding to the partial display image b indicates that there is a QR code. When (a) is long-pressed, the graphic code result acquisition entrance will not be displayed. When (a) is long-pressed, the graphic code result acquisition entrance will be displayed. The effect diagram of displaying the graphic code result acquisition entrance is shown in (c).

[0123] In some embodiments, the terminal obtains the graphic code recognition result in response to the graphic code recognition result acquisition operation. When the graphic code recognition result indicates the presence of a graphic code, the terminal obtains the recognition result identifier corresponding to the graphic code recognition result, and generates a graphic code result acquisition entry based on the recognition result identifier, so that the graphic code result entry points to the graphic code recognition result. The recognition result identifier can be, for example, the storage address of the graphic code recognition result. The storage address can be, for example, a URL (Uniform Resource Locator). When the terminal receives a trigger operation for the graphic code result acquisition entry, it can access the storage address of the graphic code recognition result to obtain the graphic code recognition result.

[0124] In this embodiment, when it is determined based on the graphic code recognition result that no graphic code exists in the target image, the graphic code result acquisition entrance of the target image is hidden. In response to the move operation on the target image, the step of capturing the image area displayed on the screen in the target image to obtain a partial display image is entered again to perform graphic code recognition again. When it is determined based on the graphic code recognition result obtained by the re-recognition that a graphic code exists in the target image, the graphic code result acquisition entrance of the target image is displayed, thereby realizing the switching of the hidden graphic code result acquisition entrance to the displayed graphic code result acquisition entrance, thereby improving the display effect and flexibility of the graphic code result acquisition entrance.

[0125] This application also provides an application scenario, which applies the above-mentioned graphic code recognition method. Specifically, Figure 10 As shown, the application of the graphic code recognition method in this application scenario is as follows:

[0126] S1002, display the target image.

[0127] S1004: responding to a graphic code recognition instruction for a target image.

[0128] S1006, determining whether the image display mode of the target image is a partial display mode, if so, proceeding to step S1008, if not, proceeding to step S1010.

[0129] S1008, determine whether the target image is a wide image or a long image, if so, go to step S1018.

[0130] S1010, determine whether the target image is a wide image, if so, go to step S1012.

[0131] S1012, determine whether the resolution of the target image is greater than the resolution threshold, if so, go to step S1014, if not, execute step S1030.

[0132] S1014: Display image zoom prompt information, and execute step S1016.

[0133] S1016, determine whether the image display mode is switched to partial display, if so, jump to step S1018.

[0134] S1018, triggering the screenshot instruction, performing image capture, obtaining a partial display image, and going to step S1020.

[0135] S1020, obtaining the resolution of the partial display image, comparing the resolution of the partial display image with a resolution threshold, and proceeding to step S1022.

[0136] S1022, determine whether the pixel size of the long side of the partial display image is greater than the pixel size threshold, if so, go to step S1024, if not, go to step S1026.

[0137] The long side of the partial display image refers to the larger of the width and height of the partial display image. For example, if the width is 1330 pixels and the height is 771 pixels, the long side is the width of the partial display image. The pixel size threshold can be set as needed, for example, 1920 pixels.

[0138] S1024 , performing image compression processing on the partial display image to obtain a compressed partial display image, wherein the pixel size of the long side of the compressed partial display image is less than or equal to the pixel size threshold, and then proceeding to step S1028 .

[0139] S1026, perform graphic code recognition on the partial display image to obtain a graphic code recognition result, and go to step S1040.

[0140] S1028, perform graphic code recognition on the compressed partial display image to obtain a graphic code recognition result, and go to step S1040.

[0141] S1030, determine whether the pixel size of the long side of the target image is greater than the pixel size threshold, if so, go to step S1032, if not, go to step S1034.

[0142] S1032, perform image compression processing on the target image to obtain a compressed target image, the pixel size of the long side of the compressed target image is less than or equal to the pixel size threshold, and go to step S1036.

[0143] S1034, perform graphic code recognition on the target image to obtain a graphic code recognition result, and go to step S1040.

[0144] S1036, perform graphic code recognition on the compressed target image to obtain a graphic code recognition result, and go to step S1040.

[0145] S1040: When it is determined based on the graphic code recognition result that the target image includes the graphic code, a graphic code result acquisition entrance is displayed, and the process goes to step S1042.

[0146] S1042: When a trigger operation on the graphic code result acquisition entry is obtained, the graphic code recognition result is displayed.

[0147] In this embodiment, when the image is long or wide, when the image is partially displayed, the image is captured and recognized, thereby improving the accuracy of graphic code recognition.

[0148] It should be understood that although Figure 2-Figure 10 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 2-Figure 10 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The order of execution of these steps or stages is not necessarily one by one, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0149] In some embodiments, as Figure 11As shown, a graphic code recognition device is provided. The device can be a software module or a hardware module, or a combination of both to form a part of a computer device. The device specifically includes: a target image display module 1102, an image display mode acquisition module 1104, a partial display image acquisition module 1106, and a graphic code recognition result acquisition module 1108, wherein:

[0150] A target image display module 1102 is used to display a target image on the screen;

[0151] An image display mode acquisition module 1104 is configured to acquire an image display mode of a target image in response to a graphic code recognition instruction for the target image;

[0152] A partial display image obtaining module 1106 is configured to, when the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value, intercept the image area displayed on the screen in the target image to obtain a partial display image;

[0153] The graphic code recognition result obtaining module 1108 is used to perform graphic code recognition based on the partial display image to obtain a graphic code recognition result corresponding to the target image.

[0154] In some embodiments, the partial display image obtaining module includes: a size comparison result obtaining unit, which is used to obtain the size comparison result between the size measurement value of the target image and the standard measurement value when the image display mode is determined to be partial display; and a partial display image obtaining unit, which is used to capture the image area displayed on the screen in the target image when the size comparison result indicates that the size measurement value of the target image is greater than the standard measurement value to obtain a partial display image.

[0155] In some embodiments, the size measurement value includes an image size ratio, and the standard measurement value includes a screen size ratio; the size comparison result acquisition unit is further used to obtain the image size ratio of the target image between different size dimensions, and obtain the screen size ratio of the screen between different size dimensions; compare the image size ratio with the screen size ratio to obtain a size comparison result.

[0156] In some embodiments, the device further includes: an image magnification prompt information display module, which is used to display image magnification prompt information corresponding to the target image when the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, and the image magnification prompt information is used to prompt the enlarged display of the graphic code area of ​​the target image; a display mode switching module, which is used to enlarge and display the target image when a magnification operation on the target image is detected, and when it is determined that the image display mode is switched to partial display, enter the step of intercepting the image area displayed on the screen in the target image to obtain a partial display image.

[0157] In some embodiments, the image magnification prompt information display module includes: an image resolution acquisition unit, used to obtain the image resolution of the target image when the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value; an image magnification prompt information display unit, used to display the image magnification prompt information corresponding to the target image when the image resolution is greater than the resolution threshold.

[0158] In some embodiments, the device also includes: a compressed image acquisition module, which is used to compress the target image according to the resolution compression index when the image resolution is less than the resolution threshold to obtain a compressed image; and a graphic code recognition module, which is used to perform graphic code recognition on the compressed image to obtain a graphic code recognition result.

[0159] In some embodiments, the device also includes: a target graphic code recognition result acquisition module, which is used to determine the current display area in the target image in response to the graphic code recognition result acquisition operation, and obtain the target graphic code recognition result to be displayed based on the current display area; a target graphic code recognition result display module, which is used to display the target graphic code recognition result.

[0160] In some embodiments, the target graphic code recognition result acquisition module includes:

[0161] A first target graphic code recognition result obtaining unit is configured to use the valid graphic code recognition result corresponding to the current display area as the target graphic code recognition result when there is a corresponding valid graphic code recognition result in the current display area;

[0162] The second target graphic code recognition result obtaining unit is configured to use the valid historical graphic code recognition result corresponding to the target image as the target graphic code recognition result when there is no corresponding valid graphic code recognition result in the current display area.

[0163] In some embodiments, the first target graphic code recognition result obtaining unit is further used to determine a local display image whose overlap with the current display area is greater than an overlap threshold as an overlapping display area; when a valid graphic code recognition result is identified in the overlapping display area, it is determined that a corresponding valid graphic code recognition result exists in the current display area, and the valid graphic code recognition result corresponding to the current display area is used as the target graphic code recognition result.

[0164] In some embodiments, the device further includes: an entry hiding module, which is used to hide the entry for obtaining the graphic code result of the target image when it is determined based on the graphic code recognition result that the target image does not contain a graphic code; a movement operation response module, which is used to respond to the movement operation on the target image and re-enter the step of intercepting the image area displayed on the screen in the target image to obtain a partial display image, so as to perform graphic code recognition again; and an entry display module, which is used to display the entry for obtaining the graphic code result of the target image when it is determined based on the graphic code recognition result obtained by re-recognition that the target image contains a graphic code.

[0165] The specific definition of the graphical code recognition device can be found in the definition of the graphical code recognition method above and will not be repeated here. Each module in the graphical code recognition device described above may be implemented in whole or in part through software, hardware, or a combination thereof. Each of the modules described above may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0166] In some embodiments, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 12 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a graphic code recognition method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse.

[0167] In some embodiments, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 13As shown. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data involved in the graphic code recognition method. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a graphic code recognition method is implemented.

[0168] Those skilled in the art will understand that Figure 12 and Figure 13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0169] In some embodiments, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0170] In some embodiments, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above-mentioned method embodiments when executed by a processor.

[0171] In some embodiments, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of each of the above method embodiments.

[0172] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0173] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0174] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.

Claims

1. A method for recognizing a graphic code, characterized in that: The method comprises: Displaying the target image on the screen according to the image type of the target image; In response to a graphic code recognition instruction for the target image, acquiring an image display mode of the target image; When the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value, intercepting the image area of ​​the target image displayed on the screen to obtain a partial display image; When the image display mode is full display and the size measurement value is greater than the standard measurement value, when a zoom-in operation on the target image is detected, the target image is zoomed in and displayed; when it is determined that the image display mode is switched to partial display, an image area of ​​the target image displayed on the screen is intercepted to obtain a partial display image; Graphic code recognition is performed based on the partial display image to obtain a graphic code recognition result corresponding to the target image.

2. The method according to claim 1, characterized in that When the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value, intercepting the image area of ​​the target image displayed on the screen to obtain the partial display image includes: When it is determined that the image display mode is partial display, obtaining a size comparison result between the size measurement value of the target image and the standard measurement value; When the size comparison result indicates that the size measurement value of the target image is greater than the standard measurement value, an image area of ​​the target image displayed on the screen is cut out to obtain a partial display image.

3. The method according to claim 2, characterized in that The size measurement value includes an image size ratio, and the standard measurement value includes a screen size ratio; and obtaining a size comparison result between the size measurement value of the target image and the standard measurement value includes: Obtaining an image size ratio of the target image between different size dimensions, and obtaining a screen size ratio of the screen between different size dimensions; The image size ratio is compared with the screen size ratio to obtain a size comparison result.

4. The method according to claim 1, wherein When the image display mode is full display and the size measurement value is greater than the standard measurement value, when a zoom-in operation on the target image is detected, the target image is zoomed in and displayed, including: When the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, the image enlargement prompt information corresponding to the target image is displayed, and the image enlargement prompt information is used to prompt the graphic code area of ​​the target image to be enlarged and displayed; When a zoom-in operation on the target image is detected, the target image is zoomed in and displayed.

5. The method according to claim 4, characterized in that When the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, displaying the image enlargement prompt information corresponding to the target image includes: When the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, obtaining the image resolution of the target image; When the image resolution is greater than a resolution threshold, image magnification prompt information corresponding to the target image is displayed.

6. The method according to claim 5, characterized in that The method further comprises: When the image resolution is less than the resolution threshold, compressing the target image according to the resolution compression index to obtain a compressed image; Performing graphic code recognition on the compressed image to obtain a graphic code recognition result.

7. The method according to claim 1, characterized in that The method further comprises: In response to the graphic code recognition result acquisition operation, determining a current display area in the target image, and acquiring a target graphic code recognition result to be displayed based on the current display area; Display the target graphic code recognition result.

8. The method according to claim 7, characterized in that The obtaining of the target graphic code recognition result to be displayed based on the current display area includes: When there is a corresponding valid graphic code recognition result in the current display area, the valid graphic code recognition result corresponding to the current display area is used as the target graphic code recognition result; When there is no corresponding valid graphic code recognition result in the current display area, the valid historical graphic code recognition result corresponding to the target image is used as the target graphic code recognition result.

9. The method according to claim 8, characterized in that When a valid graphic code recognition result exists in the current display area, taking the valid graphic code recognition result corresponding to the current display area as the target graphic code recognition result includes: Determine a partial display image whose degree of overlap with the current display area is greater than an overlap threshold as an overlapping display area; When a valid graphic code recognition result is identified in the overlapping display area, it is determined that a corresponding valid graphic code recognition result exists in the current display area, and the valid graphic code recognition result corresponding to the current display area is used as the target graphic code recognition result.

10. The method according to claim 1, characterized in that The method further comprises: When it is determined based on the graphic code recognition result that the target image does not contain a graphic code, hiding the graphic code result acquisition entrance of the target image; In response to a move operation on the target image, the step of again capturing an image area of ​​the target image displayed on the screen to obtain a partial display image is performed to perform graphic code recognition again; When it is determined that the target image has a graphic code based on the graphic code recognition result obtained by the second recognition, an entry for obtaining the graphic code result of the target image is displayed.

11. A graphic code recognition device, characterized in that: The device comprises: A target image display module, configured to display the target image on a screen according to the image type of the target image; an image display mode acquisition module, configured to acquire an image display mode of the target image in response to a graphic code recognition instruction for the target image; a partial display image obtaining module, configured to, when the image display mode is partial display and the size measurement value of the target image is greater than the standard measurement value, intercept the image area displayed on the screen in the target image to obtain a partial display image; a display mode switching module, configured to, when the image display mode is full display and the size measurement value is greater than the standard measurement value, upon detecting a zoom-in operation on the target image, and, when determining that the image display mode is switched to partial display, intercept an image area of ​​the target image displayed on the screen to obtain a partial display image; The graphic code recognition result obtaining module is used to perform graphic code recognition based on the local display image to obtain the graphic code recognition result corresponding to the target image.

12. The device according to claim 11, characterized in that The local display image obtaining module includes: a size comparison result obtaining unit, configured to obtain a size comparison result between the size measurement value of the target image and the standard measurement value when determining that the image display mode is partial display; The partial display image obtaining unit is configured to, when the size comparison result indicates that the size measurement value of the target image is greater than the standard measurement value, intercept an image area of ​​the target image displayed on the screen to obtain a partial display image.

13. The device according to claim 12, characterized in that The size measurement value includes an image size ratio, and the standard measurement value includes a screen size ratio; the partial display image obtaining module is further configured to: Obtaining an image size ratio of the target image between different size dimensions, and obtaining a screen size ratio of the screen between different size dimensions; The image size ratio is compared with the screen size ratio to obtain a size comparison result.

14. The device according to claim 11, characterized in that The display mode switching module is further used to: When the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, the image enlargement prompt information corresponding to the target image is displayed, and the image enlargement prompt information is used to prompt the graphic code area of ​​the target image to be enlarged and displayed; When a zoom-in operation on the target image is detected, the target image is zoomed in and displayed.

15. The device according to claim 14, characterized in that The display mode switching module is further used to: When the image display mode is full display and the size measurement value of the target image is greater than the standard measurement value, obtaining the image resolution of the target image; When the image resolution is greater than a resolution threshold, image magnification prompt information corresponding to the target image is displayed.

16. The device according to claim 15, characterized in that The device is also used for: When the image resolution is less than the resolution threshold, compressing the target image according to the resolution compression index to obtain a compressed image; Performing graphic code recognition on the compressed image to obtain a graphic code recognition result.

17. The device according to claim 11, characterized in that The device is also used for: In response to the graphic code recognition result acquisition operation, determining a current display area in the target image, and acquiring a target graphic code recognition result to be displayed based on the current display area; Display the target graphic code recognition result.

18. The device according to claim 17, characterized in that The device is also used for: When there is a corresponding valid graphic code recognition result in the current display area, the valid graphic code recognition result corresponding to the current display area is used as the target graphic code recognition result; When there is no corresponding valid graphic code recognition result in the current display area, the valid historical graphic code recognition result corresponding to the target image is used as the target graphic code recognition result.

19. The device according to claim 18, characterized in that The device is also used for: Determine a partial display image whose degree of overlap with the current display area is greater than an overlap threshold as an overlapping display area; When a valid graphic code recognition result is identified in the overlapping display area, it is determined that a corresponding valid graphic code recognition result exists in the current display area, and the valid graphic code recognition result corresponding to the current display area is used as the target graphic code recognition result.

20. The device according to claim 11, characterized in that The device is also used for: When it is determined based on the graphic code recognition result that the target image does not contain a graphic code, hiding the graphic code result acquisition entrance of the target image; In response to a move operation on the target image, the step of again capturing an image area of ​​the target image displayed on the screen to obtain a partial display image is performed to perform graphic code recognition again; When it is determined that the target image has a graphic code based on the graphic code recognition result obtained by the second recognition, an entry for obtaining the graphic code result of the target image is displayed.

21. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.

22. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

23. A computer program product, characterized in that The computer program product includes computer program code, which is stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the computer device performs the steps of the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Picture information search method and apparatus

    CN106919613A

  • Picture display method and electronic equipment

    CN111061531A