CN110969580A - Image display method and device - Google Patents

Image display method and device Download PDF

Info

Publication number
CN110969580A
CN110969580A CN201911259917.2A CN201911259917A CN110969580A CN 110969580 A CN110969580 A CN 110969580A CN 201911259917 A CN201911259917 A CN 201911259917A CN 110969580 A CN110969580 A CN 110969580A
Authority
CN
China
Prior art keywords
resolution
width
height
image
calculating
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.)
Granted
Application number
CN201911259917.2A
Other languages
Chinese (zh)
Other versions
CN110969580B (en
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.)
Shell Internet Beijing Security Technology Co Ltd
Original Assignee
Shell Internet Beijing Security Technology 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 Shell Internet Beijing Security Technology Co Ltd filed Critical Shell Internet Beijing Security Technology Co Ltd
Priority to CN201911259917.2A priority Critical patent/CN110969580B/en
Publication of CN110969580A publication Critical patent/CN110969580A/en
Application granted granted Critical
Publication of CN110969580B publication Critical patent/CN110969580B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4053Scaling of whole images or parts thereof, e.g. expanding or contracting based on super-resolution, i.e. the output image resolution being higher than the sensor resolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/14Digital output to display device ; Cooperation and interconnection of the display device with other functional units
    • G06F3/1407General aspects irrespective of display type, e.g. determination of decimal point position, display with fixed or driving decimal point, suppression of non-significant zeros
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4092Image resolution transcoding, e.g. by using client-server architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2200/00Indexing scheme for image data processing or generation, in general
    • G06T2200/16Indexing scheme for image data processing or generation, in general involving adaptation to the client's capabilities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2200/00Indexing scheme for image data processing or generation, in general
    • G06T2200/24Indexing scheme for image data processing or generation, in general involving graphical user interfaces [GUIs]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Processing (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

The application provides an image display method and device, wherein the method comprises the following steps: when the first resolution of the image is inconsistent with the second resolution of the display area, obtaining a height reference adjustment value by calculating the height of the first resolution and the height of the second resolution, and obtaining a width reference adjustment value by calculating the width of the first resolution and the width of the second resolution; calculating the height reference adjusting value and the width reference adjusting value according to a preset algorithm to obtain a target adjusting value; respectively calculating the height and the width of the first resolution according to the target adjusting value to obtain the scaling height and the scaling width of the first resolution; and generating a target image corresponding to the image according to the zoom height and the zoom width, and displaying the target image in a display area. Therefore, the problem of display distortion caused by inconsistent display resolution of the image and the display area is avoided, and the display effect of the image is optimized.

Description

Image display method and device
Technical Field
The present application relates to the field of technologies, and in particular, to an image display method and apparatus.
Background
The display adaptation of images is a common technical problem at present, for example, in the process of game design and development, the adaptation is an indehiscent topic, and the adaptation includes a lot of parameters and rules, so that the images in the game can be displayed perfectly on different devices (with different resolutions), and the phenomenon of force image distortion and stretching is not generated.
In the related art, an image may have an image resolution when generating a design, and a display device may have a display resolution, and when the image resolution is not consistent with the display resolution, the image may be full-screen-adapted, that is, the image resolution is adjusted to the display resolution, so that, as shown in fig. 1, the image may be stretched to generate distortion.
Disclosure of Invention
The application provides an image display method and device, which are used for solving the technical problem of image display distortion caused by mismatching of image resolution and display area resolution in the related technology.
An embodiment of an aspect of the present application provides an image display method, including: when a first resolution of an image is inconsistent with a second resolution of a display area, obtaining a height reference adjustment value for the calculation of the height of the first resolution and the height of the second resolution, and obtaining a width reference adjustment value for the calculation of the width of the first resolution and the width of the second resolution; calculating the height reference adjusting value and the width reference adjusting value according to a preset algorithm to obtain a target adjusting value; respectively calculating the height and the width of the second resolution according to the target adjusting value to obtain the zoom height and the zoom width of the image; and generating a target image corresponding to the image according to the zoom height and the zoom width, and displaying the target image in the display area.
In addition, the image display method of the embodiment of the application further includes the following additional technical features:
in a possible implementation manner of the embodiment of the present application, the calculating the height of the first resolution and the height of the second resolution to obtain a height reference adjustment value, and calculating the width of the first resolution and the width of the second resolution to obtain a width reference adjustment value includes: calculating the high ratio of the second resolution to the first resolution according to a preset logarithmic formula to obtain the height reference adjustment value; and calculating the width ratio of the second resolution to the first resolution according to the preset logarithmic formula to obtain the width reference adjusting value.
In a possible implementation manner of the embodiment of the present application, the calculating the height of the first resolution and the height of the second resolution to obtain a height reference adjustment value, and calculating the width of the first resolution and the width of the second resolution to obtain a width reference adjustment value includes: calculating a high absolute difference value between the second resolution and the first resolution, and calculating a high ratio of the high absolute difference value to the first resolution to obtain the height reference adjustment value; calculating a width difference absolute value of the second resolution and the first resolution, and calculating a ratio of the width difference absolute value to the width of the first resolution to obtain the width reference adjustment value.
In a possible implementation manner of the embodiment of the present application, the calculating the height reference adjustment value and the width reference adjustment value according to a preset algorithm to obtain a target adjustment value includes: calculating the height reference adjusting value and the width reference adjusting value according to a preset interpolation algorithm to obtain a reference adjusting value; and calculating the reference adjusting value according to a preset calculation formula to obtain the target adjusting value.
In a possible implementation manner of the embodiment of the present application, the calculating the height reference adjustment value and the width reference adjustment value according to a preset algorithm to obtain a target adjustment value includes: and calculating the arithmetic mean value of the height reference adjusting value and the width reference adjusting value to obtain the target adjusting value.
In a possible implementation manner of the embodiment of the present application, the obtaining the zoom height and the zoom width of the image by respectively calculating the height and the width of the second resolution according to the target adjustment value includes: calculating the ratio of the height of the second resolution to the target adjustment value to obtain the zoom height of the image; and calculating the ratio of the width of the second resolution to the target adjustment value to obtain the zoom width of the image.
In a possible implementation manner of the embodiment of the present application, the generating a target image corresponding to the image according to the zoom height and the zoom width includes: adjusting the first resolution of the image according to the zoom height and the zoom width, and generating the target image according to the adjusted image; or, determining the size of the canvas of the image according to the zoom height and the zoom width; and rendering the image according to the adjusted canvas to generate the target image.
An embodiment of an aspect of the present application provides an image display apparatus, including: a first calculation module, configured to, when a first resolution of an image is inconsistent with a second resolution of a display area, obtain height reference adjustment values for the calculation of the height of the first resolution and the height of the second resolution, and obtain width reference adjustment values for the calculation of the width of the first resolution and the width of the second resolution; the second calculation module is used for calculating the height reference adjusting value and the width reference adjusting value according to a preset algorithm to obtain a target adjusting value; the third calculation module is used for calculating the height and the width of the second resolution according to the target adjustment value respectively to obtain the zoom height and the zoom width of the image; and the display module is used for generating a target image corresponding to the image according to the zoom height and the zoom width and displaying the target image in the display area.
In addition, the image display device according to the embodiment of the present application further includes the following additional technical features:
in a possible implementation manner of the embodiment of the present application, the first calculating module is specifically configured to: calculating the high ratio of the second resolution to the first resolution according to a preset logarithmic formula to obtain the height reference adjustment value; and calculating the width ratio of the second resolution to the first resolution according to the preset logarithmic formula to obtain the width reference adjusting value.
In a possible implementation manner of the embodiment of the present application, the first calculating module is specifically configured to: calculating a high absolute difference value between the second resolution and the first resolution, and calculating a high ratio of the high absolute difference value to the first resolution to obtain the height reference adjustment value; and calculating the width difference absolute value of the second resolution and the first resolution, and calculating the ratio of the width difference absolute value to the width of the first resolution to obtain the width reference adjustment value.
In a possible implementation manner of the embodiment of the present application, the second calculating module is specifically configured to: calculating the height reference adjusting value and the width reference adjusting value according to a preset interpolation algorithm to obtain a reference adjusting value; and calculating the reference adjusting value according to a preset calculation formula to obtain the target adjusting value.
In a possible implementation manner of the embodiment of the present application, the second calculating module is specifically configured to: and calculating the arithmetic mean value of the height reference adjusting value and the width reference adjusting value to obtain the target adjusting value.
In a possible implementation manner of the embodiment of the present application, the third calculating module is specifically configured to: calculating the ratio of the height of the second resolution to the target adjustment value to obtain the zoom height of the image; and calculating the ratio of the width of the second resolution to the target adjustment value to obtain the zoom width of the image.
In a possible implementation manner of the embodiment of the present application, the display module is specifically configured to:
adjusting the first resolution of the image according to the zoom height and the zoom width, and generating the target image according to the adjusted image; or,
the display module is specifically configured to: determining a canvas size of the image according to the zoom height and the zoom width; and rendering the image according to the adjusted canvas to generate the target image.
Another embodiment of the present application provides an electronic device, including a processor and a memory; wherein the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, for implementing the image display method as described in the above embodiments.
Another embodiment of the present application proposes a non-transitory computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the image display method as described in the above embodiment.
The technical scheme provided by the embodiment of the application at least has the following technical effects:
when the first resolution of the image is inconsistent with the second resolution of the display area, calculating the height of the first resolution and the height of the second resolution to obtain a height reference adjusting value, calculating the width of the first resolution and the width of the second resolution to obtain a width reference adjusting value, calculating the height reference adjusting value and the width reference adjusting value according to a preset algorithm to obtain a target adjusting value, calculating the height and the width of the second resolution respectively according to the target adjusting value to obtain the zoom height and the zoom width of the image, further generating a target image corresponding to the image according to the zoom height and the zoom width, and displaying the target image on the display area. Therefore, the problem of display distortion caused by inconsistent display resolutions of the image and the display area is avoided, and the display effect of the image is optimized.
Additional aspects and advantages of the application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the application.
Drawings
The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a schematic diagram of an image display scene in the prior art according to an embodiment of the present application;
fig. 2 is a schematic flowchart of an image display method according to an embodiment of the present disclosure;
FIG. 3-1 is a schematic illustration of a display area according to one embodiment of the present application;
3-2 are schematic diagrams of display regions according to another embodiment of the present application;
FIG. 4 is a schematic diagram of a configuration of an image display device according to an embodiment of the present application; and
FIG. 5 illustrates a block diagram of an exemplary electronic device suitable for use in implementing embodiments of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary and intended to be used for explaining the present application and should not be construed as limiting the present application.
An image display method and apparatus of an embodiment of the present application are described below with reference to the drawings. The image display method of the embodiment of the application is applied to any image containing the game interface image.
In order to solve the technical problem of image distortion caused by direct rough stretching when the image resolution is adjusted to the display resolution, the invention provides an optimal adjustment method of the image resolution, which ensures that the image is not distorted and achieves the best display effect.
Specifically, fig. 2 is a schematic flowchart of an image display method according to an embodiment of the present disclosure. As shown in fig. 2, the method includes:
step 101, when the first resolution of the image is not consistent with the second resolution of the display area, a height reference adjustment value is obtained for the calculation of the height of the first resolution and the height of the second resolution, and a width reference adjustment value is obtained for the calculation of the width of the first resolution and the width of the second resolution.
It should be noted that the resolution is understood as the ratio of the resolution of the high side of the image or the display area to the resolution of the wide side, and the resolution of the display area of many mobile phones is 16: 9 (here, aspect ratio) where 16 is the value of the high side and 9 is the value of the wide side, where the first resolution of the image mentioned in this embodiment is not consistent with the second resolution of the display area, meaning that the ratio of the length of the long side to the length of the wide side is different. As shown in fig. 3-1, the display area in this embodiment may be the entire display screen, or may be a partial area in the display screen displaying the image as shown in fig. 3-2, which is not limited herein.
Specifically, the image resolution of the image and the display resolution of the display area are obtained, whether the image resolution and the display resolution are the same is determined, whether the resolutions of the image resolution and the display resolution are the same is determined, if the resolutions of the image resolution and the display resolution are not the same, a height reference adjustment value is obtained by calculating the height of the first resolution and the height of the second resolution, and a width reference adjustment value is obtained by calculating the width of the first resolution and the width of the second resolution, wherein the height reference adjustment value reflects the difference of the first resolution and the second resolution in height, and the width reference value reflects the difference of the first resolution and the second resolution in width.
It should be noted that, in different application scenarios, the height reference adjustment value and the width reference adjustment value are calculated in different manners, which is exemplified as follows:
example one:
in this example, the height reference adjustment value is obtained according to the preset logarithmic formula for calculating the high ratio of the second resolution to the first resolution, that is, in this embodiment, the logarithmic formula is used to calculate the logarithmic value of the high ratio of the first resolution to the second resolution, and since the logarithm may reflect the characteristic of the ratio and may reduce the data magnitude, the logarithmic formula is given to calculate the height reference adjustment value in this example.
Similarly, in this embodiment, the width reference adjustment value is obtained by calculating the width ratio of the second resolution to the first resolution according to a preset logarithmic formula.
It should be noted that, in this embodiment, the logarithmic formulas for calculating the width reference value and the height reference value are the same, so as to ensure the precision of the subsequent image resolution scaling, where the logarithmic reference formulas may be multiple:
as one possible example, the logarithmic formula may be formula (1) below, in which formula (1), H1 and H2 are respectively high for the first resolution, H is the height reference adjustment value, W1 and W2 are respectively wide for the first resolution, and W is the height reference adjustment value:
Figure BDA0002311335800000051
as another possible implementation manner, a high absolute difference value between the second resolution and the first resolution is calculated, and a ratio between the high absolute difference value and the high first resolution is calculated to obtain a height reference adjustment value, i.e., a difference between the first resolution and the second resolution in height is determined according to the high ratio.
Of course, other ways of calculating the height reference adjustment value and the width reference adjustment value are also possible, such as, for example, using only the absolute value of the high difference as the height reference adjustment value, using only the absolute value of the wide difference as the width reference adjustment value, etc. For another example, the height reference adjustment value may be obtained by calculating a ratio of a height of the image to a height of the display area, and the width reference adjustment value may be obtained by calculating a ratio of a width of the image to a width of the display area.
For example, when the first resolution of the image is 750 × 1334 and the second resolution of the display region is 1080 × 2240, the height reference adjustment value is 750/1080 and the length reference adjustment value is 1334/2240.
The calculation method in the two examples can be selected according to the requirements of the application scene, when the resolution is expressed by aspect ratio, the calculation in example two can be adopted, and when the resolution is expressed by a large number of orders of pixels and the like, the calculation in the manner shown in example one can be adopted in order to reduce the calculation amount. In example one, the reference adjustment value can be accurately calculated to the pixel level, so that accurate adaptation of the image is possible, and the existing adaptation method can be greatly improved, so that the user experience of more models can be considered when the image is adapted.
And 102, calculating the height reference adjusting value and the width reference adjusting value according to a preset algorithm to obtain a target adjusting value.
Specifically, the height reference adjustment value and the width reference adjustment value are calculated according to a preset algorithm, and a target adjustment value is obtained, namely, the height difference and the width difference are comprehensively considered to calculate the target adjustment value.
It should be noted that, in different application scenarios, the height reference adjustment value and the width reference adjustment value are calculated according to a preset algorithm, and the manner of obtaining the target adjustment value is different, which is exemplified as follows:
example one:
in this example, the height reference adjustment value and the width reference adjustment value are calculated according to a preset interpolation algorithm to obtain a reference adjustment value, and further, the reference adjustment value is calculated according to a preset calculation formula to obtain a target adjustment value.
That is, in the present example, the height reference adjustment value and the width reference adjustment value are calculated twice, and the target adjustment value is obtained.
The preset interpolation algorithm formula can be shown in formula (2), M is a deviation ratio in the difference algorithm and belongs to a certain numerical value between 0 and 1, and when M is 1, the interpolation output by formula (2) is log2W, when M is 0, the interpolation output by the formula (2) is log2H, when M is 0.5, the value output by the formula (2) is log2W and log2The preset calculation formula of the average value of the sum of H may be as shown in the following formula (3), where D is the target adjustment value, a is the reference adjustment value, H is the height reference adjustment value, and W is the height reference adjustment value.
A=Lerp(log2H,log2W, M) formula (2)
D=2AEquation (3).
Example two:
in this example, the height reference adjustment value and the width reference adjustment value are arithmetically averaged to obtain a target adjustment value. I.e. the target adjustment value is determined directly from the arithmetic mean of the height reference adjustment value and the width reference adjustment value.
In this example, for better adjusting the image, an absolute value of a difference between the height reference adjustment value and the width reference adjustment value may be calculated, and if the absolute value is greater than a certain value, it indicates that the difference between the height reference adjustment value and the width reference adjustment value is greater, at this time, after an arithmetic mean value is calculated, a corresponding percentage is determined according to the difference between the absolute value and the certain value, a product value of the greater adjustment value and the percentage of the height reference adjustment value and the width reference adjustment value is calculated, and a target adjustment value is determined according to a sum of the arithmetic mean value and the product value, thereby compensating the reference adjustment value having the greater difference for the target adjustment value to a greater extent.
And 103, respectively calculating the height and the width of the second resolution according to the target adjusting value to obtain the zoom height and the zoom width of the image.
Specifically, after the target adjustment value is obtained, the height and width of the second resolution are calculated according to the target adjustment value, and the zoom height and the zoom width of the image are obtained.
It should be noted that, depending on the generation method of the target adjustment value, the calculation methods for the zoom width and the zoom height are different:
as a possible implementation manner, when the calculation manner of the target adjustment value is the calculation manner of the above example, the ratio of the height of the second resolution to the target adjustment value is calculated, the zoom height of the image is acquired, the ratio of the width of the second resolution to the target adjustment value is calculated, and the zoom width of the image is acquired.
As another possible implementation manner, for the target adjustment value calculated in some scenarios, a product value of the height of the first resolution and the target adjustment value is calculated, the zoom height of the first resolution is obtained, a product value of the width of the first resolution and the target adjustment value is calculated, and the zoom width of the first resolution is obtained.
And 104, generating a target image corresponding to the image according to the zoom height and the zoom width, and displaying the target image in the display area.
Specifically, a target image corresponding to the image is generated according to the zoom height and the zoom width, and the target image is adapted to the size of the display area, so that the target image is displayed in the display area, and the display effect of the image is optimized.
It should be noted that, in different application scenarios, the manner of generating the target image corresponding to the image according to the zoom height and the zoom width is different, and the following example is given:
example one:
in this example, the first resolution may be adjusted according to the zoom height and the zoom width, the image may be adjusted according to the ratio when the zoom height and the zoom width are at the aspect ratio level, and the length and the width of the corresponding image may be directly adjusted at the pixel level when the zoom height and the zoom width are at the pixel level, for example, stretching may be performed by interpolating the pixels, or reducing may be performed by merging the pixels, and the like.
To explain the image display method of the present embodiment in more detail, in the present scene, the first resolution is 1920 × 1080 (pixel level), the second resolution is 750 × 1334 (pixel level), the calculated H is 0.3434, W is 0.0588, a is 0.2011, the calculated D is 1.1455, the calculated width scaling ratio is 750/D652, and the calculated height scaling ratio is 1334/D1161, in combination with the specific scene distance. The image is adjusted according to the width scaling ratio and the height scaling ratio.
In an embodiment of the present application, in order to view the displayed effect, the image after zoom adjustment may be firstly displayed in the form of a preview, and after confirmation by the user, the image is displayed in an adaptive manner.
Example two:
in this example, the canvas size of the image is determined according to the zoom height and the zoom width, that is, the width and the height of the canvas size are respectively adjusted to the zoom height and the zoom width, and then the target image is generated according to the adjusted canvas rendering image, that is, in this example, the canvas where the image is located is changed without changing the resolution of the image, so that the image retains the original image element size, the reality sense of the image is improved, and the target is pushed to be matched with the size of the display area.
To sum up, in the image display method according to the embodiment of the present application, when the first resolution of the image is inconsistent with the second resolution of the display area, the height reference adjustment value is obtained by calculating the height of the first resolution and the height of the second resolution, the width reference adjustment value is obtained by calculating the width of the first resolution and the width of the second resolution, the height reference adjustment value and the width reference adjustment value are calculated according to a preset algorithm, the target adjustment value is obtained, the zoom height and the zoom width of the image are obtained by calculating the height and the width of the second resolution according to the target adjustment value, and then the first resolution of the image is adjusted according to the zoom height and the zoom width, and the adjusted image is displayed in the display area. Therefore, the problem of display distortion caused by inconsistent display resolutions of the image and the display area is avoided, and the display effect of the image is optimized.
In order to implement the above embodiments, the present application also proposes an image display device. Fig. 4 is a schematic structural diagram of an image display device according to an embodiment of the present application, as shown in fig. 4, the image display device including: a first calculation module 10, a second calculation module 20, a second calculation module 30 and a display module 40, wherein,
a first calculating module 10, configured to, when a first resolution of the image is inconsistent with a second resolution of the display area, obtain height reference adjustment values for the calculation of the height of the first resolution and the height of the second resolution, and obtain width reference adjustment values for the calculation of the width of the first resolution and the width of the second resolution;
the second calculation module 20 is configured to calculate the height reference adjustment value and the width reference adjustment value according to a preset algorithm to obtain a target adjustment value;
a third calculating module 30, configured to calculate, according to the target adjustment value, the height and width of the second resolution, respectively, to obtain a zoom height and a zoom width of the image;
and a display module 40, configured to generate a target image corresponding to the image according to the zoom height and the zoom width, and display the target image in the display area.
In an embodiment of the present application, the first calculating module 10 is specifically configured to:
calculating the high ratio of the second resolution to the first resolution according to a preset logarithmic formula to obtain a height reference adjustment value;
and calculating the width ratio of the second resolution to the first resolution according to a preset logarithmic formula to obtain a width reference adjustment value.
In an embodiment of the present application, the first calculating module 10 is specifically configured to: calculating the high difference absolute value of the second resolution and the first resolution, and calculating the high ratio of the high difference absolute value to the first resolution to obtain a height reference adjustment value;
and calculating the width difference absolute value of the second resolution and the first resolution, and calculating the ratio of the width difference absolute value to the width of the first resolution to obtain the width reference adjustment value.
In an embodiment of the present application, the second calculating module 20 is specifically configured to:
calculating the height reference adjusting value and the width reference adjusting value according to a preset interpolation algorithm to obtain a reference adjusting value;
and calculating the reference adjusting value according to a preset calculation formula to obtain the target adjusting value.
In an embodiment of the present application, the second calculating module 20 is specifically configured to:
and calculating the arithmetic mean value of the height reference adjusting value and the width reference adjusting value to obtain the target adjusting value.
In an embodiment of the present application, the third calculating module 30 is specifically configured to: calculating the ratio of the height of the second resolution to the target adjustment value to obtain the zoom height of the image;
and calculating the ratio of the width of the second resolution to the target adjustment value to obtain the zoom width of the image.
In an embodiment of the present application, the display module 40 is specifically configured to:
adjusting the first resolution of the image according to the zoom height and the zoom width, and generating the target image according to the adjusted image; or,
the display module is specifically configured to: determining a canvas size of the image according to the zoom height and the zoom width; and rendering the image according to the adjusted canvas to generate the target image.
It should be noted that the foregoing explanation of the image processing method is also applicable to the image processing apparatus in the embodiment of the present application, and the implementation principle is similar, and is not repeated here.
To sum up, in the image display apparatus according to the embodiment of the present application, when the first resolution of the image is inconsistent with the second resolution of the display area, the height reference adjustment value is obtained by calculating the height of the first resolution and the height of the second resolution, the width reference adjustment value is obtained by calculating the width of the first resolution and the width of the second resolution, the height reference adjustment value and the width reference adjustment value are calculated according to a preset algorithm, the target adjustment value is obtained, the zoom height and the zoom width of the image are obtained by calculating the height and the width of the second resolution according to the target adjustment value, and then the target image corresponding to the image is generated according to the zoom height and the zoom width, and the target image is displayed in the display area. Therefore, the problem of display distortion caused by inconsistent display resolution of the image and the display area is avoided, and the display effect of the image is optimized.
In order to implement the foregoing embodiments, an electronic device is further provided in an embodiment of the present application, including a processor and a memory;
wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, for implementing the image display method as described in the above embodiments.
FIG. 5 illustrates a block diagram of an exemplary electronic device suitable for use in implementing embodiments of the present application. The electronic device 12 shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in FIG. 5, electronic device 12 is embodied in the form of a general purpose computing device. The components of electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
Memory 28 may include computer system readable media in the form of volatile Memory, such as Random Access Memory (RAM) 30 and/or cache Memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, and commonly referred to as a "hard disk drive"). Although not shown in FIG. 5, a disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a Compact disk Read Only memory (CD-ROM), a Digital versatile disk Read Only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the application.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally perform the functions and/or methodologies of the embodiments described herein.
Electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with electronic device 12, and/or with any devices (e.g., network card, modem, etc.) that enable electronic device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public Network such as the Internet) via the Network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via the bus 18. It should be understood that although not shown, other hardware and/or software modules may be used in conjunction with electronic device 12, including but not limited to: microcode, device drives, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing, for example, implementing the methods mentioned in the foregoing embodiments, by executing programs stored in the system memory 28.
In order to implement the above embodiments, the present application also proposes a non-transitory computer-readable storage medium on which a computer program is stored, which when executed by a processor implements the image display method as described in the above embodiments.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Moreover, various embodiments or examples and features of various embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing steps of a custom logic function or process, and alternate implementations are included within the scope of the preferred embodiment of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present application.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a sequential list of executable instructions that may be thought of as being useful for implementing logical functions, may be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that may fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having appropriate combinational logic gates, Programmable Gate Arrays (PGAs), Field Programmable Gate Arrays (FPGAs), etc.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware that can be related to instructions of a program, which can be stored in a computer-readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.

