CN116228533A - Graphic code display method and device, electronic equipment and storage medium - Google Patents

Graphic code display method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116228533A
CN116228533A CN202211656786.3A CN202211656786A CN116228533A CN 116228533 A CN116228533 A CN 116228533A CN 202211656786 A CN202211656786 A CN 202211656786A CN 116228533 A CN116228533 A CN 116228533A
Authority
CN
China
Prior art keywords
graphic code
image
display
ratio
scaling
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211656786.3A
Other languages
Chinese (zh)
Inventor
曾鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuba Co Ltd
Original Assignee
Wuba Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuba Co Ltd filed Critical Wuba Co Ltd
Priority to CN202211656786.3A priority Critical patent/CN116228533A/en
Publication of CN116228533A publication Critical patent/CN116228533A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding

Abstract

The invention provides a graphic code display method, a graphic code display device, electronic equipment and a storage medium. The method comprises the following steps: acquiring a graphic code image, and acquiring the display size of a display control, wherein the graphic code image comprises at least one graphic code; according to the display size, scaling the graphic code image to obtain a processed image, wherein the width of the processed image is the same as the width in the display size, the height of the processed image is smaller than or equal to the height in the display size, or the height of the processed image is the same as the height in the display size, and the width of the processed image is smaller than or equal to the width in the display size; carrying out graphic code identification on the processed image to obtain the position information of each graphic code in the processed image; and displaying the processed image in the display control, and displaying the position mark of each graphic code in the processed image according to the position information of each graphic code. The invention can reduce the time of graphic code adaptive display and improve the graphic code adaptive display efficiency.

Description

