Image generation method, device, electronic device and storage medium

By acquiring and sampling the depth information and brightness/color parameters of the image, and integrating them to generate a mixed image, it solves the problem of single virtual light source and monotonous color in mixed reality, and improves the imaging effect and presentation quality of the image.

CN114155175BActive Publication Date: 2024-10-11BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010929857.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-07
Publication Date
2024-10-11
Estimated Expiration
2040-09-07

AI Technical Summary

Technical Problem

In mixed reality, the virtual light source lighting pattern is single and the color is monotonous, which affects the imaging effect of the mixed image, resulting in poor presentation results.

Method used

By obtaining the pixel depth information of the first image and the second image, the spatial coordinate system of the virtual light source is constructed, the brightness and color parameters of the first image are sampled, and the hybrid image is generated through fusion, thereby achieving personalized image fusion and improving the presentation effect.

Benefits of technology

It realizes personalized image fusion in mixed reality, improves the imaging effect of mixed images, makes the virtual light source lighting pattern not limited by form and color, and presents a three-dimensional visual effect that is more suitable for real scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114155175B_ABST
    Figure CN114155175B_ABST
Patent Text Reader

Abstract

The present disclosure relates to an image generation method, device, electronic device and storage medium, and belongs to the field of image processing technology. The method includes: obtaining a first image and a second image; constructing a first spatial coordinate system of a virtual light source in the second image; obtaining depth information of each pixel in the first image, and determining the first position coordinates of each pixel in the first spatial coordinate system according to the depth information; sampling the first image according to the first position coordinates, and generating a sampled image according to the brightness parameters and / or color parameters of the sampled pixel; and fusing the first image, the sampled image and the second image to generate a mixed image. Personalized image fusion is achieved in mixed reality, and when the first image is fused to the second image, the three-dimensional visual effect of the first image can be presented, which is more in line with the second image, and the imaging effect of the mixed image is improved, thereby improving the presentation effect of mixed reality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to an image generating method, device, electronic device and storage medium. Background Art

[0002] With the development of graphics and visual algorithms, mixed reality technology has made great progress. Mixed Reality (MR) is a further development of virtual reality technology. This technology introduces real scene information into the virtual environment, builds an interactive feedback information loop between the virtual world, the real world and the user, and enhances the realism of the user experience. Based on the application of mixed reality technology, mixed images of real scenes and virtual objects can be presented on electronic devices. In a scene where mixed reality technology is applied, virtual light sources can be added to the real scene to create a different atmosphere, and then on the basis of adding virtual light sources, the effect of advertising projection lamps can be simulated, thereby adding virtual advertising projection imaging to the real scene.

[0003] In the related art, the coordinates of the real scene image based on the world coordinate system are usually calculated, and the light source of the advertisement projection is projected into the corresponding world coordinate system, thereby superimposing it with the real scene image to generate a mixed image with a mixed reality effect.

[0004] In this way, the lighting pattern of the virtual light source in the mixed reality is single and the color is monotonous, which affects the imaging effect of the mixed image, resulting in poor presentation of the mixed reality. Summary of the invention

[0005] The present disclosure provides an image generation method, device, electronic device, storage medium and computer program product to at least solve the technical problem in the related art that the virtual light source lighting pattern in mixed reality is single and the color is monotonous, which affects the imaging effect of the mixed image, thereby resulting in poor presentation effect of the mixed reality. The technical solution of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, there is provided an image generating method, comprising: acquiring a first image and a second image, wherein the first image is an image to be fused into the second image; constructing a first spatial coordinate system of a virtual light source in the second image; acquiring depth information of each pixel in the first image, and determining first position coordinates of each pixel in the first spatial coordinate system according to the depth information; sampling brightness parameters and / or color parameters corresponding to some pixels in the first image according to the first position coordinates, and generating a sampled image according to the brightness parameters and / or color parameters of the sampled pixels; and fusing the first image, the sampled image and the second image to generate a mixed image.

[0007] In some embodiments of the present disclosure, determining the first position coordinates of each pixel point in the first space coordinate system according to the depth information includes:

[0008] Constructing a coordinate transformation matrix from the world coordinate system to the first space coordinate system;

[0009] Determine the second position coordinates of each pixel point in the world coordinate system according to the depth information;

[0010] The first position coordinates of each pixel point in the first space coordinate system are determined according to the second position coordinates of each pixel point and the coordinate transformation matrix.

[0011] In some embodiments of the present disclosure, the step of determining the second position coordinates of each pixel point in the world coordinate system according to the depth information includes:

[0012] Acquire a camera coordinate system corresponding to the first image;

[0013] Determine, according to the depth information and the camera parameters corresponding to the first image, the third position coordinates of each pixel point in the camera coordinate system;

[0014] Obtaining a transformation matrix from a camera coordinate system to a world coordinate system corresponding to the first image;

[0015] The second position coordinates of each pixel point in the world coordinate system are determined according to the third position coordinates and the transformation matrix.

[0016] In some embodiments of the present disclosure, the step of constructing a coordinate transformation matrix from a world coordinate system to the first space coordinate system includes:

[0017] Obtaining position information and orientation information of the virtual light source in the world coordinate system;

[0018] The coordinate transformation matrix is ​​constructed according to the position information and the orientation information, the transformation matrix from the camera coordinate system to the world coordinate system, and the first space coordinate system.

[0019] In some embodiments of the present disclosure, the step of sampling brightness parameters and / or color parameters corresponding to some pixels in the first image according to the first position coordinates includes:

[0020] When the Z coordinate value of the first position coordinate is greater than zero, determining the first position coordinate as the target first position coordinate;

[0021] Normalizing the X coordinate value and the Y coordinate value of the first position coordinate of the target according to the scaling constant to obtain sampling coordinates;

[0022] When the sampling coordinates are all less than or equal to 1, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinates belong is sampled;

[0023] When any coordinate value of the sampling coordinates is greater than 1, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinates belong is not sampled.

[0024] In some embodiments of the present disclosure, the step of sampling brightness parameters and / or color parameters corresponding to some pixels in the first image according to the first position coordinates further includes:

[0025] When the Z coordinate value of the first position coordinate is less than or equal to zero, the brightness parameter and / or color parameter corresponding to the pixel point to which the first position coordinate belongs is not sampled.

[0026] In some embodiments of the present disclosure, the step of sampling the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinate belongs includes:

[0027] Determine that the standard function formula corresponds to the standard graphic coordinates in the first space coordinate system;

[0028] Performing corresponding adjustment processing on the sampling coordinates according to the standard graphic coordinates;

[0029] The brightness parameter and / or color parameter corresponding to the pixel point to which the adjusted sampling coordinates belong in the first image is sampled to generate the sampled image.

[0030] According to a second aspect of an embodiment of the present disclosure, an image generating device is provided, comprising: a first acquisition module, configured to acquire a first image and a second image, wherein the first image is an image to be fused into the second image; a construction module, configured to construct a first spatial coordinate system of a virtual light source in the second image; a second acquisition module, configured to acquire depth information of each pixel in the first image, and determine first position coordinates of each pixel in the first spatial coordinate system according to the depth information; a sampling module, configured to sample brightness parameters and / or color parameters corresponding to some pixels in the first image according to the first position coordinates, and generate a sampled image according to the brightness parameters and / or color parameters of the sampled pixels; and a fusion module, configured to fuse the first image, the sampled image and the second image to generate a mixed image.

[0031] In some embodiments of the present disclosure, the second acquisition module includes:

[0032] A construction unit, configured to construct a coordinate transformation matrix from a world coordinate system to the first space coordinate system;

[0033] A first determining unit is configured to determine a second position coordinate of each pixel point in the world coordinate system according to the depth information;

[0034] The second determining unit is configured to determine the first position coordinates of each pixel point in the first space coordinate system according to the second position coordinates of each pixel point and the coordinate transformation matrix.

[0035] In some embodiments of the present disclosure, the first determining unit is configured to:

[0036] Acquire a camera coordinate system corresponding to the first image;

[0037] Determine, according to the depth information and the camera parameters corresponding to the first image, the third position coordinates of each pixel point in the camera coordinate system;

[0038] Obtaining a transformation matrix from a camera coordinate system to a world coordinate system corresponding to the first image;

[0039] The second position coordinates of each pixel point in the world coordinate system are determined according to the third position coordinates and the transformation matrix.

[0040] In some embodiments of the present disclosure, the construction unit is configured as follows:

[0041] Obtaining position information and orientation information of the virtual light source in the world coordinate system;

[0042] The coordinate transformation matrix is ​​constructed according to the position information and the orientation information, the transformation matrix from the camera coordinate system to the world coordinate system, and the first space coordinate system.

[0043] In some embodiments of the present disclosure, the sampling module is configured to:

[0044] When the Z coordinate value of the first position coordinate is greater than zero, determining the first position coordinate as the target first position coordinate;

[0045] Normalizing the X coordinate value and the Y coordinate value of the first position coordinate of the target according to the scaling constant to obtain sampling coordinates;

[0046] When the sampling coordinates are all less than or equal to 1, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinates belong is sampled;

[0047] When any coordinate value of the sampling coordinates is greater than 1, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinates belong is not sampled.

[0048] In some embodiments of the present disclosure, the sampling module is configured to:

[0049] When the Z coordinate value of the first position coordinate is less than or equal to zero, the brightness parameter and / or color parameter corresponding to the pixel point to which the first position coordinate belongs is not sampled.

[0050] In some embodiments of the present disclosure, the sampling module is configured to:

[0051] Determine that the standard function formula corresponds to the standard graphic coordinates in the first space coordinate system;

[0052] Performing corresponding adjustment processing on the sampling coordinates according to the standard graphic coordinates;

[0053] The brightness parameter and / or color parameter corresponding to the pixel point to which the adjusted sampling coordinates belong in the first image is sampled to generate the sampled image.

[0054] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the image generating method as described above.

[0055] According to a fourth aspect of an embodiment of the present disclosure, a storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the image generating method as described above.

[0056] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided. When the computer program is executed by a processor of an electronic device, the electronic device can execute the image generating method as described above.

[0057] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects: by acquiring a first image and a second image, the depth information of each pixel in the first image is acquired, and the first position coordinates of each pixel in the first space coordinate system are determined according to the depth information, so as to assist in the subsequent image fusion process, and refer to the first position coordinates to perform sampling and processing on the brightness parameters and / or color parameters corresponding to some pixels in the first image, so as to realize personalized image fusion in mixed reality without being restricted by the form and color of the lighting pattern of the virtual light source in the mixed reality, and enable the three-dimensional visual effect of the first image to be presented when the first image is fused into the second image, which is more in line with the second image, thereby improving the imaging effect of the mixed image and thus improving the presentation effect of the mixed reality.

[0058] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0060] Figure 1 The figure is a flowchart of an image generating method according to an exemplary embodiment.

[0061] Figure 2 is a flowchart of another image generating method according to an exemplary embodiment.

[0062] Figure 3 is a flowchart of yet another image generating method according to an exemplary embodiment.

[0063] Figure 4 A schematic diagram of a mixed image according to an embodiment of the present disclosure.

[0064] Figure 5 The figure is a block diagram of an image generating device according to an exemplary embodiment.

[0065] Figure 6 is a block diagram of an image generating device according to another exemplary embodiment.

[0066] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0067] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0068] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0069] Figure 1 The figure is a flowchart of an image generating method according to an exemplary embodiment.

[0070] This embodiment is described by taking the image generating method as an example in which the image generating device is configured.

[0071] In this embodiment, the image generating method may be configured in an image generating device, and the image generating device may be set in a server, or may also be set in an electronic device, which is not limited in this embodiment of the present disclosure.

[0072] This embodiment takes the image generation method configured in an electronic device as an example. The electronic device may be a mobile phone, a tablet computer, a personal digital assistant, a wearable device, or other hardware device with various operating systems and cameras.

[0073] It should be noted that the execution subject of the embodiment of the present disclosure may be, for example, a central processing unit (CPU) in a server or electronic device in terms of hardware, or may be, for example, a related background service in a server or electronic device in terms of software, without limitation.

[0074] like Figure 1 As shown, the image generation method includes the following steps:

[0075] In step S101 , a first image and a second image are acquired, wherein the first image is an image to be fused into the second image.

[0076] The first image is an image to be fused into the second image, and the second image may be, for example, an image obtained by capturing a real scene.

[0077] In a mixed reality implementation scenario, for example, an advertising projector lamp utilizes the optical projection principle and a high-brightness light source to project the trademark image on the advertising trademark LOGO light sheet onto a building wall or the ground, thereby forming an image display and advertising effect with great visual impact. When the scene of the building wall or the ground after the projected trademark image is presented in an electronic device, the image corresponding to the building wall or the ground can be called the second image, and correspondingly, the trademark image can be called the first image.

[0078] In the process of implementing the present disclosure, a camera carried by the electronic device itself can be used to capture a video of the real scene, and each video frame can be parsed to obtain a corresponding second image. Alternatively, the camera of the electronic device can be directly used to shoot the real scene to obtain the second image. Alternatively, a second image sent by other devices can be received, and there is no limitation to this.

[0079] The above-mentioned first image or second image can be an original image, wherein the original image can be, for example, a RAW format image without any processing obtained by capturing an image sensor in a camera of an electronic device, or it can also be an image obtained after some image processing steps, without limitation.