Claims (10)

1. An image display method, comprising the steps of:
when a first resolution of an image is inconsistent with a second resolution of a display area, obtaining a height reference adjustment value for a calculation of a height of the first resolution and a height of the second resolution, and obtaining a width reference adjustment value for a calculation of a width of the first resolution and a width of the second resolution;
calculating the height reference adjusting value and the width reference adjusting value according to a preset algorithm to obtain a target adjusting value;
respectively calculating the height and the width of the second resolution according to the target adjusting value to obtain the zoom height and the zoom width of the image;
and generating a target image corresponding to the image according to the zoom height and the zoom width, and displaying the target image in the display area.
2. The method of claim 1, wherein said calculating a height of said first resolution and a height of said second resolution to obtain a height reference adjustment value and calculating a width of said first resolution and a width of said second resolution to obtain a width reference adjustment value comprises:
calculating the high ratio of the second resolution to the first resolution according to a preset logarithmic formula to obtain the height reference adjustment value;
and calculating the width ratio of the second resolution to the first resolution according to the preset logarithmic formula to obtain the width reference adjusting value.
3. The method of claim 1, wherein said calculating a height of said first resolution and a height of said second resolution to obtain a height reference adjustment value and calculating a width of said first resolution and a width of said second resolution to obtain a width reference adjustment value comprises:
calculating a high absolute difference value between the second resolution and the first resolution, and calculating a high ratio of the high absolute difference value to the first resolution to obtain the height reference adjustment value;
and calculating the width difference absolute value of the second resolution and the first resolution, and calculating the ratio of the width difference absolute value to the width of the first resolution to obtain the width reference adjustment value.
4. The method of claim 1, wherein said calculating the height reference adjustment value and the width reference adjustment value according to a preset algorithm to obtain a target adjustment value comprises:
calculating the height reference adjusting value and the width reference adjusting value according to a preset interpolation algorithm to obtain a reference adjusting value;
and calculating the reference adjusting value according to a preset calculation formula to obtain the target adjusting value.
5. The method of claim 1, wherein said calculating the height reference adjustment value and the width reference adjustment value according to a preset algorithm to obtain a target adjustment value comprises:
and calculating the arithmetic mean value of the height reference adjusting value and the width reference adjusting value to obtain the target adjusting value.
6. The method of claim 1, wherein said obtaining a scaled height and a scaled width of said image based on said target adjustment value for said height and width calculations, respectively, for said second resolution comprises:
calculating the ratio of the height of the second resolution to the target adjustment value to obtain the zoom height of the image;
and calculating the ratio of the width of the second resolution to the target adjustment value to obtain the zoom width of the image.
7. The method of claim 1, wherein generating a target image corresponding to the image from the zoom height and the zoom width comprises:
adjusting the first resolution of the image according to the zoom height and the zoom width, and generating the target image according to the adjusted image; or,
determining a canvas size of the image according to the zoom height and the zoom width;
and rendering the image according to the adjusted canvas to generate the target image.
8. An image display apparatus, comprising:
a first calculation module, configured to, when a first resolution of an image is inconsistent with a second resolution of a display area, obtain height reference adjustment values for the calculation of the height of the first resolution and the height of the second resolution, and obtain width reference adjustment values for the calculation of the width of the first resolution and the width of the second resolution;
the second calculation module is used for calculating the height reference adjusting value and the width reference adjusting value according to a preset algorithm to obtain a target adjusting value;
the third calculation module is used for calculating the height and the width of the second resolution according to the target adjustment value respectively to obtain the zoom height and the zoom width of the image;
and the display module is used for generating a target image corresponding to the image according to the zoom height and the zoom width and displaying the target image in the display area.
9. An electronic device comprising a processor and a memory;
wherein the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory for implementing the image display method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the image display method according to any one of claims 1 to 7.
CN201911259917.2A 2019-12-10 2019-12-10 Image display method and device Active CN110969580B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911259917.2A CN110969580B (en) 2019-12-10 2019-12-10 Image display method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911259917.2A CN110969580B (en) 2019-12-10 2019-12-10 Image display method and device