Graphic code display method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for displaying a graphic code, an electronic device, and a storage medium.
Background
Along with the popularization of graphic codes such as two-dimensional codes in recent years, the code scanning scenes are more and more abundant, the situation that multiple codes appear in one lens is also increased, and the situation that a single image contains multiple graphic codes is also immediately presented. However, the conventional code scanning software recognizes only one graphic code at a time, which requires a user to select a corresponding graphic code from an image containing a plurality of graphic codes for recognition, and thus requires a mark of each graphic code to be displayed in the image.
Because the sizes of the graphic code image and the display control are inconsistent, the graphic code image and the display control need to be integrally adapted, and then the marks of the graphic code are displayed based on the displayed graphic code image. In the prior art, when the graphic code image and the display control are subjected to adaptation adjustment, the graphic code image is identified through a graphic code identification program to obtain graphic code position information, and then the graphic code position information and the graphic code image are subjected to adaptation adjustment, so that the graphic code image is aligned in the center of the display control, and the coordinate position of the graphic code is in the center of the graphic code.
In the prior art, the graphic code image and the graphic code position need to be respectively adapted and adjusted, the graphic code position is relatively complex to be adapted and processed in a corresponding offset calculation mode on double axes (an x axis and a y axis) according to the reduced or enlarged proportion of the graphic code image, the offset of the graphic code image relative to a screen is considered in the process, the offset after the graphic code image is scaled is considered, and finally, the display effect aligned with the graphic code in the graphic code image in the middle is achieved.
Disclosure of Invention
The embodiment of the invention provides a graphic code display method, a graphic code display device, electronic equipment and a storage medium, so that the time for adaptively displaying graphic codes is reduced, and the efficiency for adaptively displaying the graphic codes is improved.
According to a first aspect of an embodiment of the present invention, there is provided a graphic code display method, including:
acquiring a graphic code image, and acquiring the display size of a display control, wherein the graphic code image comprises at least one graphic code;
performing scaling processing on the graphic code image according to the display size to obtain a processed image, wherein the width of the processed image is the same as the width in the display size, the height of the processed image is smaller than or equal to the height in the display size, or the height of the processed image is the same as the height in the display size, and the width of the processed image is smaller than or equal to the width in the display size;
Performing graphic code identification on the processed image to obtain the position information of each graphic code in the processed image;
and displaying the processed image in the display control, and displaying the position mark of each graphic code in the processed image according to the position information of each graphic code.
According to a second aspect of an embodiment of the present invention, there is provided a graphic code display apparatus, including:
the acquisition module is used for acquiring a graphic code image and acquiring the display size of the display control, wherein the graphic code image comprises at least one graphic code;
the scaling processing module is used for scaling the graphic code image according to the display size to obtain a processed image, wherein the width of the processed image is the same as the width in the display size, the height of the processed image is smaller than or equal to the height in the display size, or the height of the processed image is the same as the height in the display size, and the width of the processed image is smaller than or equal to the width in the display size;
the graphic code identification module is used for carrying out graphic code identification on the processed image to obtain the position information of each graphic code in the processed image;
The display module is used for displaying the processed image in the display control and displaying the position mark of each graphic code in the processed image according to the position information of each graphic code.
According to a third aspect of an embodiment of the present invention, there is provided an electronic apparatus including: a processor, a memory and a computer program stored on the memory and executable on the processor, which when executed by the processor, performs the steps of the graphical code presentation method as described in the first aspect.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the graphical code presentation method according to the first aspect.
According to the graphic code display method, the device, the electronic equipment and the storage medium, the graphic code image is zoomed according to the display size of the display control, the processed image is obtained, the width of the processed image is identical to the width in the display size, or the height of the processed image is identical to the height in the display size, the graphic code identification is carried out on the processed image, the position information of each graphic code in the processed image is obtained, the processed image is displayed in the display control, the position mark of each graphic code is displayed in the processed image according to the position information of each graphic code, the graphic code identification is carried out after the graphic code image is adaptively adjusted based on the display size of the display control, the identified graphic code position information is the display position information of the graphic code in the processed image, the graphic code position information is not required to be adaptively adjusted, the complex operation of the graphic code position information is reduced, the calculation amount is reduced, the graphic code adaptation time is shortened, and the graphic code adaptation display efficiency and the graphic code identification efficiency are improved.
Drawings
FIG. 1 is a schematic illustration of a prior art cross-machine overlay for adaptive presentation of graphic code images;
FIG. 2 is a schematic illustration of a prior art vertical overlay when a graphic code image is adaptively displayed;
FIG. 3 is a flowchart of a graphic code display method according to an embodiment of the present invention;
FIG. 4a is an exemplary diagram of an original image including at least one graphic code in an embodiment of the invention;
FIG. 4b is an exemplary diagram of a graphic code image obtained by truncating the original image shown in FIG. 4a in accordance with an embodiment of the present invention;
FIG. 5 is a flowchart of a graphic code display method according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a lateral overlay of graphic code images during adaptive presentation in accordance with an embodiment of the present invention;
FIG. 7 is a schematic diagram of a graphic code image in a vertical overlay for adaptive display in an embodiment of the invention;
fig. 8 is a block diagram of a graphic code display device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
When a plurality of graphic codes are included in the graphic code image, if the plurality of graphic codes in the graphic code image need to be identified, the identified graphic code image needs to be displayed first, and then a scanning result of the graphic code marked by the icon is added at the corresponding position of the graphic code image according to the identified graphic code coordinate information. There are two presentations, one presenting the identified image and the other presenting the identified coordinate points in the image. Because the sizes of the image and the display control are inconsistent, the display control cannot be filled with the image directly, or the coordinates cannot be aligned after the display control is attempted to be filled, so that the display effect is poor, and the image and the display control need to be integrally adapted when the graphic code is displayed.
In the prior art, when the graphic code image and the display control are subjected to adaptation adjustment, the graphic code image is identified through a graphic code identification program to obtain graphic code position information, and then the graphic code position information and the graphic code image are subjected to adaptation adjustment, so that the graphic code image is aligned in the center of the display control, and the coordinate position of the graphic code is in the center of the graphic code.
Fig. 1 is a schematic diagram of the prior art, which is transversely paved when a graphic code image is adaptively displayed, and as shown in fig. 1, graphic code identification is firstly performed on the graphic code image 1 to obtain graphic code position information 2; then, carrying out adaptation adjustment on the graphic code image 1 and the graphic code position information 2 to enable the adjusted graphic code image 3 to be transversely paved with display controls, and carrying out adaptation adjustment on the graphic code position information 2 relative to the adjusted graphic code image 3 to enable the coordinate position of the graphic code adjusted in the adjusted graphic code image 3 to be in the center of the graphic code; and displaying the adjusted graphic code image and the adjusted graphic code position information in a display control to obtain a display image 4.
Fig. 2 is a schematic diagram of the prior art, which is longitudinally paved when a graphic code image is adaptively displayed, and as shown in fig. 2, graphic code identification is firstly performed on the graphic code image 5 to obtain graphic code position information 6; then, carrying out adaptation adjustment on the graphic code image 5 and the graphic code position information 6 to enable the adjusted graphic code image 7 to be longitudinally paved with display controls, and carrying out adaptation adjustment on the graphic code position information 6 relative to the adjusted graphic code image 7 to enable the coordinate position of the graphic code adjusted in the adjusted graphic code image 7 to be in the center of the graphic code; and displaying the adjusted graphic code image and the adjusted graphic code position information in a display control to obtain a display image 8.
Therefore, the process of adapting and adjusting the graphic code image and the graphic code position in the prior art is complex, and consumes long time, so that the display efficiency of the graphic code is low. In order to solve the technical problem, the embodiment of the invention provides the following technical scheme.
Fig. 3 is a flowchart of a graphic code display method according to an embodiment of the present invention, where the graphic code display method may be executed by an electronic device such as a mobile phone, a tablet computer, and the like, as shown in fig. 3, and the graphic code display method includes:
Step 310, a graphic code image is obtained, and a presentation size of a presentation control is obtained, wherein the graphic code image comprises at least one graphic code.
Wherein the graphic code image is an image comprising at least one graphic code to be identified. The display control can be the whole display screen or a part of the display area in the display screen. The graphic code may be a two-dimensional code, a bar code, or the like.
The original image comprising at least one graphic code can be obtained through the camera, or the original image comprising at least one graphic code selected by a user can be obtained from the album page; in order to better display the graphic codes in the display control, the display control can avoid displaying too many graphic code-independent partial areas, the original image can be intercepted based on the position of at least one graphic code in the original image, the partial area comprising the at least one graphic code is intercepted from the original image, and the graphic code image is obtained by removing the graphic code-independent partial area. For example, fig. 4a is an exemplary diagram of an original image including at least one graphic code in an embodiment of the present invention, fig. 4b is an exemplary diagram of a graphic code image obtained by cutting the original image shown in fig. 4a, where, as shown in fig. 4a, the original image 9 includes a graphic code 10 and a graphic code 11, and further includes a partial area 12 unrelated to the graphic code, and in order to avoid displaying the partial area 12 unrelated to the graphic code in a display control, the original image may be cut, and the area 12 may be removed, to obtain a graphic code image 13 including the graphic code 10 and the graphic code 11, as shown in fig. 4 b.
It will be appreciated by those skilled in the art that the graphic code image may be an original image, in addition to a partial image that was taken from the original image in the manner described above, the original image may be a different size than the presentation size of the presentation control.
And 320, performing scaling processing on the graphic code image according to the display size to obtain a processed image, wherein the width of the processed image is the same as the width in the display size, the height of the processed image is smaller than or equal to the height in the display size, or the height of the processed image is the same as the height in the display size, and the width of the processed image is smaller than or equal to the width in the display size.
And according to the display size of the display control, scaling the graphic code image to the display size to obtain a processed image, so that the processed image is fully paved with the display control, namely, the width of the processed image is the same as the width in the display size, and the height of the processed image is smaller than or equal to the height of the display control, or the height of the processed image is the same as the height in the display size, and the width of the processed image is smaller than or equal to the width of the display control. In the processing process, if the width and the height of the graphic code image are respectively smaller than the width and the height in the display size, the graphic code image is amplified, so that the width and the height of the graphic code image are proportionally amplified to the display size of the display control; if the width of the graphic code image is larger than the width in the display size or the height of the graphic code image is larger than the height in the display size, the graphic code image is subjected to reduction processing, so that the width and the height of the graphic code image are reduced to the display size of the display control in equal proportion.
And 330, performing graphic code identification on the processed image to obtain the position information of each graphic code in the processed image.
Extracting matrix data in the processed image, and carrying out graphic code recognition on the matrix data by applying a graphic code recognition algorithm to obtain the position information of each graphic code in the processed image. The position information of the graphic code may include information of the center coordinates, width, height, and the like of the graphic code.
And step 340, displaying the processed image in the display control, and displaying the position mark of each graphic code in the processed image according to the position information of each graphic code.
Wherein the position marks may include a center position mark and/or a rim position mark.
The processed image can be centrally displayed in the display control, and the center position mark and/or the frame position mark of each graphic code are displayed in the processed image displayed in the display control according to the position information of each graphic code in the processed image. When the central position mark of the graphic code is displayed, the central position mark is displayed by taking the central coordinate of the graphic code as the center; and when the frame position mark of the graphic code is displayed, determining the frame position of the graphic code according to the center coordinates, the width and the height of the graphic code, and displaying the frame position mark of the graphic code based on the frame position.
According to the graphic code display method provided by the embodiment, the graphic code image is subjected to scaling processing according to the display size of the display control, so that the processed image is obtained, the width of the processed image is identical to the width in the display size, or the height of the processed image is identical to the height in the display size, the graphic code identification is performed on the processed image, the position information of each graphic code in the processed image is obtained, the processed image is displayed in the display control, the position mark of each graphic code is displayed in the processed image according to the position information of each graphic code, the graphic code identification is performed after the graphic code image is subjected to the adaptive adjustment based on the display size of the display control, the identified graphic code position information is the display position information of the graphic code in the processed image, the adaptive adjustment of the graphic code position information is not needed, the complex operation of the adaptive adjustment of the graphic code position information is reduced, the calculated amount is reduced, the time of the graphic code adaptive display can be shortened, and the adaptive display efficiency and the identification efficiency of the graphic code are improved.
Fig. 5 is a flowchart of a graphic code display method according to an embodiment of the present invention, where the graphic code display method may be executed by an electronic device such as a mobile phone, a tablet computer, and the like, as shown in fig. 5, and the graphic code display method includes:
Step 510, obtaining a graphic code image, and obtaining a display size of a display control, wherein the graphic code image comprises at least one graphic code.
And step 520, generating a background image with the image size being the display size.
Wherein the background image may be a black background image.
Step 530, scaling the graphic code image to the presentation size.
Performing equal-ratio scaling on the width and the height of the graphic code image to enable the size of the graphic code image after scaling to be basically the same as the display size of the display control, namely enabling the width of the graphic code image after scaling to be the same as the width of the display control, and enabling the height of the graphic code image after scaling to be smaller than or equal to the height of the display control; or, the height of the graphic code image after the scaling treatment is the same as the height of the display control, and the width of the graphic code image after the scaling treatment is smaller than or equal to the width of the display control.
In one embodiment of the invention, the isostatically scaling the graphic code image to the presentation size comprises: determining an aspect ratio of the graphic code image as a first aspect ratio; determining the aspect ratio of the display control as a second aspect ratio according to the display size; determining a scale of the graphic code image according to the first aspect ratio, the second aspect ratio, the size of the graphic code image, and the presentation size; and scaling the graphic code image to the showing size according to the scaling scale.
Calculating the ratio of the width to the height of the graphic code image to obtain a first aspect ratio; calculating the ratio of the width to the height of the display control to obtain a second aspect ratio; comparing the first aspect ratio with the second aspect ratio, determining a scaling ratio required when the graphic code image is scaled to the display size of the display control based on the comparison result, further scaling the graphic code image based on the scaling ratio, multiplying the width and the height of the graphic code image by the scaling ratio respectively to obtain the size of the graphic code image after the scaling processing, and scaling the graphic code image to the display size of the display control. By determining the proper scaling according to the first aspect ratio, the second aspect ratio, the size of the graphic code image and the display size, the graphic code image subjected to scaling processing can be displayed in the display control to the maximum extent, and the display effect of the graphic code image is improved.
In one embodiment of the invention, said determining the scale of said graphic code image according to said first aspect ratio, said second aspect ratio, the size of said graphic code image and said presentation size comprises:
if the first aspect ratio is greater than or equal to the second aspect ratio, determining a first ratio between the width in the presentation size and the width of the graphic code image as the scaling;
If the first aspect ratio is less than the second aspect ratio, a second ratio between the height in the display size and the height of the graphic code image is determined as the scaling.
If the first aspect ratio is greater than or equal to the second aspect ratio, transversely spreading the scaled graphic code image to the display control, namely aligning the graphic code image with the left side and the right side of the display control respectively, and determining a first ratio between the width in the display size and the width of the graphic code image as a scaling ratio; if the first aspect ratio is smaller than the second aspect ratio, the display space is fully paved in the longitudinal direction of the scaled graphic code image, namely the graphic code image is respectively aligned with the upper side and the lower side of the display control, and at the moment, the second ratio between the height in the display size and the height of the graphic code image is determined to be the scaling ratio. For example, the first aspect ratio is 1:1 and the second aspect ratio is 1:2, the first aspect ratio being greater than the second aspect ratio, such that the landscape of the graphic code image is full of presentation controls. As another example, the first aspect ratio is 1:3 and the second aspect ratio is 1:2, the first aspect ratio being smaller than the second aspect ratio, such that the portrait of the graphic code image is fully populated with presentation controls.
By determining the first ratio between the widths as the scaling or the second ratio between the heights as the scaling based on the comparison result of the first aspect ratio and the second aspect ratio, a more proper scaling can be determined, so that the graphic code image subjected to scaling processing can be displayed in the display control to the maximum extent, and the display effect of the graphic code image is improved.
In another embodiment of the present invention, the isostatically scaling the graphic code image to the presentation size includes: determining a third ratio between the width in the display size and the width of the graphic code image, and determining a fourth ratio between the height in the display size and the height of the graphic code image; determining a scaling of the graphic code image according to the third ratio and the fourth ratio; and scaling the graphic code image to the showing size according to the scaling scale.
Calculating a third ratio between the width in the display size and the width of the graphic code image, and calculating a fourth ratio between the height in the display size and the height of the graphic code image; determining whether the third ratio and the fourth ratio are smaller than 1, determining a scaling ratio required when the graphic code image is scaled to the display size of the display control based on a comparison result, further performing scaling treatment on the graphic code image based on the scaling ratio, multiplying the width and the height of the graphic code image by the scaling ratio respectively to obtain the size of the graphic code image after scaling treatment, and scaling the graphic code image to the display size of the display control. Through the third ratio between width and graphic code image width in the display size and the fourth ratio between height and graphic code image height in the display size, a proper scaling ratio can be determined, and further the graphic code image is scaled based on the scaling ratio, so that the graphic code image after the scaling processing can be displayed in a display control in a maximized and complete mode, and the display effect of the graphic code image is improved.
In one embodiment of the present invention, the determining the scaling of the graphic code image according to the third ratio and the fourth ratio includes:
if the minimum value between the third ratio and the fourth ratio is greater than or equal to 1, determining the minimum value between the third ratio and the fourth ratio as the scaling of the graphic code image;
and if the minimum value between the third ratio and the fourth ratio is smaller than 1, determining the maximum value between the third ratio and the fourth ratio as the scaling of the graphic code image.
If the maximum value between the third ratio and the fourth ratio is greater than or equal to 1, indicating that the dimension of one dimension in the display dimension is greater than the dimension of the corresponding dimension in the graphic code image, and if the width of the display dimension is greater than the width of the graphic code image or the height of the display dimension is greater than the height of the graphic code image, determining the minimum value between the third ratio and the fourth ratio as the scaling ratio of the graphic code image in order to completely display the graphic code image subjected to the equal-ratio scaling treatment in the display control; if the maximum value between the third ratio and the fourth ratio is smaller than 1, the width in the display size of the instruction book is smaller than the width of the graphic code image and the height in the display size is smaller than the height of the graphic code image, and the graphic code image needs to be subjected to reduction processing, so that the graphic code image subjected to the equal-ratio scaling processing can be completely displayed in the display control, and the maximum value between the third ratio and the fourth ratio is determined as the scaling ratio of the graphic code image.
And determining the scaling of the graphic code image based on the comparison result of the maximum value between the third ratio and the fourth ratio and 1, so that the more proper scaling can be determined, the graphic code image subjected to scaling treatment can be displayed in a display control in a maximized and complete manner, and the display effect of the graphic code image is improved.
And step 540, drawing the zoomed graphic code image in the background image to obtain the processed image.
In one embodiment of the present invention, the drawing the scaled graphic code image in the background image to obtain the processed image includes: and centrally drawing the zoomed graphic code image in the background image to obtain the processed image.
When the scaled graphic code image is drawn in the background image, the scaled graphic code image is centered in the background image. For example, when the lateral dimension (width) of the scaled graphic code image is the same as the lateral dimension of the background image, the background image may be horizontally filled when the scaled graphic code image is drawn in the background image, and the vertical direction may be drawn centrally, i.e., the dimensions of the blank areas left on the upper and lower sides are the same. The display effect of the graphic code image can be improved by centrally drawing the zoomed graphic code image in the background image.
And 550, performing graphic code recognition on the processed image to obtain the position information of each graphic code in the processed image.
Step 560, displaying the processed image in the display control, and displaying the position mark of each graphic code in the processed image according to the position information of each graphic code.
According to the graphic code display method, when the graphic code image is subjected to scaling processing, a background image with the image size being the display size of the display space is generated, the graphic code image is scaled to the display size in an equal ratio, and then the scaled graphic code image is drawn in the background image to obtain a processed image, so that the processed image obtained through processing can be displayed in a display control in a maximized and complete mode.
Fig. 6 is a schematic diagram of cross-spreading when performing adaptive display on a graphic code image in an embodiment of the present invention, as shown in fig. 6, performing adaptive display on a graphic code image 1, that is, scaling the graphic code image 1, drawing the graphic code image in a background image with the same display size as that of a display control, to obtain a processed image 14, spreading the display control on the processed image 14, performing graphic code recognition on the processed image 14, to obtain position information 15 of a graphic code, and displaying the processed image 14 and the position information 15 of the graphic code in the display control, to obtain a display image 16. Compared with fig. 1, the coordinate adaptation process of the graphic code position in fig. 6 is not required, so that the calculation amount can be reduced, and the efficiency of the adaptation display can be improved.
Fig. 7 is a schematic diagram of longitudinal spreading when performing adaptive display on a graphic code image in the embodiment of the present invention, as shown in fig. 7, performing adaptive display on the graphic code image 5, that is, scaling the graphic code image 5, drawing the graphic code image in a background image with the same display size as that of a display control, obtaining a processed image 17, spreading the display control longitudinally on the processed image 17, performing graphic code recognition on the processed image 17, obtaining position information 18 of the graphic code, and displaying the processed image 17 and the position information 18 of the graphic code in the display control, so as to obtain a display image 19. Compared with fig. 2, the coordinate adaptation process of the graphic code position in fig. 7 is not required, so that the calculation amount can be reduced, and the efficiency of the adaptation display can be improved.
Fig. 8 is a block diagram of a graphic code display device according to an embodiment of the present invention, and as shown in fig. 8, the graphic code display device includes:
an obtaining module 810, configured to obtain a graphic code image, and obtain a display size of a display control, where the graphic code image includes at least one graphic code;
a scaling processing module 820, configured to perform scaling processing on the graphic code image according to the display size, so as to obtain a processed image, where a width of the processed image is the same as a width in the display size, and a height of the processed image is less than or equal to a height in the display size, or the height of the processed image is the same as a height in the display size, and a width of the processed image is less than or equal to a width in the display size;
A graphic code recognition module 830, configured to perform graphic code recognition on the processed image, to obtain location information of each graphic code in the processed image;
and the display module 840 is configured to display the processed image in the display control, and display the position mark of each graphic code in the processed image according to the position information of each graphic code.
Optionally, the scaling processing module includes:
a background image generating unit for generating a background image with an image size being the display size;
a scaling processing unit for scaling the graphic code image to the presentation size in an equal ratio;
and the image drawing unit is used for drawing the zoomed graphic code image in the background image to obtain the processed image.
Optionally, the scaling processing unit includes:
a first aspect ratio determining subunit configured to determine an aspect ratio of the graphic code image as a first aspect ratio;
a second aspect ratio determining subunit configured to determine, as a second aspect ratio, an aspect ratio of the presentation control according to the presentation size;
a first scaling determination subunit configured to determine a scaling of the graphics code image according to the first aspect ratio, the second aspect ratio, the size of the graphics code image, and the presentation size;
And the first scaling processing subunit is used for scaling the graphic code image to the display size according to the scaling ratio.
Optionally, the first scaling determining subunit is specifically configured to:
if the first aspect ratio is greater than or equal to the second aspect ratio, determining a first ratio between the width in the presentation size and the width of the graphic code image as the scaling;
if the first aspect ratio is less than the second aspect ratio, a second ratio between the height in the display size and the height of the graphic code image is determined as the scaling.
Optionally, the scaling processing unit includes:
a ratio determination subunit configured to determine a third ratio between a width in the display size and a width of the graphic code image, and determine a fourth ratio between a height in the display size and a height of the graphic code image;
a second scaling determining subunit, configured to determine a scaling of the graphic code image according to the third ratio and the fourth ratio;
and the second scaling processing subunit is used for scaling the graphic code image to the display size according to the scaling ratio.
Optionally, the second scaling determining subunit is specifically configured to:
if the maximum value between the third ratio and the fourth ratio is greater than or equal to 1, determining the minimum value between the third ratio and the fourth ratio as the scaling of the graphic code image;
and if the maximum value between the third ratio and the fourth ratio is smaller than 1, determining the maximum value between the third ratio and the fourth ratio as the scaling of the graphic code image.
Optionally, the image drawing unit is specifically configured to:
and centrally drawing the zoomed graphic code image in the background image to obtain the processed image.
The graphic code display device provided by the embodiment of the invention is used for realizing the steps of the graphic code display method provided by the embodiment of the invention, and the specific implementation of each module of the device refers to the corresponding steps and is not repeated here.
According to the graphic code display device provided by the embodiment of the invention, the graphic code image is subjected to scaling treatment according to the display size of the display control, so that the processed image is obtained, the width of the processed image is identical to the width in the display size, or the height of the processed image is identical to the height in the display size, the graphic code identification is carried out on the processed image, the position information of each graphic code in the processed image is obtained, the processed image is displayed in the display control, the position mark of each graphic code is displayed in the processed image according to the position information of each graphic code, the graphic code identification is carried out after the graphic code image is subjected to the adaptation adjustment based on the display size of the display control, the identified graphic code position information is the display position information of the graphic code in the processed image, the adaptation adjustment of the graphic code position information is not needed, the complex operation of the adaptation adjustment of the graphic code position information is reduced, the calculated amount is reduced, the graphic code adaptation display time is shortened, and the graphic code adaptation display efficiency and the identification efficiency are improved.
Preferably, the embodiment of the present invention further provides an electronic device, including: the computer program is stored in the memory and can run on the processor, and when the computer program is executed by the processor, the processes of the above-mentioned graphic code display method embodiment are implemented, and the same technical effects can be achieved, so that repetition is avoided, and the description is omitted here.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, realizes the processes of the above-mentioned graphic code display method embodiment, and can achieve the same technical effects, and in order to avoid repetition, the description is omitted here. Wherein the computer readable storage medium is selected from Read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The embodiments of the present invention have been described above with reference to the accompanying drawings, but the present invention is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present invention and the scope of the claims, which are to be protected by the present invention.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk, etc.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (10)

