Special effects display method, device, equipment and storage medium for ground area
By acquiring and merging the mask images of the current frame and historical frames in the video, and performing tracking processing of the ground area, the problem of inconsistency between ground area segmentation frames in the video is solved, and the close fit between the special effects elements and the ground area is achieved. Effect.
Patent Information
- Application Number
- CN202110235108.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-03
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-03-03
AI Technical Summary
In the existing technology, there is inter-frame inconsistency when identifying and segmenting ground areas in videos, resulting in the separation of special effects elements and ground areas.
By obtaining the mask image in the current video frame image and the historical video frame image, image fusion is performed, and combined with the tracking processing of the video frame image, the movement trajectory of the ground area is determined, and special effect elements are replaced synchronously to ensure inter-frame consistency.
It reduces the jitter of the target mask image, improves the inter-frame consistency of ground area segmentation, and makes the special effects elements closely fit the ground area.
Smart Images

Figure CN115018877B
Abstract
Description
Technical Field
[0001] The present application relates to computer technology, and more particularly to a method, device, equipment and computer-readable storage medium for displaying special effects in a ground area. Background Art
[0002] When users are capturing videos, if there is a ground area in the captured video, the ground area will be replaced with the corresponding special effect elements for display to increase the fun. However, in the process of identifying and segmenting the ground area in the video, the relevant technology segments each frame of the image independently. However, the segmentation results of each frame of the image obtained in this way will have a certain degree of jump, which affects the inter-frame consistency of the ground area segmentation and causes the separation between the displayed special effect elements and the ground area. Summary of the invention
[0003] The embodiments of the present application provide a method, device, equipment and computer-readable storage medium for displaying special effects of a ground area, which can ensure the consistency between the time frames of the ground area segmentation, thereby making the displayed special effect elements fit closely with the ground area.
[0004] The technical solution of the embodiment of the present application is implemented as follows:
[0005] The embodiment of the present application provides a special effects display method for a ground area, including:
[0006] In the process of collecting the video, a first mask image corresponding to the ground area in the current video frame image and a second mask image corresponding to the ground area in the historical video frame image are obtained;
[0007] Projecting the second mask image onto the current video frame image to obtain a projected mask image corresponding to the historical video frame image;
[0008] Performing image fusion on the first mask image and the projection mask image to obtain a target mask image corresponding to the ground area in the current video frame image;
[0009] Tracking the ground area in the captured video frame image to determine the moving trajectory of the ground area in the captured video;
[0010] When the ground area in the captured video moves according to the moving trajectory, the target mask image corresponding to the ground area in the captured video frame image is replaced with a special effect element for display.
[0011] The embodiment of the present application provides a special effects display method for a ground area, including:
[0012] Capturing a video containing a ground area, and in the process of capturing the video, displaying the ground area in the video using corresponding special effect elements;
[0013] The special effect element is obtained by replacing the target mask image corresponding to the ground area in the acquired video frame image; the target mask image is obtained by fusing a projection mask image obtained by projecting a first mask image corresponding to the ground area in the current video frame image and a second mask image corresponding to the ground area in the historical video frame image onto the current video frame image;
[0014] Along with the change of the acquisition posture corresponding to the video, the posture of the special effect element in the displayed video is synchronously adjusted.
[0015] The embodiment of the present application provides a special effect display device for a ground area, comprising:
[0016] An acquisition module, used to acquire, during the process of acquiring the video, a first mask image corresponding to the ground area in the current video frame image and a second mask image corresponding to the ground area in the historical video frame image;
[0017] A projection module, used for projecting the second mask image into the current video frame image to obtain a projection mask image corresponding to the historical video frame image;
[0018] A fusion module, used for fusing the first mask image with the projection mask image to obtain a target mask image corresponding to the ground area in the current video frame image;
[0019] A tracking module is used to track the ground area in the captured video frame image to determine the movement trajectory of the ground area in the captured video;
[0020] The replacement module is used to replace the target mask image corresponding to the ground area in the captured video frame image with a special effect element for display when the ground area in the captured video moves according to the moving trajectory.
[0021] In the above solution, the acquisition module is further used to perform gravity correction on the rotation angle of the current video frame image to obtain a corrected image corresponding to the current video frame image;
[0022] Performing ground area detection on the corrected image, and performing segmentation processing on the detected ground area to obtain a segmented image corresponding to the ground area in the current video frame image;
[0023] The segmented image is filtered for non-ground areas to obtain a first mask image corresponding to the ground area in the current video frame image.
[0024] In the above solution, the acquisition module is also used to obtain the posture rotation matrix when the video acquisition device acquires the current video frame image;
[0025] Based on the attitude rotation matrix, determining the rotation angle of the corresponding gravity direction;
[0026] The current video frame image is rotated in the direction of gravity according to the rotation angle to obtain a corrected image corresponding to the current video frame image.
[0027] In the above scheme, the acquisition module is also used to obtain the posture rotation matrix when the video acquisition device acquires the current video frame image, and based on the posture rotation matrix, obtain the first reference point and the second reference point on the same horizontal plane as the video acquisition device, and the third reference point on the vertical plane of the video acquisition device;
[0028] Determine a horizontal vanishing line of the current video frame image based on the first reference point and the second reference point, and determine a gravity direction of the current video frame image based on the third reference point;
[0029] Based on the horizontal vanishing line and the gravity direction, the segmented image is filtered for non-ground areas to obtain a first mask image corresponding to the ground area in the current video frame image.
[0030] In the above scheme, the acquisition module is further used to project the first reference point, the second reference point and the third reference point into the current video frame image respectively to obtain a first target point corresponding to the first reference point, a second target point corresponding to the second reference point, and a third target point corresponding to the third reference point;
[0031] Determine a line connecting the first target point and the second target point as a horizontal vanishing line of the current video frame image;
[0032] The direction indicated by the ray starting from the third target point and perpendicular to the horizontal vanishing line is determined as the gravity direction of the current video frame image.
[0033] In the above solution, the acquisition module is further used to acquire the number of intersections between the horizontal vanishing line and the current video frame image;
[0034] Based on the number of the intersection points and the gravity direction, determining a non-ground area in the current video frame image;
[0035] When the ground area corresponding to the segmented image contains the non-ground area, the segmented image is filtered for the non-ground area to obtain a first mask image corresponding to the ground area in the current video frame image.
[0036] In the above scheme, the acquisition module is further used to determine that the current video frame image is a non-ground area when the number of the intersection points is 0 or 1, and the third target point indicated by the gravity direction and the current video frame image are located on the same side of the horizontal vanishing line;
[0037] When the number of the intersection points is 2, a partial area on the same side of the horizontal vanishing line as the third target point indicated by the gravity direction in the current video frame image is determined as a non-ground area.
[0038] In the above solution, the projection module is also used to obtain the optical flow field between the historical video frame image and the current video frame image;
[0039] Based on the optical flow field, obtaining a transformation matrix between the historical video frame image and the current video frame image;
[0040] Based on the transformation matrix, the second mask image is projected into the current video frame image to obtain a projected mask image corresponding to the historical video frame image.
[0041] In the above solution, the fusion module is further used to obtain weights corresponding to the first mask image and the projection mask image respectively;
[0042] Based on the acquired weights, weighted processing is performed on the first mask image and the projection mask image to obtain a target mask image corresponding to the ground area in the current video frame image.
[0043] In the above scheme, the tracking module is also used to obtain the posture rotation matrix when the video acquisition device acquires the video, and determine the posture rotation angle of the ground area relative to the gravity direction in the acquired video based on the posture rotation matrix;
[0044] Determine the position translation amount of the ground area relative to the horizontal direction in the captured video;
[0045] Based on the posture rotation angle and the position translation amount, a movement trajectory of the ground area in the captured video is determined.
[0046] In the above scheme, the tracking module is further used to extract feature points from the target mask image corresponding to the historical video frame image to obtain first image feature points corresponding to the historical video frame image, and perform feature point tracking based on the first image feature points to obtain second image feature points in the target mask image corresponding to the current video frame image that match the first image feature points;
[0047] Performing mapping processing on the first image feature points to obtain first camera feature points corresponding to the first image feature points, and constructing feature point matching pairs based on the first camera feature points and the second image feature points;
[0048] Based on the feature point matching pairs, a position translation amount of the ground area relative to the horizontal direction in the captured video is determined.
[0049] In the above solution, the tracking module is further used to obtain the posture rotation matrix of the video acquisition device corresponding to the feature point matching pair and the intrinsic parameter matrix of the video acquisition device;
[0050] Based on the feature point matching pairs, the posture rotation matrix and the intrinsic parameter matrix, the translation of the ground area is estimated to obtain the position translation of the ground area relative to the horizontal direction in the captured video.
[0051] The embodiment of the present application provides a special effect display device for a ground area, comprising:
[0052] A display module, used for collecting videos containing ground areas, and in the process of collecting the videos, using corresponding special effect elements to display the ground areas in the videos;
[0053] The special effect element is obtained by replacing the target mask image corresponding to the ground area in the acquired video frame image; the target mask image is obtained by fusing a projection mask image obtained by projecting a first mask image corresponding to the ground area in the current video frame image and a second mask image corresponding to the ground area in the historical video frame image onto the current video frame image;
[0054] The adjustment module is used to synchronously adjust the posture of the special effect element in the displayed video along with the change of the acquisition posture corresponding to the video.
[0055] An embodiment of the present application provides an electronic device, including:
[0056] A memory for storing executable instructions;
[0057] The processor is used to implement the special effects display method of the ground area provided in the embodiment of the present application when executing the executable instructions stored in the memory.
[0058] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute and implement the special effects display method for the ground area provided in the embodiment of the present application.
[0059] The embodiments of the present application have the following beneficial effects:
[0060] A target mask image corresponding to the ground area in the acquired video frame image is obtained by projecting a first mask image corresponding to the ground area in the current video frame image and a second mask image corresponding to the ground area in the historical video frame image into the current video frame image and fusing them. The ground area in the acquired video frame image is tracked to determine the moving trajectory of the ground area in the acquired video. In the process of the ground area moving along the moving trajectory in the video, the target mask image corresponding to the ground area in the acquired video frame image is replaced with a special effect element for display. Since the mask images corresponding to the ground area in the current video frame image and the historical frame image are comprehensively considered and the ground area is tracked, the jitter of the target mask image is reduced, thereby ensuring the inter-frame consistency of the ground area segmentation, and making the displayed special effect elements fit closely with the ground area. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 A schematic diagram of the architecture of a special effect display system 100 for a ground area provided in an embodiment of the present application;
[0062] Figure 2 An optional structural diagram of an electronic device 500 provided in an embodiment of the present application;
[0063] Figure 3 A schematic diagram of a flow chart of a special effects display method for a ground area provided in an embodiment of the present application;
[0064] Figure 4 A schematic diagram of a flow chart of a special effects display method for a ground area provided in an embodiment of the present application;
[0065] Figure 5 A schematic diagram of a flow chart of a special effects display method for a ground area provided in an embodiment of the present application;
[0066] Figure 6 A schematic diagram of a flow chart of a special effects display method for a ground area provided in an embodiment of the present application;
[0067] Figure 7 A schematic diagram of a flow chart of a special effects display method for a ground area provided in an embodiment of the present application;
[0068] Figures 8A-8B A schematic diagram of a special effects display interface for a ground area provided in an embodiment of the present application;
[0069] Figures 9A-9B A schematic diagram of determining a non-ground area provided in an embodiment of the present application;
[0070] Fig.10 A schematic diagram showing a time-consuming performance comparison of movement trajectory evaluation provided in an embodiment of the present application;
[0071] Fig.11 A schematic diagram of comparison of the accuracy of movement trajectory assessment provided in an embodiment of the present application;
[0072] Fig.12 A schematic diagram of the structure of a special effect display device for a ground area provided in an embodiment of the present application;
[0073] Fig.13 A schematic diagram of the structure of a special effects display device for a ground area provided in an embodiment of the present application. DETAILED DESCRIPTION
[0074] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0075] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0076] In the following description, the terms "first\second..." are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second..." can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0077] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0078] See also Figure 1 , Figure 1The schematic diagram of the architecture of the special effects display system 100 for the ground area provided in the embodiment of the present application, in order to support an exemplary application, the terminal (including the terminal 400-1 and the terminal 400-2) is connected to the server 200 through the network 300, and the network 300 can be a wide area network or a local area network, or a combination of the two. The terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a camera, etc., but is not limited to this. The server 200 can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN, Content Delivery Network), and big data and artificial intelligence platforms.
[0079] In actual applications, the terminal is provided with a client, such as a video playback client, an instant messaging client, and a short video client, etc., and the server 200 is a background server corresponding to the client provided on the terminal. In the process of collecting videos, the terminal sends the collected video frame images to the server 200, and the server 200 obtains the first mask image corresponding to the ground area in the current video frame image, and the second mask image corresponding to the ground area in the historical video frame image; the second mask image is projected into the current video frame image to obtain the projection mask image corresponding to the historical video frame image; the first mask image is image-fused with the projection mask image to obtain the target mask image corresponding to the ground area in the current video frame image; the ground area in the collected video frame image is tracked to determine the moving trajectory of the ground area in the collected video; and the tracking result is returned to the terminal. Based on the tracking result, the terminal replaces the target mask image corresponding to the ground area in the collected video frame image with a special effect element for display in the process of the ground area moving according to the moving trajectory in the video.
[0080] Next, an electronic device that implements the special effects display method for the ground area of the embodiment of the present application is described. Figure 2 , Figure 2 This is an optional structural diagram of an electronic device 500 provided in an embodiment of the present application. In practical applications, the electronic device 500 may be Figure 1 The terminal (such as terminal 400-1 and terminal 400-2) or server 200 in the example of FIG. Figure 1 Take the terminal shown as an example, Figure 2The electronic device 500 shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 2 Various buses are labeled as bus system 540 .
[0081] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0082] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0083] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 550 may optionally include one or more storage devices that are physically remote from the processor 510.
[0084] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.
[0085] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0086] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0087] A network communication module 552, for reaching other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB);
[0088] a presentation module 553 for enabling presentation of information via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripherals and displaying content and information);
[0089] The input processing module 554 is used to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions.
[0090] In some embodiments, the special effect display device of the ground area provided in the embodiments of the present application can be implemented in a software manner. Figure 2 A special effects display device 555 of a ground area stored in a memory 550 is shown, which may be software in the form of a program or plug-in, including the following software modules: an acquisition module 5551, a projection module 5552, a fusion module 5553, a tracking module 5554, and a replacement module 5555. These modules are logical, and therefore may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0091] In other embodiments, the special effects display device for the ground area provided in the embodiments of the present application can be implemented in hardware. As an example, the special effects display device for the ground area provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the special effects display method for the ground area provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.
[0092] Based on the above description of the special effect display system and electronic device of the ground area of the embodiment of the present application, the special effect display method of the ground area provided by the embodiment of the present application is described below. In some embodiments, the special effect display method of the ground area can be implemented by a terminal or a server alone, such as by Figure 1 The terminal 400-1, the terminal 400-2 or the server 200 may be implemented separately, or the server and the terminal may be implemented in collaboration, such as by Figure 1 The terminal 400-1 and the server 200 cooperate to implement, and then combine Figure 1 and Figure 3 , Figure 3 A flow chart of a special effect display method for a ground area provided in an embodiment of the present application, Figure 1 The terminal implements the special effects display of the ground area provided in the embodiment of the present application as an example for explanation.
[0093] Step 101: During the process of collecting video, the terminal obtains a first mask image corresponding to a ground area in a current video frame image and a second mask image corresponding to a ground area in a historical video frame image.
[0094] See also Figure 4 , Figure 4 A schematic diagram of a flow chart of a special effect display method for a ground area provided in an embodiment of the present application. In some embodiments, Figure 4 Show Figure 3 In step 101 of the method, the first mask image corresponding to the ground area in the current video frame image is obtained, which can be achieved through steps 1011 to 1013:
[0095] Step 1011: Perform gravity correction on the rotation angle of the current video frame image to obtain a corrected image corresponding to the current video frame image.
[0096] In some embodiments, the terminal can perform gravity correction on the rotation angle of the current video frame image to obtain a corrected image corresponding to the current video frame image in the following manner: obtain the posture rotation matrix when the video acquisition device acquires the current video frame image; based on the posture rotation matrix, determine the corresponding rotation angle in the gravity direction; rotate the current video frame image in the gravity direction according to the rotation angle to obtain a corrected image corresponding to the current video frame image.
[0097] In actual implementation, the gravity direction of the current video frame image is calculated according to the inertial measurement unit (IMU), and the attitude rotation matrix R = [r0, r1, r2; r3, r4, r5; r6, r7, r8] when the video acquisition device acquires the current video frame image is obtained through the gravity sensor; based on the attitude rotation matrix, the corresponding rotation angle of the gravity direction is determined to be θ = arctan (r8 / r5); the current video frame image is rotated in the gravity direction according to the rotation angle, that is, the current video frame image is rotated by θ angle to obtain a corrected image corresponding to the current video frame image.
[0098] Step 1012: perform ground area detection on the corrected image, and segment the detected ground area to obtain a segmented image corresponding to the ground area in the current video frame image.
[0099] In actual implementation, the corrected image after gravity correction can be input into the ground area segmentation model to obtain a segmented image corresponding to the ground area in the current video frame image, wherein the ground area segmentation model includes but is not limited to: traditional segmentation algorithms (such as GraphCut, conditional random fields, Markov random fields, etc.), deep network segmentation models (such as Mask R-CNN (Region-Convolutional Neural Networks), encoding-decoding architecture segmentation models, etc.).
[0100] Step 1013: Filter the non-ground area of the segmented image to obtain a first mask image corresponding to the ground area in the current video frame image.
[0101] In some embodiments, the terminal may filter the non-ground area of the segmented image in the following manner to obtain a first mask image corresponding to the ground area in the current video frame image:
[0102] Obtain a posture rotation matrix when the video acquisition device acquires the current video frame image, and based on the posture rotation matrix, obtain a first reference point and a second reference point that are in the same horizontal plane as the video acquisition device, and a third reference point that is located in the vertical plane of the video acquisition device; determine a horizontal vanishing line of the current video frame image based on the first reference point and the second reference point, and determine a gravity direction of the current video frame image based on the third reference point; based on the horizontal vanishing line and the gravity direction, filter the non-ground area of the segmented image to obtain a first mask image corresponding to the ground area in the current video frame image.
[0103] The horizontal vanishing line is used to indicate the disappearance end of the ground area in the video frame image. The horizontal vanishing line is parallel to the horizontal plane where the ground area is located, and the gravity direction of the video frame image is perpendicular to the horizontal vanishing line.
[0104] In some embodiments, the terminal may determine the horizontal vanishing line of the current video frame image based on the first reference point and the second reference point, and determine the gravity direction of the current video frame image based on the third reference point in the following manner:
[0105] The first reference point, the second reference point and the third reference point are projected into the current video frame image respectively to obtain a first target point corresponding to the first reference point, a second target point corresponding to the second reference point, and a third target point corresponding to the third reference point; a line between the first target point and the second target point is determined as a horizontal vanishing line of the current video frame image; a direction indicated by a ray starting from the third target point and perpendicular to the horizontal vanishing line is determined as a gravity direction of the current video frame image.
[0106] Here, when calculating the horizontal vanishing line and gravity direction of the current video frame image, first obtain the posture rotation matrix R = [r0, r1, r2; r3, r4, r5; r6, r7, r8] when the video acquisition device acquires the current video frame image, and based on the posture rotation matrix, obtain a first reference point (p1 = [r2, r5, 0]) and another second reference point (p2 = [r2+r5, r5-r2, 0]) in the same horizontal plane as the video acquisition device and directly in front of the video acquisition device, and a third reference point (p3 = [r2, r5, -1]) located in the vertical plane of the video acquisition device, wherein the z-axis direction is defined as the gravity direction downward; then respectively obtain the first reference point (p1), the second reference point ( p2) and the third reference point (p3) are projected into the current video frame image to obtain a first target point (u1, v1) corresponding to the first reference point (p1), a second target point (u2, v2) corresponding to the second reference point (p2), and a third target point (u3, v3) corresponding to the third reference point (p3), that is, the reference points in the coordinate system corresponding to the video acquisition device (also known as the camera coordinate system) are projected onto the reference points in the image coordinate system; finally, the line between the first target point (u1, v1) and the second target point (u2, v2) is determined as the horizontal vanishing line of the current video frame image; and the direction indicated by the ray starting from the third target point (u3, v3) and perpendicular to the horizontal vanishing line is determined as the gravity direction of the current video frame image.
[0107] In some embodiments, the terminal may filter the non-ground area of the segmented image based on the horizontal vanishing line and the gravity direction in the following manner to obtain a first mask image corresponding to the ground area in the current video frame image:
[0108] Obtain the number of intersections between the horizontal vanishing line and the current video frame image; determine the non-ground area in the current video frame image based on the number of intersections and the gravity direction; when the ground area corresponding to the segmented image contains the non-ground area, filter the non-ground area of the segmented image to obtain a first mask image corresponding to the ground area in the current video frame image.
[0109] In some embodiments, the terminal may determine the non-ground area in the current video frame image based on the number of intersections and the direction of gravity in the following manner: when the number of intersections is 0 or 1, and the third target point indicated by the gravity direction is located on the same side of the horizontal vanishing line as the current video frame image, the current video frame image is determined to be a non-ground area; when the number of intersections is 2, the partial area on the same side of the horizontal vanishing line as the third target point indicated by the gravity direction in the current video frame image is determined to be a non-ground area.
[0110] Here, after determining the horizontal vanishing line and gravity direction of the current video frame image, the number of intersection points between the horizontal vanishing line and the current video frame image can be obtained; when the number of intersection points is 0 or 1, it is determined whether the entire current video frame image is a ground area or a non-ground area according to (u3, v3). For example, when the number of intersection points is 0 or 1, and the third target point indicated by the gravity direction is on the same side of the horizontal vanishing line as the current video frame image, the current video frame image is determined to be a non-ground area; when the number of intersection points is 0 or 1, and the third target point indicated by the gravity direction is on both sides of the horizontal vanishing line as the current video frame image, the current video frame image is determined to be a ground area. When the number of intersections is 2, the current video frame image is divided into two parts by the horizontal vanishing line, and the ground area part and the non-ground area part are distinguished according to (u3, v3). For example, when the number of intersections is 2, the partial area on the same side of the third target point indicated by the gravity direction in the current video frame image is determined as the non-ground area, and the partial area on the different side of the horizontal vanishing line from the third target point indicated by the gravity direction in the current video frame image is determined as the ground area.
[0111] After determining the ground area and the non-ground area, the segmented image corresponding to the ground area in the current video frame image obtained above is filtered for the non-ground area. When the ground area corresponding to the segmented image contains the non-ground area, the segmented image is filtered for the non-ground area to obtain a first mask image corresponding to the ground area in the current video frame image. The same method as above can be used to obtain a second mask image corresponding to the ground area in the historical video frame image, wherein the number of historical video frame images can be N (the N value can be determined according to the computing performance of the video acquisition device, such as taking any one of 1-10).
[0112] In the above method, gravity correction is first performed on the captured video frame images according to the IMU, and then the ground area is segmented on the corrected video frame images. This can solve the problem of poor segmentation effect caused by users rotating the video acquisition device at a large angle (such as rotating the mobile phone at a large angle or even holding the mobile phone upside down), and improve robustness. At the same time, the false detection of the non-ground area in the segmented image corresponding to the ground area in the current video frame image is filtered out, thereby improving the accuracy of ground area segmentation.
[0113] Step 102: Project the second mask image onto the current video frame image to obtain a projected mask image corresponding to the historical video frame image.
[0114] See also Figure 5 , Figure 5 A schematic diagram of a flow chart of a special effect display method for a ground area provided in an embodiment of the present application. In some embodiments, Figure 5 Show Figure 3 Step 102 in the embodiment can be implemented through steps 1021 to 1022:
[0115] Step 1021: Obtain an optical flow field between a historical video frame image and a current video frame image;
[0116] Step 1022: Based on the optical flow field, project the second mask image into the current video frame image to obtain a projected mask image corresponding to the historical video frame image.
[0117] In practical applications, the optical flow field includes a sparse optical flow field and a dense optical flow field. In some embodiments, when the optical flow field is a sparse optical flow field, a transformation matrix between the historical video frame image and the current video frame image is obtained based on the optical flow field; based on the transformation matrix, the second mask image is projected into the current video frame image to obtain a projected mask image corresponding to the historical video frame image.
[0118] In some embodiments, when the optical flow field is a dense optical flow field, a position mapping relationship between the historical video frame image and the current video frame image is obtained based on the optical flow field, and based on the position mapping relationship, the second mask image is projected into the current video frame image to obtain a projected mask image corresponding to the historical video frame image.
[0119] Here, when calculating the dense optical flow field between the historical video frame image and the current video frame image, the calculation methods include but are not limited to: Farneback, DIS-flow and Lucas–Kanade, etc. According to the dense optical flow field, the second mask images of N historical frame video frame images are projected into the current video frame image to obtain the projection mask images corresponding to the N historical video frame images. Since the result of the dense optical flow field records the position of each pixel point in the current video frame image in the historical frame video frame image, the mask value of the corresponding position in the historical video frame image is directly converted, which is equivalent to projecting each pixel point according to the result of the optical flow separately. Since the dense optical flow field can perform pixel-level image registration, its registration accuracy is relatively high.
[0120] Step 103: performing image fusion on the first mask image and the projected mask image to obtain a target mask image corresponding to the ground area in the current video frame image.
[0121] In some embodiments, the terminal may fuse the first mask image with the projection mask image in the following manner to obtain a target mask image corresponding to the ground area in the current video frame image:
[0122] The weights corresponding to the first mask image and the projection mask image are obtained respectively; based on the obtained weights, the first mask image and the projection mask image are weighted to obtain a target mask image corresponding to the ground area in the current video frame image. The weighted processing method includes but is not limited to: average weighting, learning rate attenuation weighting, etc.
[0123] Through the above method, since the target mask image corresponding to the ground area in the current video frame image is fused with the mask images corresponding to the ground area in the current video frame image and the historical frame image, the jumping of the target mask image is reduced by fusing the segmentation results of multiple frames, thereby improving the inter-frame consistency of the ground area segmentation.
[0124] It should be noted that, since the target mask image corresponding to the ground area in the current video frame image is a fusion of the mask images corresponding to the ground area in the current video frame image and the historical frame image, if the current video frame image is the first frame image, the target mask image corresponding to the ground area in the current video frame image is the first mask image (unfused) corresponding to the ground area in the current video frame image. By using the above method, the target mask images corresponding to each of the other historical video frame images except the first video frame image can also be obtained.
[0125] Step 104: Tracking the ground area in the captured video frame image to determine the moving trajectory of the ground area in the captured video.
[0126] In actual implementation, when tracking the ground area in the captured video frame image, it can be achieved in the following way: extracting feature points from the target mask image corresponding to the ground area in the captured video frame image, and tracking the ground area based on the extracted feature points to determine the movement trajectory of the ground area in the captured video. Among them, when tracking the ground area for the feature points extracted from the target mask image corresponding to the historical video frame image, what is determined is the inter-frame movement trajectory of the feature points between the historical video frame image and the current video frame image; when tracking the ground area for the feature points extracted from the target mask image corresponding to the current video frame image, what is determined is the inter-frame movement trajectory of the feature points between the current video frame image and the next video frame image in the future.
[0127] For example, if the current video frame image is the second frame, feature points are extracted from the target mask image corresponding to the ground area of the first video frame image (i.e., the historical video frame image), and the ground area is tracked for the extracted feature points, and the inter-frame movement trajectory of the feature points between the first video frame image and the second video frame image is determined; feature points are extracted from the target mask image corresponding to the ground area of the second video frame image (i.e., the current video frame image), and the ground area is tracked for the extracted feature points, and the inter-frame movement trajectory of the feature points between the second video frame image and the third video frame image (i.e., the future video frame image) is determined.
[0128] See also Figure 6 , Figure 6 A schematic diagram of a flow chart of a special effect display method for a ground area provided in an embodiment of the present application. In some embodiments, Figure 6 Show Figure 3 Step 104 in the embodiment can be implemented through steps 1041 to 1043:
[0129] Step 1041: obtaining a posture rotation matrix when the video acquisition device acquires the video frame image, and determining a posture rotation angle of the ground area relative to the gravity direction in the acquired video based on the posture rotation matrix;
[0130] Here, the posture rotation angle of the ground area relative to the gravity direction in the captured video is determined based on the posture rotation matrix R of the video capture device (such as a camera).
[0131] Step 1042: determining the position translation amount of the ground area in the captured video relative to the horizontal direction;
[0132] In some embodiments, the terminal may determine the position translation amount of the ground area relative to the horizontal direction in the captured video in the following manner:
[0133] Feature points of the target mask image corresponding to the historical video frame image are extracted to obtain first image feature points corresponding to the historical video frame image, and feature points are tracked based on the first image feature points to obtain second image feature points in the target mask image corresponding to the current video frame image that match the first image feature points; the first image feature points are mapped to obtain first camera feature points corresponding to the first image feature points, and feature point matching pairs (3D-2D matching pairs) are constructed based on the first camera feature points and the second image feature points; based on the feature point matching pairs, the position translation amount of the ground area in the captured video relative to the horizontal direction is determined.
[0134] In some embodiments, the position translation of the ground area in the captured video relative to the horizontal direction can be determined based on the feature point matching pairs in the following manner: obtain the posture rotation matrix of the video acquisition device corresponding to the feature point matching pairs, and the intrinsic parameter matrix of the video acquisition device; based on the feature point matching pairs, the posture rotation matrix and the intrinsic parameter matrix, perform translation estimation of the ground area to obtain the position translation of the ground area in the captured video relative to the horizontal direction.
[0135] In actual implementation, the PnP (Perspective-n-Point) algorithm can be used to calculate the rotation and translation of the 3D-2D matching pairs. The PnP algorithm solves the following equation: su = K (Rp + t), where p is the feature point in the 3D camera coordinate system, u is the projection of p on the image, and K is the camera intrinsic parameter matrix. PnP knows multiple pairs of 3D-2D matching pairs {p i ,u i} i=1,2,...,N To solve for the rotation R and translation t.
[0136] Normally, PnP requires at least three matching pairs to solve R, t, but if the attitude rotation matrix R of the video acquisition device is known (for example, obtained through gyroscope integration), only two points are needed to solve the translation vector, so it is called the two-point method. Since R, p are known, we set p′=Rp, multiply K by the left side of the equation, and set u′=K -1 u, then equation (3) can be simplified to su′=p′+t, that is:
[0137]
[0138] Set the third row s=p′ z +t z Substituting the first two lines gives:
[0139]
[0140]
[0141] It can be seen that there are tx ,t y ,t z There are three unknowns. Each set of 3D-2D matching pairs can only obtain two constraint equations, so only two sets of 3D-2D matching pairs are needed to solve t. Therefore, by substituting the first feature point matching pair and the second feature point matching pair obtained in step c) into the above formula, the position translation of the ground area relative to the horizontal direction in the captured video can be obtained.
[0142] When constructing two sets of feature point matching pairs, feature points can be first extracted from the target mask image corresponding to the historical video frame image to obtain the first image feature points corresponding to the historical video frame image, and feature point tracking can be performed based on the first image feature points to obtain the second image feature points that match the first image feature points in the target mask image corresponding to the current video frame image; the first image feature points are mapped to obtain the first camera feature points corresponding to the first image feature points, and the first feature point matching pair is constructed based on the first camera feature points and the second image feature points.
[0143] Then, the second image feature points are mapped to obtain the second camera feature points corresponding to the second image feature points; and the second image feature points are tracked to obtain the third image feature points that match the second image feature points in the corresponding target mask view in the future video frame image, and based on the second camera feature points and the third image feature points, a second feature point matching pair is constructed; based on the first feature point matching pair and the second feature point matching pair, the position translation amount of the ground area in the captured video relative to the horizontal direction is determined.
[0144] Among them, the historical video frame image is the previous frame image adjacent to the current video frame image, and the future video frame image is the next frame image adjacent to the current video frame image. For example, if the current video frame image is the third frame image, the historical video frame image is the second frame image, and the future video frame image is the fourth frame image.
[0145] For example, feature point extraction is performed on the target mask view corresponding to the video frame image of the t0th frame, and the first image feature point is obtained as The first image feature point is mapped to obtain the first camera feature point corresponding to the first image feature point in the camera coordinate system: And the first image feature point is tracked to obtain the second image feature point (i.e., tracking feature point) of the target mask view corresponding to the first image feature point corresponding to the t0th frame in the video frame image of the t1th frame: Based on the first camera feature points (3D) and the second image feature points (2D), a first feature point matching pair (3D-2D matching pair) is constructed.
[0146] Then, the second image feature point is mapped to obtain the second camera feature point corresponding to the second image feature point in the camera coordinate system: The second image feature point is tracked to obtain the third image feature point (i.e., tracking feature point) of the target mask view corresponding to the second image feature point corresponding to the t1th frame in the video frame image of the t2th frame: Based on the second camera feature points (3D) and the third image feature points (2D), a second feature point matching pair (3D-2D matching pair) is constructed.
[0147] In some embodiments, the terminal may determine the position translation amount of the ground area relative to the horizontal direction in the captured video based on the first feature point matching pair and the second feature point matching pair in the following manner:
[0148] Obtain a first posture rotation matrix of the video acquisition device corresponding to the first feature point matching pair, a second posture rotation matrix of the video acquisition device corresponding to the second feature point matching pair, and an intrinsic parameter matrix of the video acquisition device; based on the first feature point matching pair, the second feature point matching pair, the intrinsic parameter matrix, the first posture rotation matrix, and the second posture rotation matrix, estimate the translation of the ground area to obtain the position translation of the ground area in the captured video relative to the horizontal direction.
[0149] Here, based on the constructed first feature point matching pair, the second feature point matching pair, the internal parameter matrix of the video acquisition device, and the posture rotation matrix of the video acquisition device corresponding to the video frame image, the P2P algorithm is used to solve the problem, and the position translation of the ground area in the captured video relative to the horizontal direction is obtained according to the solution result.
[0150] Step 1043: Based on the posture rotation angle and the position translation, determine the movement trajectory of the ground area in the captured video.
[0151] Through the above method, the attitude rotation angle of the ground area relative to the gravity direction in the collected video and the position translation relative to the horizontal direction in the collected video are determined respectively, and then the moving trajectory of the ground area in the collected video can be determined by combining the two. Since this method decouples the attitude rotation angle estimation and the position translation estimation, uses IMU to estimate the attitude rotation angle, uses video frame images to estimate the position translation, and proposes a 3-degree-of-freedom position translation estimation method, the accuracy and speed of position translation estimation are significantly improved compared with traditional tracking algorithms.
[0152] Step 105: When the ground area in the captured video moves along the moving trajectory, the target mask image corresponding to the ground area in the captured video frame image is replaced with a special effect element for display.
[0153] Here, while the ground area in the video is moving along the moving trajectory, the target mask image corresponding to the ground area in the captured video frame image is replaced with a special effect element for display. When the user moves the video capture device, the special effect element will move with the ground area, giving the user the feeling that the special effect element is nailed to the ground. The user can view the special effects from different angles by zooming in, zooming in, or rotating the video capture device.
[0154] Next, the special effects display method of the ground area provided in the embodiment of the present application will be described. Figure 7 , Figure 7 A schematic diagram of a flow chart of a special effects display method for a ground area provided in an embodiment of the present application, the method comprising:
[0155] Step 201: The terminal collects a video containing a ground area, and in the process of collecting the video, displays the ground area in the video using corresponding special effect elements;
[0156] Among them, the special effect element is obtained by replacing the target mask image corresponding to the ground area in the collected video frame image; the target mask image is obtained by fusing the projection mask image obtained by projecting the first mask image corresponding to the ground area in the current video frame image and the second mask image corresponding to the ground area in the historical video frame image into the current video frame image.
[0157] It should be noted that in step 201, the ground area in the video is displayed using corresponding special effect elements, which can be achieved through the method shown in steps 101 to 105, and will not be repeated here.
[0158] See also Fig. 8A , Fig. 8A A schematic diagram of a special effects display interface for a ground area provided in an embodiment of the present application. During video capture, when a ground area 801 exists in the captured video, the ground area 801 in the video is displayed using corresponding special effects elements 802.
[0159] Step 202: along with the change of the acquisition posture of the video, the posture of the special effect element in the displayed video is synchronously adjusted.
[0160] Here, when the user moves the video capture device, the ground area in the captured video frame image changes along with the change of the video capture posture. Correspondingly, the special effect elements will move with the ground area, giving the user the feeling that the special effect elements are nailed to the ground.
[0161] See also Figure 8B , Figure 8BA schematic diagram of the display interface of special effect elements provided in an embodiment of the present application, wherein the "diagonal stripes" indicate the ground area and the "arrows" indicate the special effect elements. When the user moves the video acquisition device, the special effect elements will move with the ground area, giving the user the feeling that the special effect elements are nailed to the ground. The user can view the special effects from different angles by zooming in, zooming in, or rotating the video acquisition device.
[0162] Below, an exemplary application of the embodiment of the present application in an actual application scenario will be described. The special effects display method of the ground area provided in the embodiment of the present application is applied to the scene of user video shooting. When the user shoots a video through a video acquisition device (such as a camera, a mobile phone camera, etc.), when there is a ground area in the captured video screen, the ground area will be replaced with special effects elements (such as virtual volcanic magma, virtual flowers, etc.) for display. When the user moves the video acquisition device, the special effects elements will move with the ground area, giving the user a feeling similar to the special effects elements being nailed to the ground. The user can achieve viewing of special effects from different angles by zooming in, zooming in, or rotating the video acquisition device.
[0163] The special effects display method of the ground area provided in the embodiment of the present application mainly involves: ground area segmentation and ground area tracking, which will be explained one by one below.
[0164] 1. Ground area segmentation
[0165] During the process of video capture, the terminal performs ground area segmentation on the captured current video frame image to obtain a first mask image corresponding to the ground area in the current video frame image. Similarly, the terminal performs ground area segmentation on the captured historical video frame image to obtain a second mask image corresponding to the ground area in the historical video frame image. Next, taking the ground area segmentation of the current video frame image as an example, the ground area segmentation method provided in an embodiment of the present application is explained.
[0166] a) Performing gravity correction on the rotation angle of the current video frame image to obtain a corrected image corresponding to the current video frame image.
[0167] In actual implementation, the gravity direction of the current video frame image is calculated according to the IMU, and the attitude rotation matrix R = [r0, r1, r2; r3, r4, r5; r6, r7, r8] when the video acquisition device acquires the current video frame image is obtained through the gravity sensor; based on the attitude rotation matrix, the corresponding rotation angle of the gravity direction is determined to be θ = arctan (r8 / r5); according to the rotation angle, the current video frame image is rotated in the gravity direction, that is, the current video frame image is rotated by θ angle to obtain a corrected image corresponding to the current video frame image.
[0168] b) performing ground area detection on the corrected image and performing segmentation processing on the detected ground area to obtain a segmented image corresponding to the ground area in the current video frame image.
[0169] In actual implementation, the corrected image after gravity correction can be input into the ground area segmentation model to obtain a segmented image corresponding to the ground area in the current video frame image, wherein the ground area segmentation model includes but is not limited to: traditional segmentation algorithms (such as GraphCut, conditional random fields, Markov random fields, etc.), deep network segmentation models (such as Mask R-CNN (Region-Convolutional Neural Networks), encoding-decoding architecture segmentation models, etc.).
[0170] c) Calculate the non-ground area in the current video frame image based on the IMU.
[0171] In actual implementation, the horizontal vanishing line and gravity direction of the current video frame image are first calculated, and the non-ground area in the current video frame image is determined based on the horizontal vanishing line and gravity direction of the current video frame image.
[0172] When calculating the horizontal vanishing line and gravity direction of the current video frame image, first obtain the posture rotation matrix R = [r0, r1, r2; r3, r4, r5; r6, r7, r8] when the video acquisition device acquires the current video frame image, and based on the posture rotation matrix, obtain the first reference point (p1 = [r2, r5, 0]) and the second reference point (p2 = [r2+r5, r5-r2, 0]) in the same horizontal plane as the video acquisition device, and the third reference point (p3 = [r2, r5, -1]) in the vertical plane of the video acquisition device, wherein the z-axis direction is defined as the gravity direction downward; then respectively obtain the first reference point (p1 = [r2, r5, 0]) and the second reference point (p2 = [r2+r5, r5-r2, 0]) in the same horizontal plane as the video acquisition device. 1), the second reference point (p2) and the third reference point (p3) are projected into the current video frame image according to the following formula (1), and the first target point (u1, v1) corresponding to the first reference point (p1), the second target point (u2, v2) corresponding to the second reference point (p2), and the third target point (u3, v3) corresponding to the third reference point (p3) are obtained; finally, the line between the first target point (u1, v1) and the second target point (u2, v2) is determined as the horizontal vanishing line of the current video frame image; and the direction indicated by the ray starting from the third target point (u3, v3) and perpendicular to the horizontal vanishing line is determined as the gravity direction of the current video frame image.
[0173]
[0174] Among them, R is the camera's attitude rotation matrix, [x c ,y c , z c] T is a spatial point in the camera coordinate system, and the image coordinates of point p are set to p(x, y), the pixel coordinates are set to (u, v), the pixel coordinate origin is in the upper left corner, the u axis is horizontal to the left, and the v axis is vertically downward. The image coordinate origin is at the center of the image, and there is a translation (c x , c y ), f x and f y are the normalized focal lengths on the u-axis and v-axis respectively.
[0175] After determining the horizontal vanishing line and gravity direction of the current video frame image, the number of intersection points between the horizontal vanishing line and the current video frame image can be obtained; when the number of intersection points is 0 or 1, determine whether the entire current video frame image is a ground area or a non-ground area according to (u3, v3). For example, when the number of intersection points is 0 or 1, and the third target point indicated by the gravity direction is located on the same side of the horizontal vanishing line as the current video frame image, determine that the current video frame image is a non-ground area; when the number of intersection points is 0 or 1, and the third target point indicated by the gravity direction is located on both sides of the horizontal vanishing line as the current video frame image, determine that the current video frame image is a ground area. When the number of intersections is 2, the current video frame image is divided into two parts by the horizontal vanishing line, and the ground area part and the non-ground area part are distinguished according to (u3, v3). For example, the partial area on the same side of the horizontal vanishing line as the third target point indicated by the gravity direction in the current video frame image is determined as the non-ground area, and the partial area on the different side of the horizontal vanishing line as the third target point indicated by the gravity direction in the current video frame image is determined as the ground area.
[0176] See also Figures 9A-9B , Figures 9A-9B A schematic diagram of determining a non-ground area provided in an embodiment of the present application, Fig.9A In the example, the horizontal vanishing line 901 divides the current video frame image into a first area 902 and a second area 903, and the first area 902 located on the same side of the horizontal vanishing line 901 as the third target point 904 indicated by the gravity direction in the current video frame image is determined as a non-ground area, and the second area 903 located on a different side from the third target point 904 is determined as a ground area; Fig. 9B In the figure, the horizontal vanishing line 905 divides the current video frame image into a first area 906 and a second area 907. The first area 907 located on the same side as the third target point 908 indicated by the gravity direction in the current video frame image is determined as a non-ground area, and the second area 906 located on a different side of the horizontal vanishing line 905 from the third target point 908 is determined as a ground area.
[0177] d) For the segmented image corresponding to the ground area in the current video frame image obtained in b), non-ground area filtering is performed. When the ground area corresponding to the segmented image contains non-ground area, the non-ground area filtering is performed on the segmented image to obtain a first mask image corresponding to the ground area in the current video frame image.
[0178] Through the above steps a)-d), the second mask image corresponding to the ground area in the historical video frame image can be obtained, wherein the number of historical video frame images can be N (the N value can be determined according to the computing performance of the video acquisition device, such as taking any one of 1-10).
[0179] Through the above steps a) to d), the captured video frame images are first gravity corrected according to the IMU, and then the ground area is segmented for the corrected video frame images, which can solve the problem of poor segmentation effect caused by the user rotating the video acquisition device at a large angle (such as rotating the mobile phone at a large angle or even holding the mobile phone upside down), and improve the robustness. At the same time, the false detection of the non-ground area in the segmented image corresponding to the ground area in the current video frame image is filtered out, thereby improving the accuracy of ground area segmentation.
[0180] e) fusing the second mask image corresponding to the ground area in the historical video frame image with the first mask image corresponding to the ground area in the current video frame image to obtain a target mask image corresponding to the ground area in the current video frame image.
[0181] In actual implementation, after obtaining the second mask image corresponding to the ground area in the historical video frame image, the optical flow field (such as a sparse optical flow field or a dense optical flow field) between the historical video frame image and the current video frame image can be calculated. In some embodiments, when the optical flow field is a sparse optical flow field, the transformation moment between the historical video frame image and the current video frame image is obtained based on the optical flow field; based on the transformation matrix, the second mask image corresponding to the ground area in the historical video frame image is projected into the current video frame image to obtain a projected mask image corresponding to the historical video frame image.
[0182] In some embodiments, when the optical flow field is a dense optical flow field, a position mapping relationship between the historical video frame image and the current video frame image is obtained based on the optical flow field, and based on the position mapping relationship, the second mask image is projected into the current video frame image to obtain a projected mask image corresponding to the historical video frame image.
[0183] Among them, when calculating the dense optical flow field between the historical video frame image and the current video frame image, the calculation methods include but are not limited to: Farneback, DIS-flow and Lucas–Kanade, etc. According to the dense optical flow, the second mask images of N historical frame video frame images are projected into the current video frame image to obtain the projection mask images corresponding to the N historical video frame images. Since the result of the dense optical flow records the position of each pixel point in the current video frame image in the historical frame video frame image, the mask value of the corresponding position in the historical video frame image is directly converted, which is equivalent to projecting each pixel point according to the result of the optical flow separately. Since pixel-level image registration can be performed through the dense optical flow field, the registration accuracy is relatively high.
[0184] After obtaining the projection mask image corresponding to the historical video frame image, respectively obtain the weights of the first mask image and the projection mask image corresponding to the ground area in the current video frame image; based on the obtained weights, perform weighted processing on the first mask image and the projection mask image to obtain the target mask image corresponding to the ground area in the current video frame image, wherein the weighted processing method includes but is not limited to: average weighting, learning rate decay weighting, etc.
[0185] In the above manner, since the target mask image corresponding to the ground area in the current video frame image is fused with the mask images corresponding to the ground area in the current video frame image and multiple historical frame images, the jitter of the target mask image is reduced by fusing the segmentation results of multiple frames, thereby improving the inter-frame consistency of the ground area segmentation. After obtaining the target mask image corresponding to the ground area in the current video frame image, the target mask image corresponding to the ground area in the captured video frame image can be replaced with special effect elements for display.
[0186] 2. Ground area tracking
[0187] Here, based on the video frame images of adjacent frames and the posture rotation matrix of the video acquisition device when acquiring the corresponding video frame images, the 6-degree-of-freedom motion (3-degree-of-freedom posture + 3-degree-of-freedom position) of the video acquisition device (camera) relative to the ground is estimated, and then the moving trajectory of the ground area in the acquired video is determined. In the process of the ground area moving along the moving trajectory in the video, the target mask image corresponding to the ground area in the acquired video frame image is replaced with a special effect element for display.
[0188] The rotation angle of the ground area relative to the gravity direction in the captured video can be determined based on the camera attitude rotation matrix R, and the position translation of the ground area relative to the horizontal direction in the captured video will be implemented through the following steps:
[0189] a) Through step 1, a target mask image corresponding to the ground area in each frame of the video frame image can be obtained, and feature points of the target mask image of the historical (previous frame) video frame image are extracted to obtain the first image feature points of the target mask image of the previous frame of the video frame image; wherein the feature point extraction algorithm includes but is not limited to: Harris, FAST (Features from accelerated segment test), Good Feature To Track, etc.
[0190] b) performing feature point tracking on the first image feature point to obtain a second image feature point corresponding to the first image feature point in the current video frame image, wherein the tracking algorithm includes but is not limited to: Lucas–Kan ade optical flow tracking, scale-invariant feature transform (SIFT), SURF (Speeded-Up Robust Features), ORB (Oriented Fast and Rotated Brief) feature matching, etc.
[0191] c) Assume that the initial position of the video acquisition device (camera) is (0, 0, h) by default, where h is the initial height of the video acquisition device above the ground, which can be 1 or any other value. Assume that when the last video frame is acquired, the position of the video acquisition device is (tx, ty, tz). The three-dimensional coordinates of the feature points are restored by the following formula (2):
[0192]
[0193] Among them, u and v are the image coordinates of the feature points, K is the intrinsic parameter matrix of the video acquisition device, R is the posture rotation matrix of the video acquisition device when acquiring video frame images, s is the unknown scale factor, and (px, py, pz) are the three-dimensional coordinates of the feature points to be determined.
[0194] For example, feature point extraction is performed on the target mask view corresponding to the video frame image of the t0th frame, and the first image feature point is obtained as The first image feature point is mapped to obtain the first camera feature point corresponding to the first image feature point in the camera coordinate system: And the first image feature point is tracked to obtain the second image feature point (i.e., tracking feature point) of the target mask view corresponding to the first image feature point corresponding to the t0th frame in the video frame image of the t1th frame: Based on the first camera feature points (3D) and the second image feature points (2D), a first feature point matching pair (3D-2D matching pair) is constructed.
[0195] Then, the second image feature point is mapped to obtain the second camera feature point corresponding to the second image feature point in the camera coordinate system: The second image feature point is tracked to obtain the third image feature point (i.e., tracking feature point) of the target mask view corresponding to the second image feature point corresponding to the t1th frame in the video frame image of the t2th frame: Based on the second camera feature points (3D) and the third image feature points (2D), a second feature point matching pair (3D-2D matching pair) is constructed.
[0196] Based on the constructed first feature point matching pair, the second feature point matching pair, the internal parameter matrix of the video acquisition device, and the posture rotation matrix of the video acquisition device corresponding to the video frame image, the PnP (Perspective-n-Point) algorithm is used to solve, and the position translation of the ground area relative to the horizontal direction in the captured video is obtained according to the solution result. Among them, the PnP algorithm includes but is not limited to EPnP, direct linear transformation (DLT, Direct Linear Transformation) algorithm, homography matrix decomposition method (Homography), etc. Since only the position translation of the ground area is estimated here, the P2P algorithm is used for calculation, and the P2P algorithm is explained below.
[0197] The P2P algorithm is a type of PnP algorithm. The PnP algorithm is a type of algorithm that calculates rotation and translation based on 3D-2D matching. It solves the following equation (3):
[0198] su=K(Rp+t) (3)
[0199] Among them, p is the 3D camera feature point, u is the projection of p on the image, K is the camera internal parameter matrix, PnP knows multiple pairs of 3D-2D matching pairs {p i ,u i} i=1,2,...,N To solve for the rotation R and translation t.
[0200] Normally, PnP requires at least three matching pairs to solve R, t, but if R is known (for example, obtained through gyroscope integration), only two points are needed to solve the translation vector, so it is called the two-point method. Since R and p are known, we set p′ = Rp, multiply K by the left side of the equation, and set u′ = K -1 u, then equation (3) can be simplified to su′=p′+t, that is:
[0201]
[0202] Set the third row s=p′ z +t z Substituting the first two lines gives:
[0203]
[0204] Total t x ,t y ,t z There are three unknowns. Each set of 3D-2D matching pairs can only obtain two constraint equations, so only two sets of 3D-2D matching pairs are needed to solve t. Therefore, by substituting the first feature point matching pair and the second feature point matching obtained in step c) into the above formula, the position translation of the ground area relative to the horizontal direction in the captured video can be obtained.
[0205] Through the above method, the attitude rotation angle of the ground area relative to the gravity direction in the collected video and the position translation relative to the horizontal direction in the collected video are determined respectively, and then the moving trajectory of the ground area in the collected video can be determined by combining the two. Since this method decouples the attitude rotation angle estimation and the position translation estimation, uses IMU to estimate the attitude rotation angle, uses video frame images to estimate the position translation, and proposes a 3-degree-of-freedom position translation estimation method, the accuracy and speed of position translation estimation are significantly improved compared with traditional tracking algorithms.
[0206] See also Figure 10-11 , Fig.10 A schematic diagram showing the time-consuming performance comparison of the movement trajectory evaluation provided in the embodiment of the present application. Fig.11 This is a schematic diagram of the comparison of the accuracy of mobile trajectory evaluation provided in the embodiment of the present application. It can be seen that the 3-DOF PnP algorithm provided in the embodiment of the present application takes 10 times less time and has 10 times higher accuracy than the conventional 6-DOF PnP (such as Homogra phy and ground truth).
[0207] The following is a description of an exemplary structure of the special effect display device 555 of the ground area provided in the embodiment of the present application being implemented as a software module. In some embodiments, for example, Fig.12 As shown, Fig.12 A schematic diagram of the structure of a special effect display device for a ground area provided in an embodiment of the present application, wherein the special effect display device 555 for a ground area stored in the memory 550 includes:
[0208] The acquisition module 5551 is used to acquire, during the process of acquiring the video, a first mask image corresponding to the ground area in the current video frame image and a second mask image corresponding to the ground area in the historical video frame image;
[0209] The projection module 5552 is used to project the second mask image into the current video frame image to obtain a projection mask image corresponding to the historical video frame image;
[0210] A fusion module 5553 is used to fuse the first mask image with the projection mask image to obtain a target mask image corresponding to the ground area in the current video frame image;
[0211] The tracking module 5554 is used to track the ground area in the captured video frame image to determine the moving track of the ground area in the captured video;
[0212] The replacement module 5555 is used to replace the target mask image corresponding to the ground area in the captured video frame image with a special effect element for display when the ground area in the captured video moves according to the moving trajectory.
[0213] In some embodiments, the acquisition module is further used to perform gravity correction on the rotation angle of the current video frame image to obtain a corrected image corresponding to the current video frame image;
[0214] Performing ground area detection on the corrected image, and performing segmentation processing on the detected ground area to obtain a segmented image corresponding to the ground area in the current video frame image;
[0215] The segmented image is filtered for non-ground areas to obtain a first mask image corresponding to the ground area in the current video frame image.
[0216] In some embodiments, the acquisition module is further used to acquire the posture rotation matrix when the video acquisition device acquires the current video frame image;
[0217] Based on the attitude rotation matrix, determining the rotation angle of the corresponding gravity direction;
[0218] The current video frame image is rotated in the direction of gravity according to the rotation angle to obtain a corrected image corresponding to the current video frame image.
[0219] In some embodiments, the acquisition module is further used to acquire a posture rotation matrix when the video acquisition device acquires the current video frame image, and based on the posture rotation matrix, acquire a first reference point and a second reference point on the same horizontal plane as the video acquisition device, and a third reference point on a vertical plane of the video acquisition device;
[0220] Determine a horizontal vanishing line of the current video frame image based on the first reference point and the second reference point, and determine a gravity direction of the current video frame image based on the third reference point;
[0221] Based on the horizontal vanishing line and the gravity direction, the segmented image is filtered for non-ground areas to obtain a first mask image corresponding to the ground area in the current video frame image.
[0222] In some embodiments, the acquisition module is further used to project the first reference point, the second reference point and the third reference point into the current video frame image respectively to obtain a first target point corresponding to the first reference point, a second target point corresponding to the second reference point, and a third target point corresponding to the third reference point;
[0223] Determine a line connecting the first target point and the second target point as a horizontal vanishing line of the current video frame image;
[0224] The direction indicated by the ray starting from the third target point and perpendicular to the horizontal vanishing line is determined as the gravity direction of the current video frame image.
[0225] In some embodiments, the acquisition module is further used to acquire the number of intersections between the horizontal vanishing line and the current video frame image;
[0226] Based on the number of the intersection points and the gravity direction, determining a non-ground area in the current video frame image;
[0227] When the ground area corresponding to the segmented image contains the non-ground area, the segmented image is filtered for the non-ground area to obtain a first mask image corresponding to the ground area in the current video frame image.
[0228] In some embodiments, the acquisition module is further configured to determine that the current video frame image is a non-ground area when the number of the intersection points is 0 or 1 and the third target point indicated by the gravity direction and the current video frame image are located on the same side of the horizontal vanishing line;
[0229] When the number of the intersection points is 2, a partial area on the same side of the horizontal vanishing line as the third target point indicated by the gravity direction in the current video frame image is determined as a non-ground area.
[0230] In some embodiments, the projection module is further used to obtain an optical flow field between the historical video frame image and the current video frame image;
[0231] Based on the optical flow field, the second mask image is projected into the current video frame image to obtain a projected mask image corresponding to the historical video frame image.
[0232] In some embodiments, the fusion module is further used to obtain weights corresponding to the first mask image and the projection mask image respectively;
[0233] Based on the acquired weights, weighted processing is performed on the first mask image and the projection mask image to obtain a target mask image corresponding to the ground area in the current video frame image.
[0234] In some embodiments, the tracking module is further used to obtain a posture rotation matrix when the video acquisition device acquires the current video frame image, and determine the posture rotation angle of the ground area relative to the gravity direction in the acquired video based on the posture rotation matrix;
[0235] Determine the position translation amount of the ground area relative to the horizontal direction in the captured video;
[0236] Based on the posture rotation angle and the position translation amount, a movement trajectory of the ground area in the captured video is determined.
[0237] In some embodiments, the tracking module is further used to extract feature points from the target mask image corresponding to the historical video frame image to obtain first image feature points corresponding to the historical video frame image, and perform feature point tracking based on the first image feature points to obtain second image feature points in the target mask image corresponding to the current video frame image that match the first image feature points;
[0238] Performing mapping processing on the first image feature points to obtain first camera feature points corresponding to the first image feature points, and constructing feature point matching pairs based on the first camera feature points and the second image feature points;
[0239] Based on the feature point matching pairs, a position translation amount of the ground area relative to the horizontal direction in the captured video is determined.
[0240] In some embodiments, the tracking module is further used to obtain the posture rotation matrix of the video acquisition device corresponding to the feature point matching pair and the intrinsic parameter matrix of the video acquisition device;
[0241] Based on the feature point matching pairs, the posture rotation matrix and the intrinsic parameter matrix, the translation of the ground area is estimated to obtain the position translation of the ground area relative to the horizontal direction in the captured video.
[0242] See also Fig.13 , Fig.13 The structural diagram of the special effect display device 13 of the ground area provided in the embodiment of the present application includes:
[0243] The display module 131 is used to collect a video containing a ground area, and in the process of collecting the video, display the ground area in the video using corresponding special effect elements;
[0244] The special effect element is obtained by replacing the target mask image corresponding to the ground area in the acquired video frame image; the target mask image is obtained by fusing a projection mask image obtained by projecting a first mask image corresponding to the ground area in the current video frame image and a second mask image corresponding to the ground area in the historical video frame image onto the current video frame image;
[0245] The adjustment module 132 is used to synchronously adjust the posture of the special effect element in the displayed video along with the change of the acquisition posture of the video.
[0246] The embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the special effect display method of the ground area described in the embodiment of the present application.
[0247] An embodiment of the present application provides a computer-readable storage medium storing executable instructions, wherein executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the special effects display method of the ground area provided in the embodiment of the present application.
[0248] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EP ROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.
[0249] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0250] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (for example, files storing one or more modules, subroutines, or code portions).
[0251] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0252] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A special effects display method for a ground area, characterized in that: The method comprises: During the video acquisition process, gravity correction is performed on the rotation angle of the current video frame image to obtain a corrected image corresponding to the current video frame image; Performing ground area detection on the corrected image, and performing segmentation processing on the detected ground area to obtain a segmented image corresponding to the ground area in the current video frame image; Obtaining a posture rotation matrix when the video acquisition device acquires the current video frame image, and based on the posture rotation matrix, obtaining a first reference point and a second reference point on the same horizontal plane as the video acquisition device, and a third reference point on a vertical plane of the video acquisition device; Determine a horizontal vanishing line of the current video frame image based on the first reference point and the second reference point, and determine a gravity direction of the current video frame image based on the third reference point; Obtaining the number of intersections between the horizontal vanishing line and the current video frame image; Based on the number of the intersection points and the gravity direction, determining a non-ground area in the current video frame image; When the ground area corresponding to the segmented image contains the non-ground area, filtering the non-ground area on the segmented image to obtain a first mask image corresponding to the ground area in the current video frame image; Obtaining a second mask image corresponding to the ground area in the historical video frame image; Projecting the second mask image onto the current video frame image to obtain a projected mask image corresponding to the historical video frame image; Performing image fusion on the first mask image and the projection mask image to obtain a target mask image corresponding to the ground area in the current video frame image; Tracking the ground area in the captured video frame image to determine the moving trajectory of the ground area in the captured video; When the ground area in the captured video moves according to the moving trajectory, the target mask image corresponding to the ground area in the captured video frame image is replaced with a special effect element for display.
2. The method according to claim 1, characterized in that The performing gravity correction on the rotation angle of the current video frame image to obtain a corrected image corresponding to the current video frame image includes: Obtaining a posture rotation matrix when a video acquisition device acquires the current video frame image; Based on the attitude rotation matrix, determining the rotation angle of the corresponding gravity direction; The current video frame image is rotated in the direction of gravity according to the rotation angle to obtain a corrected image corresponding to the current video frame image.
3. The method according to claim 1, characterized in that The determining the horizontal vanishing line of the current video frame image based on the first reference point and the second reference point, and determining the gravity direction of the current video frame image based on the third reference point, comprises: Respectively projecting the first reference point, the second reference point, and the third reference point into the current video frame image to obtain a first target point corresponding to the first reference point, a second target point corresponding to the second reference point, and a third target point corresponding to the third reference point; Determine a line connecting the first target point and the second target point as a horizontal vanishing line of the current video frame image; The direction indicated by the ray starting from the third target point and perpendicular to the horizontal vanishing line is determined as the gravity direction of the current video frame image.
4. The method according to claim 1, characterized in that The determining, based on the number of the intersection points and the gravity direction, a non-ground area in the current video frame image includes: When the number of the intersection points is 0 or 1, and the third target point indicated by the gravity direction and the current video frame image are located on the same side of the horizontal vanishing line, determining that the current video frame image is a non-ground area; When the number of the intersection points is 2, a partial area on the same side of the horizontal vanishing line as the third target point indicated by the gravity direction in the current video frame image is determined as a non-ground area.
5. The method according to claim 1, characterized in that The projecting the second mask image into the current video frame image to obtain a projected mask image corresponding to the historical video frame image includes: Acquire an optical flow field between the historical video frame image and the current video frame image; Based on the optical flow field, the second mask image is projected into the current video frame image to obtain a projected mask image corresponding to the historical video frame image.
6. The method according to claim 1, characterized in that The step of fusing the first mask image with the projection mask image to obtain a target mask image corresponding to the ground area in the current video frame image includes: respectively obtaining weights corresponding to the first mask image and the projection mask image; Based on the acquired weights, weighted processing is performed on the first mask image and the projection mask image to obtain a target mask image corresponding to the ground area in the current video frame image.
7. The method according to claim 1, characterized in that The tracking process of the ground area in the captured video frame image to determine the moving trajectory of the ground area in the captured video includes: Acquire a posture rotation matrix when a video acquisition device acquires a video frame image, and determine a posture rotation angle of the ground area relative to the gravity direction in the acquired video based on the posture rotation matrix; Determine the position translation amount of the ground area relative to the horizontal direction in the captured video; Based on the posture rotation angle and the position translation amount, a movement trajectory of the ground area in the captured video is determined.
8. The method according to claim 7, characterized in that The determining of the position translation amount of the ground area relative to the horizontal direction in the captured video includes: Extracting feature points of a target mask image corresponding to a ground area in the historical video frame image to obtain first image feature points corresponding to the historical video frame image, and tracking feature points based on the first image feature points to obtain second image feature points in a target mask image corresponding to a ground area in the current video frame image that match the first image feature points; Performing mapping processing on the first image feature points to obtain first camera feature points corresponding to the first image feature points, and constructing feature point matching pairs based on the first camera feature points and the second image feature points; Based on the feature point matching pairs, a position translation amount of the ground area relative to the horizontal direction in the captured video is determined.
9. The method according to claim 8, characterized in that The determining, based on the feature point matching pairs, a position translation amount of the ground area relative to the horizontal direction in the captured video includes: Obtaining a posture rotation matrix of a video acquisition device corresponding to the feature point matching pair and an intrinsic parameter matrix of the video acquisition device; Based on the feature point matching pairs, the posture rotation matrix and the intrinsic parameter matrix, the translation of the ground area is estimated to obtain the position translation of the ground area relative to the horizontal direction in the captured video.
10. A special effects display method for a ground area, characterized in that: The method comprises: Capturing a video containing a ground area, and in the process of capturing the video, displaying the ground area in the video using corresponding special effect elements; Among them, the special effect element is obtained by replacing the target mask image corresponding to the ground area in the captured video frame image; the target mask image is obtained by projecting a first mask image corresponding to the ground area in the current video frame image and a second mask image corresponding to the ground area in the historical video frame image onto the current video frame image and performing image fusion; the first mask image is obtained by: performing gravity correction on the rotation angle of the current video frame image to obtain a corrected image corresponding to the current video frame image; performing ground area detection on the corrected image, and performing segmentation processing on the detected ground area to obtain a segmented image corresponding to the ground area in the current video frame image; obtaining the posture rotation when the video acquisition device acquires the current video frame image A rotation matrix is provided, and based on the posture rotation matrix, a first reference point and a second reference point in the same horizontal plane as the video acquisition device, and a third reference point in the vertical plane of the video acquisition device are obtained; based on the first reference point and the second reference point, a horizontal vanishing line of the current video frame image is determined, and based on the third reference point, a gravity direction of the current video frame image is determined; the number of intersections between the horizontal vanishing line and the current video frame image is obtained; based on the number of intersections and the gravity direction, a non-ground area in the current video frame image is determined; when the ground area corresponding to the segmented image contains the non-ground area, the segmented image is filtered for the non-ground area to obtain a first mask image corresponding to the ground area in the current video frame image; Along with the change of the acquisition posture corresponding to the video, the posture of the special effect element in the displayed video is synchronously adjusted.
11. A special effects display device for a ground area, characterized in that: The device comprises: an acquisition module, used to, in the process of video acquisition, perform gravity correction on the rotation angle of the current video frame image to obtain a corrected image corresponding to the current video frame image; perform ground area detection on the corrected image, and perform segmentation processing on the detected ground area to obtain a segmented image corresponding to the ground area in the current video frame image; obtain a posture rotation matrix when the video acquisition device acquires the current video frame image, and based on the posture rotation matrix, obtain a first reference point and a second reference point in the same horizontal plane as the video acquisition device, and a third reference point located in a vertical plane of the video acquisition device; determine a horizontal vanishing line of the current video frame image based on the first reference point and the second reference point, and determine a gravity direction of the current video frame image based on the third reference point; obtain the number of intersections between the horizontal vanishing line and the current video frame image; determine a non-ground area in the current video frame image based on the number of intersections and the gravity direction; when the ground area corresponding to the segmented image contains the non-ground area, perform non-ground area filtering on the segmented image to obtain a first mask image corresponding to the ground area in the current video frame image; The acquisition module is further used to acquire a second mask image corresponding to the ground area in the historical video frame image; A projection module, used for projecting the second mask image into the current video frame image to obtain a projection mask image corresponding to the historical video frame image; A fusion module, used for fusing the first mask image with the projection mask image to obtain a target mask image corresponding to the ground area in the current video frame image; A tracking module is used to track the ground area in the captured video frame image to determine the movement trajectory of the ground area in the captured video; The replacement module is used to replace the target mask image corresponding to the ground area in the captured video frame image with a special effect element for display when the ground area in the captured video moves according to the moving trajectory.
12. A special effect display device for a ground area, characterized in that: The device comprises: A display module, used for collecting a video containing a ground area, and in the process of collecting the video, displaying the ground area in the video using corresponding special effect elements; Among them, the special effect element is obtained by replacing the target mask image corresponding to the ground area in the captured video frame image; the target mask image is obtained by projecting a first mask image corresponding to the ground area in the current video frame image and a second mask image corresponding to the ground area in the historical video frame image onto the current video frame image and performing image fusion; the first mask image is obtained by: performing gravity correction on the rotation angle of the current video frame image to obtain a corrected image corresponding to the current video frame image; performing ground area detection on the corrected image, and performing segmentation processing on the detected ground area to obtain a segmented image corresponding to the ground area in the current video frame image; obtaining the posture rotation when the video acquisition device acquires the current video frame image A rotation matrix is provided, and based on the posture rotation matrix, a first reference point and a second reference point in the same horizontal plane as the video acquisition device, and a third reference point in the vertical plane of the video acquisition device are obtained; based on the first reference point and the second reference point, a horizontal vanishing line of the current video frame image is determined, and based on the third reference point, a gravity direction of the current video frame image is determined; the number of intersections between the horizontal vanishing line and the current video frame image is obtained; based on the number of intersections and the gravity direction, a non-ground area in the current video frame image is determined; when the ground area corresponding to the segmented image contains the non-ground area, the segmented image is filtered for the non-ground area to obtain a first mask image corresponding to the ground area in the current video frame image; The adjustment module is used to synchronously adjust the posture of the special effect element in the displayed video along with the change of the acquisition posture corresponding to the video.
13. An electronic device, characterized in that: include: A memory for storing executable instructions; A processor is used to implement the special effects display method of the ground area described in any one of claims 1 to 10 when executing the executable instructions stored in the memory.
14. A computer-readable storage medium, characterized in that: Executable instructions are stored, which are used to implement the special effects display method of the ground area described in any one of claims 1 to 10 when executed by a processor.
15. A computer program product, characterized in that It includes a computer program or a computer executable instruction, characterized in that when the computer program or the computer executable instruction is executed by a processor, it implements the special effects display method of the ground area described in any one of claims 1 to 10.