Publications (2)

Publication Number Publication Date
CN110969580A true CN110969580A (en) 2020-04-07
CN110969580B CN110969580B (en) 2024-02-20

Family

ID=70033797

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911259917.2A Active CN110969580B (en) 2019-12-10 2019-12-10 Image display method and device

Country Status (1)

Country Link
CN (1) CN110969580B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112083906A (en) * 2020-08-25 2020-12-15 佛山市顺德区美的洗涤电器制造有限公司 Method, processor, device and storage medium for displaying cooking progress
CN112115392A (en) * 2020-08-18 2020-12-22 北京奇艺世纪科技有限公司 Image display method, image display device, electronic equipment and readable storage medium
CN112370784A (en) * 2021-01-15 2021-02-19 腾讯科技(深圳)有限公司 Virtual scene display method, device, equipment and storage medium
CN112598569A (en) * 2020-12-25 2021-04-02 上海硬通网络科技有限公司 Material delivery method and device and electronic equipment
CN114466401A (en) * 2022-03-02 2022-05-10 北京新氧科技有限公司 Image transmission method and electronic device
CN114510187A (en) * 2022-01-28 2022-05-17 北京百度网讯科技有限公司 Image display method and apparatus, electronic device, and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170006239A1 (en) * 2014-03-13 2017-01-05 Beijing Zhigu Rui Tuo Tech Co., Ltd Image acquisition method and image acquisition apparatus
CN106648511A (en) * 2016-12-16 2017-05-10 竞技世界(北京)网络技术有限公司 Self-adaptive display method and device of display resolutions
CN107093418A (en) * 2017-06-20 2017-08-25 努比亚技术有限公司 A kind of screen display method, computer equipment and storage medium
CN108733336A (en) * 2018-05-21 2018-11-02 北京字节跳动网络技术有限公司 page display method and device
CN108881743A (en) * 2018-07-19 2018-11-23 威创集团股份有限公司 A kind of method of video image processing based on combination, apparatus and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170006239A1 (en) * 2014-03-13 2017-01-05 Beijing Zhigu Rui Tuo Tech Co., Ltd Image acquisition method and image acquisition apparatus
CN106648511A (en) * 2016-12-16 2017-05-10 竞技世界(北京)网络技术有限公司 Self-adaptive display method and device of display resolutions
CN107093418A (en) * 2017-06-20 2017-08-25 努比亚技术有限公司 A kind of screen display method, computer equipment and storage medium
CN108733336A (en) * 2018-05-21 2018-11-02 北京字节跳动网络技术有限公司 page display method and device
CN108881743A (en) * 2018-07-19 2018-11-23 威创集团股份有限公司 A kind of method of video image processing based on combination, apparatus and system

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112115392A (en) * 2020-08-18 2020-12-22 北京奇艺世纪科技有限公司 Image display method, image display device, electronic equipment and readable storage medium
CN112115392B (en) * 2020-08-18 2023-08-25 北京奇艺世纪科技有限公司 Image display method, device, electronic equipment and readable storage medium
CN112083906A (en) * 2020-08-25 2020-12-15 佛山市顺德区美的洗涤电器制造有限公司 Method, processor, device and storage medium for displaying cooking progress
CN112598569A (en) * 2020-12-25 2021-04-02 上海硬通网络科技有限公司 Material delivery method and device and electronic equipment
CN112370784A (en) * 2021-01-15 2021-02-19 腾讯科技(深圳)有限公司 Virtual scene display method, device, equipment and storage medium
CN114510187A (en) * 2022-01-28 2022-05-17 北京百度网讯科技有限公司 Image display method and apparatus, electronic device, and medium
CN114510187B (en) * 2022-01-28 2023-06-23 北京百度网讯科技有限公司 Image display method and device, electronic equipment and medium
CN114466401A (en) * 2022-03-02 2022-05-10 北京新氧科技有限公司 Image transmission method and electronic device
CN114466401B (en) * 2022-03-02 2024-03-22 北京新氧科技有限公司 Image transmission method and electronic equipment