1. A graphic code display method, comprising:
acquiring a graphic code image, and acquiring the display size of a display control, wherein the graphic code image comprises at least one graphic code;
performing scaling processing on the graphic code image according to the display size to obtain a processed image, wherein the width of the processed image is the same as the width in the display size, the height of the processed image is smaller than or equal to the height in the display size, or the height of the processed image is the same as the height in the display size, and the width of the processed image is smaller than or equal to the width in the display size;
performing graphic code identification on the processed image to obtain the position information of each graphic code in the processed image;
And displaying the processed image in the display control, and displaying the position mark of each graphic code in the processed image according to the position information of each graphic code.
2. The method according to claim 1, wherein scaling the graphic code image according to the display size to obtain a processed image comprises:
generating a background image with the image size being the display size;
scaling the graphic code image to the presentation size;
and drawing the zoomed graphic code image in the background image to obtain the processed image.
3. The method of claim 2, wherein the scaling the graphic code image to the presentation size comprises:
determining an aspect ratio of the graphic code image as a first aspect ratio;
determining the aspect ratio of the display control as a second aspect ratio according to the display size;
determining a scale of the graphic code image according to the first aspect ratio, the second aspect ratio, the size of the graphic code image, and the presentation size;
and scaling the graphic code image to the showing size according to the scaling scale.
4. A method according to claim 3, wherein said determining the scale of the graphic code image based on the first aspect ratio, the second aspect ratio, the size of the graphic code image and the presentation size comprises:
if the first aspect ratio is greater than or equal to the second aspect ratio, determining a first ratio between the width in the presentation size and the width of the graphic code image as the scaling;
if the first aspect ratio is less than the second aspect ratio, a second ratio between the height in the display size and the height of the graphic code image is determined as the scaling.
5. The method of claim 2, wherein the scaling the graphic code image to the presentation size comprises:
determining a third ratio between the width in the display size and the width of the graphic code image, and determining a fourth ratio between the height in the display size and the height of the graphic code image;
determining a scaling of the graphic code image according to the third ratio and the fourth ratio;
and scaling the graphic code image to the showing size according to the scaling scale.
6. The method of claim 5, wherein said determining a scale of the graphic code image based on the third ratio and the fourth ratio comprises:
if the maximum value between the third ratio and the fourth ratio is greater than or equal to 1, determining the minimum value between the third ratio and the fourth ratio as the scaling of the graphic code image;
and if the maximum value between the third ratio and the fourth ratio is smaller than 1, determining the maximum value between the third ratio and the fourth ratio as the scaling of the graphic code image.
7. The method according to any one of claims 2-6, wherein said rendering the scaled graphic code image in the background image to obtain the processed image comprises:
and centrally drawing the zoomed graphic code image in the background image to obtain the processed image.
8. A graphic code display device, comprising:
the acquisition module is used for acquiring a graphic code image and acquiring the display size of the display control, wherein the graphic code image comprises at least one graphic code;
the scaling processing module is used for scaling the graphic code image according to the display size to obtain a processed image, wherein the width of the processed image is the same as the width in the display size, the height of the processed image is smaller than or equal to the height in the display size, or the height of the processed image is the same as the height in the display size, and the width of the processed image is smaller than or equal to the width in the display size;
The graphic code identification module is used for carrying out graphic code identification on the processed image to obtain the position information of each graphic code in the processed image;
the display module is used for displaying the processed image in the display control and displaying the position mark of each graphic code in the processed image according to the position information of each graphic code.
9. An electronic device, comprising: a processor, a memory and a computer program stored on the memory and executable on the processor, which when executed by the processor performs the steps of the graphical code presentation method of any of claims 1 to 7.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the graphic code presentation method according to any of claims 1 to 7.
CN202211656786.3A 2022-12-22 2022-12-22 Graphic code display method and device, electronic equipment and storage medium Pending CN116228533A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211656786.3A CN116228533A (en) 2022-12-22 2022-12-22 Graphic code display method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211656786.3A CN116228533A (en) 2022-12-22 2022-12-22 Graphic code display method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116228533A true CN116228533A (en) 2023-06-06

