Image display method and device, equipment, storage medium and computer program product

By acquiring image data and rendering based on vertex and texture coordinates, the problem of long switching time and poor flexibility in existing technologies is solved, and fast and flexible image display is achieved.

CN121680979APending Publication Date: 2026-03-17BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

In existing technologies, switching image aspect ratios is time-consuming, lacks flexibility, and cannot be customized, thus affecting the user experience.

Method used

In response to an image display command, the system acquires image data and the set aspect ratio, determines the target image data, and renders and draws the target image based on preset vertex coordinates and texture coordinates to obtain and display the target image.

Benefits of technology

It improves the speed of acquiring target image data, enhances the user's visual experience and flexibility, and allows for arbitrary setting of the image display ratio.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121680979A_ABST
    Figure CN121680979A_ABST
Patent Text Reader

Abstract

The invention relates to an image display method and device, equipment, a storage medium and a computer program product, and the method comprises the steps: obtaining image data and a set picture display scale in response to a detected image display instruction; wherein the picture display scale comprises a randomly set scale; determining target image data in the image data according to the picture display scale; wherein the picture proportion represented by the target image data is the same as the picture display proportion; determining texture coordinates for drawing the target image data; and rendering and drawing the target image data based on preset vertex coordinates and the texture coordinates to obtain a target image and display the target image, wherein the vertex coordinates are used for indicating the size of a canvas during rendering, and the texture coordinates are used for associating pixel points in the target image data for rendering. Through the method, the efficiency and the flexibility are higher, and the visual experience of the user can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, and in particular to an image display method, apparatus, device, storage medium, and computer program product. Background Technology

[0002] With the rapid development of electronic devices, more and more things can be done on them. For example, taking photos with electronic devices has become an important way for people to record life and share beautiful moments. However, when users take photos or view images in their image library, they often need to adjust the aspect ratio according to the shooting scene or user needs to obtain better image results. But currently, switching aspect ratios is time-consuming, lacks flexibility, and cannot be customized. Summary of the Invention

[0003] To overcome the problems existing in related technologies, this disclosure provides an image display method, apparatus, device, storage medium, and computer program product.

[0004] According to a first aspect of the present disclosure, an image display method is provided, the method comprising:

[0005] In response to detecting an image display command, image data and a set aspect ratio are acquired; wherein, the aspect ratio can be any set aspect ratio;

[0006] Based on the aspect ratio, target image data is determined in the image data; wherein the aspect ratio represented by the target image data is the same as the aspect ratio.

[0007] Determine the texture coordinates used to draw the target image data;

[0008] The target image data is rendered and drawn based on preset vertex coordinates and texture coordinates to obtain and display the target image; wherein, the vertex coordinates are used to indicate the size of the canvas during rendering, and the texture coordinates are used to associate the pixels in the target image data for rendering.

[0009] In some embodiments, the acquired image data is data with an initial aspect ratio, and determining the target image data in the image data according to the aspect ratio includes:

[0010] In response to the image display ratio being the initial image ratio, the image data is used as the target image data;

[0011] In response to the image display ratio not being the initial image display ratio, a portion of the image data is determined from the image data as the target image data based on the image display ratio.

[0012] In some embodiments, the step of determining a portion of image data as the target image data based on the image data in response to the display aspect ratio not being the initial aspect ratio includes:

[0013] In response to the fact that the aspect ratio is not the initial aspect ratio, the size of the target image data is determined based on the size of the image data and the aspect ratio.

[0014] Based on the size of the target image data, with the center of the image data as the center of the target image data, a portion of the image data is determined from the image data as the target image data.

[0015] In some embodiments, determining the texture coordinates used to draw the target image data includes:

[0016] Determine the mapped coordinates of each vertex of the target image data in the texture coordinate system;

[0017] Each coordinate within the mapped coordinate range in the texture coordinate system is determined as the texture coordinate of the target image data.

[0018] In some embodiments, rendering and drawing the target image data based on preset vertex coordinates and texture coordinates to obtain and display the target image includes:

[0019] The size of the canvas is determined based on the canvas-occupied area indicated by the vertex coordinates;

[0020] The target image data is rendered and drawn on the canvas based on the texture coordinates to obtain and display the target image.

[0021] In some embodiments, determining the canvas size based on preset vertex coordinates includes:

[0022] In response to the vertex coordinate indication that the canvas is filled, the size of the display screen for displaying the target image is obtained;

[0023] Based on the size of the display screen and the aspect ratio, the size of the canvas used to draw the target image data is determined; wherein the aspect ratio of the canvas is the same as the aspect ratio of the display screen, and the size of at least one side of the canvas is the same as the size of one side of the display screen.

[0024] In some embodiments, the step of acquiring image data in response to detecting an image display instruction includes:

[0025] In response to the detection of an image display command, image data in YUV format is acquired.

[0026] In some embodiments, the step of acquiring image data and a set aspect ratio in response to detecting an image display command includes:

[0027] In response to the detection of an image preview command in the camera application, image data and the set aspect ratio are obtained.

[0028] According to a second aspect of the present disclosure, an image display apparatus is provided, the apparatus comprising:

[0029] The acquisition module is configured to acquire image data and a set aspect ratio in response to the detection of an image display command; wherein the aspect ratio can be any set aspect ratio.

[0030] The first determining module is configured to determine target image data in the image data based on the aspect ratio; wherein the aspect ratio represented by the target image data is the same as the aspect ratio.

[0031] The second determining module is configured to determine the texture coordinates used to draw the target image data;

[0032] The display module is configured to render and draw the target image data based on preset vertex coordinates and texture coordinates to obtain and display the target image; wherein, the vertex coordinates are used to indicate the size of the canvas during rendering, and the texture coordinates are used to associate the pixels in the target image data for rendering.

[0033] In some embodiments, the acquired image data is data with an initial aspect ratio. The first determining module is further configured to, in response to the aspect ratio being the initial aspect ratio, use the image data as the target image data; and in response to the aspect ratio not being the initial aspect ratio, determine a portion of the image data from the image data as the target image data based on the aspect ratio.

[0034] In some embodiments, the first determining module is further configured to, in response to the image display ratio not being the initial image display ratio, determine the size of the target image data based on the size of the image data and the image display ratio; and, based on the size of the target image data, determine a portion of the image data as the target image data, with the center of the image data as the center of the target image data.

[0035] In some embodiments, the second determining module is further configured to determine the mapped coordinates of each vertex coordinate of the target image data in the texture coordinate system; and to determine each coordinate within the range of the mapped coordinates in the texture coordinate system as the texture coordinates of the target image data.

[0036] In some embodiments, the display module is further configured to determine the size of the canvas based on the canvas-occupied area indicated by the vertex coordinates; render and draw the target image data on the canvas based on the texture coordinates to obtain and display the target image.

[0037] In some embodiments, the display module is further configured to, in response to the vertex coordinate indication to fill the canvas, obtain the size of the display screen for displaying the target image; and determine the size of the canvas for drawing the target image data based on the size of the display screen and the aspect ratio; wherein the aspect ratio of the canvas is the same as the aspect ratio, and the size of at least one side of the canvas is the same as the size of one side of the display screen.

[0038] In some embodiments, the acquisition module is further configured to acquire YUV format image data in response to detecting an image display instruction.

[0039] In some embodiments, the acquisition module is further configured to acquire image data and a set aspect ratio in response to detecting an image preview command in a camera application.

[0040] According to a third aspect of the present disclosure, an electronic device is provided, comprising:

[0041] processor;

[0042] Memory used to store computer programs or instructions;

[0043] The processor executes the computer program or instructions to implement the steps of the image display method described in the first aspect above.

[0044] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, the storage medium storing a computer program or instructions that, when executed by a processor, implement the steps of the image display method as described in the first aspect above.

[0045] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program or instructions, which, when executed by a processor, implement the steps of the image display method as described in the first aspect above.

[0046] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:

[0047] In this embodiment, the electronic device, in response to detecting an image display command, acquires image data and a set aspect ratio. Based on the aspect ratio, it determines target image data in the image data whose aspect ratio is the same as the aspect ratio. Then, it determines the texture coordinates used to draw the target image data and renders the target image data based on preset vertex coordinates and texture coordinates to obtain and display the target image. On the one hand, since it is not necessary to change the aspect ratio of the acquired image data based on the set aspect ratio, and thus re-receive image data with the aspect ratio of the same as the aspect ratio, but instead determines the target image data from the original image data based on the aspect ratio, the speed of acquiring the target image data can be improved, thereby improving the speed of acquiring the target image and making it more efficient. On the other hand, compared with the method in related technologies of covering the image area beyond the aspect ratio with a semi-transparent layer, this embodiment does not require a semi-transparent layer, which can improve the user's visual experience and is more intelligent. Furthermore, the aspect ratio can be set arbitrarily, providing high flexibility.

[0048] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0049] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0050] Figure 1 This is a flowchart illustrating an image display method according to an exemplary embodiment.

[0051] Figure 2 This is a texture coordinate mapping diagram illustrated according to an exemplary embodiment.

[0052] Figure 3 This is a diagram illustrating the relationship between vertex coordinates and canvas area according to an exemplary embodiment.

[0053] Figure 4 This is a block diagram of an image display device according to an exemplary embodiment.

[0054] Figure 5 This is a structural block diagram of an electronic device according to an exemplary embodiment. Detailed Implementation

[0055] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0056] One related technology involves switching the image aspect ratio during camera preview. When switching the aspect ratio, the user needs to close the camera application. The device, after receiving the user-set aspect ratio, restarts the camera application and sends the user-set aspect ratio to the Hardware Abstraction Layer (HAL). The HAL layer adjusts the image data configuration parameters (such as resolution, pixel format, and aspect ratio) according to this aspect ratio to ensure the acquired image data matches the set aspect ratio, and then sends the adjusted image data back to the upper-layer application for display. This process typically takes more than one second, which is time-consuming and may cause users to miss crucial moments when capturing images, thus affecting the shooting experience. Furthermore, this method limits users to selecting aspect ratios supported by the device, resulting in limited flexibility.

[0057] Another method developed by the relevant technology center involves switching the image aspect ratio during camera preview. This method first displays the camera's original image (at the original aspect ratio of the received image data), then, based on the user-selected aspect ratio, keeps the original image center unchanged while covering the image area outside the user-selected aspect ratio with a semi-transparent layer. While this method reduces the time spent closing and reopening the camera, the original image content under the semi-transparent layer remains clearly visible, potentially distracting the user and interfering with their visual experience, especially in scenarios where image cleanliness and focus are crucial. Furthermore, this method limits users to selecting aspect ratios supported by the device, resulting in limited flexibility.

[0058] In response, this disclosure provides an image display method. Figure 1 This is a flowchart illustrating an image display method according to an exemplary embodiment. Figure 1 As shown, the method mainly includes the following steps:

[0059] S11. In response to detecting an image display command, acquire image data and a set aspect ratio; wherein, the aspect ratio includes any set aspect ratio;

