Screen projection image stretching method, device, electronic device and computer storage medium
By using the preset stretching algorithm and the central pixel point of the target image during the screen projection process, the image is stretched, and the problem of image deformation and insufficient display is solved, and efficient and invisible deformation of the screen projection between different devices is achieved.
Patent Information
- Application Number
- CN202311254001.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2025-04-04
AI Technical Summary
In the process of screen projection, the display area of the projection device cannot be fully utilized when the image is projected directly, and conventional proportional stretching will cause image deformation.
By obtaining the target image sent to the projected device by the projected device, and stretching the image according to the preset stretching algorithm, the display parameters of the projected device and the central pixel point of the target image, ensuring that the image is displayed on the projected device full screen without deforming.
It effectively avoids the problem of image deformation during the screen projection process, and ensures that the display area of the screen projection device is fully utilized, providing a better screen projection effect.
Smart Images

Figure CN119762335A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method, device, electronic device and computer storage medium (computer-readable storage medium) for stretching a projection image. Background Art
[0002] With the rapid development of the computer industry, there are more and more application scenarios for device screen projection.
[0003] In the prior art, screen projection operation is convenient for different devices. Due to the different display parameters of different devices, if the image is not processed during the projection process and the original ratio is used for direct projection, an unfilled area will appear on the projected device, wasting the display area of the projected device. Therefore, the full-screen display of the projected device is achieved by stretching the projected screen during the image projection process. However, the current projection stretching is usually proportional. For example, the display ratio of the projected device is 16:10, and the display ratio of the projection device is 16:9, 4:3 or 21:9. The ratio between the projected device and the projection device is calculated, and then stretched according to the ratio. According to the current projection image stretching scheme, image deformation problems will occur. Summary of the invention
[0004] The present application provides a projection screen image stretching method, device, electronic device and computer storage medium, aiming to solve the technical problem of image stretching and deformation in existing projection screen displays.
[0005] On the one hand, the present application provides a projection image stretching method, the projection image stretching method comprising the following steps:
[0006] Get the target image sent by the projection device to the projection device;
[0007] According to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel point of the target image, the target image is stretched to obtain a stretched target image; wherein the preset stretching algorithm is a relationship between the target pixel point to be stretched in the target image and the central pixel point of the target image;
[0008] The stretched target image is output to the projected screen device.
[0009] In some embodiments of the present application, the stretching process is performed on the target image according to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel point of the target image to obtain the stretched target image, including:
[0010] Determining a first stretching coefficient according to a first display parameter of the projected screen device and a second display parameter of the projecting screen device;
[0011] Determining a second stretching coefficient according to a pixel position of a central pixel of the target image and a pixel position of a target pixel to be stretched in the target image;
[0012] Inputting the first stretching coefficient and the second stretching coefficient into the preset stretching algorithm to obtain a stretching ratio of a target pixel point to be stretched in the target image;
[0013] The target pixel points to be stretched in the target image are stretched according to the stretching ratio to obtain a stretched target image.
[0014] In some embodiments of the present application, determining the first stretching coefficient according to the first display parameter of the projected screen device and the second display parameter of the projecting screen device includes:
[0015] Comparing the first display parameter of the projected screen device with the second display parameter of the projecting screen device to obtain the stretching direction of the target image;
[0016] Acquire the total number of pixels of the target image in the stretching direction and the number of times the target image is stretched in the stretching direction;
[0017] The ratio between the total number of pixels and the number of stretching times is calculated, and the ratio is set as a first stretching coefficient.
[0018] In some embodiments of the present application, determining the second stretching coefficient according to the pixel position of the central pixel of the target image and the pixel position of the target pixel to be stretched in the target image includes:
[0019] If the target image has at least two central pixel points, dividing the target image into stretching areas corresponding to the central pixel points according to the pixel positions between the central pixel points;
[0020] For each of the stretching regions, a relative distance between a pixel position of a central pixel of the stretching region and a pixel position of a target pixel to be stretched in the stretching region is calculated, and the relative distance is set as the second stretching coefficient.
[0021] In some embodiments of the present application, the method comprises: stretching the target image according to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel of the target image, and obtaining the stretched target image.
[0022] Obtaining a first display parameter of the projected screen device and a second display parameter of the projected screen device;
[0023] Calculating a first display aspect ratio corresponding to the first display parameter and a second display aspect ratio corresponding to the second display parameter;
[0024] If the first display aspect ratio and the second display aspect ratio are different, the target image is stretched according to a preset stretching algorithm, the first display parameter of the projected device, and the central pixel point of the target image to obtain a stretched target image.
[0025] In some embodiments of the present application, if the first display aspect ratio and the second display aspect ratio are different, the method includes:
[0026] Obtaining a stretching mode of the projected device;
[0027] If the stretching mode of the projected device is the first stretching mode, determining a stretching direction and a stretching ratio according to the first display aspect ratio and the second display aspect ratio; and performing stretching processing on the target image according to the stretching direction and the stretching ratio to obtain a stretched target image;
[0028] If the stretching mode of the projected device is the second stretching mode, the target image is stretched according to a preset stretching algorithm, the first display parameter of the projected device, and the central pixel point of the target image to obtain a stretched target image.
[0029] In some embodiments of the present application, the stretching process of the target image is performed according to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel point of the target image, and before obtaining the stretched target image, the process includes:
[0030] In response to a center pixel setting request triggered by a target image, output a setting page;
[0031] A target position is input based on the setting page, and a pixel point corresponding to the target position is set as a central pixel point of the target image and saved.
[0032] On the other hand, the present application provides a projection image stretching device, the projection image stretching device comprising:
[0033] An acquisition module is used to acquire a target image sent by the projection device to the projection device;
[0034] A stretching module, configured to perform stretching processing on the target image according to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel point of the target image to obtain a stretched target image; wherein the preset stretching algorithm is a relationship between the target pixel point to be stretched in the target image and the central pixel point of the target image;
[0035] An output module is used to output the stretched target image to the projected screen device.
[0036] On the other hand, the present application also provides an electronic device, the electronic device comprising:
[0037] one or more processors;
[0038] Memory; and
[0039] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the steps in the projection image stretching method.
[0040] On the other hand, the present application also provides a computer storage medium on which a computer program is stored, and the computer program is loaded by a processor to execute the steps in the projection image stretching method.
[0041] The technical solution of the present application provides a projection image stretching method, device, electronic device and computer storage medium; the projection image stretching method includes: obtaining a target image sent by a projection device to a projection device; stretching the target image according to a preset stretching algorithm, a first display parameter of the projection device, and a central pixel of the target image to obtain a stretched target image; wherein the preset stretching algorithm is the relationship between the target pixel to be stretched in the target image and the central pixel of the target image; outputting the stretched target image to the projection device; a preset stretching algorithm is provided in the embodiment of the present application, and the preset stretching algorithm is the relationship between the target pixel to be stretched and the central pixel in the target image, which involves the relative distance between the target pixel to be stretched and the central pixel in the target image, and stretching the target image according to the preset stretching algorithm effectively avoids deformation during image stretching. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0043] Figure 1 It is a scene schematic diagram of the projection image stretching method provided in an embodiment of the present application;
[0044] Figure 2 This is a schematic diagram of an embodiment of the method for stretching a projection image in an embodiment of the present application;
[0045] Figure 3 is a schematic diagram of an image stretching scenario in the projection image stretching method provided in an embodiment of the present application;
[0046] Figure 4 It is a flowchart of an embodiment of stretching a target image in a projection image stretching method provided in an embodiment of the present application;
[0047] Figure 5 It is a schematic diagram of a stretching ratio scenario determined by a preset stretching algorithm in the projection image stretching method provided in an embodiment of the present application;
[0048] Figure 6 It is a flow chart of an embodiment before image stretching in the projection image stretching method provided in the embodiments of the present application;
[0049] Figure 7 It is a schematic diagram of an embodiment of a flow chart of different stretching modes in the projection image stretching method in an embodiment of the present application;
[0050] Figure 8 This is a schematic diagram of a scene in which a central pixel point of image stretching is set in the projection image stretching method provided in an embodiment of the present application;
[0051] Fig. 9 It is a schematic structural diagram of an embodiment of a projection image stretching device provided in an embodiment of the present application;
[0052] Fig.10 It is a schematic diagram of the structure of an embodiment of an electronic device provided in the embodiments of the present application. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of the present invention.
[0054] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, which are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0055] In this application, the word "exemplary" is used to mean "serving as an example, illustration, or illustration." Any embodiment described in this application as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. The following description is given to enable any person skilled in the art to implement and use the invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the invention can be implemented without using these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in this application.
[0056] A method, device, equipment and computer storage medium for stretching a projection image are provided in the embodiments of the present application, which are described in detail below.
[0057] The projection image stretching method in the embodiment of the present invention is applied to a projection image stretching device, which is arranged in an electronic device. The electronic device is provided with one or more processors, a memory, and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the projection image stretching method; the electronic device can be a terminal, such as a mobile phone or a tablet computer, and the electronic device can also be a server, or a service cluster composed of multiple servers.
[0058] like Figure 1 As shown, Figure 1This is a scene diagram of the projection image stretching method in the embodiment of the present application. The projection image stretching scene in the embodiment of the present invention includes an electronic device 100 (a projection image stretching device is integrated in the electronic device 100), and a computer storage medium corresponding to the projection image stretching is run in the electronic device 100 to execute the projection image stretching steps.
[0059] Understandably, Figure 1 The electronic devices in the scene of stretched projection image shown, or the devices included in the electronic devices, do not constitute limitations on the embodiments of the present invention. That is, the number of devices and types of devices included in the scene of stretched projection image, or the number of devices and types of devices included in each device, do not affect the overall implementation of the technical solution in the embodiments of the present invention, and can all be regarded as equivalent replacements or derivatives of the technical solution claimed to be protected in the embodiments of the present invention.
[0060] In the embodiment of the present invention, the electronic device 100 is mainly used for: obtaining a target image sent by a projection device to a projection device; stretching the target image according to a preset stretching algorithm, a first display parameter of the projection device, and a central pixel of the target image to obtain a stretched target image; wherein the preset stretching algorithm is a relationship between a target pixel to be stretched in the target image and a central pixel of the target image; and outputting the stretched target image to the projection device.
[0061] In the embodiment of the present invention, the electronic device 100 may be an independent electronic device, or an electronic device network or electronic device cluster composed of electronic devices. For example, the electronic device 100 described in the embodiment of the present invention includes but is not limited to a computer, a network host, a single network electronic device, a set of multiple network electronic devices, or a cloud electronic device composed of multiple electronic devices. The cloud electronic device is composed of a large number of computers or network electronic devices based on cloud computing.
[0062] Those skilled in the art will understand that Figure 1 The application environment shown in the figure is only one application scenario of the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 1 More or fewer electronic devices shown in, or electronic device network connection relationships, such as Figure 1 Only one electronic device is shown. It can be understood that the scene of stretching the projected image may also include one or more other electronic devices, which are not limited here. The electronic device 100 may also include a memory.
[0063] In addition, in the scenario of screen projection image stretching of the present application, the electronic device 100 may be provided with a display device, or the electronic device 100 may not be provided with a display device and may be communicated with an external display device 200, and the display device 200 is used to output the result of the execution of the screen projection image stretching method in the electronic device. The electronic device 100 may access a background database 300 (the background database may be in the local memory of the electronic device, or may be set in the cloud), and the background database 300 may store information related to screen projection image stretching.
[0064] It should be noted that Figure 1 The scene diagram of the projection image stretching method shown is only an example. The scene of projection image stretching described in the embodiment of the present invention is to more clearly illustrate the technical solution of the embodiment of the present invention, and does not constitute a limitation on the technical solution provided by the embodiment of the present invention.
[0065] Based on the above-mentioned scenario of screen projection image stretching, an embodiment of a screen projection image stretching method is proposed.
[0066] like Figure 2 As shown, Figure 2 This is a flow chart of an embodiment of the projection image stretching method in the embodiment of the present application. The projection image stretching method includes steps 201-203:
[0067] 201, obtaining a target image sent by the screen projection device to the screen projection device.
[0068] The projection image stretching method in the embodiment of the present application is applied to an electronic device, and the type of the electronic device is not specifically limited. For example, the electronic device may be a terminal device or a server, and the terminal device may be a projection device or a projected device.
[0069] The electronic device obtains the target image sent by the projection device to the projected device. The number and format of the target image are not specifically limited. For example, the number of images can be one frame of images or multiple frames of images in a video.
[0070] The electronic device obtains the display parameters of the projected device. The display parameters refer to the display-related data of the projected device. For example, the display parameters may be the length and width of the display screen of the projected device, or the display parameters may be the resolution of the display screen of the projected device.
[0071] The electronic device obtains the display parameters of the projection device, where the display parameters refer to the display-related data of the projection device. For example, the display parameters may be the length and width of the display screen of the projection device, or the display parameters may be the resolution of the display screen of the projection device.
[0072] The electronic device determines whether it is necessary to stretch the target image to be projected based on the display parameters of the projected device and the display parameters of the projecting device. For example, the electronic device determines that the aspect ratio of the projected device is 16:10 based on the display parameters of the projected device, and the electronic device determines that the display ratio of the projecting device is 16:9 based on the display parameters of the projecting device. The electronic device determines that the display parameters of the projected device and the display parameters of the projecting device do not match, and the target image needs to be stretched.
[0073] 202. According to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel point of the target image, the target image is stretched to obtain a stretched target image.
[0074] In the embodiment of the present application, the preset stretching algorithm is a functional relationship between the target pixel points to be stretched in the target image and the central pixel points of the target image, wherein the central pixel points are used to represent the visual center of the target image. For example, if the target image is a person image, the central pixel points of the target object are the pixels of the face part.
[0075] In the embodiment of the present application, there is no limitation on the setting method of the central pixel point of the target image, that is, the central pixel point of the target image can be manually set by a user; in addition, the central pixel point of the target image can also be automatically set by the electronic device, for example, the electronic device stores an image recognition model, the electronic device inputs the target image into the image recognition model, recognizes the target image through the image recognition model, and obtains the central pixel point of the target image.
[0076] Furthermore, in the embodiment of the present application, the number of central pixels in the target image is not limited, that is, the target image may include one central pixel or multiple central pixels. For example, the target image is a photo image of three people. The electronic device identifies the central pixels of the target image and determines that the target image contains three central pixels corresponding to the three facial positions.
[0077] The electronic device has a preset stretching algorithm pre-stored therein. The preset stretching algorithm is related to the display parameters of the projected device and the relative distance between the target pixel to be stretched in the target image and the central pixel of the target image. For example, the preset stretching algorithm is Wherein, n represents the number of pixels in the screen pixel stretching direction of the projection device / 2, for example, if the 1920*1080 screen is stretched horizontally, then n=960; x represents the relative distance from the column where the target pixel to be stretched in the target image is located to the column where the center pixel is located.
[0078] The electronic device calculates the relative distance between the target pixel to be stretched and the center pixel in the target image, and stretches the target pixel to be stretched in the target image according to a preset stretching algorithm, display parameters of the projected device, and the relative distance between the target pixel to be stretched and the center pixel to obtain a stretched target image.
[0079] 203, output the stretched target image to the projected screen device.
[0080] The electronic device outputs the target image after stretching according to the preset stretching algorithm to the projected device, referring to Figure 3 , Figure 3 is a schematic diagram of an image stretching scenario in the projection image stretching method provided in an embodiment of the present application, Figure 3 (a) is a schematic diagram of a scene in which the projected device displays an unstretched target image. There are grayscale areas on both sides of the display screen of the projected device, and the display screen resources of the projected device are not fully utilized; Figure 3 (b) is a schematic diagram of a scene in which a projection device displays a target image formed according to a traditional stretching algorithm. The target image on the display screen of the projection device is uniformly stretched, and the target image is deformed; Figure 3 (c) is a schematic diagram of a scene in which the projected device displays a target image formed by stretching according to a preset stretching algorithm in an embodiment of the present application. In the embodiment of the present application, since the preset stretching algorithm is the relationship between the target pixel points to be stretched in the target image and the central pixel points of the target image, the target image in the projected device can be more in line with the user's visual focus, reducing image deformation.
[0081] In the embodiment of the present application, the electronic device stretches the target image according to a preset stretching algorithm. The user can customize the position of the center pixel point of the target image, and the remaining target pixels to be stretched are stretched based on their relative distance from the customized center pixel point, so that the image stretching effect is better and image deformation is avoided.
[0082] Reference Figure 4 , Figure 4 It is a flow chart of an embodiment of stretching a target image in a projection image stretching method provided in an embodiment of the present application.
[0083] In some embodiments of the present application, step 202 stretches the target image according to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel of the target image to obtain the stretched target image, specifically including steps 301-304:
[0084] 301. Determine a first stretching coefficient according to a first display parameter of the projected screen device and a second display parameter of the projecting screen device.
[0085] The electronic device obtains the display parameters of the projected device and the display parameters of the projecting device, and determines the first stretching coefficient of the target image based on the display parameters of the projecting device and the display parameters of the projected device; for example, the first stretching coefficient may be a proportional coefficient between the display parameters of the projecting device and the display parameters of the projected device; further, the first stretching coefficient may also be related to the stretching direction of the target image, etc.
[0086] For ease of understanding, an embodiment of the present application provides a specific implementation method for an electronic device to determine a first stretch coefficient, including:
[0087] 1. Compare the first display parameter of the projected screen device with the second display parameter of the projecting screen device to obtain the stretching direction of the target image;
[0088] 2. Obtain the total number of pixels of the target image in the stretching direction and the number of times the target image is stretched in the stretching direction;
[0089] 3. Calculate the ratio between the total number of pixels and the number of stretching times, and set the ratio as the first stretching coefficient.
[0090] That is, the electronic device compares the display parameters of the projected device with the display parameters of the projecting device to obtain the stretching direction of the target image; the electronic device obtains the total number of pixels of the target image in the stretching direction and the number of stretches of the target image in the stretching direction; the electronic device calculates the ratio between the total number of pixels and the number of stretches, and the electronic device sets the ratio as the first stretching coefficient. For example, the preset stretching algorithm is The first stretching coefficient n represents the number of pixels in the stretching direction of the screen pixels of the projection device / 2. For example, if a 1920*1080 screen is stretched horizontally, then n=960.
[0091] 302 : Determine a second stretching coefficient according to a pixel position of a central pixel of the target image and a pixel position of a target pixel to be stretched in the target image.
[0092] The electronic device determines the second stretching coefficient according to the pixel position of the central pixel of the target image and the relative distance between the pixel positions of the target pixel to be stretched in the target image. For example, the preset stretching algorithm is: The second stretching coefficient x is expressed as the relative distance between the column where the target pixel point to be stretched is located and the column where the center pixel point is located in the target image.
[0093] Furthermore, since multiple central pixel points may be set in the target image in the embodiment of the present application, the method for determining the second stretch coefficient further includes:
[0094] 1. If the target image has at least two central pixels, the target image is divided into stretching areas corresponding to the central pixels according to the pixel positions between the central pixels;
[0095] 2. For each of the stretching regions, calculate the relative distance between the pixel position of the central pixel of the stretching region and the pixel position of the target pixel to be stretched in the stretching region, and set the relative distance as the second stretching coefficient.
[0096] If there are at least two central pixels in the target image, the electronic device divides the target image into stretching areas corresponding to the central pixels according to the pixel positions between the central pixels; for example, if the central pixels are pixels at the positions of two human faces, the electronic device sets the contour areas of the two people in the target image as stretching areas corresponding to their central pixels.
[0097] For each stretching area, the electronic device calculates the relative distance between the pixel position of the central pixel point of the stretching area and the pixel position of the target pixel point to be stretched in the stretching area, and sets the relative distance as the second stretching coefficient.
[0098] 303 : Input the first stretching coefficient and the second stretching coefficient into the preset stretching algorithm to obtain a stretching ratio of a target pixel point to be stretched in the target image.
[0099] The electronic device inputs the first stretching coefficient and the second stretching coefficient into a preset stretching algorithm to obtain a stretching ratio of a target pixel point to be stretched in the target image, and refers to Figure 5 , Figure 5 is a schematic diagram of a stretching ratio scenario determined by a preset stretching algorithm in the projection image stretching method provided in an embodiment of the present application; Figure 5 As shown, the stretching ratio of the target pixel to be stretched is related to the relative distance between the target pixel and the center pixel. The larger the relative distance between the pixels, the greater the stretching ratio; conversely, the smaller the relative distance between the pixels, the smaller the stretching ratio.
[0100] 304 , stretching the target pixel points to be stretched in the target image according to the stretching ratio to obtain a stretched target image.
[0101] The electronic device stretches the target pixel points to be stretched in the target image according to the stretching ratio of the target pixel points to obtain the stretched target image; in the embodiment of the present application, the electronic device determines the stretching ratio of the target pixel points according to the two stretching coefficients, thereby stretching the target image, so that the stretching of the target image is more in line with the objective scene and avoids image deformation.
[0102] Reference Figure 6 , Figure 6 It is a flow chart of an embodiment before image stretching in the projection image stretching method provided in the embodiment of the present application.
[0103] In some embodiments of the present application, step 203 stretches the target image according to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel of the target image, and before obtaining the stretched target image, specifically includes steps 401-403:
[0104] 401, obtaining a first display parameter of the screen-projected device and a second display parameter of the screen-projecting device.
[0105] The electronic device obtains the display parameters of the projected device and the display parameters of the projecting device.
[0106] 402 : Calculate a first display aspect ratio corresponding to the first display parameter and a second display aspect ratio corresponding to the second display parameter.
[0107] The electronic device calculates the display aspect ratio of the display parameters of the projected device and the display aspect ratio corresponding to the display parameters of the projecting device.
[0108] 403. If the first display aspect ratio and the second display aspect ratio are different, the target image is stretched according to a preset stretching algorithm, the first display parameter of the projected device, and the center pixel of the target image to obtain a stretched target image.
[0109] If the display aspect ratio of the projected device is different from the display aspect ratio of the projected device, the electronic device determines that stretching is required between the projected device and the projecting device, and the electronic device stretches the target image according to a preset stretching algorithm, the first display parameter of the projected device, and the center pixel of the target image to obtain a stretched target image.
[0110] In the embodiment of the present application, the electronic device first determines whether image stretching is required based on the display parameters of the projected device and the projecting device, and then performs the image stretching operation. In this way, the stretching operation can be reduced for screens with small differences, thereby avoiding waste of computing power of the electronic device.
[0111] Reference Figure 7 , Figure 7 It is a flow chart of an embodiment of different stretching modes in the projection image stretching method in the embodiment of the present application.
[0112] In some embodiments of the present application, the display aspect ratio of the projected device is different from the display aspect ratio of the projecting device, and the electronic device obtains the stretching mode of the projected device, specifically including steps 501-503:
[0113] 501, obtaining a stretching mode of the projected device;
[0114] The electronic device obtains a stretching mode of the projected device, wherein the stretching mode includes a default first stretching mode and a customized second stretching mode. The electronic device processes the target image according to the stretching mode of the projected device, specifically:
[0115] 502. If the stretching mode of the projected device is the first stretching mode, determine a stretching direction and a stretching ratio according to the first display aspect ratio and the second display aspect ratio; and stretch the target image according to the stretching direction and the stretching ratio to obtain a stretched target image.
[0116] If the stretching mode of the projected device is the first stretching mode, the electronic device determines the stretching direction and the stretching ratio according to the first display aspect ratio and the second display aspect ratio; the electronic device stretches the target image according to the stretching direction and the stretching ratio to obtain the stretched target image. For example, if the display aspect ratio of the projected device is greater than the display aspect ratio of the projecting device, the screen is stretched in length; if the display aspect ratio of the projected device is less than the display aspect ratio of the projecting device, the screen is stretched in width.
[0117] 503. If the stretching mode of the projected device is the second stretching mode, the target image is stretched according to a preset stretching algorithm, the first display parameter of the projected device, and the central pixel point of the target image to obtain a stretched target image.
[0118] If the stretching mode of the projected device is the second stretching mode, the electronic device executes step 202 in the embodiment of the present application to stretch the target image according to the preset stretching algorithm, the first display parameter of the projected device, and the central pixel point of the target image to obtain the stretched target image. In the embodiment of the present application, the electronic device sets different stretching modes, which can be applied to different stretching scenarios, so that the stretching during the projection process better meets user needs.
[0119] Furthermore, before step 202 of the projection image stretching method provided in the embodiment of the present application, the method further includes:
[0120] 1. In response to a center pixel setting request triggered by a target image, output a setting page;
[0121] 2. Obtain a target position input based on the setting page, set a pixel point corresponding to the target position as a central pixel point of the target image and save the setting.
[0122] That is, in the embodiment of the present application, the electronic device outputs a setting page in response to a request for setting a center pixel point triggered by a target image; so that the user can set the center pixel point of the target image in the setting page; the electronic device obtains the target position input by the user based on the setting page, and the electronic device sets the pixel point corresponding to the target position as the center pixel point of the target image and saves it.
[0123] parameter Figure 8 , Figure 8 is a schematic diagram of a scene for setting a central pixel point of image stretching in a projection image stretching method provided in an embodiment of the present application, Figure 8 (a) is a schematic diagram of a scene in which the projected device displays an unstretched target image. There are grayscale areas on both sides of the display screen of the projected device, and the display screen resources of the projected device are not fully utilized; Figure 8 (b) is a schematic diagram of a scene in which a projection device displays a target image formed according to a traditional stretching algorithm. The target image on the display screen of the projection device is uniformly stretched, and the target image is deformed; Figure 8 (c) is a schematic diagram of a scene in which the projection device displays a target image stretched according to a preset stretching algorithm in the present application, Figure 8 In (c), the central pixel points of the target image are respectively located in the left area and the upper area of the target image. In the embodiment of the present application, the user can personalize the central pixel points according to the actual situation, so that the image stretching is more reasonable.
[0124] like Fig. 9 As shown, Fig. 9 It is a schematic diagram of the structure of an embodiment of the projection image stretching device provided in the embodiments of the present application.
[0125] In order to better implement the projection image stretching method in the embodiment of the present application, based on the projection image stretching method, a projection image stretching device is also provided in the embodiment of the present application, and the projection image stretching device includes:
[0126] An acquisition module 601 is used to acquire a target image sent by a screen projection device to a screen projection device;
[0127] The stretching module 602 is used to stretch the target image according to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel of the target image to obtain a stretched target image; wherein the preset stretching algorithm is the relationship between the target pixel to be stretched in the target image and the central pixel of the target image;
[0128] The output module 603 is used to output the stretched target image to the projected screen device.
[0129] In some embodiments of the present application, the stretching module 602 in the projection image stretching device includes:
[0130] Determining a first stretching coefficient according to a first display parameter of the projected screen device and a second display parameter of the projecting screen device;
[0131] Determining a second stretching coefficient according to a pixel position of a central pixel of the target image and a pixel position of a target pixel to be stretched in the target image;
[0132] Inputting the first stretching coefficient and the second stretching coefficient into the preset stretching algorithm to obtain a stretching ratio of a target pixel point to be stretched in the target image;
[0133] The target pixel points to be stretched in the target image are stretched according to the stretching ratio to obtain a stretched target image.
[0134] In some embodiments of the present application, the projection image stretching device determines a first stretching coefficient according to a first display parameter of the projection device and a second display parameter of the projection device, including:
[0135] Comparing the first display parameter of the projected screen device with the second display parameter of the projecting screen device to obtain the stretching direction of the target image;
[0136] Acquire the total number of pixels of the target image in the stretching direction and the number of times the target image is stretched in the stretching direction;
[0137] The ratio between the total number of pixels and the number of stretching times is calculated, and the ratio is set as a first stretching coefficient.
[0138] In some embodiments of the present application, the projection image stretching device determines the second stretching coefficient according to the pixel position of the central pixel of the target image and the pixel position of the target pixel to be stretched in the target image, including:
[0139] If the target image has at least two central pixel points, dividing the target image into stretching areas corresponding to the central pixel points according to the pixel positions between the central pixel points;
[0140] For each of the stretching regions, a relative distance between a pixel position of a central pixel of the stretching region and a pixel position of a target pixel to be stretched in the stretching region is calculated, and the relative distance is set as the second stretching coefficient.
[0141] In some embodiments of the present application, the projection image stretching device is also used for:
[0142] Obtaining a first display parameter of the projected screen device and a second display parameter of the projected screen device;
[0143] Calculating a first display aspect ratio corresponding to the first display parameter and a second display aspect ratio corresponding to the second display parameter;
[0144] If the first display aspect ratio and the second display aspect ratio are different, the target image is stretched according to a preset stretching algorithm, the first display parameter of the projected device, and the central pixel point of the target image to obtain a stretched target image.
[0145] In some embodiments of the present application, the projection image stretching device is also used for:
[0146] Obtaining a stretching mode of the projected device;
[0147] If the stretching mode of the projected device is the first stretching mode, determining a stretching direction and a stretching ratio according to the first display aspect ratio and the second display aspect ratio; and performing stretching processing on the target image according to the stretching direction and the stretching ratio to obtain a stretched target image;
[0148] If the stretching mode of the projected device is the second stretching mode, the target image is stretched according to a preset stretching algorithm, the first display parameter of the projected device, and the central pixel point of the target image to obtain a stretched target image.
[0149] In some embodiments of the present application, the projection image stretching device is also used for:
[0150] In response to a center pixel setting request triggered by a target image, output a setting page;
[0151] A target position is input based on the setting page, and a pixel point corresponding to the target position is set as a central pixel point of the target image and saved.
[0152] The projection image stretching device in this embodiment: obtains the target image sent by the projection device to the projection device; according to a preset stretching algorithm, the first display parameter of the projection device, and the center pixel of the target image, stretches the target image to obtain a stretched target image; wherein the preset stretching algorithm is the relationship between the target pixel to be stretched in the target image and the center pixel of the target image; outputs the stretched target image to the projection device; a preset stretching algorithm is provided in the embodiment of the present application, and the preset stretching algorithm is the relationship between the target pixel to be stretched and the center pixel in the target image, which involves the relative distance between the target pixel to be stretched and the center pixel in the target image, and stretches the target image according to the preset stretching algorithm, thereby effectively avoiding deformation caused by image stretching.
[0153] The embodiment of the present invention further provides an electronic device, such as Fig.10 As shown, Fig.10 It is a schematic diagram of the structure of an embodiment of an electronic device provided in the embodiments of the present application.
[0154] An electronic device is integrated with any one of the projection image stretching devices provided in the embodiments of the present invention, and the electronic device includes:
[0155] one or more processors;
[0156] Memory; and
[0157] One or more applications, wherein the one or more applications are stored in the memory and are configured so that the processor executes the steps of the projection image stretching method described in any of the above-mentioned projection image stretching method embodiments.
[0158] Specifically, the electronic device may include one or more processing core processors 701, one or more computer storage media memories 702, a power supply 703, an input unit 704 and other components. Those skilled in the art will understand that Fig.10 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0159] The processor 701 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 702, and calling data stored in the memory 702, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. Optionally, the processor 701 may include one or more processing cores; preferably, the processor 701 may integrate an application processor and a modem processor, wherein the application processor mainly processes performance adjustment systems, user interfaces, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 701.
[0160] The memory 702 can be used to store software programs and modules. The processor 701 executes various functional applications and data processing by running the software programs and modules stored in the memory 702. The memory 702 may mainly include a program storage area and a data storage area, wherein the program storage area may store a performance adjustment system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 702 may also include a memory controller to provide the processor 701 with access to the memory 702.
[0161] The electronic device also includes a power supply 703 for supplying power to each component. Preferably, the power supply 703 can be logically connected to the processor 701 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 703 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0162] The electronic device may further include an input unit 704, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0163] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 701 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 702 according to the following instructions, and the processor 701 will run the application programs stored in the memory 702, thereby realizing various functions, as follows:
[0164] Get the target image sent by the projection device to the projection device;
[0165] According to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel point of the target image, the target image is stretched to obtain a stretched target image; wherein the preset stretching algorithm is a relationship between the target pixel point to be stretched in the target image and the central pixel point of the target image;
[0166] The stretched target image is output to the projected screen device.
[0167] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer storage medium and loaded and executed by a processor.
[0168] To this end, an embodiment of the present invention provides a computer storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any one of the projection image stretching methods provided in the embodiment of the present invention. For example, the computer program can be loaded by the processor to execute the following steps:
[0169] Get the target image sent by the projection device to the projection device;
[0170] According to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel point of the target image, the target image is stretched to obtain a stretched target image; wherein the preset stretching algorithm is a relationship between the target pixel point to be stretched in the target image and the central pixel point of the target image;
[0171] The stretched target image is output to the projected screen device.
[0172] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the detailed description of other embodiments above, and will not be repeated here.
[0173] In specific implementation, the above units or structures can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units or structures can refer to the previous method embodiments, which will not be repeated here.
[0174] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0175] The above is a detailed introduction to a projection image stretching method provided in an embodiment of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A projection image stretching method, characterized in that: The projection image stretching method comprises: Get the target image sent by the projection device to the projection device; According to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel point of the target image, the target image is stretched to obtain a stretched target image; wherein the preset stretching algorithm is a relationship between the target pixel point to be stretched in the target image and the central pixel point of the target image; The stretched target image is output to the projected screen device.
2. The projection image stretching method according to claim 1, characterized in that: The stretching process is performed on the target image according to a preset stretching algorithm, a first display parameter of the projected screen device, and a central pixel point of the target image to obtain a stretched target image, including: Determining a first stretching coefficient according to a first display parameter of the projected screen device and a second display parameter of the projecting screen device; Determining a second stretching coefficient according to a pixel position of a central pixel of the target image and a pixel position of a target pixel to be stretched in the target image; Inputting the first stretching coefficient and the second stretching coefficient into the preset stretching algorithm to obtain a stretching ratio of a target pixel point to be stretched in the target image; The target pixel points to be stretched in the target image are stretched according to the stretching ratio to obtain a stretched target image.
3. The projection image stretching method according to claim 2, characterized in that: The determining a first stretching coefficient according to a first display parameter of the projected screen device and a second display parameter of the projecting screen device includes: Comparing the first display parameter of the projected screen device with the second display parameter of the projecting screen device to obtain the stretching direction of the target image; Acquire the total number of pixels of the target image in the stretching direction and the number of times the target image is stretched in the stretching direction; The ratio between the total number of pixels and the number of stretching times is calculated, and the ratio is set as a first stretching coefficient.
4. The projection image stretching method according to claim 2, characterized in that: The determining the second stretching coefficient according to the pixel position of the central pixel point of the target image and the pixel position of the target pixel point to be stretched in the target image includes: If the target image has at least two central pixel points, dividing the target image into stretching areas corresponding to the central pixel points according to the pixel positions between the central pixel points; For each of the stretching regions, a relative distance between a pixel position of a central pixel of the stretching region and a pixel position of a target pixel to be stretched in the stretching region is calculated, and the relative distance is set as the second stretching coefficient.
5. The projection image stretching method according to claim 1, characterized in that: Before stretching the target image according to the preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel of the target image to obtain the stretched target image, the method includes: Obtaining a first display parameter of the projected screen device and a second display parameter of the projected screen device; Calculating a first display aspect ratio corresponding to the first display parameter and a second display aspect ratio corresponding to the second display parameter; If the first display aspect ratio and the second display aspect ratio are different, the target image is stretched according to a preset stretching algorithm, the first display parameter of the projected device, and the central pixel point of the target image to obtain a stretched target image.
6. The projection image stretching method according to claim 5, characterized in that: If the first display aspect ratio and the second display aspect ratio are different, the method includes: Acquire the stretching mode of the projected device; If the stretching mode of the projected device is the first stretching mode, determining a stretching direction and a stretching ratio according to the first display aspect ratio and the second display aspect ratio; and performing stretching processing on the target image according to the stretching direction and the stretching ratio to obtain a stretched target image; If the stretching mode of the projected device is the second stretching mode, the target image is stretched according to a preset stretching algorithm, the first display parameter of the projected device, and the central pixel point of the target image to obtain a stretched target image.
7. The projection image stretching method according to any one of claims 1 to 6, characterized in that: The method comprises: stretching the target image according to the preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel of the target image to obtain the stretched target image, including: In response to a center pixel setting request triggered by a target image, output a setting page; A target position is input based on the setting page, and a pixel point corresponding to the target position is set as a central pixel point of the target image and saved.
8. A projection image stretching device, characterized in that: The projection image stretching device comprises: An acquisition module is used to acquire a target image sent by the projection device to the projection device; A stretching module, configured to perform stretching processing on the target image according to a preset stretching algorithm, the first display parameter of the projected screen device, and the central pixel point of the target image to obtain a stretched target image; wherein the preset stretching algorithm is a relationship between the target pixel point to be stretched in the target image and the central pixel point of the target image; An output module is used to output the stretched target image to the projected screen device.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the steps in the projection image stretching method described in any one of claims 1 to 7.
10. A computer storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the projection image stretching method described in any one of claims 1 to 7.