Family

ID=86570601

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211656786.3A Pending CN116228533A (en) 2022-12-22 2022-12-22 Graphic code display method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116228533A (en)

Similar Documents

Publication Publication Date Title
US20180232135A1 (en) Method for window displaying on a mobile terminal and mobile terminal
EP2779618B1 (en) Automatic generation of thumbnail images
JP2002123842A (en) Device for generating stereoscopic image, and medium for recording information
CN104915332A (en) Method and device for generating composing template
CN111291753A (en) Image-based text recognition method and device and storage medium
CN111209908B (en) Method, device, storage medium and computer equipment for updating annotation frame
CN111833234A (en) Image display method, image processing apparatus, and computer-readable storage medium
CN112686131B (en) Image processing method, device, equipment and storage medium
CN113592720A (en) Image scaling processing method, device, equipment, storage medium and program product
CN111881846B (en) Image processing method, image processing apparatus, image processing device, image processing apparatus, storage medium, and computer program
CN111008987B (en) Method and device for extracting edge image based on gray background and readable storage medium
CN116228533A (en) Graphic code display method and device, electronic equipment and storage medium
CN116193159A (en) Image data adjustment method and device, electronic equipment and storage medium
US20180336684A1 (en) Image processing device, image processing method, and information storage medium
CN115454365A (en) Picture processing method and device, electronic equipment and medium
CN115100663A (en) Method and device for estimating distribution situation of character height in document image
CN111372009B (en) Image processing method and processing equipment
JP2004054898A (en) Printing data generating device, printing data generating method and program
CN110996026B (en) OSD display method, device, equipment and storage medium
CN113763233A (en) Image processing method, server and photographing device
US11798212B2 (en) Content generation method for electronic books and computer-readable medium
JP4125245B2 (en) Document display method and document display apparatus
CN116778032B (en) Answer sheet generation method, device, equipment and storage medium
CN110473146B (en) Remote sensing image display method and device, storage medium and computer equipment
CN114205659A (en) Method, device and equipment for adjusting video picture

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination