Method, apparatus and electronic device for image processing

By using image processing methods to embed AR special effects materials based on line features and spatial models, the problem of low efficiency in embedding AR special effects in existing technologies is solved, achieving efficient and realistic special effects image processing.

CN115619960BActive Publication Date: 2026-11-20BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110803231.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-15
Publication Date
2026-11-20
Estimated Expiration
2041-07-15

Smart Images

  • Figure CN115619960B_ABST
    Figure CN115619960B_ABST
Patent Text Reader

Abstract

The present disclosure discloses a method and device for image processing and electronic equipment, and relates to the field of computer vision, specifically to the field of augmented reality. The specific implementation scheme is: determining a to-be-processed region according to line features in a to-be-processed image frame; establishing a space model according to the to-be-processed image frame; embedding a to-be-embedded special effect material in the to-be-processed region according to the space model to generate a special effect image frame. The embodiment of the present disclosure can identify the to-be-processed region in the to-be-processed image frame, and increase the to-be-embedded special effect material in the to-be-processed region. The tracking of the same to-be-processed region in different to-be-processed image frames is realized by obtaining the similar to-be-processed region through the region label, the calculation amount of image processing is reduced, and the efficiency of embedding the to-be-embedded special effect in the to-be-processed image frame is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer vision, specifically to the field of augmented reality, and in particular to an image processing method, apparatus, and electronic device. Background Technology

[0002] Augmented Reality (AR) technology. In recent years, the application fields of AR devices have become increasingly wide, and optimizing the effects of augmented reality scenes presented by AR devices has become increasingly important.

[0003] Currently, embedding AR effects requires specialized effects software, which incurs a learning curve and is beyond the reach of most users. Furthermore, the process of embedding effects is cumbersome, time-consuming, and lacks intelligence. There is currently a lack of efficient solutions for embedding effects materials. Summary of the Invention

[0004] This disclosure provides a method, apparatus, and electronic device for image processing.

[0005] According to a first aspect of this disclosure, an image processing method is provided, comprising:

[0006] The region to be processed is determined based on the line features in the image frame to be processed;

[0007] A spatial model is established based on the image frame to be processed;

[0008] According to the spatial model, the special effects material to be embedded is embedded in the area to be processed to generate special effects image frames.

[0009] Optionally, embedding the special effects material to be embedded in the area to be processed according to the spatial model includes:

[0010] Determine the corresponding spatial region to be processed in the spatial model for the region to be processed;

[0011] The special effects material to be embedded is embedded into the space to be processed.

[0012] Optionally, it also includes:

[0013] The special effects material to be embedded is determined based on the type of the spatial region to be processed;

[0014] And / or,

[0015] The corresponding building type is determined based on the area to be processed; the special effects material to be embedded is determined based on the building type.

[0016] Optionally, the size of the special effects material to be embedded corresponds to the size of the space region to be processed or the size of the region to be processed.

[0017] Optionally, it also includes:

[0018] When the image frame to be processed is different from the previous image frame to be processed, the region label of the image of the region to be processed is obtained;

[0019] The second region to be processed in the previous image frame is identified based on the region label, and the second region to be processed has the same region label as the region to be processed.

[0020] Embed the second special effects material corresponding to the second area to be processed into the area to be processed.

[0021] Optionally, establishing a spatial model based on the image frame to be processed includes:

[0022] Generate the three-dimensional coordinates corresponding to the pixels on the line feature;

[0023] The spatial model is established based on the three-dimensional coordinates, and the spatial model is a three-dimensional model.

[0024] Optionally, the special effects material includes at least one of the following:

[0025] 2D special effects materials;

[0026] 3D special effects materials.

[0027] According to a second aspect of this disclosure, an image processing apparatus is provided, comprising:

[0028] The region to be processed determination module is used to determine the region to be processed based on the line features in the image frame to be processed.

[0029] The model building module is used to build a spatial model based on the image frame to be processed.

[0030] The special effects embedding module is used to embed the special effects material to be embedded in the area to be processed according to the spatial model, so as to generate special effects image frames.

[0031] Optionally, the special effects embedding module includes:

[0032] The spatial determination submodule is used to determine the spatial region to be processed corresponding to the region to be processed in the spatial model.

[0033] The first special effects embedding submodule is used to embed the special effects material to be embedded into the space to be processed.

[0034] Optionally, it also includes:

[0035] The special effects determination submodule is used to determine the special effects material to be embedded based on the type of the spatial region to be processed.

[0036] And / or,

[0037] Determine the corresponding building type based on the area to be processed;

[0038] The special effects material to be embedded is determined based on the building type.

[0039] Optionally, the size of the special effects material to be embedded corresponds to the size of the space region to be processed or the size of the region to be processed.

[0040] Optionally, it also includes:

[0041] The tag acquisition submodule is used to acquire the region tag of the image to be processed when the image frame to be processed is different from the previous image frame to be processed;

[0042] The label comparison submodule is used to identify a second region to be processed in the previous image frame based on the region label, wherein the second region to be processed is the same as the region label of the region to be processed.

[0043] The second special effects embedding submodule is used to embed the second special effects material corresponding to the second area to be processed into the area to be processed.

[0044] Optionally, the model building module includes:

[0045] The coordinate acquisition submodule is used to generate the three-dimensional coordinates corresponding to the pixels on the line feature;

[0046] The model building submodule is used to build the spatial model based on the three-dimensional coordinates, wherein the spatial model is a three-dimensional model.

[0047] Optionally, the special effects material includes at least one of the following:

[0048] 2D special effects materials;

[0049] 3D special effects materials.

[0050] According to a third aspect of this disclosure, an electronic device is provided, comprising:

[0051] At least one processor; and

[0052] A memory communicatively connected to the at least one processor; wherein,

[0053] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in any one of the first aspects.

[0054] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method according to any one of the first aspects.

[0055] According to a fifth aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method according to any one of the first aspects.

[0056] This disclosure has the following beneficial effects:

[0057] By obtaining the similar regions to be processed through the region labels, the tracking of the same region to be processed in different image frames to be processed is realized, which reduces the amount of computation in image processing and improves the efficiency of embedding the special effects to be embedded in the image frames to be processed.

[0058] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0059] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0060] Figure 1 This is a schematic flowchart of an image processing method provided according to an embodiment of the present disclosure;

[0061] Figure 2 This is a schematic flowchart of an image processing method provided according to an embodiment of the present disclosure;

[0062] Figure 3 This is a schematic flowchart of an image processing method provided according to an embodiment of the present disclosure;

[0063] Figure 4 This is a schematic flowchart of an image processing method provided according to an embodiment of the present disclosure;

[0064] Figure 5 This is a schematic diagram of the structure of an image processing apparatus provided according to an embodiment of the present disclosure;

[0065] Figure 6 This is a schematic diagram of the structure of an image processing apparatus provided according to an embodiment of the present disclosure;

[0066] Figure 7 This is a schematic diagram of the structure of an image processing apparatus provided according to an embodiment of the present disclosure;

[0067] Figure 8This is a schematic diagram of the structure of an image processing apparatus provided according to an embodiment of the present disclosure;

[0068] Figure 9 This is a block diagram of an electronic device used to implement the image processing method of the embodiments of this disclosure;

[0069] Figure 10 This is a schematic diagram of an image frame to be processed provided in an embodiment of this disclosure;

[0070] Figure 11 This is a schematic diagram of a special effects image frame provided in an embodiment of this disclosure. Detailed Implementation

[0071] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0072] Augmented Reality (AR) technology overlays simulated information (visual, sound, tactile, etc.) onto the real world, thus presenting the real environment and virtual objects in the same scene or space in real time. In recent years, the application fields of AR devices have become increasingly wide, and optimizing the effects of augmented reality scenes presented by AR devices has become increasingly important.

[0073] Currently, embedding AR effects requires embedding the effects into each frame of the video being processed, which is computationally intensive and inefficient. There is currently a lack of efficient AR effect embedding solutions.

[0074] Currently, manufacturers are heavily investing in camera development, and cameras are a crucial component for leveraging AR technology. Currently, it's necessary to manually set surfaces, points, and lines in image frames using professional effects software like Adobe After Effects, and then further perform spatial modeling. AR effects materials are then manually bound to the set surfaces, points, and lines to ultimately obtain the AR effects video. However, professional effects software requires a learning curve, and most users are unfamiliar with it. The process of embedding AR effects using such software is cumbersome and time-consuming. Manual operation is inefficient and costly.

[0075] It should be noted that this disclosure applies to the processing of images in a photo album, or the processing of image frames during the shooting process.

[0076] Figure 1This is a schematic flowchart of an image processing method provided according to an embodiment of the present disclosure; as shown below. Figure 1 As shown, the image processing method may include:

[0077] Step 101: Determine the region to be processed based on the line features in the image frame to be processed;

[0078] In order to embed special effects materials (such as AR special effects materials) into the image frame to be processed, the image frame to be processed needs to be preprocessed to generate an image of the area to be processed. The area to be processed in this embodiment of the disclosure can be one or any combination of buildings, windows, road signs, road markings, roads, etc. These areas to be processed are all surrounded by clear line features, so it is necessary to obtain the lines in the image frame to be processed to generate the area to be processed.

[0079] In order to reduce the computational load of embedding special effects materials (such as AR special effects materials), this disclosure sets a label for each of the regions to be processed. If there are regions with the same label in adjacent image frames to be processed, the same special effects material (such as AR special effects material) can be embedded into the two regions with the same label.

[0080] Step 102: Establish a spatial model based on the image frame to be processed;

[0081] To accurately embed the special effects material (e.g., AR special effects material) into the area to be processed, it is necessary to obtain the three-dimensional coordinates of the area to be processed. This step involves spatial modeling based on lines in the image frame to be processed to obtain the three-dimensional coordinates of the area to be processed. Various and well-known methods exist for three-dimensional spatial modeling based on two-dimensional images, and are not included within the scope of this disclosure. In one possible embodiment, several reference points are selected on the lines, the two-dimensional coordinates of the reference points are obtained, and the three-dimensional coordinates of the reference points are calibrated. A projection matrix is ​​obtained based on the two-dimensional and three-dimensional coordinates of the reference points. The three-dimensional coordinates corresponding to the pixels on the lines can then be obtained from the projection matrix, and further, the spatial model can be generated.

[0082] Step 103: Embed the special effects material to be embedded in the area to be processed according to the spatial model to generate a special effects image frame.

[0083] For example, the three-dimensional coordinates of pixels in the image of the region to be processed can be obtained according to the spatial model. We need to embed the special effects material to be embedded (such as AR special effects material) into the region to be processed in the spatial model after homography transformation.

[0084] Homography transformation can be achieved using the homography matrix; the homography transformation is a mapping relationship from one plane to another. Since the area to be processed is not necessarily directly opposite the camera capturing the image frame to be processed, the material to be embedded with special effects (e.g., AR special effects) should exhibit some distortion in the camera's field of view, making the special effects image frame appear more realistic.

[0085] For example, the image processing method of this embodiment can be applied to post-capture processing, such as processing of images (moving or static images) and / or videos in a photo album, or it can be applied to processing during image capture, such as processing during the capture process.

[0086] Figure 10 This is a schematic diagram of an image frame to be processed provided in an embodiment of this disclosure; Figure 11 This is a schematic diagram of a special effects image frame provided in an embodiment of this disclosure. As shown in the figure, the special effects material to be embedded is added to the building in the schematic diagram of the special effects image frame.

[0087] Figure 2 This is a schematic flowchart of an image processing method provided according to an embodiment of the present disclosure; as shown below. Figure 2 As shown, the image processing method includes:

[0088] Step 201: Determine the spatial region to be processed corresponding to the region to be processed in the spatial model;

[0089] The space to be processed is a three-dimensional space. If the material to be embedded is a three-dimensional special effects material, then the material to be embedded is embedded into the space to be processed. The area to be processed is a two-dimensional area. If the material to be embedded is a two-dimensional special effects material, then the material to be embedded is embedded into the area to be processed.

[0090] Step 202: Embed the special effects material to be embedded into the space to be processed.

[0091] Based on the line features of the region to be processed, the target plane is determined; the region to be processed is then determined based on the target plane.

[0092] Alternatively, based on the building plan corresponding to the area to be processed (such as building walls, road surfaces, road signs, etc.), the spatial area to be processed can be determined based on the building plan.

[0093] Optionally, it also includes:

[0094] The special effects material to be embedded is determined based on the type of the spatial region to be processed;

[0095] And / or,

[0096] Determine the corresponding building type based on the area to be processed;

[0097] The special effects material to be embedded is determined based on the building type.