[0060] S12. Determine the target image data in the image data according to the aspect ratio; wherein the aspect ratio represented by the target image data is the same as the aspect ratio.

[0061] S13. Determine the texture coordinates used to draw the target image data;

[0062] S14. Render the target image data based on the preset vertex coordinates and the texture coordinates to obtain and display the target image; wherein, the vertex coordinates are used to indicate the size of the canvas during rendering, and the texture coordinates are used to associate the pixels in the target image data for rendering.

[0063] In this embodiment of the disclosure, the image display method can be applied to electronic devices with image display functions, such as user equipment (UE), mobile devices, user terminals, mobile phones, tablet computers, personal digital assistants (PDAs), handheld devices, computing devices, in-vehicle devices, wearable devices, cameras, camcorders, and cameras.

[0064] In step S11, the electronic device, in response to detecting an image display instruction, acquires image data and the set aspect ratio. In some embodiments, the image display instruction may be a detected instruction to display a captured image. For example, the electronic device may determine that an image display instruction has been detected when it detects a user's selection instruction for a specific image among multiple captured images. This selection instruction may be a touch instruction, a voice instruction, a gesture instruction, etc. Alternatively, the image display instruction may be an image display instruction from an image library application, where the image library application is an application used to store captured images. This disclosure does not limit the scope of the embodiments.

[0065] In other embodiments, the step of acquiring image data and a set aspect ratio in response to detecting an image display command includes:

[0066] In response to the detection of an image preview command in the camera application, image data and the set aspect ratio are obtained.

[0067] In this embodiment of the disclosure, the electronic device, in response to detecting an image preview command from a camera application, acquires image data and sets the aspect ratio. The camera application can be the native camera application built into the electronic device, or other applications, such as third-party camera applications like beauty camera applications, light camera applications, or Wuta camera applications, or third-party applications with camera functions such as WeChat, QQ, and Alipay. This embodiment of the disclosure does not impose any limitations on this.

[0068] In this embodiment of the disclosure, the electronic device detecting an image preview command in a camera application can be detecting a camera application launch command. This launch command can be a launch command triggered by clicking the camera application icon, a voice launch command, or a gesture launch command. Alternatively, it can be a launch command triggered by detecting the camera function of a third-party application, such as detecting a launch command for the camera control in the chat interface function selection area of ​​the WeChat application. It should be noted that the camera application being in image preview mode indicates that the user is viewing the shooting effect before taking a picture.

[0069] In this embodiment, the electronic device acquires image data. The electronic device may include an image acquisition component, which acquires image data through this component. The image acquisition component may be a front-facing camera or a rear-facing camera. The electronic device may include one or more image acquisition components; for example, a front-facing camera may include one or more cameras, and a rear-facing camera may also include one or more cameras. When the image display command is an image preview command in a camera application, the electronic device acquires image data in real time based on the image acquisition component. In other embodiments, the electronic device may also include a storage component, such as a hard drive or flash memory card. The electronic device can read pre-stored image data from the storage component. In other embodiments, the electronic device can also acquire image data from other devices, such as from a server via a network protocol (e.g., Hypertext Transfer Protocol, HTTP).

[0070] In this embodiment of the disclosure, the acquired image data may be in RGB format, YUV format, CMYK format, HSV format, etc., and this embodiment of the disclosure does not limit it.

[0071] In this embodiment, the electronic device also acquires the set aspect ratio. In some embodiments, the electronic device may include a user interface, and the electronic device can acquire the aspect ratio set by the user based on the user interface. For example, the user interface may include an operation box for inputting the aspect ratio, and the electronic device can receive the aspect ratio input by the user based on the operation box. In other embodiments, the electronic device can also acquire the set aspect ratio by receiving user voice commands, gesture commands, or other commands. It should be noted that if the electronic device does not receive a user command to set the aspect ratio, it can set the aspect ratio to the default aspect ratio, such as 4:3.

[0072] In this embodiment of the disclosure, the aspect ratio can be any set ratio, including ratios supported by the underlying electronic device, such as commonly used aspect ratios like 4:3, 1:1, and 16:9, as well as custom ratios like 4:3.2 and 1:1.5. This embodiment of the disclosure does not impose any restrictions on these aspects.

[0073] In step S12, the electronic device determines the target image data in the image data according to the aspect ratio; wherein the aspect ratio represented by the target image data is the same as the aspect ratio of the image display.

[0074] In some embodiments, the electronic device can directly crop out a region that conforms to the aspect ratio of the image data and use the image data in that region as the target image data. For example, the electronic device can determine multiple regions that conform to the aspect ratio in the image data and use the image data in the region with the largest area as the target image data.

[0075] In other embodiments, the electronic device can acquire the aspect ratio of the image data. For example, the electronic device can read the width and height of the image data, determine the aspect ratio of the image data based on the width and height of the image data, and determine the target image data with the same aspect ratio as the display aspect ratio based on the aspect ratio of the image data. For example, when the aspect ratio of the image data is the same as the display aspect ratio, the image data can be used as the target image data; when the aspect ratio of the image data is different from the display aspect ratio, the electronic device can keep the height of the image data or keep the height unchanged when determining the target image data from the image data.

[0076] In this embodiment of the present disclosure, when the electronic device determines the target image data from the image data, it can use the center point of the image data as the center point of the target image data to determine the target image data that conforms to the display ratio. When the electronic device determines the target image data from the image data, it can also use any vertex of the image data as the vertex of the target image data to determine the target image data that conforms to the display ratio. For example, when the image data is rectangular, the upper left vertex of the image data can be used as the upper left vertex of the target image data to determine the target image data that conforms to the display ratio. This embodiment of the present disclosure does not limit this.

[0077] In step S13, the electronic device determines the texture coordinates used to draw the target image data. In some embodiments, after determining the target image data, the electronic device may determine the mapping coordinates of each pixel in the target image data in the texture coordinate system, and the mapping coordinates of all pixels in the target image data in the texture coordinate system are the texture coordinates used to draw the target image data.

[0078] In other embodiments, determining the texture coordinates used to draw the target image data includes:

[0079] Determine the mapped coordinates of each vertex of the target image data in the texture coordinate system;

[0080] Each coordinate within the mapped coordinate range in the texture coordinate system is determined as the texture coordinate of the target image data.

[0081] In this embodiment of the disclosure, the electronic device determines the mapped coordinates of each vertex of the target image data in a texture coordinate system. The texture coordinate system is a two-dimensional coordinate system, typically with (0,0) as the origin and (1,1) as the diagonal points, covering the entire target image data. The texture coordinate system is used to locate each pixel on the target image data. Determining the mapped coordinates of each vertex of the target image data in the texture coordinate system can involve determining the coordinates of the corresponding points of each vertex in the texture coordinate system. The vertices typically constitute the four corner points of the image data (e.g., the lower left, lower right, upper left, and upper right corners).

[0082] In this embodiment of the disclosure, the electronic device determines each coordinate within the mapped coordinate range in the texture coordinate system as the texture coordinate of the target image data. For example, if the mapped coordinates of each vertex of the target image data in the texture coordinate system are (0, 0), (1, 0), (0, 1), and (1, 1), then the texture coordinate of the target image data includes the coordinates of each pixel point in the rectangular region of the texture coordinate system.

[0083] Figure 2 This is a texture coordinate mapping diagram illustrated according to an exemplary embodiment, such as... Figure 2 As shown, L21 is the image coordinate system, L23 is the texture coordinate system, L221, L222, L223, and L224 are the vertex coordinates of the target image data in the image coordinate system, L241 is the mapped coordinate of L221 in the texture coordinate system, L242 is the mapped coordinate of L222 in the texture coordinate system, L243 is the mapped coordinate of L223 in the texture coordinate system, and L244 is the mapped coordinate of L224 in the texture coordinate system. All coordinates in the texture coordinate system within the range of L241, L242, L243, and L244 are the texture coordinates of the target image data. For example, L25 is the texture coordinate of a pixel in the target image data.

[0084] In this embodiment, the mapping coordinates of each vertex coordinate of the target image data in the texture coordinate system are first determined, and then each coordinate within the mapping coordinate range in the texture coordinate system is determined as the texture coordinate of the target image data. This method can improve the accuracy of the determined texture coordinates, and the solution is simpler and more intelligent.

[0085] In step S14, the electronic device renders and draws the target image data based on preset vertex coordinates and texture coordinates to obtain and display the target image; wherein, vertex coordinates are used to indicate the size of the canvas during rendering, and texture coordinates are used to associate the pixels in the target image data for rendering.

[0086] In this embodiment of the disclosure, the electronic device can pre-set vertex coordinates for rendering. Vertex coordinates indicate the size of the canvas during rendering. The vertex coordinates represent the area occupied by the target image data on the canvas. The size of the canvas during rendering can be determined based on the vertex coordinates. For example, when the vertex coordinates are (-1, 1), (-1, -1), (1, -1), (1, 1), it indicates that the target image data fills the canvas. In this case, the size of the canvas can be determined based on the size of the target image data, such as setting the canvas size to the size of the target image data. For instance, when the vertex coordinates indicate that the target image data occupies 50% of the canvas area, the size of the canvas can be determined by combining the position of the area occupied by the target image data on the canvas. For example, when the center point of the target image data coincides with the center point of the canvas, the width of the canvas can be set to 2^(1 / 2) the width of the target image data. 1 / 2 Multiply, set the canvas height to 2^2 times the height of the target image data. 1 / 2 The canvas width can also be set to the width of the target image data, and the canvas height can be set to twice the target image data. However, this disclosure does not limit the scope of the embodiments.

[0087] In this embodiment of the disclosure, texture coordinates are used to associate pixels in the target image data for rendering. During the rendering process, the rendering engine maps the pixels in the target image data onto the canvas according to the texture coordinates. Each texture coordinate points to a pixel in the target image data, and the rendering engine extracts the color information of the corresponding pixel from the target image data according to these texture coordinates.

[0088] In this embodiment of the disclosure, the electronic device renders and draws target image data based on preset vertex coordinates and texture coordinates. Specifically, the electronic device renders and draws the target image data using a display image control and a graphics application programming interface (API). The display image control provides a canvas and can be a Surface View control, an Open Graphics Library Surface View control, an Image View control, etc. The API provides a standardized interface that allows the application to control the graphics hardware to render and draw image data. The API can be an Open Graphics Library for Embedded Systems (OpenGL ES), a Web Graphics Library (Web GL), DirectX, Vulkan, Metal, etc.

[0089] In some embodiments, the display image control is a GLSurfaceView control, and the graphics application programming interface is OpenGL ES. The GLSurfaceView control is a display image control used for OpenGL ES rendering. GLSurfaceView has its own drawing thread (graphics library thread, GLThread), which is the thread where the graphics library environment is created. Rendering can be performed directly on the drawing thread through OpenGL without blocking the main thread. Furthermore, the GLSurfaceView control utilizes the Graphics Processing Unit (GPU) for acceleration, which improves rendering efficiency. For example, the efficiency of image rendering using the GLSurfaceView control is more than 30 times that of using the SurfaceView control.

[0090] In this embodiment, the electronic device, in response to detecting an image display command, acquires image data and a set aspect ratio. Based on the aspect ratio, it determines target image data in the image data whose aspect ratio is the same as the aspect ratio. Then, it determines the texture coordinates used to draw the target image data and renders the target image data based on preset vertex coordinates and texture coordinates to obtain and display the target image. On the one hand, since it is not necessary to change the aspect ratio of the acquired image data based on the set aspect ratio, and thus re-receive image data with the aspect ratio of the same as the aspect ratio, but instead determines the target image data from the original image data based on the aspect ratio, the speed of acquiring the target image data can be improved, thereby improving the speed of acquiring the target image and making it more efficient. On the other hand, compared with the method in related technologies of covering the image area beyond the aspect ratio with a semi-transparent layer, this embodiment does not require a semi-transparent layer, which can improve the user's visual experience and is more intelligent. Furthermore, the aspect ratio can be set arbitrarily, providing high flexibility.

[0091] In some embodiments, the acquired image data is data with an initial aspect ratio, and determining the target image data in the image data according to the aspect ratio includes:

[0092] In response to the image display ratio being the initial image ratio, the image data is used as the target image data;

[0093] In response to the image display ratio not being the initial image display ratio, a portion of the image data is determined from the image data as the target image data based on the image display ratio.

[0094] In this embodiment of the disclosure, the image data acquired by the electronic device is data with an initial aspect ratio. In some embodiments, the initial aspect ratio is an aspect ratio that is compatible with many electronic devices, such as 4:3. Since many electronic devices and image processing software are designed based on the 4:3 standard, setting the initial aspect ratio to 4:3 eliminates the need to convert the aspect ratio of the image data, resulting in higher intelligence and compatibility. In other embodiments, the initial aspect ratio can also be set to other ratios, such as 16:9, by changing the underlying settings of the electronic device. This embodiment of the disclosure does not limit this.

[0095] In this embodiment of the disclosure, the electronic device responds to the initial aspect ratio of the image display and uses the image data as the target image data. After the electronic device acquires the image data, it can compare the initial aspect ratio of the image data with the aspect ratio of the image display. When the aspect ratio of the image display is the initial aspect ratio, it means that the aspect ratio of the image data is the aspect ratio of the image display, and the image data can be directly used as the target image data.

[0096] In this embodiment of the disclosure, in response to a screen aspect ratio that is not the initial screen aspect ratio, the electronic device determines a portion of the image data as target image data based on the screen aspect ratio. In some embodiments, as described above, when determining the target image data from the image data, the electronic device can use any vertex of the image data as the vertex of the target image data to determine the target image data that conforms to the screen aspect ratio. For example, when the image data is rectangular, the upper left vertex of the image data can be used as the upper left vertex of the target image data to determine the target image data that conforms to the screen aspect ratio.

[0097] In other embodiments, when determining target image data from image data, the electronic device may use the center point of the image data as the center point of the target image data to determine target image data that conforms to the aspect ratio.

[0098] In other embodiments, the electronic device may also identify a subject in the image data and determine a portion of the image data as target image data based on the subject in the image data.

[0099] In this embodiment, the electronic device first determines whether the display aspect ratio is consistent with the initial aspect ratio of the image data before determining the target image data. Based on the relationship between the display aspect ratio and the initial aspect ratio, the image data is flexibly processed. When the aspect ratios are consistent, the image data is directly used as the target image data; when the aspect ratios are inconsistent, the corresponding target image data is determined from the original image data according to the display aspect ratio, demonstrating a high degree of intelligence.

[0100] In some embodiments, the step of determining a portion of image data as the target image data based on the image data in response to the display aspect ratio not being the initial aspect ratio includes:

[0101] In response to the fact that the aspect ratio is not the initial aspect ratio, the size of the target image data is determined based on the size of the image data and the aspect ratio.

[0102] Based on the size of the target image data, with the center of the image data as the center of the target image data, a portion of the image data is determined from the image data as the target image data.

[0103] In this embodiment of the disclosure, the electronic device, in response to a display aspect ratio that is not the initial aspect ratio, determines the size of the target image data based on the size of the image data and the display aspect ratio. After acquiring the image data, the electronic device can determine the size of the image data, such as its height and width. When the display aspect ratio is not the initial aspect ratio, it determines the size of the target image data based on the size of the image data and the display aspect ratio. For example, if the image data size is 1440 pixels * 1080 pixels, the initial aspect ratio is 4:3, and the display aspect ratio is 1:1, then the size of the target image data can be determined based on the display aspect ratio and the size of the image data. The size of the target image must satisfy the display aspect ratio, and the height of the target image data must be less than or equal to the height of the image data, and the width of the target image data must be less than or equal to the width of the image data. For example, the size of the target image data can be 1080 pixels * 1080 pixels, or it can be 1000 pixels * 1000 pixels.

[0104] In this embodiment of the disclosure, after the electronic device determines the size of the target image data, it determines a portion of the image data as the target image data based on the size of the target image data, with the center of the image data as the center of the target image data. For example, when the size of the image data is 1440 pixels * 1080 pixels, the initial aspect ratio is 4:3, the aspect ratio is 1:1, and the size of the target image data is 1080 pixels * 1080 pixels, the center of the image data is taken as the center of the target image data, and the image data with a size of 1080 pixels * 1080 pixels is determined as the target image data.