[0080] Among them, RAW format images are the original images that the image sensor converts the captured light source signal into a digital signal. RAW format images record the original information of the image sensor and some metadata generated by the camera, such as sensitivity settings, shutter speed, aperture value, white balance, etc.

[0081] In step S102, a first space coordinate system of a virtual light source in the second image is constructed.

[0082] After acquiring the first image and the second image, the step of constructing a first space coordinate system of a virtual light source in the second image is performed, wherein the virtual light source makes the light source effect of the second image more realistic.

[0083] Among them, the spatial coordinate system based on the virtual light source in the second image can be called the first spatial coordinate system. The first spatial coordinate system can be, for example, a spatial rectangular coordinate system, or it can be any other spatial coordinate system that can measure spatial dimensions, such as a spherical coordinate system, etc., without limitation.

[0084] When constructing the first spatial coordinate system of the virtual light source in the second image, the light source effect in the second image (for example, light source brightness, light direction, etc.) can be first identified, and then, based on the identified light source effect and the preconfigured correspondence, the position information of the virtual light source is determined, so as to construct a spatial rectangular coordinate system with the position information of the virtual light source as the coordinate origin and serve as the first spatial coordinate system of the virtual light source. Alternatively, any other possible method can be used to construct the first spatial coordinate system of the virtual light source in the second image, and there is no limitation to this.

[0085] The above-mentioned correspondence has learned the correspondence between the sample light source effect and the sample virtual light source position information. The sample virtual light source position information can be determined in advance based on the posture information of the camera of the electronic device or the internal and external parameters of the camera. Alternatively, the above-mentioned correspondence may also have learned the correspondence between the sample light source effect, the posture information of the sample camera, the internal and external parameters of the sample camera, and the sample virtual light source position information. Therefore, after identifying the light source effect in the second image (for example, light source brightness, light direction, etc.), the corresponding virtual light source position information can be identified from the correspondence based on the light source effect combined with the internal and external parameters of the camera. There is no limitation to this.

[0086] In step S103, the depth information of each pixel in the first image is obtained, and the first position coordinates of each pixel in the first space coordinate system are determined according to the depth information.

[0087] The depth information can be used to represent information related to the distance from the surface of the scene object presented by the first image to the viewpoint. By collecting the depth information of each pixel in the first image, it can be used for three-dimensional reconstruction of the scene object presented by the first image. That is to say, the depth information can be used to represent the three-dimensional spatial position information of each pixel corresponding to the actual scene object.

[0088] Therefore, after the depth information of each pixel point in the first image is acquired, a step of determining the first position coordinates of each pixel point in the first space coordinate system according to the depth information may be performed.

[0089] For example, the depth information of each pixel in the first image may be identified, so as to determine the first position coordinates of each pixel in the first space coordinate system according to the depth information.

[0090] For another example, for the first image, the reference point of the first image may be matched with the coordinate origin of the first space coordinate system, so that after matching, the first position coordinates of each pixel point in the first space coordinate system are determined in combination with the depth information of each pixel point.

[0091] When identifying the depth information of the first image, structured light may be projected onto the first image, and a structured light image modulated by the first image may be captured, thereby demodulating phase information corresponding to each pixel of the structured light image to obtain depth information. The structured light may be, for example, speckle structured light, or any other possible method may be used to obtain the depth information of each pixel point of the first image, such as an engineering method, an artificial intelligence method, etc., without limitation.

[0092] In the embodiment of the present disclosure, the step of determining the first position coordinates of each pixel point in the first space coordinate system based on the depth information may be performed by determining the first position coordinates of each pixel point in the first space coordinate system in a parallel processing manner based on the depth information, thereby achieving rapid determination of the first position coordinates of each pixel point in the first space coordinate system, thereby assisting in rapid fusion of the first image into the second image.

[0093] In step S104, brightness parameters and / or color parameters corresponding to some pixels in the first image are sampled according to the first position coordinates, and a sampled image is generated according to the brightness parameters and / or color parameters of the sampled pixels.

[0094] The above-mentioned first position coordinates can characterize the spatial position state of each pixel point of the first image in the first spatial coordinate system of the virtual light source in the second image. Therefore, in the embodiment of the present disclosure, the sampled image is obtained by combining the first position coordinates to sample the brightness parameters and / or color parameters corresponding to some pixel points in the first image, so that the generated mixed image can fuse the local brightness parameters and / or color parameters obtained by sampling the first image, thereby realizing personalized image fusion, without being restricted by the shape and color of the virtual light source lighting pattern in the mixed reality.

[0095] In some embodiments, it is possible to determine whether the first position coordinates of each pixel point meet preset conditions, select the target first position coordinates that meet the preset conditions, normalize the target first position coordinates according to the scaling constant to obtain sampling coordinates, and sample the brightness parameters and / or color parameters of the image to be processed according to the sampling coordinates to generate a sampled image.

[0096] The above-mentioned preset conditions can be dynamically configured according to actual image fusion requirements. The preset conditions can be pre-configured by the factory program of the electronic device. One preset condition can correspond to one image fusion requirement. When the electronic device is set to sample and process the first image according to the preset condition corresponding to the selected image fusion requirement, the generated mixed image can meet the image fusion requirement. This not only realizes personalized image fusion in mixed reality, but also assists in realizing a variety of different image fusion effects, making the implementation method of mixed reality more flexible, applicable to a variety of different real-life scene requirements, and improving the flexibility of image fusion based on mixed reality.

[0097] In the embodiment of the present disclosure, when the Z coordinate value of the first position coordinate is greater than zero, the first position coordinate is determined to be the target first position coordinate, and the X coordinate value and the Y coordinate value of the target first position coordinate are normalized according to the scaling constant to obtain the sampling coordinate, and when the sampling coordinates are all less than or equal to 1, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinate belongs are sampled; when any coordinate value in the sampling coordinates is greater than 1, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinate belongs is not sampled, and when the Z coordinate value of the first position coordinate is less than or equal to zero, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinate belongs is not sampled.

[0098] Therefore, since the X-coordinate value and the Y-coordinate value of the target first position coordinate are normalized according to the scaling constant, the sampling coordinates are obtained, thereby reducing the coordinate dimension, thereby reducing the data volume and improving the sampling efficiency, and sampling The brightness parameters and / or color parameters corresponding to the pixel points to which the sampling coordinates belong are sampled to generate a sampled image, and the sampled image is used to assist in the subsequent generation of a mixed image, thereby realizing the synthesis of mixed images according to image features of multiple dimensions, improving the performance of the mixed image, and sampling The enhanced image parameters are accumulated in the mixed image by accumulating the image parameter values ​​into the mixed image, thereby effectively improving the presentation effect of the mixed image.

[0099] The above-mentioned scaling constant C is a fixed constant for simulating the spotlight effect in the field of image processing. This constant has a numerical range of 0.1-100, and the sampling coordinates are UV (C*x / z, C*y / z), wherein the values ​​of C*x / z, C*y / z have corresponding numerical relationships with C, the x-coordinate value, the y-coordinate value, and the z-coordinate value. In the present disclosure, the scaling constant C and the threshold 1 are combined to determine the timing of sampling, so that after the first image is fused into the second image, the enlarged or reduced first image with a spotlight effect can be presented in the second image. Therefore, when the scaling constant C selects different values, it indicates that the degree of enlargement or reduction of the image is different, which can meet the personalized image fusion needs.

[0100] The above-mentioned scaling constant may also be configured according to the image fusion requirements of the user, and there is no limitation on this.

[0101] Of course, other image fusion effects can also be achieved. For example, if the image fusion effect is to achieve the projection of any geometric shape in mixed reality, it is also possible to determine the standard function formula (heart-shaped function formula) corresponding to the standard graphic coordinates in the first space coordinate system; perform corresponding adjustment processing on the sampling coordinates according to the standard graphic coordinates; sample the brightness parameters and / or color parameters corresponding to the pixel points to which the adjusted sampling coordinates belong in the first image to generate a heart-shaped sampling image, thereby achieving the fusion effect of the heart-shaped image in the subsequent mixed image, realizing personalized image fusion in mixed reality, and improving the flexibility and applicability of image fusion.

[0102] The above-mentioned standard graphic coordinates are not a single coordinate, but include a series of coordinates. In subsequent adjustments, the coordinates in the standard graphic coordinates can be used to correct the position of the sampling coordinates, and the sampling coordinates can be adjusted to be within the graphic range covered by the standard graphic coordinates, so that the sampled image can present the graphics corresponding to the standard function formula. Alternatively, any other possible method can be used for adjustment (such as configuring weights to merge the standard graphic coordinates with the sampling coordinates), so as to adjust the sampling coordinates, and there is no restriction on this.

[0103] In step S105 , the first image, the sampled image, and the second image are fused to generate a mixed image.

[0104] The above-mentioned fusion of the first image, the sampled image and the second image can specifically be performed by directly synthesizing the first image, the sampled image and the second image to obtain a mixed image, or the first image can be first rendered accordingly using the sampled image to obtain a rendered image, and then the rendered image is synthesized into the second image, or any other possible image synthesis algorithm can be used to fuse the first image, the sampled image and the second image to obtain a mixed image, and there is no limitation to this.

[0105] In this embodiment, by acquiring the first image and the second image, the depth information of each pixel in the first image is acquired, and the first position coordinates of each pixel in the first space coordinate system are determined according to the depth information, so as to assist the subsequent image fusion process. The brightness parameters and / or color parameters corresponding to some pixels in the first image are sampled and processed with reference to the first position coordinates, so as to realize personalized image fusion in mixed reality without being restricted by the shape and color of the virtual light source lighting pattern in the mixed reality, and enable the three-dimensional visual effect of the first image to be presented when the first image is fused into the second image, which is more in line with the second image, thereby improving the imaging effect of the mixed image and thus improving the presentation effect of the mixed reality.

[0106] Figure 2 is a flowchart of another image generating method according to an exemplary embodiment.

[0107] like Figure 2 As shown, the image generation method includes the following steps:

[0108] In step S201 , a first image and a second image are acquired, wherein the first image is an image to be fused into the second image.

[0109] In step S202, a first space coordinate system of a virtual light source in the second image is constructed.

[0110] In step S203, the depth information of each pixel in the first image is obtained.

[0111] The explanation of steps S201 to S203 can be found in the above embodiments and will not be repeated here.

[0112] In step S204, a coordinate transformation matrix from the world coordinate system to the first space coordinate system is constructed.

[0113] It can be understood that since the electronic device that captures the first image can be placed at any position in the environment, a reference coordinate system is selected in the environment to describe the camera position of the electronic device that captures the first image, and it is used to describe the position of any object in the environment. This coordinate system is called the world coordinate system, and the relationship between the camera coordinate system of the electronic device and the world coordinate system can be described by a rotation matrix and a translation vector.

[0114] In some embodiments, for the first image, the reference point of the first image can be matched with the coordinate origin of the first space coordinate system, so that after matching, the first position coordinates of each pixel point in the first space coordinate system are determined in combination with the depth information of each pixel point.

[0115] In the present embodiment, in order to make the first position coordinates of each pixel point of the first image in the first space coordinate system more accurate and to ensure processing efficiency, the present embodiment first constructs a coordinate transformation matrix from the world coordinate system to the first space coordinate system, and then uses the coordinate transformation matrix to assist in determining the first position coordinates of each pixel point in the first space coordinate system.

[0116] The above-mentioned coordinate transformation matrix can be used to describe the coordinate transformation relationship between the world coordinate system and the first space coordinate system of the virtual light source in the second image, so that the use of the coordinate transformation matrix can assist in quickly and accurately determining the first position coordinates of each pixel point in the first space coordinate system.

[0117] Optionally, in some embodiments, the step of constructing a coordinate transformation matrix from the world coordinate system to the first space coordinate system may be to obtain the position information and orientation information of the virtual light source in the world coordinate system, and construct the coordinate transformation matrix based on the position information and orientation information, the transformation matrix from the camera coordinate system to the world coordinate system, and the first space coordinate system. This is easy to implement, does not consume too much computing resources, improves processing efficiency, and while ensuring the mixed reality presentation effect, also saves resource consumption on electronic equipment, hardware, and software.

[0118] It should be noted that the above-mentioned transformation matrix from the camera coordinate system to the world coordinate system can be obtained by calculating based on the posture information of the camera, and the posture information can be obtained by analyzing the sensing signal of the gyroscope sensor of the electronic device. The posture information can be used to describe the orientation, angular velocity and other information of the camera on the electronic device. The underlying processing logic of the electronic device can directly automatically calculate the transformation matrix from the camera coordinate system to the world coordinate system based on the posture information sensed by the gyroscope.

[0119] The above-mentioned gyroscope is also called an angular velocity sensor, which can measure the angular velocity of rotation when the physical quantity is deflected or tilted. In electronic devices, the gyroscope can well measure the rotation and deflection movements, thereby accurately analyzing and judging the actual movements of the user.

[0120] The sensing signal of the gyroscope sensor of the electronic device may include the movement information of the electronic device in three dimensions in the three-dimensional space. The three dimensions of the three-dimensional space may be respectively represented as the X-axis, Y-axis, and Z-axis directions, wherein the X-axis, Y-axis, and Z-axis are in a perpendicular relationship to each other.