[0098] The space to be processed is a three-dimensional space. If the material to be embedded is a three-dimensional special effects material, then the material to be embedded is embedded into the space to be processed. The area to be processed is a two-dimensional area. If the material to be embedded is a two-dimensional special effects material, then the material to be embedded is embedded into the area to be processed.

[0099] Based on the line features of the region to be processed, the target plane is determined; the region to be processed is then determined based on the target plane.

[0100] Alternatively, based on the building plan corresponding to the area to be processed (such as building walls, road surfaces, road signs, etc.), the spatial area to be processed can be determined based on the building plan.

[0101] Optionally, the size of the special effects material to be embedded corresponds to the size of the space region to be processed or the size of the region to be processed.

[0102] In order to make the embedded special effects fit the space area to be processed better, the size of the special effects material to be embedded needs to correspond to the size of the space area to be processed.

[0103] Simultaneously, the embedded special effects material needs to be embedded into the outer surface of the area to be processed.

[0104] Figure 3 This is a schematic flowchart of an image processing method provided according to an embodiment of the present disclosure; as shown below. Figure 3 As shown, the image processing method may include:

[0105] Step 301: When the image frame to be processed is different from the previous image frame to be processed, obtain the region label of the image of the region to be processed;

[0106] To reduce the computational cost of embedding special effects materials (e.g., AR special effects materials), this disclosure assigns a label to each of the regions to be processed. If there are regions with the same label in adjacent image frames to be processed, the same special effects material (e.g., AR special effects material) to be embedded can be embedded into the two regions with the same label.

[0107] Step 302: Identify a second region to be processed in the previous image frame based on the region label, wherein the second region to be processed has the same region label as the region to be processed.

[0108] Determine if there is a region label in the previous image frame that is the same as the region label of the image frame to be processed. If they are the same, then set it as the second region to be processed, and add the same special effects material to be embedded in the image frame to be processed.

[0109] Step 303: Embed the second special effects material corresponding to the second area to be processed into the area to be processed.

[0110] This step enables the tracking of the same object, and further, it enables the tracking of special effects materials (such as AR special effects materials) to the area to be processed. If the camera moves, the special effects materials (such as AR special effects materials) embedded in the same area to be processed remain unchanged. If the area to be processed contains a moving car, its corresponding special effects (such as AR special effects) will also continuously follow the car.

[0111] Figure 4 This is a schematic flowchart of an image processing method provided according to an embodiment of the present disclosure; as shown below. Figure 4 As shown, the image processing method may include:

[0112] Step 401: Generate the three-dimensional coordinates corresponding to the pixels on the line feature;

[0113] To accurately embed the special effects material (e.g., AR special effects material) into the area to be processed, it is necessary to obtain the three-dimensional coordinates of the area to be processed. This step involves spatial modeling based on lines in the image frame to be processed to obtain the three-dimensional coordinates of the area to be processed. Various and well-known methods exist for three-dimensional spatial modeling based on two-dimensional images, and are not included within the scope of this disclosure. In one possible embodiment, several reference points are selected on the lines, the two-dimensional coordinates of the reference points are obtained, and the three-dimensional coordinates of the reference points are calibrated. A projection matrix is ​​obtained based on the two-dimensional and three-dimensional coordinates of the reference points. The three-dimensional coordinates corresponding to the pixels on the lines can then be obtained from the projection matrix, and further, the spatial model can be generated.

[0114] Step 402: Establish the spatial model based on the three-dimensional coordinates. The spatial model is a three-dimensional model.

[0115] After establishing the spatial model, the three-dimensional coordinates of all pixels in the image to be processed can be obtained in the spatial model, which facilitates the subsequent embedding of the special effects material (such as AR special effects material) into the image to be processed.

[0116] Optionally, the special effects material to be embedded includes at least one of the following:

[0117] 2D special effects materials;

[0118] 3D special effects materials.

[0119] The two-dimensional special effects material can be embedded into the area to be processed, and the three-dimensional special effects material can be embedded into the spatial area to be processed. The material to be embedded is a pre-set material, including font renderings, graphic materials, etc.

[0120] In one possible implementation, image recognition and spatial reconstruction are performed first:

[0121] The system identifies the image to be processed, establishes a spatial model, and fuses the materials to be embedded based on the x, y, and z axes. If roads, building outlines (lines), etc. are identified, they are processed to emit light.

