Motion Trajectory Synthesis Method and Electronic Device

By raster division and filtering of moving images, and selecting images of the grid areas of the non-overlapping moving subjects for synthesis, the overlapping problems that may occur in the synthesis of moving subjects are solved, and the synthesis effect is improved.

CN111105434BActive Publication Date: 2025-05-30ZTE CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201811250802.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-10-25
Publication Date
2025-05-30
Estimated Expiration
2038-10-25

AI Technical Summary

Technical Problem

The movement speed of the moving subject is different, the direction of movement is uncertain, and the size of the moving subject is different, resulting in the movement subjects that may overlap in the synthesized image, and the complete movement movement cannot be clearly seen, and the synthesis effect is not good.

Method used

By acquiring multiple frame images, arranging them according to the acquisition time, and dividing the images into multiple grid areas according to the preset method, selecting several frame images that meet the preset conditions for synthesis, ensuring that the grid areas occupied by the moving subject in any two frame images do not overlap.

Benefits of technology

It is achieved to avoid overlapping the moving subjects when synthesizing the motion trajectory, improve the synthesis effect, and make the motion trajectory clearer and complete.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111105434B_ABST
    Figure CN111105434B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention relate to the technical field of image processing, and disclose a method for synthesizing a motion trajectory and an electronic device. In the embodiments of the present invention, the method for synthesizing a motion trajectory includes: obtaining multiple frames of images; wherein, the multiple frames of images are arranged according to the acquisition time; dividing the multiple frames of images into multiple grid regions respectively according to a preset method; selecting several frames of images that meet the preset conditions from the multiple frames of images; wherein, the preset conditions include that the several frames of images all contain a moving object and the grid regions occupied by the moving object in any two frames of images do not overlap; synthesizing the motion trajectory of the moving object according to the selected several frames of images. Embodiments of the present invention also provide an electronic device. The embodiments of the present invention use the grid method to screen out the images for synthesis, which is not affected by the speed, direction of movement of the moving object, and changes in the size of the moving object, and can ensure that the moving objects in the synthesized motion trajectory do not overlap, and the synthesis effect is good.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the technical field of image processing, and particularly to a method for synthesizing a motion trajectory and an electronic device. Background Art

[0002] Taking pictures and videos of a scene with a moving object is one of the common daily scenarios of camera photography. Wonderful moving scenes always pass by in a flash. For example, during a basketball game, a dunk action, during a football game, dribbling and shooting, high jump, long jump, etc. When the moving object moves, a motion silhouette will be generated. By synthesizing multiple motion images into one image, a series of motion trajectory silhouette images of the moving object can be synthesized.

[0003] The inventors found that there are at least the following problems in the background art: the moving speeds of the moving objects are different, the moving directions are uncertain, and the sizes of the moving objects are different. In the synthesized image, the moving objects may overlap with each other, and it is not clear to see the actions of the complete moving objects, as Figure 1 shown, so the synthesis effect is not very good. Summary of the Invention

[0004] Embodiments of the present invention aim to provide a method for synthesizing a motion trajectory and an electronic device, which can prevent the moving objects from overlapping in the synthesized motion trajectory and have a better synthesis effect.

[0005] To solve the above technical problems, an embodiment of the present invention provides a method for synthesizing a motion trajectory, including: acquiring multiple frames of images; wherein, the multiple frames of images are arranged according to the acquisition time; dividing the multiple frames of images into multiple grid regions according to a preset method; selecting several frames of images that meet a preset condition from the multiple frames of images; wherein, the preset condition includes that the several frames of images all contain a moving object and the grid regions occupied by the moving objects in any two frames of images do not overlap; synthesizing the motion trajectory of the moving object according to the selected several frames of images.

[0006] An embodiment of the present invention further provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; a camera connected to the at least one processor and the memory; wherein, the camera is used to acquire images; the memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor can execute the above method for synthesizing a motion trajectory.

[0007] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the above method for synthesizing a motion trajectory is implemented.

[0008] In the embodiments of the present invention, compared with the prior art, an image is divided into a plurality of grid regions according to a preset method; several frames of images that meet preset conditions are selected from multiple frames of images for synthesis, where the preset conditions include that the image contains a moving object and the grid regions occupied by the moving object in any two frames of images do not overlap. Therefore, the grid method is used to screen out the images for synthesis, which is not affected by the speed, direction of movement of the moving object, or the change in the size of the moving object, and it can ensure that the moving objects do not overlap in the synthesized movement trajectory, and the synthesis effect is better. Brief Description of the Drawings

[0009] One or more embodiments are exemplarily illustrated by the pictures in the corresponding drawings. These exemplary illustrations do not limit the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements, unless otherwise stated, the drawings in the drawings do not constitute a proportional limitation.

[0010] Figure 1 is a schematic diagram of the synthesized movement trajectory in the prior art;

[0011] Figure 2 is a flowchart of the movement trajectory synthesis method according to the first embodiment of the present invention;

[0012] Figure 3 is a schematic diagram of the synthesized movement trajectory according to the first embodiment of the present invention;

[0013] Figure 4 is a flowchart of the movement trajectory synthesis method according to the second embodiment of the present invention;

[0014] Figure 5 is a flowchart of the movement trajectory synthesis method according to the third embodiment of the present invention;

[0015] Figure 6 is a schematic diagram of the grid regions divided according to the third embodiment of the present invention;

[0016] Figure 7 is a flowchart of the screening method in sub-step 3032 according to the third embodiment of the present invention;

[0017] Figure 8 is a flowchart of the screening method in sub-step 3032 according to the fourth embodiment of the present invention;

[0018] Figure 9 is a flowchart of the movement trajectory synthesis method according to the fifth embodiment of the present invention;

[0019] Figure 10 is a schematic diagram of the electronic device according to the sixth embodiment of the present invention. Detailed Embodiments

[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will elaborate on the various embodiments of the present invention in conjunction with the accompanying drawings. However, those of ordinary skill in the art can understand that in the various embodiments of the present invention, many technical details are provided to help readers better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present application can still be implemented.

[0021] The first embodiment of the present invention relates to a method for synthesizing a motion trajectory. The specific process is as Figure 2 shown.

[0022] Step 101: Obtain multiple frames of images; among them, the multiple frames of images are arranged according to the acquisition time;

[0023] Step 102: Divide the multiple frames of images into multiple grid regions respectively according to a preset method;

[0024] Step 103: Select several frames of images that meet the preset conditions from the multiple frames of images; among them, the preset conditions include that the several frames of images all contain a moving object and the grid regions occupied by the moving object in any two frames of images do not overlap;

[0025] Step 104: Synthesize the motion trajectory of the moving object according to the selected several frames of images.

[0026] Compared with the prior art, in the embodiments of the present invention, the images are divided into multiple grid regions according to a preset method; several frames of images that meet the preset conditions are selected from the multiple frames of images for synthesis, where the preset conditions include that the images contain a moving object and the grid regions occupied by the moving object in any two frames of images do not overlap. Therefore, the grid method is used to screen out the images for synthesis, and it is not affected by the speed, direction of movement of the moving object, or changes in the size of the moving object, and it can ensure that the moving objects in the synthesized motion trajectory do not overlap, and the synthesis effect is good.

[0027] The following specifically describes the implementation details of the motion trajectory synthesis method in this embodiment. The following content is only provided for the convenience of understanding and is not necessary for implementing this solution.

[0028] The motion trajectory synthesis method in this embodiment can be applied to an electronic device, and this electronic device is, for example, a personal computer, a mobile phone, etc., and is not limited thereto. Please refer to Figure 2 and Figure 3 , where Figure 3 is a schematic diagram of the synthesized motion trajectory in this embodiment.

[0029] In step 101, the electronic device can collect multiple frames of images through a camera; the camera can be integrated on the electronic device or external. The camera can collect images at a preset frequency. Among them, the number of frames of the collected images can be preset. For example, if 60 frames are preset, the camera will collect 60 frames of images at the preset frequency; or, the time for collecting images can be preset. For example, if 10 seconds are preset, the camera will collect images at the preset frequency and stop collecting after 10 seconds. The number of collected images is related to the preset time and preset frequency. The multiple frames of collected images are arranged according to the collection time.

[0030] In step 102, each frame of image can be divided into multiple grid regions according to the preset method. Figure 3 Each of the regions divided by the dotted line in the figure is the grid region.

[0031] The preset method can be set as needed. For example, if it is preset to divide the image into X grid regions, then according to the width W and height h of the image, the width W1 and height h1 of each grid region are calculated, and then the grid division is carried out. Among them, the width W and height h of the image can be calculated according to the collected image or preset in advance; or, the width W1 and height h1 of each grid region are preset, and at this time, the grid division can be carried out; the above is only an example and is not limited thereto. Among them, X is an integer greater than 0. When the image size remains unchanged, the larger X is, the smaller the divided grid regions are.

[0032] Among them, since the shooting background of each frame of image is the same (even if there is a slight difference in the background due to jitter during shooting, the background can be aligned through calibration), when mapped to the same coordinate system, the total area occupied by each frame of image is the same. That is, after each frame of image is divided into grids according to the preset method, the number of grid regions is the same, and the coordinate positions of the corresponding grid regions are the same; for example, each grid region of each frame of image is encoded in the same order (for example, from the first row to the last row, and in the order from left to right), and the grid regions with the same encoding in each frame of image are the corresponding grid regions.

[0033] Step 103 can be implemented in the following manner.

[0034] First, for each frame of image in sequence according to the arrangement order, motion recognition is performed, and the images containing the moving object are recognized. The recognized images containing the moving object are also arranged in sequence according to the acquisition time. Among them, for motion recognition, methods such as feature point extraction and matching in the prior art can be used, which will not be elaborated here. Suppose that among the 60 frames of images collected, only the 6th to 45th frames of images contain the moving object, while the 1st to 5th frames of images and the 46th to 60th frames of images do not contain the moving object. Then, only the 6th to 45th frames of images can be saved, and the 1st to 5th frames of images and the 46th to 60th frames of images can be discarded (i.e., deleted).

[0035] Second, for an image containing a moving object, determine the grid regions occupied by the moving object in each image, and select several frames of images from these images containing the moving object, where the grid regions occupied by the moving object in any two frames of the selected images do not overlap. Specifically, for example, each grid region can be numbered; then first select a frame of image, determine the numbers of the grid regions occupied by the moving object in the selected image, and the selected image is considered to be an image that meets the preset conditions. In the above example, the 6th frame of image can be selected, and it is confirmed that the numbers of the grid regions occupied by the moving object in the 6th frame of image are 1 and 2. Among them, the 6th frame of image is considered to be an image that meets the preset conditions; then, judge the grid regions occupied by the moving object in each image in the order of image arrangement. In the above example, screen the 7th to 45th frames of images in sequence. Suppose the numbers of the grid regions occupied by the moving object in the 7th frame of image are 3 and 4. Then it is judged that the grid regions occupied by the moving object in the 7th frame of image do not overlap with the grid regions occupied by the moving object in the 6th frame of image (the grid regions numbered 3 and 4 do not overlap with the grid regions numbered 1 and 2). Therefore, the 7th frame of image is considered to be an image that meets the preset conditions; the numbers of the grid regions occupied by the moving object in the 8th frame of image are 4, 6, and 7. Then it is judged that the grid regions occupied by the moving object in the 8th frame of image overlap with the grid regions occupied by the moving object in the 7th frame of image (both the 8th frame of image and the 7th frame of image occupy the grid region numbered 4). Therefore, the 8th frame of image is not an image that meets the preset conditions and can be discarded; the numbers of the grid regions occupied by the moving object in the 9th frame of image are 7, 9, and 10. Then it is judged that the grid regions occupied by the moving object in the 9th frame of image do not overlap with the grid regions occupied by the moving object in the 6th and 7th frames of image (the grid regions numbered 7, 9, and 10 do not overlap with the grid regions numbered 1 to 4). Therefore, the 9th frame of image can be considered to be an image that meets the preset conditions; and so on until the screening of the 45th frame of image is completed. Thus, the grid regions occupied by the moving object in any two frames of the selected several frames of images do not overlap. Among them, the selected image can be set as needed, and any frame of image in the images containing the moving object can be used as the selected image. For example, the 1st frame of image can be used as the selected image (such as the 6th frame of image in the above example).

[0036] Alternatively, step 103 can also be implemented in the following manner. In the order of arrangement, motion recognition is performed on each frame of image in turn. When an image containing a moving object is recognized, the grid area occupied by the moving object in the image is determined, and it is judged whether the grid area occupied by the moving object in the image overlaps with the grid areas occupied by the moving objects in other images. In the above example, motion recognition is performed on the first frame to the fifth frame of images in turn, and no moving object is recognized, so the first frame to the fifth frame of images are discarded; motion recognition is performed on the sixth frame of image and a moving object is recognized, and the numbers of the grid areas occupied by the moving object are determined to be 1 and 2. Since the sixth frame of image is the first one to recognize a moving object, the sixth frame of image is considered as the image that meets the preset conditions. Motion recognition is performed on the seventh frame of image and a moving object is recognized, and the numbers of the grid areas occupied by the moving object are determined to be 3 and 4. Then it is judged that the grid area occupied by the moving object in the seventh frame of image does not overlap with the grid area occupied by the moving object in the sixth frame of image (the grid areas numbered 3 and 4 do not overlap with the grid areas numbered 1 and 2), so the seventh frame of image is considered as an image that meets the preset conditions; the recognition methods for the eighth frame to the forty-fifth frame of images are similar to those in the above example and will not be elaborated here; no moving object is recognized in the forty-sixth frame to the sixtieth frame of images, so the forty-sixth frame to the sixtieth frame of images are discarded.

[0037] It should be emphasized that in this embodiment and subsequent embodiments, the moving object in the image refers to the picture of the moving object in the image.

[0038] In step 104, if the moving object in the image is separated from the background image, the separated moving objects in each frame of image are synthesized onto a background image. If the moving object in the image is not separated from the background image, direct synthesis is performed (if there is jitter during shooting, there may be some deviations between the background images of each frame of image, and the deviations can be calibrated first and then synthesis is performed). The synthesis methods here are all similar to the prior art and will not be elaborated here.

[0039] The second embodiment of the present invention relates to a method for synthesizing a motion trajectory. The second embodiment is substantially the same as the first embodiment, and the main difference is that: in the second embodiment of the present invention, motion recognition is performed on the currently acquired image, the images containing moving objects are screened out, and when no moving object is recognized in the continuously acquired images for multiple times, the acquisition is stopped.

[0040] As Figure 4 shown is a flowchart of the method for synthesizing a motion trajectory according to the second embodiment of the present invention; among them, steps 202 to 204 are the same as Figure 2Steps 102 to 104 are substantially the same as those in [reference], and will not be elaborated here. The difference lies in that in step 201, multiple frames of images are obtained, which includes the following sub-steps:

[0041] Sub-step 2011, collect images at a preset frequency;

[0042] Sub-step 2012, perform motion recognition on the currently collected image and determine whether the recognition is successful; if so, enter sub-step 2013, if not, enter sub-step 2014;

[0043] Sub-step 2013, add the currently collected image to the first image sequence set; return to sub-step 2011.

[0044] Sub-step 2014, discard the currently collected image; then enter sub-step 2015.

[0045] Sub-step 2015, accumulate the number of frames of continuously discarded images and determine whether the preset number of frames K is reached; if so, stop collecting and enter step 202; if not, return to sub-step 2011. Where K is a preset number of frames and K is greater than 1

[0046] In this embodiment, the first image sequence set, such as the sequence P, can be preset inside the electronic device. The electronic device performs motion recognition on the currently collected image in real time. If a moving object is recognized from the currently collected image, it means the recognition is successful, and the currently collected image is added to the first image sequence set P, that is, as an element Pi of the first image sequence set P, where i is an integer greater than or equal to 1, and i represents the sorting number of the image in the first image sequence set P; if no moving object is recognized from the currently collected image, it means the recognition is failed, and the currently collected image is discarded. Since the images added to the first image sequence set are added in the collection order, the images in the first image sequence set are arranged according to the collection time. For example, the sequence P = {P1, P2, P3,..., Pm}, indicating that m frames of images are obtained.

[0047] The electronic device also accumulates the number of frames of continuously discarded images, and determines whether the number of frames of continuously discarded images reaches a preset number of frames K. If the number of frames of continuously discarded images reaches the preset number of frames K, that is, no moving object is recognized in any of the continuously acquired K frames of images, it is considered that no moving object has been detected, and at this time, the acquisition is stopped. Among them, the preset number of frames K can be set according to actual experience or actual needs. For example, when K is 10, if no moving object is recognized in the 1st to 10th frames of the acquired images, the number of continuously discarded images is 10 frames, reaching the preset number of frames K. Therefore, it is considered that the moving object has never entered the shooting frame, and the acquisition is stopped (the synthesis of the current motion trajectory ends); or, a moving object is recognized in the 1st to 45th frames of the acquired images, and starting from the 46th frame, 10 frames are continuously acquired, and no moving object is recognized in the acquired images, that is, no moving object is recognized in the 46th to 56th frames of the acquired images, then it is considered that the moving object has run out of the shooting frame, and the acquisition is stopped; and the 1st to 45th frames of images are used as the acquired multiple frames of images. Suppose a moving object is recognized in the 1st to 30th frames of the acquired images, no moving object is recognized in the 31st to 35th frames of the acquired images, and a moving object is recognized in the 36th to 50th frames of the acquired images. Then, the 31st to 35th frames of images are discarded. However, since the number of discarded images is only 5 times, less than the preset number of frames K, the acquisition will not be stopped, and the 36th to 50th frames of images acquired subsequently are recorded, and the 1st to 30th frames of images and the 36th to 50th frames of images are used as the acquired images, that is, a total of 45 frames of images are acquired.

[0048] In this embodiment, in the synthesis of the motion trajectory, a motion recognition method is used to initially screen the acquired images. Whether to continue acquiring images or stop acquiring images is determined by whether the moving object is within the shooting frame, rather than acquiring a preset fixed number of frames of images as in the prior art; that is, in this embodiment, if it is detected that no moving object is recognized in any of the continuously acquired K frames of images, then even if the current number of images containing the moving object does not reach the preset fixed number of frames, the acquisition will be stopped, because even if the acquisition continues, since the moving object is no longer within the shooting frame, the acquired images are of no practical use for the synthesis of the motion trajectory; therefore, this embodiment is more in line with the actual needs of the motion trajectory synthesis during image acquisition, improving the effectiveness of image acquisition, and thus can improve the synthesis efficiency of the motion trajectory.

[0049] The third embodiment of the present invention relates to a method for synthesizing a motion trajectory. The third embodiment is substantially the same as the second embodiment, and the main difference is that: in the third embodiment of the present invention, a specific method for dividing a plurality of grid regions is provided.

[0050] As shown Figure 5 in the flowchart of the motion trajectory synthesis method of the third embodiment, wherein steps 301 and 304 are substantially the same as steps 201 and 204 in Figure 4 and will not be described herein again. The differences are as follows.

[0051] Step 302: Divide the image into multiple grid regions according to a preset method, including the following sub-steps:

[0052] Sub-step 3021: Select a frame of image containing the moving object from multiple frames of images, and determine the target box region of the moving object in the selected image; wherein, the moving object in the selected image is located in the target box region.

[0053] Since the third embodiment is an improvement based on the second embodiment, therefore, all the multiple frames of images obtained here are images containing the moving object and are arranged in the acquisition order; that is, the multiple frames of images in the first image sequence set P in the second embodiment. The selected image can be any frame of image in the first image sequence set P; for example, the first frame image P1 in the first image sequence set P can be selected, and the target box region R1 of the moving object in the selected image P1 can be determined, or, a frame of image in the middle of the first image sequence set P can be selected; or, the selected image can also be the image with the largest moving object among the first few frames of images arranged in the first image sequence set P. For example, compare the sizes of the moving objects in the first 3 frames of images P1, P2, and P3 in the first image sequence set P, and select the frame of image with the larger moving object. If the moving object in the second frame image is the largest, then the selected image is the second frame image P2 in the first image sequence set P. It should be noted that the selected image is not limited to the above examples, and the designer can set it according to actual needs. For example, the average value of the sizes of the moving objects in the multiple frames of images obtained or several of them can also be calculated, and the image where the moving object near the average value is located can be used as the selected image. Among them, for the same moving object, the closer it is to the camera during movement, the larger the moving object in the captured image, and the farther it is from the camera during movement, the smaller the moving object in the captured image.

[0054] In this embodiment, as Figure 6In this case, the target box area R1 is a rectangular box area. The target box area R1 can be the area where the minimum bounding rectangle of the moving object is located, so as to ensure that the moving object is located in the target box area R1. Alternatively, the target box area R1 can be similar in shape to the area where the minimum bounding rectangle is located, but the area is larger than the area where the minimum bounding rectangle is located. That is, after identifying the minimum bounding rectangle of the moving object, the minimum bounding rectangle is enlarged. The target box area R1 is slightly larger than R1min but preferably does not exceed 1 / 4 of the area where the minimum bounding rectangle is located. That is, the area ratio of the target box area to the area where the minimum bounding rectangle is located is greater than 1 and less than or equal to 5 / 4.

[0055] Sub-step 3022: Divide the selected image into multiple grid areas according to the size of the target box area; among them, the target box area is located in one of the grid areas.

[0056] In this embodiment, the target box area R1 is used as a basic cell to perform grid division on the image. For example, for the width W and height H of the image, starting from the coordinate position of one of the corner points of the target box area R1, using the width w1 and height h1 of the target box area R1 as the standards, the width W of the entire image is divided every w1 interval, and the height H of the entire image is divided into grid areas every h1 interval; preferably, for example, starting from the coordinate position of the upper corner point of the target box area R1. Therefore, the target box area is located in one of the grid areas; in this embodiment, the target box area is a grid cell, but it is not limited thereto. It should be noted that due to the limitations of the image width W and height H, the grid areas located at the edges of the image may be smaller than the target box area.

[0057] Step 303: Select several frames of images that meet the preset conditions from multiple frames of images; among them, the preset conditions include that the image contains a moving object and the grid areas occupied by the moving object in any two frames of images do not overlap, including the following sub-steps:

[0058] Sub-step 3031: Add the selected image to the second image sequence set and mark the grid area where the selected image is located as occupied.

[0059] Among them, a second image sequence set Q can be preset in the electronic device to store images that meet the preset conditions; the selected image is used as the basis for comparison with other images, so the selected image is considered to be an image that meets the preset conditions, added to the second image sequence set Q, and the grid area where the selected image is located is marked as occupied, where the grid area where the selected image is located is the above-mentioned target box area R1. In this embodiment, the grid areas already occupied by the moving object are marked for subsequent comparison.

[0060] Sub-step 3032: For each frame of the multi-frame images except the selected image, perform screening in the arranged order.

[0061] As Figure 7 shown, the screening method includes

[0062] Sub-step 3032-1: Determine whether the grid area where the moving object in the image is located is marked as occupied; if not, proceed to Sub-step 3032-2; if so, proceed to Sub-step 3032-3;

[0063] Sub-step 3032-2: Add the image to the second image sequence set and mark the grid area where the moving object in the image is located as occupied.

[0064] Sub-step 3032-3: Discard the image.

[0065] For each frame of the images in the first image sequence set P except the selected image, first determine the grid area where the moving object is located, and then determine whether the grid area where the moving object in the image is located is marked as occupied. In this embodiment, the target box area of the moving object in the image can be determined first, and then it is determined whether the grid area where the target box area of the moving object in the image is located is marked as occupied; if it is not marked as occupied, it is considered that the image meets the preset conditions and is added to the second image sequence set Q; if it is marked as occupied, it is considered that the image does not meet the preset conditions and the image is discarded. Among them, the number of grid areas where the target box area of the moving object is located can be one or more. If the number of grid areas where the target box area of the moving object is located is multiple, as long as one grid area is marked as occupied, it is considered that the image does not meet the preset conditions.

[0066] For example, set the second image sequence set Q. If the selected image from the first image sequence set P = {P1, P2, P3,..., Pm} is P1, then let Q1 = P1, and mark the grid area where P1 is located as occupied; screen P2 to Pm in the first image sequence set P = {P1, P2, P3,..., Pm} in turn. First, determine the target box area of the moving object in the currently screened image. When the target box area is not marked as occupied, add the image to the second image sequence set Q. If it is marked as occupied, discard the image. Specifically, the grid areas can be numbered, and the numbers are used to represent the grid areas where the moving objects in the images are located. Determine the numbers of the grid areas where the moving objects in the images are located, and judge whether the grid areas represented by the numbers have been marked as occupied. If they have been marked as occupied, it means that the image does not meet the preset conditions. For example, if the number of the grid area where P1 is located is 3, then mark the grid area numbered 3 as occupied; the number of the grid area where P2 is located is 5. Since the grid area numbered 5 is not marked as occupied, add P2 to the second image sequence set Q, that is, let Q2 = P2. At the same time, mark the grid area numbered 5 as occupied; the numbers of the grid areas where P3 is located are 6 and 7. Since the grid areas numbered 6 and 7 are not marked as occupied, add P3 to the second image sequence set Q, that is, let Q3 = P3. At the same time, mark the grid areas numbered 6 and 7 as occupied; the numbers of the grid areas where P4 is located are 7 and 8. Since the grid area numbered 7 is marked as occupied, discard P4; the number of the grid area where P5 is located is 8. Since the grid area numbered 8 is not marked as occupied, add P5 to the second image sequence set Q, that is, let Q4 = P5. At the same time, mark the grid area numbered 8 as occupied; and so on until the screening of Pm is completed. The second image sequence set Q = {Q1, Q2, Q3..., Qs}, which represents s frames of images that meet the preset conditions screened from m frames of images in the first image sequence set P, where s is an integer less than or equal to m.

[0067] In this embodiment, a specific method for dividing grid areas is proposed, that is, selecting the target box area of the moving object in a frame of image as the basic unit for division, where the moving object in the selected image is located in the target box area; the sizes of the grid areas divided in this way are appropriate, which is convenient for relatively quickly performing overlap judgment; because relative to the size of the moving object, if the grid area is too small, the moving object in each image will occupy multiple grid areas, then the workload consumed in the overlap judgment will be relatively large (because it is necessary to check whether each grid area is marked as occupied). If the grid area is too large, the distance between the moving objects in the images that meet the preset conditions screened out will be relatively large, resulting in a relatively large distance between adjacent moving objects in the finally synthesized motion trajectory, which affects the synthesis effect.

[0068] It should be noted that the third embodiment can also be an improvement based on the first embodiment; when the third embodiment is improved based on the first embodiment, since the method of motion recognition is not used to screen the collected images in step 301, there may be images that do not contain a moving object among the multiple frames of images obtained; in step 302, the selected image must contain a moving object. Therefore, the selected image can be the first frame among the multiple frames of images that contains a moving object.

[0069] The fourth embodiment of the present invention relates to a method for synthesizing a motion trajectory. The fourth embodiment is substantially the same as the third embodiment, and the main difference is that: in the fourth embodiment of the present invention, images in which the moving object suddenly becomes too large can be excluded to eliminate external interference and improve the synthesis effect of the motion trajectory.

[0070] As Figure 8 shown is the flowchart of the screening method in the fourth embodiment. Figure 8 It is an improvement based on Figure 7 On this basis, before sub-step 3032-1, it further includes sub-step 3032-0, which determines whether the target box area of the moving object in the image is entirely located within one grid area; if so, it proceeds to sub-step 3032-1, and if not, it proceeds to sub-step 3032-3.

[0071] Specifically, due to instability during shooting, the camera may suddenly approach or move away from the moving object. At this time, the moving object in the image will suddenly become larger, that is, the target box area of the moving object in the image will exceed one grid area (such as occupying two or more grid areas at the same time). Among them, when setting the target box area of the moving object, the target box area can be set to be slightly larger than the area where the minimum circumscribed rectangle of the moving object is located. As described in sub-step 3021 of the third embodiment, the area ratio of the target box area to the area where the minimum circumscribed rectangle is located can be greater than 1 and less than or equal to 5 / 4, so as to leave a normal variable margin. This normal variable margin refers to the change in the size of the moving object in the image caused by the normal approach or departure of the moving object from the camera during the movement process.

[0072] In this embodiment, when selecting images that meet the preset conditions, the judgment of the number of grid areas occupied is added, and moving objects that suddenly become too large can be excluded, that is, it is possible to avoid as much as possible inaccurate images captured due to unstable shooting from participating in the trajectory synthesis, thereby improving the synthesis effect and authenticity of the motion trajectory.

[0073] The fifth embodiment of the present invention relates to a method for synthesizing a motion trajectory. The fifth embodiment is substantially the same as the second embodiment, and the main difference is that: in the fifth embodiment of the present invention, images with an overly large moving object can be excluded, and when there is a phenomenon of an overly large moving object in consecutive multiple frames of images, it indicates that the shooting distance is very likely too close, and a prompt message is generated.

[0074] As Figure 9 shown is a flowchart of the method for synthesizing a motion trajectory according to the fifth embodiment of the present invention; among them, steps 602 to 604 are substantially the same as Figure 4 steps 202 to 204 in Figure 4 and will not be elaborated here. Step 601 includes sub-steps 6011 to sub-step 6019. Among them, sub-steps 6011 to 6012, sub-step 6014, sub-step 6018, sub-step 6019 and

[0075] sub-steps 2011 to 2015 in

[0076] are substantially the same and will not be elaborated here either. The difference is that it further includes:

[0077] Sub-step 6013, determining whether the moving object in the currently acquired image meets a preset size condition; where the size condition includes that the width of the moving object is less than half of the width of the currently acquired image, and the height of the moving object is less than the height of the currently acquired image. When the judgment result of sub-step 6013 is yes, enter sub-step 6014; when the judgment result of sub-step 6013 is no, then enter sub-step 6015, and then enter sub-step 6016.

[0078] Sub-step 6015, discarding the currently acquired image.

[0079] Sub-step 6016, accumulating the number of frames of continuously discarded images, and determining whether the preset number of frames L is reached; where L is a preset number of frames and L is greater than 1. If the judgment result is yes, then enter sub-step 6017, and then return to sub-step 601. If the judgment result is no, then directly return to sub-step 6011.

[0080] Sub-step 6017, generating a prompt message indicating that the moving object is too large.

[0081] Among them, sub-step 6015 and sub-step 6016 are similar to sub-step 6018 and sub-step 6019 respectively. However, the difference lies in that in sub-step 6015, the images with an overly large moving object are discarded, while in sub-step 6018, the images without a moving object are discarded; in sub-step 6016, the number of frames of continuously acquired images with an overly large moving object is accumulated, while in sub-step 6019, the number of frames of continuously acquired images without a recognized moving object is accumulated.

[0082] Therefore, in this embodiment, the images with an overly large moving object can be eliminated, and the photographer can be timely prompted that the shooting distance is too close, which is beneficial to collecting images containing a moving object with a more appropriate size for the synthesis of the motion trajectory, thereby improving the synthesis effect of the motion trajectory.

[0083] The step division of the above various methods is only for clear description. During implementation, they can be combined into one step or some steps can be split into multiple steps. As long as the same logical relationship is included, they are all within the protection scope of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs, but without changing the core design of its algorithm and process, are all within the protection scope of this patent.

[0084] The sixth embodiment of the present invention relates to an electronic device, as Figure 10 shown, including:

[0085] At least one processor 10; and,

[0086] A memory 11 communicatively connected to the at least one processor;

[0087] A camera 12 connected to the at least one processor and the memory;

[0088] Among them, the camera 12 is used to collect images; the memory 11 stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor 10 so that the at least one processor 10 can execute the above method embodiments.

[0089] Among them, the memory 11 and the processor 10 are connected in a bus manner. The bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors 10 and the memory 11 together. The bus may also connect various other circuits together, such as peripheral devices, voltage regulators, and power management circuits, etc., which are well known in the art, so they will not be further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or multiple elements, such as multiple receivers and transmitters, and provides a unit for communicating with various other devices on the transmission medium. The data processed by the processor 10 is transmitted on the wireless medium through the antenna. Further, the antenna also receives data and transmits the data to the processor 10.

[0090] The processor 10 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. The memory 11 can be used to store the data used by the processor 10 when executing operations.

[0091] The seventh embodiment of the present invention relates to a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the above method embodiments are implemented.

[0092] That is, those skilled in the art can understand that all or part of the steps in implementing the above method embodiments can be completed by instructing relevant hardware through a program. The program is stored in a storage medium, including several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.

[0093] Those of ordinary skill in the art can understand that the above embodiments are specific embodiments for implementing the present invention, and in practical applications, various changes can be made in form and details without departing from the spirit and scope of the present invention.

Claims

1. A method for synthesizing a motion trajectory, characterized in that, it includes: Obtain multiple frames of images; wherein, the multiple frames of images are arranged according to the acquisition time; Divide the multiple frames of images into multiple grid regions respectively according to a preset method; Select several frames of images that meet the preset conditions from the multiple frames of images; wherein, the preset conditions include that the several frames of images all contain a moving object and the grid regions occupied by the moving object in any two frames of images do not overlap; Synthesize the motion trajectory of the moving object according to the selected several frames of images.

2. The method for synthesizing a motion trajectory according to claim 1, characterized in that, the obtaining of the multiple frames of images includes: Collect images at a preset frequency; Perform motion recognition on the currently collected image. If a moving object is recognized from the currently collected image, add the currently collected image to the first image sequence set; wherein, the first image sequence set contains the multiple frames of images obtained; If the moving object is not recognized from K consecutive frames of images, stop collecting; where K is a preset number of frames and K>1.

3. The method for synthesizing a motion trajectory according to claim 1, characterized in that, the dividing of the multiple frames of images into multiple grid regions respectively according to a preset method includes: Select a frame of image containing a moving object from the multiple frames of images, and determine the target box region of the moving object in the selected image; wherein, the moving object in the selected image is located in the target box region; Divide the selected image into multiple grid regions according to the size of the target box region; wherein, the target box region is located in one of the grid regions.

4. The method for synthesizing a motion trajectory according to claim 3, characterized in that, the selecting of several frames of images that meet the preset conditions from the multiple frames of images includes: Add the selected image to the second image sequence set, and mark the grid region where the selected image is located as occupied; For each frame of image other than the selected image in the multiple frames of images, perform screening in the arrangement order. The screening method includes that when it is determined that the grid region where the moving object in the image is located is not marked as occupied, add the image to the second image sequence set, and mark the grid region where the moving object in the image is located as occupied; wherein, the second image sequence set contains the several frames of images that meet the preset conditions.

5. The method for synthesizing a motion trajectory according to claim 4, characterized in that, the determination that the grid region where the moving object in the image is located is not marked as occupied includes: Determine the target box region of the moving object in the image; Determine that the grid region where the target box region of the moving object in the image is located is not marked as occupied.

6. The method for synthesizing a motion trajectory according to claim 4, characterized in that, before the determination that the grid region where the target box region of the moving object in the image is located is not marked as occupied, it further includes: Determine that the target box region of the moving object in the image is entirely located within one of the grid regions.

7. The method for synthesizing a motion trajectory according to claim 2, wherein, after identifying the moving object from the currently acquired image and before adding the currently acquired image to the first image sequence set, it further includes: judging that the moving object in the currently acquired image meets a preset size condition, wherein the size condition includes that the width of the moving object is less than half of the width of the currently acquired image, and the height of the moving object is less than the height of the currently acquired image; if the moving object in the continuously acquired L frames of images does not meet the size condition, a prompt message indicating that the moving object is too large is generated; where L is a preset number of frames and L is greater than 1.

8. The method for synthesizing a motion trajectory according to any one of claims 3 to 6, wherein, the target frame area is the area where the minimum circumscribed rectangle of the moving object is located; or, the target frame area is similar in shape to the area where the minimum circumscribed rectangle is located, and the area ratio is greater than 1 and less than or equal to 5 / 4.

9. An electronic device, wherein, it includes: at least one processor; and, a memory communicatively connected to the at least one processor; a camera connected to the at least one processor and the memory; wherein, the camera is used to acquire images; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for synthesizing a motion trajectory according to any one of claims 1 to 8.

10. A computer-readable storage medium storing a computer program, wherein, the computer program, when executed by a processor, implements the method for synthesizing a motion trajectory according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Grid-based relay tracking method and device in online class

    CN104751489A

  • Output apparatus, output method and program

    US20080152193A1