[0121] For example, the motion information of the electronic device in three dimensions in three-dimensional space can be analyzed to obtain the position information and orientation information of the virtual light source in the world coordinate system. Then, the coordinate transformation matrix can be constructed based on the position information and orientation information, the transformation matrix from the camera coordinate system to the world coordinate system, and the first space coordinate system.

[0122] As an example, the position information of the virtual light source based on the world coordinate system can be expressed as: position Po (Ox, Oy, Oz), the orientation information of the virtual light source based on the world coordinate system can be expressed as: orientation (normal vector, z-axis, w), two mutually perpendicular vectors u and v perpendicular to the normal vector, so that the coordinate system of the virtual light source can be constructed based on u, v, w, and used as the first spatial coordinate system. Assuming that the unit vector of the normal vector is equal to the vector n (1.0, 0.0, 0.0), u is (0.0, 0.0, -1.0), and v is (0.0, 1.0, 0.0). Assuming that the unit vector of the normal vector is not equal to the vector n (1.0, 0.0, 0.0), then v = w × n, u = v × w, and finally we get: u (u x ,u y ,u z )、v(v x ,v y ,v z )、w(w x ,w y ,w z ), thus, after determining the position information, orientation information, the first space coordinate system, the transformation matrix from the camera coordinate system to the world coordinate system, the coordinate transformation matrix is ​​obtained as follows:

[0123]

[0124] In step S205, the second position coordinates of each pixel point in the world coordinate system are determined according to the depth information.

[0125] The depth information can be used to represent information related to the distance from the surface of the scene object presented by the first image to the viewpoint. By collecting the depth information of each pixel in the first image, it can be used for three-dimensional reconstruction of the scene object presented by the first image. That is to say, the depth information can be used to represent the three-dimensional spatial position information of each pixel corresponding to the actual scene object.

[0126] When identifying the depth information of the first image, structured light may be projected onto the first image, and a structured light image modulated by the first image may be captured, thereby demodulating phase information corresponding to each pixel of the structured light image to obtain depth information. The above-mentioned structured light may be, for example, speckle structured light, or any other possible method may be used to obtain the depth information of each pixel in the first image, such as an engineering method, an artificial intelligence method, etc., without limitation.

[0127] The position coordinates of the above-mentioned pixel points in the world coordinate system can be called second position coordinates. It can be understood that since the world coordinate system and the first space coordinate system are different coordinate systems, the first position coordinates and the second position coordinates can be different.

[0128] For example, when determining the second position coordinates of each pixel point in the world coordinate system based on the depth information, the reference point of the first image can be specifically matched with the coordinate origin of the world coordinate system, so that after matching, the second position coordinates of each pixel point based on the coordinate origin are determined.

[0129] For another example, the depth information can be used to represent information about the distance from the surface of the scene object presented by the first image to the viewpoint. Thus, the viewpoint position coordinates of the viewpoint based on the world coordinate system can be first determined, and then the point position coordinates of each point on the surface of the scene object presented by the first image in the world coordinate system can be derived based on the information about the distance from the surface of the scene object presented by the first image to the viewpoint. Thereby, the above-mentioned second position coordinates can be obtained based on the point position coordinates and the viewpoint position coordinates. There is no limitation to this.

[0130] In step S206, the first position coordinates of each pixel point in the first space coordinate system are determined according to the second position coordinates of each pixel point and the coordinate transformation matrix.

[0131] The above-mentioned coordinate transformation matrix describes the coordinate transformation relationship between the world coordinate system and the first space coordinate system of the virtual light source in the second image. Therefore, after determining the second position coordinates of each pixel point in the world coordinate system, the coordinate transformation matrix can be directly combined to determine the first position coordinates of each pixel point in the first space coordinate system, thereby using the coordinate transformation matrix to assist in quickly determining the first position coordinates.

[0132] In some embodiments, the electronic device may use parallel processing to determine the first position coordinates of each pixel point in the first space coordinate system based on its second position coordinate combined with a coordinate transformation matrix for each pixel point, without limitation.

[0133] In step S207, it is determined whether the Z coordinate value of the first position coordinate of each pixel point is greater than zero.

[0134] For example, if there are pixel point 1, pixel point 2, pixel point 3,..., and so on, the first position coordinates corresponding to pixel point 1, pixel point 2, and pixel point 3 are first position coordinate 1, first position coordinate 2, and first position coordinate 3, respectively. Then, it can be determined whether the Z coordinate values ​​of the first position coordinate 1, the first position coordinate 2, and the first position coordinate 3 are greater than zero, respectively. It is also possible to use parallel processing to determine whether the Z coordinate values ​​of the first position coordinate 1, the first position coordinate 2, and the first position coordinate 3 are greater than zero, respectively.

[0135] In step S208, when the Z coordinate value of the first position coordinate is greater than zero, the first position coordinate is determined to be the target first position coordinate, and the X coordinate value and the Y coordinate value of the target first position coordinate are normalized according to the scaling constant to obtain the sampling coordinate.

[0136] In some other embodiments, when any coordinate value in the sampling coordinates is greater than 1, the brightness parameters and / or color parameters corresponding to the pixel point to which the sampling coordinates belong are not sampled; or, when the Z coordinate value of the first position coordinates is less than or equal to zero, the brightness parameters and / or color parameters corresponding to the pixel point to which the first position coordinates belong are not sampled.

[0137] In step S209, when the sampling coordinates are all less than or equal to 1, the brightness parameters and / or color parameters corresponding to the pixel points to which the sampling coordinates belong are sampled.

[0138] For example, assuming that the first position coordinates of each pixel point can be expressed as P(x, y, z), when the image fusion requirement is: to make the mixed image able to simulate the spotlight effect, the scaling constant C can be configured. The scaling constant C is a constant greater than 0. The scaling constant C can be dynamically adjusted according to the actual spotlight effect requirements. At this time, if the Z coordinate value is greater than 0, the sampling coordinates are UV(C*x / z, C*y / z). If C*x / z>1, or C*y / z>1, no sampling is required. If the Z coordinate value is less than or equal to 0, no sampling is performed (that is, the pixel point corresponding to the first position coordinate is not sampled).

[0139] In step S210 , the first image, the sampled image, and the second image are fused to generate a mixed image.

[0140] The above-mentioned fusion of the first image, the sampled image and the second image can specifically be performed by directly synthesizing the first image, the sampled image and the second image to obtain a mixed image, or the first image can be first rendered accordingly using the sampled image to obtain a rendered image, and then the rendered image is synthesized into the second image, or any other possible image synthesis algorithm can be used to fuse the first image, the sampled image and the second image to obtain a mixed image, and there is no limitation to this.

