Image synthesis method, electronic device and storage medium
By filtering and processing the original image sequence, ensuring that the moving targets are complete and have no overlap in the motion trajectory synthesis image, the problem that the moving targets may not contain or overlap in the prior art is solved, and a clear motion trajectory display is achieved.
Patent Information
- Application Number
- CN201811354312.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-11-14
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2038-11-14
AI Technical Summary
In the prior art, when the moving target is in the preview area of the imaging device, the different movement speed and direction lead to the multiple frames of the original image that may not contain the moving target or the overlap of the moving targets, and the motion trajectory cannot be clearly obtained.
By filtering out the original image containing the moving target from the original image sequence set, the basic frame image sequence set is obtained, and the original image containing the complete moving target is then filtered out, the effective frame image sequence set is obtained, and the preferred image is filtered according to the target overlap requirements. Sequence set, finally obtain the synthesized image of the motion trajectory of the moving target.
Ensure that the moving targets in the motion trajectory synthesis image are intact and free from incompleteness, and meet the user's requirements for the overlap of motion targets, and obtain a clear motion trajectory.
Smart Images

Figure CN111192286B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of image processing technology, and in particular to an image synthesis method, electronic equipment and storage medium. Background Art
[0002] When a moving target is active, multiple frames of original images can be captured by a camera device. Images are extracted from the multiple frames of original images at fixed intervals, and then the extracted images are synthesized to obtain a composite image of the moving target. The motion trajectory of the moving target can be obtained through the synthesized image.
[0003] The inventors have discovered that there are at least the following problems in the prior art: when a moving target passes through a preview area of a camera device of constant length, the moving target may not be included in the multiple frames of original images captured, or the moving targets may overlap in the synthesized images, resulting in an inability to see a clear motion trajectory of the moving target. Therefore, the image synthesis method in the prior art cannot meet the needs of users. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide an image synthesis method, an electronic device and a storage medium, so as to obtain a complete motion trajectory synthesis image of a moving target that meets the overlap requirements.
[0005] To solve the above technical problems, an embodiment of the present invention provides an image synthesis method, comprising the following steps: screening out original images containing moving targets from an original image sequence set to obtain a basic frame image sequence set; screening out original images containing complete moving targets from the basic frame image sequence set to obtain a valid frame image sequence set; screening out original images that meet target coincidence requirements from the valid frame image sequence set to obtain a preferred image sequence set; and obtaining a motion trajectory synthetic image of the moving target based on the preferred image sequence set.
[0006] An embodiment of the present invention also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein 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 image synthesis method in the embodiment of the present application.
[0007] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program, which implements the image synthesis method in the embodiment of the present application when the computer program is executed by a processor.
[0008] Compared with the prior art, the embodiments of the present invention screen out original images containing moving targets from the original image sequence set, and then screen out original images containing complete moving targets on this basis, thereby ensuring that there is no incomplete moving target in the obtained motion trajectory composite picture, and by screening out original images that meet the target overlap requirements, it can be further ensured that the composite image meets the user's requirements for the overlap of moving targets, thereby finally obtaining a complete motion trajectory composite image of the moving target that meets the overlap requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0010] Figure 1 is a flowchart of the image synthesis method in the first embodiment of the present application;
[0011] Figure 2 This is a schematic diagram of determining the target frame area in the first embodiment of the present application;
[0012] Figure 3 This is a schematic diagram of determining a valid frame image sequence set in the first embodiment of the present application;
[0013] Figure 4 is a flowchart of an image synthesis method in a second embodiment of the present application;
[0014] Figure 5 This is a schematic diagram of determining a preferred image sequence set in the second embodiment of the present application;
[0015] Figure 6 It is a schematic diagram of the structure of the electronic device in the third embodiment of the present application. DETAILED DESCRIPTION
[0016] In order to make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the following will be described in detail with reference to the accompanying drawings. However, it will be appreciated by those skilled in the art that in the various embodiments of the present invention, many technical details are provided in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can be implemented.
[0017] The first embodiment of the present invention relates to an image synthesis method. The specific process is as follows Figure 1 As shown, the following steps are included:
[0018] Step 101: Filter out original images containing moving objects from an original image sequence set to obtain a basic frame image sequence set.
[0019] In this embodiment, before filtering out the original image containing the moving target from the original image sequence set, it is necessary to first obtain the original image sequence set, wherein the original image sequence set includes multiple frames of original images continuously shot at a preset interval. For example, a specific method of obtaining the original image sequence set may be to keep the camera device stable, that is, the preview area of the camera device remains unchanged, and after clicking the camera button of the camera device, multiple frames of original images are shot at a frame rate of 1 / 10, that is, every 0.1 second interval to obtain multiple frames of original images, so that the multiple frames of original images continuously shot at 0.1 second intervals constitute the original image sequence set A = {A1, A2, ..., An}.
[0020] Specifically, in this embodiment, there may be no moving target in the obtained original image sequence set, so each frame of the original image in the original image sequence set is detected to determine whether there is a moving target. When it is determined that there is no moving target in the original image, the frame of the original image is deleted. When it is determined that there is a moving target in the original image, the frame of the original image is retained, and all the retained original images constitute a basic frame image sequence set B = {B1, B2, ...., Bm}, and m≤n, thereby ensuring that each frame image in the basic frame image sequence set contains a moving target. In this embodiment, the detection can be specifically performed by image recognition. Since image detection is not the focus of this application, it will not be described in detail in this embodiment.
[0021] It is worth mentioning that in the implementation of the present application, after obtaining the basic frame image sequence set, it is often necessary to determine the target frame area of the original image in the basic frame image sequence set, wherein the target frame area is the minimum area containing all pixels of the moving target. Figure 2 As shown, it is a schematic diagram for determining the target frame area. In this embodiment, a rectangular frame is used as an example for explanation. Of course, it can also be a circular frame or an irregular closed curve frame. In this embodiment, the specific shape of the target frame area is not limited. As long as it is the minimum area containing all the pixels of the moving target, any shape is within the protection scope of this application.
[0022] Step 102: Filter out original images containing complete moving targets from the basic frame image sequence set to obtain a valid frame image sequence set.
[0023] Specifically, the effective frame image sequence set can be obtained by determining the preview area and the boundary margin of the camera device; determining the effective frame area according to the preview area and the boundary margin; and selecting the original image whose target frame area is located in the effective frame area from the basic frame image sequence set to obtain the effective frame image sequence set. This ensures that the moving target in each frame of the original image in the effective frame image sequence set is complete and there is no incomplete situation.
[0024] In a specific implementation, Figure 3 As shown in the figure, it is a schematic diagram for determining a valid frame image sequence set. As shown in the solid line frame in the figure, it is a preview area of the camera device, with the upper left corner of the preview area of the camera device as the origin, the upper frame of the preview area as the x-axis, and the right side of the x-axis as the positive direction of the x-axis, the left frame of the preview area as the y-axis, and the bottom of the y-axis as the positive direction of the y-axis, and the boundary margin set by the user is determined to be Dmin, then the horizontal coordinate of the left frame of the preview area is added to Dmin to obtain the horizontal coordinate of the left frame of the valid frame area, and the horizontal coordinate of the right frame of the preview area is subtracted from Dmin to obtain the horizontal coordinate of the right frame of the valid frame area, and the vertical coordinate of the upper frame and the vertical coordinate of the lower frame of the valid frame area are respectively greater than 0 and less than the vertical coordinate of the lower frame of the preview area, and the vertical coordinate of the upper frame of the valid frame area is less than the vertical coordinate of the lower frame of the valid frame area, so as to determine the valid frame area W, delete the original images that are not located in the valid frame area in the basic frame image sequence set, and filter out the original images located in the valid frame area W, and obtain the valid frame image sequence set P = {P1, P2, ...., Pe}, and e≤m. Thereby, the moving target in each frame of the original image in the effective frame image sequence is complete.
[0025] Step 103: select original images that meet the target coincidence requirement from the valid frame image sequence set to obtain a preferred image sequence set.
[0026] Specifically, in this embodiment, although the valid frame image sequence set ensures that the moving targets in each frame image are complete and there is no incomplete situation, there may be overlaps in multiple frames of original images. Therefore, according to the overlap of the targets in each frame of the original image, multiple non-overlapping frames of original images can be screened out, and the obtained multiple non-overlapping frames of original images constitute a preferred image sequence set, Q = {Q1, Q2, ...., Qs}, and s≤e.
[0027] Step 104: obtaining a motion trajectory composite image of the moving target according to the preferred image sequence set.
[0028] Specifically, in this embodiment, the moving target in each frame of the preferred image in the preferred image sequence set is extracted, and a motion trajectory composite image is obtained according to each extracted moving target.
[0029] It should be noted that after obtaining the preferred image sequence set, image recognition can be performed on each frame of the original image in the preferred image sequence set, so as to extract the moving target in each frame of the original image, and save each moving target in an image in the order of extraction, so as to obtain a composite image of the motion trajectory of the moving target.
[0030] Compared with the prior art, the image synthesis method provided in the present embodiment filters out the original images containing the moving target from the original image sequence set, and on this basis further filters out the original images containing the complete moving target, thereby ensuring that there is no incomplete moving target in the obtained motion trajectory composite picture, and by filtering out the original images that meet the target overlap requirements, it can further ensure that the composite image meets the user's requirements for the overlap of the moving target, thereby finally obtaining a complete motion trajectory composite image of the moving target that meets the overlap requirements.
[0031] The second embodiment of the present invention relates to an image synthesis method. This embodiment is further improved on the basis of the first embodiment. The specific improvement is: a method for obtaining a preferred image sequence set is described in detail. The process of the image synthesis method in this embodiment is as follows: Figure 4 Specifically, in this embodiment, steps 201 to 207 are included, wherein steps 201 to 202 are substantially the same as steps 101 to 102 in the first embodiment, and step 207 is substantially the same as step 104 in the first embodiment, which will not be described in detail here. The following mainly introduces the differences. For technical details not described in detail in this embodiment, please refer to the image synthesis method provided in the first embodiment, which will not be described in detail here.
[0032] After step 201 to step 202, step 203 is executed.
[0033] Step 203: The first original image frame in the valid frame image sequence set is used as the first preferred image frame in the preferred image sequence set.
[0034] Specifically, in this embodiment, when obtaining the preferred image sequence set based on the valid image sequence set, the first frame of the original image in the valid frame image sequence set is first determined. Because each frame of the original image is obtained by shooting at different times, according to the acquisition time of each frame of the original image in the valid frame image sequence set, the frame of the original image with the earliest acquisition time is determined as the first frame of the original image P1 in the valid frame image sequence set, and P1 is used as the first frame of the preferred image Q1 in the preferred image sequence set.
[0035] Step 204: Set the pixels of the moving target in the first frame preferred image to be in a selected state.
[0036] After determining the first frame preferred image Q1 in the preferred image sequence set, the pixels of the moving target in Q1 can be set to a selected state. For example, in practical applications, the grayscale values of the pixels of the moving target in Q1 can be transformed, and the pixels of the moving target can be determined to be selected through the change of the grayscale value of the moving target. For example, from the user's visual effect, the image of the moving target in the selected state is black.
[0037] Step 205: remove the first frame of the original image from the valid frame image sequence set to filter out the original images that meet the target coincidence requirement.
[0038] Specifically, the selection method for the remaining images in the preferred image sequence set is to determine them according to the target coincidence of each frame of the original image. The specific method may be to determine the target coincidence of each frame of the original image in the valid frame image sequence set except the first frame of the original image, wherein the target coincidence represents the ratio of the number of pixels in the selected state in the target frame area to the total number of pixels; and screen out the original images whose target coincidence is less than a preset threshold.
[0039] After screening out the original images whose target overlap is less than a preset threshold, the method further includes: setting the pixels of the moving targets in the original images whose target overlap is less than the preset threshold to a selected state.
[0040] It should be noted that the target overlap in this embodiment can be represented by the letter G, and the preset threshold is represented by the letter GT, and when GT=0, it means that the moving targets in the original images of adjacent frames are required to be completely non-overlapping, and when GT is not equal to 0 and the value is relatively small, it means that the moving targets in the original images of adjacent frames can have a small amount of edge overlap, so the overlap between the moving targets in the motion trajectory composite image can be controlled by setting the size of GT. The smaller the GT, the smaller the overlap between the moving targets in the motion trajectory composite image. In this embodiment, GT=0 is used as an example for explanation, that is, it is required that there is no overlap between the moving targets in the motion trajectory composite image.
[0041] For example, take the Q2 determination method as an example. Figure 5The figure shows a schematic diagram of determining the preferred image sequence set, where P1 is determined as Q1, i.e., the black moving target in the figure, and the target coincidence G in P2 is 10%, which is greater than GT, so P2 is eliminated, and the target coincidence G in P3 is 0, which is equal to GT, so P3 is retained and used as Q2. And after determining Q2, it is also necessary to set the pixels of the moving target in Q2 to the selected state, and the specific method is similar to the setting method of Q1, so it will not be repeated in this embodiment. Of course, this embodiment only takes Q2 as an example for explanation, and the determination method for the remaining images in the preferred image sequence set is similar to that of Q1, so it will not be repeated in this embodiment.
[0042] Step 206: Obtain a preferred image sequence set based on the first frame preferred image and the original image that meets the target coincidence requirement.
[0043] It should be noted that after determining the first frame preferred image and the original image that meets the target coincidence requirement, the first frame preferred image and the original image that meets the target coincidence requirement are sorted in the order of acquisition time, and the sorted images constitute a preferred image sequence set.
[0044] After step 206, step 207 is executed.
[0045] Compared with the prior art, the image synthesis method provided in this embodiment selects the original images containing the moving target from the original image sequence set, and then selects the original images containing the complete moving target on this basis, so as to ensure that there is no incomplete moving target in the obtained motion trajectory synthesis picture, and by selecting the original images that meet the target overlap requirements, it can further ensure that the synthesized image meets the user's requirements for the overlap of the moving target, so as to finally obtain a complete motion trajectory synthesis image of the moving target that meets the overlap requirements. And by comparing each frame image in the effective frame image sequence set with the preset threshold using the target overlap, a preferred image sequence set is obtained, so as to further ensure the accuracy of the images obtained in the preferred image sequence set.
[0046] The step division of the above methods is only for the purpose of clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this patent.
[0047] A third embodiment of the present invention relates to an electronic device, such as Figure 6As shown, it includes at least one processor 501; and a memory 502 that is communicatively connected to the at least one processor 501; wherein the memory 502 stores instructions that can be executed by the at least one processor 501, and the instructions are executed by the at least one processor 501 so that the at least one processor 501 can execute the image synthesis method in the above-mentioned embodiment.
[0048] In this embodiment, the processor 501 is a central processing unit (CPU) as an example, and the memory 502 is a readable and writable random access memory (RAM) as an example. The processor 501 and the memory 502 can be connected via a bus or other means. Figure 5 In the example, the bus connection is used. The memory 502 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. For example, the program for implementing the image synthesis method in the embodiment of the present application is stored in the memory 502. The processor 501 executes various functional applications and data processing of the device by running the non-volatile software programs, instructions and modules stored in the memory 502, that is, implementing the above-mentioned image synthesis method.
[0049] The memory 502 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store a list of options, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 502 may optionally include a memory remotely arranged relative to the processor 501, and these remote memories may be connected to an external device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0050] One or more program modules are stored in the memory 502 , and when executed by one or more processors 501 , the image synthesis method in any of the above method embodiments is executed.
[0051] The above-mentioned product can execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of the present application.
[0052] The sixth embodiment of the present application relates to a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the image synthesis method involved in any method embodiment of the present invention can be implemented.
[0053] Those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0054] Those skilled in the art will appreciate that the above-mentioned embodiments are specific examples for implementing the present invention, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present invention.
Claims
1. An image synthesis method, characterized in that: include: Filter out original images containing moving targets from the original image sequence set to obtain a basic frame image sequence set; Screening out original images containing complete moving targets from the basic frame image sequence set to obtain a valid frame image sequence set; Screening out the original images that meet the target coincidence requirement from the valid frame image sequence set to obtain a preferred image sequence set; Obtaining a motion trajectory composite image of the moving target according to the preferred image sequence set; The step of selecting the original image containing the complete moving target from the basic frame image sequence set to obtain the valid frame image sequence set specifically includes: Determining a preview area and a border margin of a camera device; Determine a valid frame area according to the preview area and the border margin; Filtering the original image whose target frame area is within the valid frame area from the basic frame image sequence set to obtain the valid frame image sequence set; The target frame area is the smallest rectangular area that includes all pixels of the moving target.
2. The image synthesis method according to claim 1, characterized in that: Before the original image containing the moving target is screened out from the original image sequence set to obtain the basic frame image sequence set, the method further includes: An original image sequence set is acquired, wherein the original image sequence set includes a plurality of frames of original images continuously shot at preset intervals.
3. The image synthesis method according to claim 1, characterized in that: Before the original image containing the complete moving target is screened out from the basic frame image sequence set to obtain the valid frame image sequence set, the method further includes: Determine a target frame area of the original image in the basic frame image sequence set.
4. The image synthesis method according to claim 1, characterized in that: The step of selecting the original images that meet the target coincidence requirement from the valid frame image sequence set to obtain a preferred image sequence set specifically includes: Taking the first frame original image in the valid frame image sequence set as the first frame preferred image in the preferred image sequence set; Setting the pixels of the moving target in the first frame preferred image to a selected state; Remove the first frame original image from the valid frame image sequence set to filter out the original image that meets the target coincidence requirement; The preferred image sequence set is obtained according to the first frame preferred image and the original image that meets the target coincidence requirement.
5. The image synthesis method according to claim 4, characterized in that: The removing the first frame original image from the valid frame image sequence set to select the original image that meets the target coincidence requirement specifically includes: Determine the target coincidence of each frame of the original image except the first frame of the original image in the valid frame image sequence, wherein the target coincidence represents the ratio of the number of pixels in the selected state to the total number of pixels in the target frame area; The original images whose target coincidence degree is less than a preset threshold are screened out.
6. The image synthesis method according to claim 5, characterized in that: After screening out the original images whose target coincidence degree is less than a preset threshold, the method further includes: The pixels of the moving target in the original image whose target coincidence degree is less than a preset threshold are set to a selected state.
7. The image synthesis method according to any one of claims 1 to 6, characterized in that: The step of obtaining the motion trajectory composite image of the moving target according to the preferred image sequence set specifically includes: Extracting a moving target from each frame of the preferred image in the preferred image sequence set; The motion track composite image is obtained according to each of the extracted motion targets.
8. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the image synthesis method according to any one of claims 1 to 7.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the image synthesis method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method of extracting shape variation descriptor for retrieving image sequence
US20040170327A1