[0122] Then image tracking is performed:

[0123] Video tracking points are established, and the material to be embedded is attached to the tracking points. When the camera moves or pans, the material to be embedded is always bound to the tracking points.

[0124] Finally, embed the material to be embedded:

[0125] The material to be embedded is a pre-modeled video material that will appear dynamically in the video work, and is not limited to two-dimensional animation, three-dimensional animation, or font interpretation. Different pre-modeled materials are added based on the previously identified space and surface types, as well as feature point tracking.

[0126] Figure 5 This is a schematic diagram of the structure of an image processing apparatus provided according to an embodiment of the present disclosure; as shown below. Figure 5 As shown, the image processing device 500 may include:

[0127] The region to be processed determination module 510 is used to determine the region to be processed based on the line features in the image frame to be processed.

[0128] To embed the special effects material (e.g., AR special effects material) into the image frame to be processed, the image frame to be processed needs to be preprocessed to generate an image of the region to be processed. In this embodiment of the disclosure, the region to be processed can be one or any combination of buildings, windows, road signs, road markings, roads, etc. These regions to be processed are all surrounded by clearly defined line features, so it is necessary to obtain the lines in the image frame to be processed to generate the region to be processed.

[0129] In order to reduce the computational load of embedding special effects materials (such as AR special effects materials), this disclosure sets a label for each of the regions to be processed. If there are regions with the same label in adjacent image frames to be processed, the same special effects materials (such as AR special effects materials) can be embedded into the two regions with the same label.

[0130] The model building module 520 is used to build a spatial model based on the image frame to be processed.

[0131] To accurately embed special effects materials (such as AR special effects materials) into the area to be processed, it is necessary to obtain the three-dimensional coordinates of the area to be processed. This step involves spatial modeling based on lines in the image frame to be processed to obtain the three-dimensional coordinates of the area to be processed. Various and well-known methods exist for three-dimensional spatial modeling based on two-dimensional images, and are not included within the scope of this disclosure. In one possible embodiment, several reference points are selected on the lines, the two-dimensional coordinates of the reference points are obtained, and the three-dimensional coordinates of the reference points are calibrated. A projection matrix is ​​obtained based on the two-dimensional and three-dimensional coordinates of the reference points. The three-dimensional coordinates corresponding to the pixels on the lines can then be obtained from the projection matrix, and further, the spatial model can be generated.

[0132] The special effects embedding module 530 is used to embed the special effects material to be embedded in the area to be processed according to the spatial model, so as to generate special effects image frames.

[0133] The three-dimensional coordinates of pixels in the image to be processed can be obtained from the spatial model. We need to embed the special effects material (such as AR special effects material) into the image to be processed in the spatial model after homography transformation.

[0134] Homography transformation can be achieved using the homography matrix; the homography transformation is a mapping relationship from one plane to another. Since the area to be processed is not necessarily directly opposite the camera capturing the image frame to be processed, the special effects material (e.g., AR special effects material) should exhibit some distortion in the camera's field of view, making the special effects image frame appear more realistic.

[0135] Figure 6 This is a schematic diagram of the structure of an image processing apparatus provided according to an embodiment of the present disclosure; as shown below. Figure 6 As shown, the image processing apparatus 600 includes:

[0136] The spatial determination submodule 610 is used to determine the spatial region to be processed corresponding to the region to be processed in the spatial model;

[0137] The space to be processed is a three-dimensional space. If the material to be embedded is a three-dimensional special effects material, then the material to be embedded is embedded into the space to be processed. The area to be processed is a two-dimensional area. If the material to be embedded is a two-dimensional special effects material, then the material to be embedded is embedded into the area to be processed.

[0138] The first special effects embedding submodule 620 is used to embed the special effects material to be embedded into the space to be processed.

[0139] Based on the line features of the region to be processed, the target plane is determined; the region to be processed is then determined based on the target plane.

[0140] Alternatively, based on the building plan corresponding to the area to be processed (such as building walls, road surfaces, road signs, etc.), the spatial area to be processed can be determined based on the building plan.

[0141] Optionally, it also includes:

[0142] The special effects determination submodule is used to determine the special effects material to be embedded based on the type of the spatial region to be processed.

[0143] And / or,