[0141] In this embodiment, personalized image fusion is implemented in mixed reality without being restricted by the form and color of the virtual light source lighting pattern in mixed reality, and when the first image is fused to the second image, the three-dimensional visual effect of the first image can be presented, which is more in line with the second image, and the imaging effect of the mixed image is improved, thereby improving the presentation effect of mixed reality. The first position coordinates of each pixel point of the determined first image in the first spatial coordinate system are made more accurate, and the processing efficiency is guaranteed. It is easy to implement, does not bring about excessive consumption of computing resources, improves processing efficiency, and on the basis of ensuring the presentation effect of mixed reality, it also saves resource consumption on electronic equipment, hardware and software. Not only does it realize personalized image fusion in mixed reality, it can also assist in realizing a variety of different image fusion effects, making the implementation method of mixed reality more flexible, applicable to a variety of different real-life scene requirements, and improving the flexibility of image fusion based on mixed reality. Since the target first position coordinates are normalized according to the scaling constant to obtain the sampling coordinates, the coordinate dimension is reduced, thereby reducing the data volume and improving the sampling efficiency. The brightness parameters and / or color parameters of the first image are sampled according to the sampling coordinates to generate a sampled image. The sampled image is used to assist in the subsequent generation of a mixed image, thereby realizing the synthesis of a mixed image based on image features of multiple dimensions and improving the performance of the mixed image.

[0142] Figure 3 is a flowchart of yet another image generating method according to an exemplary embodiment.

[0143] like Figure 3 As shown, the image generation method includes the following steps:

[0144] In step S301, a first image and a second image are acquired, wherein the first image is an image to be fused into the second image.

[0145] In step S302, a first space coordinate system of the virtual light source in the second image is constructed.

[0146] In step S303, the depth information of each pixel in the first image is obtained.

[0147] In step S304, a coordinate transformation matrix from the world coordinate system to the first space coordinate system is constructed.

[0148] The description of steps S301 to S304 can be found in the above embodiments and will not be repeated here.

[0149] In step S305, a camera coordinate system corresponding to the first image is obtained.

[0150] Among them, the spatial coordinate system based on the camera of the electronic device that captures the first image can be called the camera coordinate system. The camera coordinate system can be, for example, a spatial rectangular coordinate system, or it can be other spatial coordinate systems that can measure spatial dimensions, such as a spherical coordinate system, etc., without limitation.

[0151] When constructing the camera coordinate system corresponding to the first image, the corresponding inverse matrix Tnp can be determined based on the projection matrix of the camera, and the transformation matrix Tcw from the camera coordinate system to the world coordinate system can be determined based on the inverse matrix Tnp, and the world coordinate system can be transformed based on the transformation matrix Tcw to obtain the camera coordinate system. Of course, the camera coordinate system can also be constructed in any other possible way, and there is no limitation to this.

[0152] In step S306, the third position coordinates of each pixel point in the camera coordinate system are determined according to the depth information and the camera parameters corresponding to the first image.

[0153] Among them, the camera parameters can be, for example, camera intrinsic parameters and camera extrinsic parameters, which can be pre-calibrated. The camera intrinsic parameters are parameters related to the camera's own characteristics, such as the camera's focal length, pixel size, etc.; the camera extrinsic parameters are parameters in the world coordinate system, such as the camera's position, rotation direction, etc.

[0154] For example, the focal length, pixel size and other information of the corresponding camera when capturing each pixel point of the first image can be determined based on the camera parameters of the camera. In addition, due to the depth information, it can be used to characterize the information related to the distance from the surface of the scene object presented in the first image to the viewpoint. Therefore, the third position coordinates of each pixel point in the camera coordinate system can be determined by combining the focal length, pixel size and other information of the camera and the depth information of each pixel point of the first image.

[0155] For another example, a reference point can be determined in the first image, and the reference position coordinates of the reference point relative to the camera coordinate system can be determined based on the depth information of the reference point combined with the camera intrinsic parameters and camera extrinsic parameters. Then, for each pixel point in the first image, its relative depth information relative to the reference point can be determined, and then the third position coordinates of each pixel point in the camera coordinate system can be determined based on the relative depth information combined with the reference position coordinates. There is no limitation to this.

[0156] In step S307, a transformation matrix from the camera coordinate system to the world coordinate system corresponding to the first image is obtained.

[0157] It should be noted that the above-mentioned transformation matrix from the camera coordinate system to the world coordinate system can be obtained by calculating based on the posture information of the camera, and the posture information can be obtained by analyzing the sensing signal of the gyroscope sensor of the electronic device. The posture information can be used to describe the orientation, angular velocity and other information of the camera on the electronic device. The underlying processing logic of the electronic device can directly automatically calculate the transformation matrix from the camera coordinate system to the world coordinate system based on the posture information sensed by the gyroscope.

[0158] In step S308, the second position coordinates of each pixel point in the world coordinate system are determined according to the third position coordinates and the transformation matrix.

[0159] The above-mentioned third position coordinates are the position coordinates of each pixel point in the camera coordinate system, and the posture information can be used to present the position data, vector data, and relative angle data of the camera's current coordinate origin based on the world coordinate system. Therefore, the second position coordinates of each pixel point in the world coordinate system can be determined based on the third position coordinates and the posture information.

[0160] For example, assuming that the position coordinates of each pixel point in the camera coordinate system are A, and the current position data of the camera based on the coordinate origin of the world coordinate system is B, and the orientation data is B, then the position data B and the orientation data B can be combined to determine the origin position of the third space coordinate system, the relative position and relative orientation relative to the world coordinate system, and then, for the third position coordinates of each pixel point, the relative position and relative orientation are added to each third position coordinate, so as to obtain the second position coordinates of each pixel point in the world coordinate system, without any restriction.

[0161] In some embodiments, the electronic device may use parallel processing to determine the second position coordinates of each pixel point in the world coordinate system according to the third position coordinates and posture information for each pixel point, and there is no limitation on this.

[0162] By constructing the camera coordinate system of the camera, determining the third position coordinates of each pixel point in the camera coordinate system according to the depth information combined with the camera parameters of the camera, and obtaining the posture information of the camera, and determining the second position coordinates of each pixel point in the world coordinate system according to the third position coordinates and the posture information, the second position coordinates of each pixel point in the world coordinate system can be determined more accurately, and multi-level coordinate transformation is adopted to ensure the processing efficiency of the entire mapping process, without causing excessive consumption of computing resources, and effectively assisting the subsequent determination of the first position coordinates of each pixel point in the first space coordinate system of the virtual light source, thereby improving the processing efficiency of mixed reality.

[0163] In step S309, the first position coordinates of each pixel point in the first space coordinate system are determined according to the second position coordinates of each pixel point and the coordinate transformation matrix.

[0164] In step S310, brightness parameters and / or color parameters corresponding to some pixels in the first image are sampled according to the first position coordinates, and a sampled image is generated according to the brightness parameters and / or color parameters of the sampled pixels.