[0105] In some embodiments, when an electronic device determines a portion of image data from image data as target image data, it can determine multiple portions of image data with a aspect ratio equal to the aspect ratio of the image data, and select the portion of image data with the largest size as the target image data.

[0106] In this embodiment of the disclosure, the electronic device, in response to a display aspect ratio that is not the initial aspect ratio, determines the size of the target image data based on the size of the image data and the display aspect ratio, and determines a portion of the image data as the target image data based on the size of the target image data, with the center of the image data as the center of the target image data. This method ensures that the center of the determined target image data does not shift, thereby improving the effect of the target image rendered based on the target image data and making it more intelligent.

[0107] In some embodiments, rendering and drawing the target image data based on preset vertex coordinates and texture coordinates to obtain and display the target image includes:

[0108] The size of the canvas is determined based on the canvas-occupied area indicated by the vertex coordinates;

[0109] The target image data is rendered and drawn on the canvas based on the texture coordinates to obtain the target image and display it on the display screen.

[0110] In this embodiment of the disclosure, as described above, vertex coordinates represent the area occupied by the rendered target image data on the canvas. For example, when the vertex coordinates are (-1, 1), (-1, -1), (1, -1), (1, 1), it indicates that the rendered target image data fills the canvas. In this case, the size of the canvas can be determined based on the target image data, so that the proportion of the canvas is the aspect ratio of the target image data. For example, the size of the target image data can be set as the size of the canvas. If the vertex coordinates represent that the rendered target image data occupies 50% of the canvas area, the size of the canvas can be determined by combining the position of the area occupied by the rendered target image data on the canvas and the size of the target image data. For example, if the center point of the rendered target image data coincides with the center point of the canvas, the width of the canvas can be set to 2^3 times the width of the target image data. 1 / 2 Multiply, set the canvas height to 2^2 times the height of the target image data. 1 / 2 You can also set the canvas width to the width of the target image data and the canvas height to twice the target image data.

[0111] In this embodiment of the disclosure, the electronic device includes a display screen. The electronic device draws target image data on a canvas based on texture coordinates to obtain a target image and displays it on the display screen. After determining the size of the canvas and the area occupied by the target image data on the canvas, the electronic device maps the pixels in the target image data onto the canvas based on the texture coordinates of the target image data to obtain a target image and displays it on the display screen of the electronic device. As mentioned above, each texture coordinate points to a pixel in the target image data. The rendering engine can extract the color information of the corresponding pixel from the target image data according to these texture coordinates, thereby rendering and drawing the target image based on the color information of each pixel.

[0112] In this embodiment of the disclosure, the electronic device determines the size of the canvas based on the canvas area indicated by the vertex coordinates, and draws the target image data on the canvas based on the texture coordinates to obtain the target image and display it on the display screen. It can flexibly adjust the canvas size according to the vertex coordinates, and has high flexibility and intelligence.

[0113] In some embodiments, determining the canvas size based on preset vertex coordinates includes:

[0114] In response to the vertex coordinate indication that the canvas is filled, the size of the display screen for displaying the target image is obtained;

[0115] Based on the size of the display screen and the aspect ratio, the size of the canvas used to draw the target image data is determined; wherein the aspect ratio of the canvas is the same as the aspect ratio of the display screen, and the size of at least one side of the canvas is the same as the size of one side of the display screen.

[0116] In this embodiment of the disclosure, the electronic device, in response to a vertex coordinate indication indicating that the canvas is filled, obtains the size of the display screen for displaying the target image. Figure 3 This is an exemplary embodiment illustrating the relationship between vertex coordinates and canvas area, where L31 is the canvas, and L321, L322, L323, and L324 represent vertex coordinates of (-1, 1), (1, 1), (-1, -1), and (1, -1), respectively. Figure 3 As shown, L321, L322, L323, and L324 are also located at the vertices of the canvas, indicating that the vertex coordinates indicate that the canvas is filled.

[0117] In this embodiment of the disclosure, after the electronic device obtains the size of the display screen used to display the target image, it determines the size of the canvas used to draw the target image data based on the size of the display screen and the aspect ratio. The aspect ratio of the canvas is the same as the aspect ratio, and the size of at least one side of the canvas is the same as the size of one side of the display screen. In some embodiments, the width of the canvas may be the same as the length of the shorter side of the display screen; for example, when the size of the display screen is 1860 pixels * 1280 pixels and the aspect ratio is 1:1, the size of the canvas is 1280 pixels * 1280 pixels.

[0118] In this embodiment of the disclosure, in response to a vertex coordinate indication that the canvas is filled, the size of the display screen used to display the target image is obtained, and the size of the canvas used to draw the target image data is determined based on the size of the display screen and the aspect ratio. On the one hand, since the aspect ratio of the canvas is the same as the aspect ratio of the display screen, the target image data can be stretched on the canvas, thereby improving the effect of the target image. On the other hand, the size of at least one side of the canvas is the same as the size of one side of the display screen, which can maximize the use of the display screen and improve the utilization rate of the display screen.

[0119] In some embodiments, the step of acquiring image data in response to detecting an image display instruction includes:

[0120] In response to the detection of an image display command, image data in YUV format is acquired.

[0121] In this embodiment of the disclosure, the electronic device, in response to detecting an image display command, acquires image data in YUV format. YUV is a color encoding system that divides color information into luminance (Y) and two chromaticity components (U and V). After acquiring the image data in YUV format, the electronic device can perform image enhancement, noise reduction, and other operations on the image data, thereby improving the quality of the image data.