Also Published As

Publication number Publication date
CN110969580B (en) 2024-02-20

Similar Documents

Publication Publication Date Title
CN110969580B (en) Image display method and device
US10614551B2 (en) Image interpolation methods and related image interpolation devices thereof
US8565554B2 (en) Resizing of digital images
CN109993713B (en) Image distortion correction method and device for vehicle-mounted head-up display system
US20180115714A1 (en) Video stabilization for mobile devices
US8803902B2 (en) Computing level of detail for anisotropic filtering
CN110618803B (en) Image display method and device
CN109743473A (en) Video image 3 D noise-reduction method, computer installation and computer readable storage medium
US8204124B2 (en) Image processing apparatus, method thereof, and program
CN109767401B (en) Picture optimization method, device, terminal and corresponding storage medium
CN112306301B (en) Touch data processing method, device, equipment and storage medium
CN105930464B (en) Web rich media cross-screen adaptation method and device
CN106780336B (en) Image reduction method and device
US8233748B2 (en) Image-resolution-improvement apparatus and method
US20100054621A1 (en) Dual lookup table design for edge-directed image scaling
KR20160031328A (en) Method and apparatus for redndering
US9548043B2 (en) Pixel value interpolation method and system
WO2014008329A1 (en) System and method to enhance and process a digital image
US9082216B2 (en) System and method for filter kernel interpolation for seamless mipmap filtering
Gour et al. Hardware accelerator for real-time image resizing
JP2009111969A (en) Divided video processing apparatus and method, or control factor calculating apparatus
US9336573B2 (en) Self-adaptive image edge correction device and method thereof
CN113837987B (en) Tongue image acquisition method and device and computer equipment
TWI453695B (en) Video processing method and circuit using thereof
CN111126105B (en) Human body key point detection method and device

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
GR01 Patent grant
GR01 Patent grant