[0165] In step S311 , the first image, the sampled image and the second image are fused to generate a mixed image.

[0166] The description of step S309 to step S311 can be found in the above embodiment and will not be repeated here.

[0167] See also Figure 4 , Figure 4 A schematic diagram of a mixed image according to an embodiment of the present disclosure.

[0168] In this embodiment, personalized image fusion is achieved in mixed reality without being restricted by the form and color of the lighting pattern of the virtual light source in the mixed reality, and when the first image is fused to the second image, the three-dimensional visual effect of the first image can be presented, which is more in line with the second image, and the imaging effect of the mixed image is improved, thereby improving the presentation effect of the mixed reality. The second position coordinates of each pixel point determined in the world coordinate system can be made more accurate, and multi-level coordinate conversion is adopted to ensure the processing efficiency of the entire mapping process, without causing excessive consumption of computing resources, and effectively assisting the subsequent determination of the first position coordinates of each pixel point in the first space coordinate system of the virtual light source, thereby improving the processing efficiency of the mixed reality.

[0169] Figure 5 The figure is a block diagram of an image generating device according to an exemplary embodiment.

[0170] Reference Figure 5 , the image generating device 50 comprises:

[0171] A first acquisition module 501 is configured to acquire a first image and a second image, wherein the first image is an image to be fused into the second image;

[0172] A construction module 502 is configured to construct a first space coordinate system of a virtual light source in the second image;

[0173] The second acquisition module 503 is configured to acquire depth information of each pixel in the first image, and determine a first position coordinate of each pixel in the first space coordinate system according to the depth information;

[0174] The sampling module 504 is configured to sample brightness parameters and / or color parameters corresponding to some pixels in the first image according to the first position coordinates, and generate a sampled image according to the brightness parameters and / or color parameters of the sampled pixels; and

[0175] The fusion module 505 is configured to fuse the first image, the sampled image and the second image to generate a mixed image.

[0176] In some embodiments of the present disclosure, see Figure 6 , the second acquisition module 503 includes:

[0177] A construction unit 5031 is configured to construct a coordinate transformation matrix from the world coordinate system to the first space coordinate system;

[0178] A first determining unit 5032 is configured to determine a second position coordinate of each pixel point in the world coordinate system according to the depth information;

[0179] The second determining unit 5033 is configured to determine the first position coordinates of each pixel point in the first space coordinate system according to the second position coordinates of each pixel point and the coordinate transformation matrix.

[0180] In some embodiments of the present disclosure, the first determining unit 5032 is configured to:

[0181] Obtaining a camera coordinate system corresponding to the first image;

[0182] Determine a third position coordinate of each pixel point in the camera coordinate system according to the depth information and the camera parameters corresponding to the first image;

[0183] Obtain the transformation matrix from the camera coordinate system to the world coordinate system corresponding to the first image;

[0184] The second position coordinates of each pixel point in the world coordinate system are determined according to the third position coordinates and the transformation matrix from the camera coordinate system to the world coordinate system.

[0185] In some embodiments of the present disclosure, the construction unit 5031 is configured to:

[0186] Obtain the position information and orientation information of the virtual light source in the world coordinate system;

[0187] A coordinate transformation matrix is ​​constructed according to the position information and the orientation information, the transformation matrix from the camera coordinate system to the world coordinate system, and the first space coordinate system.

[0188] In some embodiments of the present disclosure, the sampling module 504 is configured to:

[0189] When the Z coordinate value of the first position coordinate is greater than zero, determining the first position coordinate as the target first position coordinate;

[0190] Normalizing the X coordinate value and the Y coordinate value of the first position coordinate of the target according to the scaling constant to obtain the sampling coordinate;

[0191] When the sampling coordinates are all less than or equal to 1, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinates belong is sampled;

[0192] When any coordinate value in the sampling coordinates is greater than 1, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinates belong is not sampled.

[0193] In some embodiments of the present disclosure, the sampling module 504 is configured to:

[0194] When the Z coordinate value of the first position coordinate is less than or equal to zero, the brightness parameter and / or color parameter corresponding to the pixel point to which the first position coordinate belongs is not sampled.

[0195] In some embodiments of the present disclosure, the sampling module 504 is configured to:

[0196] Determine that the standard function formula corresponds to the standard graphic coordinates in the first space coordinate system;

[0197] Adjust the sampling coordinates accordingly according to the standard graphic coordinates;

[0198] The brightness parameter and / or color parameter corresponding to the pixel point to which the sampled coordinates after adjustment are sampled in the first image is generated to generate a sampled image.

[0199] Regarding the image generating device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the image generating method, and will not be elaborated here.

[0200] In this embodiment, by acquiring the first image and the second image, the depth information of each pixel in the first image is acquired, and the first position coordinates of each pixel in the first space coordinate system are determined according to the depth information, so as to assist the subsequent image fusion process. The brightness parameters and / or color parameters corresponding to some pixels in the first image are sampled and processed with reference to the first position coordinates, so as to realize personalized image fusion in mixed reality without being restricted by the shape and color of the virtual light source lighting pattern in the mixed reality, and enable the three-dimensional visual effect of the first image to be presented when the first image is fused into the second image, which is more in line with the second image, thereby improving the imaging effect of the mixed image and thus improving the presentation effect of the mixed reality.

[0201] The present disclosure also provides an electronic device, Figure 7 7 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 700 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0202] Reference Figure 7 , the electronic device 700 may include one or more of the following components: a processing component 702 , a memory 704 , a power component 706 , a multimedia component 708 , an audio component 710 , an input / output (I / O) interface 712 , a sensor component 714 , and a communication component 716 .

[0203] The processing component 702 generally controls the overall operation of the electronic device 700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.

[0204] The memory 704 is configured to store various types of data to support operations on the electronic device 700. Examples of such data include instructions for any application or method operating on the electronic device 700, contact data, phone book data, messages, pictures, videos, etc. The memory 704 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 memory, flash memory, magnetic disk or optical disk.

[0205] The power supply component 706 provides power to the various components of the electronic device 700. The power supply component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 700.

[0206] The multimedia component 708 includes a touch display screen that provides an output interface between the electronic device 700 and the user. In some embodiments, the touch display screen may include a liquid crystal display (LCD) and a touch panel (TP). The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front camera and / or a rear camera. When the electronic device 700 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.

[0207] The audio component 710 is configured to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC), and when the electronic device 700 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 704 or sent via the communication component 716. In some embodiments, the audio component 710 also includes a speaker for outputting audio signals.