[0144] Determine the corresponding building type based on the area to be processed;

[0145] The special effects material to be embedded is determined based on the building type.

[0146] The space to be processed is a three-dimensional space. If the material to be embedded is a three-dimensional special effects material, then the material to be embedded is embedded into the space to be processed. The area to be processed is a two-dimensional area. If the material to be embedded is a two-dimensional special effects material, then the material to be embedded is embedded into the area to be processed.

[0147] Based on the line features of the region to be processed, the target plane is determined; the region to be processed is then determined based on the target plane.

[0148] Alternatively, based on the building plan corresponding to the area to be processed (such as building walls, road surfaces, road signs, etc.), the spatial area to be processed can be determined based on the building plan.

[0149] Optionally, the size of the special effects material to be embedded corresponds to the size of the space region to be processed or the size of the region to be processed.

[0150] In order to make the embedded special effects fit the space to be processed or the area to be processed more closely, the size of the special effects material to be embedded needs to correspond to the size of the space to be processed or the area to be processed.

[0151] Simultaneously, the embedded special effects material needs to be embedded into the outer surface of the area to be processed.

[0152] Figure 7 This is a schematic diagram of the structure of an image processing apparatus provided according to an embodiment of the present disclosure; as shown below. Figure 7 As shown, the image processing apparatus 700 includes:

[0153] The tag acquisition submodule 710 is used to acquire the region tag of the image to be processed when the image frame to be processed is different from the previous image frame to be processed;

[0154] To reduce the computational load of embedding special effects, this disclosure assigns a label to each of the regions to be processed. If there are regions with the same label in adjacent image frames to be processed, the same special effects material can be embedded into the two regions with the same label.

[0155] The label comparison submodule 720 is used to identify a second region to be processed in the previous image frame based on the region label, wherein the second region to be processed is the same as the region label of the region to be processed.

[0156] Determine if there is a region label in the previous image frame that is the same as the region label of the image frame to be processed. If they are the same, then set it as the second region to be processed, and add the same special effects material to be embedded in the image frame to be processed.

[0157] The second special effects embedding submodule 730 is used to embed the second special effects material corresponding to the second area to be processed into the area to be processed.

[0158] This step enables the tracking of the same object, and further, it enables the tracking of special effects materials (such as AR special effects materials) to the area to be processed. If the camera moves, the special effects materials (such as AR special effects materials) embedded in the same area to be processed remain unchanged. If the area to be processed contains a moving car, its corresponding special effects will also continuously track the car.

[0159] Figure 8 This is a schematic diagram of the structure of an image processing apparatus provided according to an embodiment of the present disclosure; as shown below. Figure 8 As shown, the image processing apparatus 800 includes:

[0160] The coordinate acquisition submodule 810 is used to generate the three-dimensional coordinates corresponding to the pixels on the line feature;

[0161] To accurately embed special effects materials (such as AR special effects materials) into the area to be processed, it is necessary to obtain the three-dimensional coordinates of the area to be processed. This step involves spatial modeling based on lines in the image frame to be processed to obtain the three-dimensional coordinates of the area to be processed. Various and well-known methods exist for three-dimensional spatial modeling based on two-dimensional images, and are not included within the scope of this disclosure. In one possible embodiment, several reference points are selected on the lines, the two-dimensional coordinates of the reference points are obtained, and the three-dimensional coordinates of the reference points are calibrated. A projection matrix is ​​obtained based on the two-dimensional and three-dimensional coordinates of the reference points. The three-dimensional coordinates corresponding to pixels on the lines can then be obtained from the projection matrix, and further, the spatial model can be generated.

[0162] The model building submodule 820 is used to build the spatial model based on the three-dimensional coordinates, wherein the spatial model is a three-dimensional model.

[0163] After establishing the spatial model, the three-dimensional coordinates of all pixels in the image to be processed can be obtained in the spatial model, which facilitates the subsequent embedding of special effects materials (such as AR special effects materials) into the image to be processed.

[0164] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0165] Figure 9 A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0166] like Figure 9 As shown, device 900 includes a computing unit 901, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 902 or a computer program loaded from storage unit 908 into random access memory (RAM) 903. RAM 903 may also store various programs and data required for the operation of device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via bus 904. Input / output (I / O) interface 905 is also connected to bus 904.