[0122] In this embodiment of the disclosure, since YUV format image data can reduce transmission bandwidth during transmission and reduce resource consumption and latency during rendering compared to RGB format or other format image data, the method of acquiring YUV format image data in response to the detection of image display instructions in this embodiment of the disclosure can improve the speed of displaying target images and has higher intelligence.

[0123] Figure 4 This is a block diagram illustrating an image display device 400 according to an exemplary embodiment. (See diagram below.) Figure 4 As shown, the device mainly includes:

[0124] The acquisition module 401 is configured to acquire image data and a set aspect ratio in response to the detection of an image display command; wherein the aspect ratio includes any set aspect ratio.

[0125] The first determining module 402 is configured to determine target image data in the image data according to the aspect ratio; wherein the aspect ratio represented by the target image data is the same as the aspect ratio.

[0126] The second determining module 403 is configured to determine the texture coordinates used to draw the target image data;

[0127] The display module 404 is configured to render and draw the target image data based on preset vertex coordinates and texture coordinates to obtain and display the target image; wherein, the vertex coordinates are used to indicate the size of the canvas during rendering, and the texture coordinates are used to associate the pixels in the target image data for rendering.

[0128] In some embodiments, the acquired image data is data with an initial aspect ratio. The first determining module 402 is further configured to, in response to the aspect ratio being the initial aspect ratio, use the image data as the target image data; and in response to the aspect ratio not being the initial aspect ratio, determine a portion of the image data from the image data as the target image data based on the aspect ratio.

[0129] In some embodiments, the first determining module 402 is further configured to, in response to the image display ratio not being the initial image display ratio, determine the size of the target image data based on the size of the image data and the image display ratio; and, based on the size of the target image data, determine a portion of the image data as the target image data, with the center of the image data as the center of the target image data.

[0130] In some embodiments, the second determining module 403 is further configured to determine the mapped coordinates of each vertex coordinate of the target image data in the texture coordinate system; and to determine each coordinate within the range of the mapped coordinates in the texture coordinate system as the texture coordinates of the target image data.

[0131] In some embodiments, the display module 404 is further configured to determine the size of the canvas based on the canvas-occupied area indicated by the vertex coordinates; and to render and draw the target image data on the canvas based on the texture coordinates to obtain and display the target image.

[0132] In some embodiments, the display module 404 is further configured to, in response to the vertex coordinate indication to fill the canvas, obtain the size of the display screen for displaying the target image; and determine the size of the canvas for drawing the target image data based on the size of the display screen and the aspect ratio; wherein the aspect ratio of the canvas is the same as the aspect ratio, and the size of at least one side of the canvas is the same as the size of one side of the display screen.

[0133] In some embodiments, the acquisition module 401 is further configured to acquire YUV format image data in response to detecting an image display instruction.

[0134] In some embodiments, the acquisition module 401 is further configured to acquire image data and a set aspect ratio in response to detecting an image preview command in a camera application.

[0135] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0136] Figure 5 This is a structural block diagram illustrating an electronic device 500 according to an exemplary embodiment. For example, the electronic device 500 may be a mobile phone, computer, game console, tablet device, medical device, fitness equipment, personal digital assistant, in-vehicle device, wearable device, camera, camcorder, etc.

[0137] Reference Figure 5The electronic device 500 may include one or more of the following components: processing component 502, memory 504, power supply component 506, multimedia component 508, audio component 510, input / output (I / O) interface 512, sensor component 514, and communication component 516.

[0138] Processing component 502 typically controls the overall operation of electronic device 500, such as operations associated with at least one of display, telephone call, data communication, camera operation, and recording operation. Processing component 502 may include one or more processors 520 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 502 may include one or more modules to facilitate interaction between processing component 502 and other components. For example, processing component 502 may include a multimedia module to facilitate interaction between multimedia component 508 and processing component 502.

[0139] Memory 504 is configured to store various types of data to support operation on electronic device 500. Examples of such data include at least one of the following: instructions for any application or method operating on electronic device 500, contact data, phonebook data, messages, pictures, and videos. Memory 504 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0140] Power supply component 506 provides power to various components of electronic device 500. Power supply component 506 may include at least one of the following: a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 500.

[0141] Multimedia component 508 includes a screen that provides an output interface between electronic device 500 and user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen may be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors may sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 508 includes a front-facing camera and / or a rear-facing camera. When electronic device 500 is in an operating mode, such as a shooting mode or video mode, the front-facing camera and / or rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0142] Audio component 510 is configured to output and / or input audio signals. For example, audio component 510 includes a microphone (MIC) configured to receive external audio signals when electronic device 500 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 504 or transmitted via communication component 516. In some embodiments, audio component 510 also includes a speaker for outputting audio signals.

[0143] I / O interface 512 provides an interface between processing component 502 and peripheral interface modules, such as keyboards, click wheels, and buttons. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0144] Sensor assembly 514 includes one or more sensors for providing state assessments of various aspects of electronic device 500. For example, sensor assembly 514 may detect the on / off state of electronic device 500, the relative positioning of components such as the display and keypad of electronic device 500, changes in position of electronic device 500 or one of its components, the presence or absence of user contact with electronic device 500, orientation or acceleration / deceleration of electronic device 500, and temperature changes of electronic device 500. Sensor assembly 514 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 514 may also include an optical sensor, such as a complementary metal-oxide-semiconductor (CMOS) or charge-coupled device (CCD) image sensor, for use in imaging applications. In some embodiments, sensor assembly 514 may also include, but is not limited to, at least one of the following: an accelerometer, a gyroscope, a magnetometer, a pressure sensor, and a temperature sensor.