[0208] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0209] The sensor assembly 714 includes one or more sensors for providing various aspects of status assessment for the electronic device 700. For example, the sensor assembly 714 can detect the open / closed state of the electronic device 700, the relative positioning of components, such as the display and keypad of the electronic device 700, and the sensor assembly 714 can also detect the position change of the electronic device 700 or a component of the electronic device 700, the presence or absence of user contact with the electronic device 700, the orientation or acceleration / deceleration of the electronic device 700, and the temperature change of the electronic device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0210] The communication component 716 is configured to facilitate wired or wireless communication between the electronic device 700 and other devices. The electronic device 700 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0211] In an exemplary embodiment, the electronic device 700 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 to perform the above-mentioned image processing method.

[0212] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, and the instructions can be executed by a processor 720 of an electronic device 700 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0213] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device 700, enables the electronic device 700 to perform an image processing method.

[0214] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0215] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. An image generation method, characterized in that: include: Acquire a first image and a second image, wherein the first image is an image to be fused into the second image; constructing a first space coordinate system of a virtual light source in the second image; Acquire depth information of each pixel in the first image, and determine first position coordinates of each pixel in the first spatial coordinate system according to the depth information; Sampling brightness parameters and / or color parameters corresponding to some pixels in the first image according to the first position coordinates, and generating a sampled image according to the brightness parameters and / or color parameters of the sampled pixels; and fusing the first image, the sampled image, and the second image to generate a mixed image; The determining, according to the depth information, first position coordinates of each pixel point in the first spatial coordinate system includes: Obtaining position information and orientation information of the virtual light source in a world coordinate system; Constructing a coordinate transformation matrix according to the position information and orientation information, a transformation matrix from a camera coordinate system to a world coordinate system, and the first space coordinate system; Determine the second position coordinates of each pixel point in the world coordinate system according to the depth information; The first position coordinates of each pixel point in the first space coordinate system are determined according to the second position coordinates of each pixel point and the coordinate transformation matrix.

2. The image generation method according to claim 1, characterized in that: The step of determining the second position coordinates of each pixel point in the world coordinate system according to the depth information comprises: Acquire a camera coordinate system corresponding to the first image; Determine, according to the depth information and the camera parameters corresponding to the first image, the third position coordinates of each pixel point in the camera coordinate system; Obtaining a transformation matrix from a camera coordinate system to a world coordinate system corresponding to the first image; The second position coordinates of each pixel point in the world coordinate system are determined according to the third position coordinates and the transformation matrix.

3. The image generation method according to claim 1, characterized in that: The step of sampling brightness parameters and / or color parameters corresponding to some pixels in the first image according to the first position coordinates includes: When the Z coordinate value of the first position coordinate is greater than zero, determining the first position coordinate as the target first position coordinate; Normalizing the X coordinate value and the Y coordinate value of the first position coordinate of the target according to the scaling constant to obtain sampling coordinates; When the sampling coordinates are all less than or equal to 1, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinates belong is sampled; When any coordinate value of the sampling coordinates is greater than 1, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinates belong is not sampled.

4. The image generation method according to claim 3, characterized in that: The step of sampling brightness parameters and / or color parameters corresponding to some pixels in the first image according to the first position coordinates also includes: When the Z coordinate value of the first position coordinate is less than or equal to zero, the brightness parameter and / or color parameter corresponding to the pixel point to which the first position coordinate belongs is not sampled.

5. The image generation method according to claim 3, characterized in that: The step of sampling the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinate belongs includes: Determine that the standard function formula corresponds to the standard graphic coordinates in the first space coordinate system; Performing corresponding adjustment processing on the sampling coordinates according to the standard graphic coordinates; The brightness parameter and / or color parameter corresponding to the pixel point to which the adjusted sampling coordinates belong in the first image is sampled to generate the sampled image.

6. An image generating device, characterized in that: include: A first acquisition module is configured to acquire a first image and a second image, wherein the first image is an image to be fused into the second image; A construction module, configured to construct a first space coordinate system of a virtual light source in the second image; A second acquisition module is configured to acquire depth information of each pixel in the first image, and determine first position coordinates of each pixel in the first space coordinate system according to the depth information; a sampling module configured to sample brightness parameters and / or color parameters corresponding to some pixels in the first image according to the first position coordinates, and generate a sampled image according to the brightness parameters and / or color parameters of the sampled pixels; and a fusion module, configured to fuse the first image, the sampled image and the second image to generate a mixed image; The second acquisition module includes: A construction unit, configured to construct a coordinate transformation matrix from a world coordinate system to the first space coordinate system; A first determining unit is configured to determine a second position coordinate of each pixel point in the world coordinate system according to the depth information; A second determining unit is configured to determine the first position coordinates of each pixel point in the first space coordinate system according to the second position coordinates of each pixel point and the coordinate transformation matrix; The building unit is configured as follows: Obtaining position information and orientation information of the virtual light source in the world coordinate system; The coordinate transformation matrix is ​​constructed according to the position information and the orientation information, a transformation matrix from the camera coordinate system to the world coordinate system, and the first space coordinate system.

7. The image generating device according to claim 6, characterized in that: The first determining unit is configured to: Acquire a camera coordinate system corresponding to the first image; Determine, according to the depth information and the camera parameters corresponding to the first image, the third position coordinates of each pixel point in the camera coordinate system; Obtaining a transformation matrix from a camera coordinate system to a world coordinate system corresponding to the first image; The second position coordinates of each pixel point in the world coordinate system are determined according to the third position coordinates and the transformation matrix.

8. The image generating device according to claim 6, characterized in that: The sampling module is configured as follows: When the Z coordinate value of the first position coordinate is greater than zero, determining the first position coordinate as the target first position coordinate; Normalizing the X coordinate value and the Y coordinate value of the first position coordinate of the target according to the scaling constant to obtain sampling coordinates; When the sampling coordinates are all less than or equal to 1, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinates belong is sampled; When any coordinate value of the sampling coordinates is greater than 1, the brightness parameter and / or color parameter corresponding to the pixel point to which the sampling coordinates belong is not sampled.

9. The image generating device according to claim 8, characterized in that: The sampling module is configured as follows: When the Z coordinate value of the first position coordinate is less than or equal to zero, the brightness parameter and / or color parameter corresponding to the pixel point to which the first position coordinate belongs is not sampled.

10. The image generating device according to claim 8, characterized in that: The sampling module is configured as follows: Determine that the standard function formula corresponds to the standard graphic coordinates in the first space coordinate system; Performing corresponding adjustment processing on the sampling coordinates according to the standard graphic coordinates; The brightness parameter and / or color parameter corresponding to the pixel point to which the adjusted sampling coordinates belong in the first image is sampled to generate the sampled image.

11. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the image generating method according to any one of claims 1 to 5. 12 . A storage medium, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the image generating method according to claim 1 .

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the image generating method according to any one of claims 1 to 5 is implemented.