[0167] Multiple components in device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of monitors, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0168] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as image processing methods. For example, in some embodiments, the image processing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by the computing unit 901, one or more steps of the image processing method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the image processing method by any other suitable means (e.g., by means of firmware).

[0169] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0170] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0171] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0172] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0173] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet, and blockchain networks.

[0174] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the management difficulties and weak business scalability inherent in traditional physical hosts and VPS (Virtual Private Server) services. Servers can also be servers for distributed systems or servers integrated with blockchain technology.

[0175] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0176] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. An image processing method, characterized in that, include: The region to be processed is determined based on the line features in the image frame to be processed; A spatial model is established based on the image frame to be processed; According to the spatial model, embed the special effects material to be embedded in the area to be processed to generate special effects image frames; The method further includes: When the image frame to be processed is different from the previous image frame to be processed, the region label of the image of the region to be processed is obtained, wherein the previous image frame to be processed and the image frame to be processed are adjacent image frames; The second region to be processed in the previous image frame is identified based on the region label, and the region label of the second region to be processed is the same as that of the region to be processed. Embed the second special effects material corresponding to the second area to be processed into the area to be processed.

2. The method according to claim 1, characterized in that, The step of embedding the special effects material to be embedded in the area to be processed according to the spatial model includes: Determine the corresponding spatial region to be processed in the spatial model for the region to be processed; The special effects material to be embedded is embedded into the space to be processed.

3. The method according to claim 2, characterized in that, Also includes: The special effects material to be embedded is determined based on the type of the spatial region to be processed; And / or, Determine the corresponding building type based on the area to be processed; The special effects material to be embedded is determined based on the building type.

4. The method according to claim 2, characterized in that, The size of the special effects material to be embedded corresponds to the size of the space area to be processed or the size of the area to be processed.

5. The method according to claim 1 or 2, characterized in that, The step of establishing a spatial model based on the image frame to be processed includes: Generate the three-dimensional coordinates corresponding to the pixels on the line feature; The spatial model is established based on the three-dimensional coordinates, and the spatial model is a three-dimensional model.

6. The method according to claim 1, characterized in that, The special effects material to be embedded includes at least one of the following: 2D special effects materials; 3D special effects materials.

7. An image processing apparatus, comprising: The region to be processed determination module is used to determine the region to be processed based on the line features in the image frame to be processed. The model building module is used to build a spatial model based on the image frame to be processed. The special effects embedding module is used to embed the special effects material to be embedded in the area to be processed according to the spatial model, so as to generate special effects image frames; The device further includes: The tag acquisition submodule is used to acquire the region tag of the image to be processed when the image frame to be processed is different from the previous image frame to be processed, wherein the previous image frame to be processed and the image frame to be processed are adjacent image frames; The label comparison submodule is used to identify a second region to be processed in the previous image frame based on the region label, wherein the second region to be processed is the same as the region label of the region to be processed. The second special effects embedding submodule is used to embed the second special effects material corresponding to the second area to be processed into the area to be processed.

8. The apparatus according to claim 7, characterized in that, The special effects embedding module includes: The spatial determination submodule is used to determine the spatial region to be processed corresponding to the region to be processed in the spatial model. The first special effects embedding submodule is used to embed the special effects material to be embedded into the space to be processed.

9. The apparatus according to claim 8, characterized in that, Also includes: The special effects determination submodule is used to determine the special effects material to be embedded based on the type of the spatial region to be processed. And / or, Determine the corresponding building type based on the area to be processed; The special effects material to be embedded is determined based on the building type.

10. The apparatus according to claim 8, characterized in that, The size of the special effects material to be embedded corresponds to the size of the space area to be processed or the size of the area to be processed.

11. The apparatus according to claim 7 or 8, characterized in that, The model building module includes: The coordinate acquisition submodule is used to generate the three-dimensional coordinates corresponding to the pixels on the line feature; The model building submodule is used to build the spatial model based on the three-dimensional coordinates, wherein the spatial model is a three-dimensional model.

12. The apparatus according to claim 7, characterized in that, The special effects material to be embedded includes at least one of the following: 2D special effects materials; 3D special effects materials.

13. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.

14. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.

15. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Method and device for generating special effect video

    CN109754383A

  • Three-dimensional virtual special effect generation method and device, computer equipment and storage medium

    CN112927349A