[0145] Communication component 516 is configured to facilitate wired or wireless communication between electronic device 500 and other devices. Electronic device 500 can access wireless networks based on communication standards, such as Wi-Fi, 4G, 5G, or combinations thereof. In one exemplary embodiment, communication component 516 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 516 also includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID), Infrared Data Association (IrDA), Ultra Wide Band (UWB), Bluetooth (BT), and other technologies.

[0146] In an exemplary embodiment, the electronic device 500 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components.

[0147] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 504 including executable instructions or a computer program, which can be executed by a processor 520 of an electronic device 500 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.

[0148] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform any of the image display methods described in the embodiments of this disclosure. For example, the method includes:

[0149] In response to detecting an image display command, image data and a set aspect ratio are acquired; wherein, the aspect ratio can be any set aspect ratio;

[0150] Based on the aspect ratio, target image data is determined in the image data; wherein the aspect ratio represented by the target image data is the same as the aspect ratio.

[0151] Determine the texture coordinates used to draw the target image data;

[0152] The target image data is rendered and drawn based on preset vertex coordinates and texture coordinates to obtain and display the target image; wherein, the vertex coordinates are used to indicate the size of the canvas during rendering, and the texture coordinates are used to associate the pixels in the target image data for rendering.

[0153] This disclosure provides a computer program product comprising a computer program or executable instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer program or executable instructions from the computer-readable storage medium and executes the computer program or executable instructions, causing the computer device to perform any of the image display methods described above in this disclosure.

[0154] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0155] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. An image display method characterized by, The method comprises: in response to detecting an image display instruction, acquiring image data and a set frame display ratio; wherein the frame display ratio comprises an arbitrarily set ratio; determining target image data in the image data according to the frame display ratio; wherein a frame ratio represented by the target image data is the same as the frame display ratio; determining a texture coordinate for drawing the target image data; rendering and drawing the target image data based on a preset vertex coordinate and the texture coordinate, to obtain a target image and display; wherein the vertex coordinate is used to indicate the size of a canvas during rendering, and the texture coordinate is used to associate a pixel point in the target image data for rendering.

2. The method of claim 1, wherein, The acquired image data is data of an initial frame ratio, and the determination of the target image data in the image data according to the frame display ratio comprises: in response to the frame display ratio being the initial frame ratio, taking the image data as the target image data; in response to the frame display ratio not being the initial frame ratio, determining part of the image data as the target image data based on the frame display ratio.

3. The method of claim 2, wherein, The determination of part of the image data as the target image data based on the frame display ratio in response to the frame display ratio not being the initial frame ratio comprises: in response to the frame display ratio not being the initial frame ratio, determining the size of the target image data based on the size of the image data and the frame display ratio; based on the size of the target image data, taking the center of the image data as the center of the target image data, to determine part of the image data as the target image data.

4. The method according to any one of claims 1 to 3, characterized in that, The determination of the texture coordinate for drawing the target image data comprises: determining a mapping coordinate of each vertex coordinate of the target image data in a texture coordinate system; determining each coordinate in the mapping coordinate range in the texture coordinate system as a texture coordinate of the target image data.

5. The method according to any one of claims 1-3, characterized in that, The rendering and drawing of the target image data based on the preset vertex coordinate and the texture coordinate to obtain a target image and display comprises: determining the size of a canvas based on the canvas occupying area indicated by the vertex coordinate; rendering and drawing the target image data on the canvas based on the texture coordinate, to obtain the target image and display.

6. The method of claim 5, wherein, The determination of the size of a canvas based on the preset vertex coordinate comprises: in response to the vertex coordinate indicating that the canvas is full, acquiring the size of a display screen for displaying the target image; determining the size of a canvas for drawing the target image data based on the size of the display screen and the frame display ratio; wherein the size of at least one side of the canvas is the same as the size of one side of the display screen, and the ratio of the canvas is the same as the frame display ratio.

7. The method according to any one of claims 1 to 3, characterized in that, The acquisition of the image data in response to detecting an image display instruction comprises: in response to detecting an image display instruction, acquiring image data in YUV format.

8. The method of claim 1, wherein, The response to the detection of the image display instruction, the image data acquisition and the set frame display ratio, comprises: In response to detecting an image preview instruction in the camera application, image data is acquired and a set frame display ratio is set.

9. An image display device, characterized by comprising: The device comprises: An acquisition module configured to acquire image data and a set frame display ratio in response to detecting an image display instruction; wherein the frame display ratio comprises an arbitrarily set ratio; A first determination module configured to determine target image data in the image data according to the frame display ratio; wherein the frame ratio represented by the target image data is the same as the frame display ratio; A second determination module configured to determine a texture coordinate for drawing the target image data; A display module configured to render and draw the target image data based on a preset vertex coordinate and the texture coordinate, to obtain a target image and display; wherein the vertex coordinate is used to indicate the size of the canvas during rendering, and the texture coordinate is used to associate the pixel points in the target image data for rendering.

10. An electronic device, comprising: Comprise: A processor; A memory for storing computer programs or instructions; Wherein the processor executes the computer programs or instructions to implement the steps of the image display method of any one of claims 1 to 8.

11. A non-transitory computer-readable storage medium storing a computer program or instructions, wherein, When the computer programs or instructions in the storage medium are executed by the processor, the steps of the image display method of any one of claims 1 to 8 are implemented.

12. A computer program product comprising computer programs or instructions, characterized in that, The computer programs or instructions are executed by the processor to implement the steps of the image display method of any one of claims 1 to 8.