Star orbit image synthesis method, device and equipment and storage medium

By fusing star and star trail mask images, the problem of poor visual effects in star trail images was solved, achieving a better visual effect.

CN117152039BActive Publication Date: 2026-08-04ARASHI VISION INC
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ARASHI VISION INC
Filing Date
2023-09-15
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

The visual quality of star trail images captured using existing technologies is poor.

Method used

By fusing the current star mask image with the previous star trail mask image, the current star trail mask image is determined. Then, the star sky image is synthesized based on the star trail mask image to obtain the current star trail image.

Benefits of technology

The visual quality of star trail images has been improved by ensuring that only the trails of stars are included in the images without any other objects being superimposed on them.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117152039B_ABST
    Figure CN117152039B_ABST
Patent Text Reader

Abstract

The application relates to a star orbit image synthesis method, device and equipment and a storage medium. The method comprises the following steps: determining a first star mask image according to a first starry sky image at a current moment, and obtaining a first star orbit mask image at a previous moment; the first star orbit mask image comprises star orbits formed by stars at the previous moment and stars at a previous time moment; performing fusion processing on the first star mask image and the first star orbit mask image to determine a second star orbit mask image at the current moment; the second star orbit mask image comprises star orbits at the previous moment and star orbits formed by stars at the current moment; and performing synthesis processing on the first starry sky image according to the second star orbit mask image to determine a star orbit image at the current moment. The method can improve the visual effect of the obtained star orbit image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for synthesizing star trail images. Background Technology

[0002] Star trails are an optical phenomenon, appearing as long-exposure images of stars moving across the sky. In most techniques for capturing star trail images, the camera is fixed in a favorable position, and a long exposure is taken to capture the image.

[0003] However, the visual quality of the star trail images obtained by the above techniques is poor. Summary of the Invention

[0004] Therefore, it is necessary to provide a star trail image synthesis method, apparatus, device, and storage medium that can improve the visual effect of the obtained star trail images, in order to address the above-mentioned technical problems.

[0005] In a first aspect, this application provides a method for synthesizing star trail images, the method comprising:

[0006] The first star mask image is determined based on the first star sky image at the current moment, and the first star orbit mask image at the previous moment is obtained; the first star orbit mask image includes the stars at the previous moment and the star orbits formed by the stars at the previous moments.

[0007] The first star mask image and the first star orbit mask image are fused to determine the second star orbit mask image at the current moment; the second star orbit mask image includes the star orbit formed by the star at the previous moment and the star at the current moment.

[0008] The first starscape image is synthesized based on the second star trail mask image to determine the star trail image at the current moment.

[0009] In one embodiment, determining the first star mask image based on the first starry sky image at the current moment includes:

[0010] Perform star detection processing on the first starry sky image to determine the first star mask image.

[0011] In one embodiment, the above-described star detection processing of the first starry sky image to determine the first star mask image includes:

[0012] Iterate through each pixel in the first starry sky image, and determine the background area corresponding to the current pixel according to a preset range, with the current pixel as the center.

[0013] Based on the pixels in the background area and the current pixel, detect whether the current pixel is a star and obtain the detection result;

[0014] The first star mask image was determined based on the detection results.

[0015] In one embodiment, determining the first star mask image based on the detection result includes:

[0016] If the detection result indicates that the current pixel is not a star, then the preset range is increased to obtain a new preset range;

[0017] The new background region is determined based on the new preset range, and the process returns to the above steps of detecting whether the current pixel is a star based on the pixels in the background region and the current pixel, and obtaining the detection result, until the preset iteration cutoff condition is met.

[0018] In one embodiment, the above iteration cutoff condition includes at least one of the following:

[0019] The current pixel is a star;

[0020] The preset number of iterations has been reached.

[0021] The new preset range is greater than or equal to the preset maximum range; the aforementioned preset maximum range is related to the exposure time and resolution of the first starry sky image.

[0022] In one embodiment, the above-mentioned method of detecting whether the current pixel is a star based on the pixels in the background area and the current pixel, and obtaining the detection result, includes:

[0023] Based on the pixel values ​​of the pixels in the background area, determine the first pixel with the largest pixel value and the second pixel with the smallest pixel value in the background area;

[0024] Based on the pixel values ​​of the first pixel, the second pixel, and the current pixel, determine whether the current pixel is a star and obtain the detection result.

[0025] In one embodiment, the above-described method of determining the background region corresponding to the current pixel according to a preset range, centered on the current pixel, includes:

[0026] Determine the border surrounding the current pixel based on a preset range, with the current pixel as the center.

[0027] Define the area contained within the border as the background area.

[0028] In one embodiment, before performing star detection processing on the first starry sky image to determine the first star mask image, the method further includes:

[0029] Region detection is performed on the first starry sky image to determine the effective regions in the first starry sky image; the effective regions are the regions where stars exist.

[0030] Accordingly, the above-mentioned star detection processing of the first starry sky image to determine the first star mask image includes:

[0031] Star detection processing is performed on the effective region in the first starry sky image to determine the first star mask image.

[0032] In one embodiment, the above-mentioned region detection of the first starry sky image to determine the effective region in the first starry sky image includes:

[0033] Detect whether the color values ​​of the three channels of each point in the first starry sky image meet the invalid threshold condition;

[0034] If a target point meets the invalid threshold condition, then the target point is determined to be invalid.

[0035] The region in the first starry sky image, excluding invalid points, is determined as the valid region.

[0036] In one embodiment, the above-mentioned region detection of the first starry sky image to determine the effective region in the first starry sky image includes:

[0037] Median filtering is applied to the first starry sky image to determine the median filtered image;

[0038] The effective region is determined based on the difference between the first starry sky image and the median filtered image.

[0039] In one embodiment, the above-described fusion process of the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment includes:

[0040] Perform a union operation on the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment.

[0041] In one embodiment, after fusing the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment, the method further includes:

[0042] The first candidate star trail mask image is obtained according to a preset first time interval or a preset first image interval;

[0043] Noise points in the first candidate star trail mask image are removed to determine a new first candidate star trail mask image.

[0044] In one embodiment, after fusing the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment, the method further includes:

[0045] The second candidate star trail mask image is obtained according to a preset second time interval or a preset second image interval;

[0046] Star detection processing is performed on the second candidate star orbit mask image to determine a new second candidate star orbit mask image.

[0047] In one embodiment, the above-mentioned synthesis processing of the first starscape image based on the second star trail mask image to determine the star trail image at the current moment includes:

[0048] Obtain the preset star trail image corresponding to the current moment;

[0049] Determine the star trail region and non-star trail region in the preset star trail image based on the second star trail mask image;

[0050] The first starscape image is synthesized based on the star trail region and the non-star trail region to determine the star trail image at the current moment.

[0051] In one embodiment, the above-mentioned synthesis processing of the first starscape image based on star trail regions and non-star trail regions to determine the star trail image at the current moment includes:

[0052] The maximum brightness value is replaced in the star trail region of the preset star trail image and the star trail region of the first star sky image, and the corresponding region in the preset star trail image is replaced with the non-star trail region in the first star sky image to obtain the star trail image at the current moment.

[0053] In one embodiment, the above-mentioned process of replacing the maximum brightness value of the star trail region in the preset star trail image and the star trail region in the first starry sky image includes:

[0054] Detect whether the brightness of the pixels in the star trail region of the first star image is greater than the brightness of the pixels at the corresponding positions in the preset star trail image;

[0055] If the value is greater than the value in the preset star trail image, the pixel value of the pixel point in the star trail region of the first star sky image will be used to replace the pixel value at the corresponding pixel position in the preset star trail image.

[0056] In one embodiment, the method further includes:

[0057] The star trail image at the current moment is determined as the preset star trail image for the next moment.

[0058] In one embodiment, the method further includes:

[0059] If the brightness of a non-star target pixel in the first starry sky image is greater than the brightness of the corresponding pixel in the preset star trail image, then the target pixel value of the target pixel in the preset star trail image is obtained.

[0060] If the pixel value of the target pixel in the candidate star image is less than the target pixel value, then the pixel value of the target pixel in the star trail image corresponding to the candidate star image is replaced with the target pixel value; the above candidate star images are star images of candidate times after the current time.

[0061] In one embodiment, the method further includes:

[0062] Obtain the third star mask image, the third star orbit mask image, and the third star sky image corresponding to any given moment;

[0063] The star trail regions in the third starscape image are synthesized based on the third star mask image and the third star trail mask image to determine the star trail image corresponding to any given moment.

[0064] In one embodiment, the method further includes:

[0065] The star trail images at various times are arranged according to their temporal sequence to obtain a star trail video.

[0066] Secondly, this application also provides a star trail image synthesis apparatus, the apparatus comprising:

[0067] The star mask determination module is used to determine a first star mask image based on the first star sky image at the current moment and to obtain a first star orbit mask image at the previous moment; the first star orbit mask image includes the stars at the previous moment and the star orbits formed by the stars at the previous moments.

[0068] The star trail mask determination module is used to fuse the first star mask image and the first star trail mask image to determine the second star trail mask image at the current moment; the second star trail mask image includes the star trail formed by the star trails of the previous moment and the stars at the current moment.

[0069] The star trail image synthesis module is used to synthesize the first star sky image based on the second star trail mask image to determine the star trail image at the current moment.

[0070] Thirdly, this application also provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in the first aspect.

[0071] Fourthly, this application also provides a shooting device, including: a camera; and the computer device described in the third aspect connected to the camera.

[0072] Fifthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in the first aspect.

[0073] In a sixth aspect, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.

[0074] The aforementioned star trail image synthesis method, apparatus, device, and storage medium acquire a first star mask image at the current moment and a first star trail mask image at the previous moment, fuse the star and star trail mask images from the two moments to determine a second star trail mask image at the current moment, and then synthesize a first starscape image based on the second star trail mask image to determine the star trail image at the current moment. The first star trail mask image includes the stars from the previous moment and the star trails formed by stars from moments before that, while the second star trail mask image includes the star trails from the previous moment and the star trails formed by stars from the current moment. In this method, because a star trail image containing only stars at the current moment is obtained by fusing the acquired star mask images and / or star trail mask images from various moments, and the starscape image is synthesized based on this star trail image, only the stars from multiple moments are fused to obtain the star trail mask and thus the star trail image, without overlaying other objects in the starscape image. Therefore, the visual effect of the star trails in the synthesized star trail image is better. Attached Figure Description

[0075] Figure 1 An example diagram of a shooting device provided in one embodiment;

[0076] Figure 2 This is a flowchart illustrating a star trail image synthesis method in one embodiment;

[0077] Figure 3 This is a flowchart illustrating the star trail image synthesis method in another embodiment;

[0078] Figure 4 This is an example diagram illustrating the determination of the current pixel and its background region in another embodiment;

[0079] Figure 5 This is a flowchart illustrating the star trail image synthesis method in another embodiment;

[0080] Figure 6 This is a flowchart illustrating the star trail image synthesis method in another embodiment;

[0081] Figure 7Example diagram for identifying invalid regions in another embodiment;

[0082] Figure 8 An example diagram for determining a star trail mask image in another embodiment;

[0083] Figure 9 This is a flowchart illustrating the star trail image synthesis method in another embodiment;

[0084] Figure 10 This is an example diagram of the sun or bright spot passing through star trails and after passing through them, as in another embodiment.

[0085] Figure 11 This is a flowchart illustrating the star trail image synthesis method in another embodiment;

[0086] Figure 12 This is a flowchart illustrating the star trail image synthesis method in another embodiment;

[0087] Figure 13 Example image of star trails synthesized against different backgrounds in another embodiment;

[0088] Figure 14 This is a structural block diagram of a star trail image synthesis device in one embodiment;

[0089] Figure 15 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0090] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0091] The star trail image synthesis method provided in this application embodiment can be applied to, for example... Figure 1 The imaging device shown includes a camera and a computer connected to the camera. The camera is primarily used to capture images of objects or the environment in a scene, such as the sky or starry sky, obtaining corresponding single-frame images or video streams, and then sending these images or video streams to the computer. The computer mainly performs image processing on the single-frame images or video streams captured by the camera to obtain star trail images and / or star trail videos at any given time.

[0092] In one embodiment, such as Figure 2 As shown, a method for synthesizing star trail images is provided, which can be applied to... Figure 1 Taking computer equipment related to the shooting equipment as an example, the method may include the following steps:

[0093] S202, determine the first star mask image based on the first star sky image at the current moment and obtain the first star orbit mask image at the previous moment; the first star orbit mask image includes the stars at the previous moment and the star orbits formed by the stars at the previous moment.

[0094] In this step, a camera can be used to capture images of the starry sky. These images are typically obtained through time-lapse photography, meaning an image is taken at regular intervals. The image taken at the current moment can be designated as the first starry sky image, and the image taken at the moment preceding it can be designated as the second starry sky image. The current and preceding moments can be adjacent, representing the specific times when the two adjacent starry sky images were captured. For example, if the first starry sky image was taken between 9:15 and 9:20, and the second starry sky image was taken between 9:10 and 9:15, then these two adjacent moments can be considered the starting times of the two starry sky image captures: 9:10 and 9:15.

[0095] The first or second starry sky image captured above may include objects within the field of view of the capturing device, such as stars, the sky, clouds, and environmental objects (e.g., buildings, bridges). Furthermore, the format of the captured starry sky image can be RGB, raw, YUV, etc., without specific limitations.

[0096] Because stars are constantly moving over time, the position of the same star may be different in starscape images taken at multiple times. However, objects or objects in the starry sky, such as the sky itself, generally do not change over time; they are usually static. Therefore, when starscape images from multiple times are directly superimposed, the same static object may be superimposed twice, deviating from the actual visual effect of the static object. This will also lead to a deterioration in the visual effect of the final star trail image.

[0097] Based on the aforementioned problems, in this embodiment, after obtaining starry sky images at multiple times, stars can be detected in the starry sky images at each time to obtain a star mask image containing only stars. Then, star trail images are synthesized using the star mask image. Here, the star mask image is a binarized image; for example, the pixel value of a star in the star mask image is 1, and the pixel value of the background is 0.

[0098] It should be noted that although only two starry sky images and corresponding star mask images are given above, the shooting device is actually shooting the starry sky continuously, thus obtaining starry sky images at multiple times. Then, the method in this step can obtain the star mask images corresponding to each time. This embodiment only uses the star mask images of two adjacent times to illustrate the subsequent star trail image synthesis process, but it does not mean that only one star trail image will be obtained in the end in this embodiment.

[0099] Additionally, it should be noted that each shot can acquire both the current starscape image and the star trail mask image from the previous moment. For the very first moment of shooting, the star trail mask image can be the star mask image for that first moment. For any subsequent moment in the shooting process, the star trail mask image from the previous moment is essentially an image of star trails formed by the stars from the previous moment and all stars from moments prior to that moment. This can be obtained by fusing the stars from the previous moment with the stars from all moments prior to that moment. The star trail mask image from the previous moment can be designated as the first star trail mask image.

[0100] S204, perform fusion processing on the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment; the second star orbit mask image includes the star orbit formed by the star at the previous moment and the star at the current moment.

[0101] Among them, star trails refer to the movement paths formed by the same star over time as the shooting equipment remains stationary.

[0102] In this step, stars can be marked in both the first star mask image and the first star orbit mask image. After obtaining mask images that only include stars or star orbits formed by stars at these two moments, the star mask images and star orbit mask images at these two moments can be fused. For example, the first star mask image at the current moment can be superimposed on the first star orbit mask image at the previous moment. Specifically, the stars in the two mask images that only include stars or star orbits formed by stars at the two moments can be superimposed together to obtain the star orbit at the current moment. This star orbit can then be adaptively superimposed on either the first star mask image or the first star orbit mask image to obtain the second star orbit mask image at the current moment.

[0103] The second star trail mask image here is similar to the first star trail mask image mentioned above. It can also be a binarized mask image, which includes star trails and background. For example, the pixel value of the star trail part can be 1, and the pixel value of the background can be 0.

[0104] This step is the same as step S202 above. It is only used as an example to illustrate obtaining the second star orbit mask image at the current time by summing the star mask images and star orbit mask images at two adjacent times. However, in fact, the method of this embodiment can obtain star orbit mask images at each time.

[0105] In addition, since the brightness of the stars captured during the shooting process may not meet the user's expectations (e.g., the stars are too bright or too dark), after obtaining the second star trail mask image at the current moment, some enhancement operations can be performed on the star trails in the second star trail mask image, such as adjusting the brightness and color, so that the obtained star trails meet the brightness requirements of the user.

[0106] Furthermore, the background of the second star trail mask image mentioned above can also be a background selected by the user.

[0107] S206, Based on the second star trail mask image, the first star sky image is synthesized to determine the star trail image at the current moment.

[0108] In this step, after obtaining the second star trail mask image at the current moment, the positions of the star trails in the second star trail mask image at the current moment correspond to those in the first star sky image at the current moment. This allows us to determine the stars at the same positions in the first star sky image based on the positions of the star trails in the second star trail mask image. Simultaneously, by combining stars or star trails from previous moments into the first star sky image, we can obtain the star trail image at the current moment. The background of the obtained star trail image is the background captured in real-time at the current moment, and the star trails within it are composed of star trails from the current moment.

[0109] After obtaining the star trail image at the current moment, star trail images at various moments can also be obtained in the same way. As an optional embodiment, after obtaining the star trail images at various moments, the star trail images at various moments can be arranged according to the time sequence to obtain a star trail video. In other words, the star trail images at various moments can be arranged in the order of shooting time to obtain a star trail video.

[0110] In the aforementioned star trail image synthesis method, a first star mask image at the current moment and a first star trail mask image at the previous moment are acquired. The star and star trail mask images from the two moments are then fused to determine a second star trail mask image for the current moment. Finally, a first starscape image is synthesized based on the second star trail mask image to determine the star trail image for the current moment. The first star trail mask image includes the stars from the previous moment and the star trails formed by stars from moments before that, while the second star trail mask image includes the star trails from the previous moment and the star trails formed by stars from the current moment. This method obtains a star trail image for the current moment by fusing the star mask images and / or star trail mask images from various moments, and then synthesizes the starscape image based on this star trail image. This process only fuses stars from multiple moments to obtain the star trail mask and thus the star trail image, without overlaying other objects in the starscape image. Therefore, the synthesized star trail image exhibits better visual effects.

[0111] The above embodiments mentioned that stars in a starry sky image can be detected to obtain a star mask image. The following embodiments will use a first starry sky image as an example to illustrate the star detection process.

[0112] In another embodiment, another method for synthesizing star trail images is provided. Based on the above embodiments, the step of "determining the first star mask image based on the first starry sky image at the current moment" in S202 may include the following steps:

[0113] Step A: Perform star detection processing on the first starry sky image to determine the first star mask image.

[0114] In this step, a star detection algorithm can be used to detect stars in the first starry sky image to obtain the detected stars and their positions. All points in the starry sky image other than the detected stars are considered background. Then, the pixel values ​​at the star positions and the background pixel values ​​are binarized to distinguish the detected stars from the background and obtain a binarized image, which is the star mask image.

[0115] In addition, when performing star detection processing on the first starry sky image, the first starry sky image can be reduced in size and converted into a grayscale image first, and then star detection processing can be performed on the reduced grayscale image. This can reduce the processing time of the star detection algorithm and facilitate the execution of subsequent star detection operations.

[0116] Of course, star images at other times can also be detected in this way, and eventually the corresponding star mask images at each time can be obtained.

[0117] In this embodiment, by performing star detection processing on the first starry sky image, the corresponding star mask image can be obtained quickly and accurately, thereby improving the efficiency and accuracy of obtaining the star mask image.

[0118] The following examples illustrate the star detection process in step A above in detail.

[0119] In another embodiment, a different method for synthesizing star trail images is provided, based on the above embodiments, such as... Figure 3 As shown, step A above may include the following steps:

[0120] S302, traverse each pixel on the first starry sky image, and determine the background area corresponding to the current pixel according to a preset range, with the current pixel as the center.

[0121] In this step, after obtaining the first starry sky image, you can directly iterate through each pixel in the first starry sky image, or you can first shrink the first starry sky image, then convert it to grayscale, and then iterate through each pixel in the grayscale image. Shrinking and converting to grayscale reduces the processing time of the star detection algorithm and facilitates subsequent star detection operations. Shrinking the first starry sky image can be, for example, to 0.6 times its resolution / size. Of course, other shrinkage factors are also possible, but the shrinkage factor is generally at most 0.5 times. This avoids the star edges in the shrunken image being too thin, which would cause obvious jagged edges in subsequent star trails.

[0122] Taking the first starry sky image as an example of shrinking and converting it into a grayscale image, after obtaining the grayscale image, the stars in the grayscale image can be detected. The detection mainly involves comparing each pixel with the pixels in the background area to determine whether the current pixel is a star based on the comparison results.

[0123] As an optional embodiment, the background area can be determined by taking the current pixel as the center and determining the border surrounding the current pixel according to a preset range; the area contained within the border is then determined as the background area.

[0124] Here, the preset range is related to the preset maximum range, and can generally be initially set to 1 / 4 of the maximum preset range. The preset maximum range is related to the exposure time and resolution of the first starry sky image. As an optional embodiment, the preset maximum range can be calculated using the following formula:

[0125] r1 = max[10, (p+40) / 7]

[0126] r max =max[3,r1*max(w,h) / 3840]

[0127] Where r1 is an intermediate quantity in the calculation process, r max The preset maximum range is defined as follows: p is the exposure time (in seconds) of the first starry sky image, and w and h are the width and height of the first starry sky image, respectively, which can also be referred to as the resolution. Generally, the longer the exposure time and the higher the resolution of the image, the larger the preset maximum range will be.

[0128] For details, please refer to Figure 4 The example image shows a background area where the small square in the center of the image represents the current pixel. A rectangular border can be drawn in the image, centered on the current pixel and with a predetermined side length. This border consists of two closed rectangles, and the area enclosed by these rectangles is the background area. For example, in the image, the area enclosed between the two larger rectangles is the background area corresponding to the current pixel. Alternatively, a circular border can be drawn in the image with a predetermined radius, also consisting of two closed circles. The area enclosed between these circles is the background area corresponding to the current pixel. Of course, the shape of the border determined by the predetermined range can also be other shapes; this is not specifically limited here.

[0129] During the process of detecting stars in the grayscale image of the first starry sky, we can start from the top left corner of the image and take each pixel as the current pixel in turn. Centered on the current pixel, we determine the background area corresponding to each current pixel according to a preset range. Generally, the background area determined by each current pixel is different.

[0130] S304: Based on the pixels in the background area and the current pixel, detect whether the current pixel is a star and obtain the detection result.

[0131] In this step, taking a current pixel as an example, after determining the background area corresponding to the current pixel, we can obtain the pixel values ​​of each pixel in the background area, as well as the pixel value of the current pixel. Then, we can detect whether the current pixel is a star based on the pixel values ​​of the background area and the pixel value of the current pixel.

[0132] As an optional embodiment, it is possible to determine the first pixel with the largest pixel value and the second pixel with the smallest pixel value in the background area based on the pixel values ​​of the pixels in the background area; and to detect whether the current pixel is a star based on the pixel values ​​of the first pixel, the second pixel, and the current pixel, thereby obtaining the detection result.

[0133] Specifically, after obtaining the pixel values ​​of each pixel within the background area, the maximum pixel value (the corresponding pixel is denoted as the first pixel) and the minimum pixel value (the corresponding pixel is denoted as the second pixel) can be obtained. Then, the formula "current pixel value - maximum pixel value > maximum pixel value - minimum pixel value" can be used to determine whether the current pixel is a star. In other words, the first difference between the current pixel value and the maximum pixel value can be calculated, along with the second difference between the maximum and minimum pixel values. The first difference is compared to the second difference; if the first difference is greater, the current pixel is determined to be a star or part of a star; otherwise, the current pixel is not a star.

[0134] The above detection method can be used to detect whether each pixel in the grayscale image of the first starry sky is a star, and finally obtain the detection result of whether each pixel in the grayscale image of the first starry sky is a star.

[0135] S306, determine the first star mask image based on the detection results.

[0136] In this step, after obtaining the detection results of whether each pixel in the grayscale image of the first starry sky image is a star, the pixel values ​​of the pixels that are stars and the pixels that are not stars in the grayscale image of the first starry sky image can be directly represented in a binarized way based on the detection results of each pixel. For example, the pixel value of the pixel that is a star is set to 1, and the pixel value of the pixel that is not a star is set to 0. Then, the grayscale image is enlarged to the resolution / size of the first starry sky image to finally obtain the first star mask image.

[0137] In this embodiment, by traversing all pixels in the first starry sky image, a background region is determined centered on the current pixel within a preset range. The detection of whether the current pixel is a star is then performed by combining the pixels within the background region with the detection of the pixels within the preset range of the current pixel. This improves the accuracy of detecting whether the current pixel is a star. Furthermore, by only considering the area within the border surrounding the current pixel as the background region, instead of including the entire preset range of the current pixel, the computational workload for background region pixels is reduced, ensuring accuracy while improving efficiency. Moreover, the determination of whether the current pixel is a star can be made by combining the maximum and minimum pixel values ​​within the background region with the pixel value of the current pixel. This calculation process is simple and intuitive, thus further improving the accuracy and efficiency of star detection.

[0138] The above embodiments mention that it is possible to detect whether the current pixel in the first starry sky image is a star. When the current pixel is not a star, in order to avoid false detection, it is proposed that the current pixel can be repeatedly detected. The following embodiments will explain the process of repeated detection.

[0139] In another embodiment, a different method for synthesizing star trail images is provided, based on the above embodiments, such as... Figure 5 As shown, the above S306 may include the following steps:

[0140] S402, if the detection result is that the current pixel is not a star, then increase the preset range to obtain a new preset range.

[0141] In this step, as mentioned in the above embodiment, it is possible to detect whether a pixel is a star by using the background area pixels within a preset range of the current pixel. After detecting that the current pixel is not a star, in order to avoid false detection, the preset range can be increased with the current pixel as the center to obtain a new preset range.

[0142] Increasing the preset range here can mean increasing it to 2 times, 3 times, or so on. For example, if the original preset range is 1 / 4 of the maximum preset range, then the new preset range after increasing it can be 1 / 4 * 2 = 1 / 2, or 1 / 4 * 3 = 3 / 4, etc.

[0143] S404, determine a new background area based on the new preset range, and return to execute the above steps of detecting whether the current pixel is a star based on the pixels in the background area and the current pixel, and obtain the detection result, until the preset iteration cutoff condition is met.

[0144] In this step, after obtaining the new preset range, the new background area corresponding to the new preset range can be redefined according to the new preset range. Then, the detection of whether the current pixel is a star can continue. Specifically, the above S304 can be iteratively executed to determine the pixels in the new background area. Then, based on the pixels in the new background area and the current pixel, the detection of whether the current pixel is a star can be obtained, and the new detection result of the current pixel can be obtained until the iteration cutoff condition is reached.

[0145] As an optional embodiment, the above iteration cutoff condition includes at least one of the following: the current pixel is a star; the number of iterations reaches a preset number of iterations; the new preset range is greater than or equal to a preset maximum range; the preset maximum range is related to the exposure time and resolution of the first starry sky image.

[0146] In other words, during the repeated detection of the current pixel, if the current pixel is detected as a star, or if the number of iterations reaches the preset number of iterations, such as the preset number of iterations being 3, or if the new preset range is greater than or equal to the preset maximum range, then the detection result of the current pixel will be directly used as the detection result of the current pixel.

[0147] In this embodiment, if the current pixel is not detected as a star, the detection of the current pixel is iteratively performed within a preset range until the iteration cutoff condition is met. This method of repeatedly iterating within an increased range avoids false detections in a single test, improving detection accuracy. Furthermore, the iteration cutoff condition includes multiple conditions, which clarifies the cutoff criteria, facilitates the termination of the iterative process, and improves the stability of the star detection process.

[0148] Furthermore, in order to improve the efficiency of star detection and reduce invalid star detection, it is proposed that detection can be performed in star regions. The following embodiments illustrate this process.

[0149] In another embodiment, a different method for synthesizing star trail images is provided, based on the above embodiments, such as... Figure 6 As shown, the following steps may be included before step A above:

[0150] S502, perform region detection on the first starry sky image to determine the effective region in the first starry sky image; the effective region is the region where stars exist.

[0151] In this step, after obtaining the first starry sky image, since some bright spots on the ground in the shooting scene may be misidentified as stars, it is necessary to first eliminate the points on the ground, that is, to eliminate invalid points or areas, and obtain the valid areas in the first starry sky image where stars may exist.

[0152] In this case, as an optional embodiment, when specifically determining the effective area, it may be to detect whether the color values ​​of the three channels of each point in the first starry sky image meet the invalid threshold condition; if a target point meets the invalid threshold condition, then the target point is determined as an invalid point; and the area in the first starry sky image other than the invalid point is determined as the effective area.

[0153] In a specific implementation of the above determination method, the first starry sky image can be reduced to a preset resolution (e.g., 1 / 4 resolution) and converted into an HSV (chroma, saturation, and brightness) image. Then, target points in the HSV image that meet the invalidity threshold conditions can be detected. These target points can be, for example, points where the chroma H is within a certain range, and the saturation S and brightness V are both greater than the threshold, and these points are marked as invalid. Next, a graphics closing operation (close operation) can be performed on the mask composed of invalid points to obtain mask images of the invalid region and other regions. Then, the invalid region in the HSV image can be obtained through position mapping, and the region in the HSV image excluding the invalid region can be taken as the valid region. Finally, the HSV image and its valid regions can be inversely mapped and enlarged to the resolution of the first starry sky image to obtain the valid region in the first starry sky image.

[0154] This typically involves filling in small, undetected areas in empirical detection methods that generally cover large, continuous invalid regions. For example, see [link to example]. Figure 7 As shown, the left image is the HSV image converted from the first starry sky image (this image is represented as a grayscale image to meet the requirements, but in reality it can be a color image with color values), and the right image is the mask image of the detected invalid area and other areas. The white area in this mask image is the invalid area, and the black area is the valid area.

[0155] This method allows for the pre-selection of some bright spots on the ground in the shooting scene, so that subsequent star detection can only be performed in the detected valid area, reducing the computational load of detection and improving detection accuracy and performance.

[0156] Of course, in some cases, there may be some flat areas in the sky of the shooting scene. These flat areas generally do not contain stars. Therefore, the flat areas can be excluded first to obtain the effective areas in the first starry sky image that may contain stars.

[0157] In this case, as an optional embodiment, when specifically determining the effective region, the first starry sky image may be subjected to median filtering to determine a median filtered image; the effective region may be determined based on the difference between the first starry sky image and the median filtered image.

[0158] Median filtering is a non-linear smoothing technique. The process involves setting the grayscale value of each pixel to the median of the grayscale values ​​of all pixels within a neighborhood window. This can be achieved by first converting the first starry sky image to grayscale and then scaling it down. The scaled-down grayscale image is then subjected to median filtering to obtain a filtered median image. This filtered median image is then enlarged to the size of the first starry sky image and subtracted from the pixel values ​​of the corresponding pixels in the first starry sky image to obtain the difference for each pixel. Pixels with differences less than 0 are marked as invalid. The remaining area in the first starry sky image, excluding invalid pixels, is then considered the valid area.

[0159] This method can eliminate potentially flat areas in the sky of the shooting scene, allowing subsequent star detection to be performed only in the detected valid areas, further reducing the computational load of detection while improving detection accuracy and performance.

[0160] It should be noted that the above two methods for detecting effective regions can be obtained by using only one detection method or by using both detection methods together. When using two detection methods together, the order of the two detection methods or whether they are executed in parallel can be set according to the actual situation. For example, invalid points in the image can be detected first by color value, and then new invalid points can be detected by median filtering to finally obtain the effective region. Of course, invalid points can also be detected first by median filtering, and then new invalid points can be detected by color value to finally obtain the effective region. There is no specific limitation here.

[0161] After obtaining the effective region in the first starry sky image, step A above may include the following steps:

[0162] S504, Perform star detection processing on the effective area in the first starry sky image to determine the first star mask image.

[0163] In other words, the effective area in the first starry sky image can be determined, and then each pixel in the effective area can be processed to detect whether it is a star. Finally, the detection results of each pixel in the effective area are obtained, and then the first star mask image can be obtained through the detection results.

[0164] In this embodiment, by detecting the effective areas containing stars in the first starry sky image and performing star detection processing within the effective areas, the detection results are obtained, and thus the first star mask image is obtained. This can quickly filter out a few effective areas that may contain stars, reduce the number of pixels performing star detection processing, improve star detection efficiency and accuracy, and thus improve star detection performance.

[0165] It should be noted that the star detection method described above can be applied to every frame of the starry sky image at every moment, thus obtaining the star mask image corresponding to each frame of the starry sky image. Therefore, based on the above method, star detection processing can also be performed on starry sky images at any moment to obtain star mask images at any moment.

[0166] The following examples illustrate the process of fusing star mask images at various times to obtain the second star orbit mask image at the current time, as mentioned above.

[0167] In another embodiment, another method for synthesizing star trail images is provided. Based on the above embodiments, S204 may include the following steps:

[0168] Perform a union operation on the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment.

[0169] In this step, after obtaining the first star mask image at the current moment and the first star orbit mask image at the previous moment, the first star mask image and the first star orbit mask image are generally the same size. Here, the pixel values ​​at each position in the first star mask image and the first star orbit mask image can be combined to obtain the pixel values ​​at each position in the first star orbit mask image. That is, all stars that are present in the first star orbit mask image but are not in the first star orbit mask image are added to the corresponding positions in the first star orbit mask image. In this way, the motion trajectory of each star can be obtained, that is, the second star orbit mask image at the current moment can be obtained.

[0170] Taking the first star mask image as an example, the process of obtaining the star trail mask image is explained. After obtaining the first star mask image, it can be saved. The second star mask image is then combined with the first star mask image to obtain the star trail mask image. Similarly, with the input of more star mask images, the union of the new star mask image with the star trail mask image is continuously performed. Since the stars are moving, the star trail mask image will continuously extend. The obtained star trail mask image can be found in [reference needed]. Figure 8 The example image shown is a star trail mask, where the white area represents the detected star trails and the black area represents the background.

[0171] In this embodiment, the second star orbit mask image at the current moment is determined by performing a union operation on the first star mask image and the first star orbit mask image. This allows for a faster and more accurate acquisition of the second star orbit mask image at the current moment, improving the efficiency and accuracy of obtaining the star orbit mask image.

[0172] In some scenarios, during the process of synthesizing star trail mask images, there may be jerky noise in very dark areas. To prevent the noise from being mistaken for stars and accumulating, it is proposed to remove the noise. The following embodiments illustrate the noise removal process.

[0173] In another embodiment, another method for synthesizing star trail images is provided. Based on the above embodiment, the following steps may be included after S204:

[0174] A first candidate star trail mask image is obtained according to a preset first time interval or a preset first image interval; noise points in the first candidate star trail mask image are removed to determine a new first candidate star trail mask image.

[0175] In this step, during the star trail mask image synthesis process, a new star trail mask image for the current moment can be obtained according to a preset first time interval or a preset first image interval, such as every 5 frames of images or the shooting time of 5 frames of images. This image is recorded as the first candidate star trail mask image. Outliers in the first candidate star trail mask image are removed (for example, if there are no other pixels marked as stars in the four neighboring regions, they are outliers). These outliers can be replaced with pixel values ​​at the corresponding positions in the background image pre-selected by the user. After replacement, a new first candidate star trail mask image with noise removal can be obtained.

[0176] It should be noted that the noise removal here is a process that is performed periodically every preset first time interval or preset first image interval, and is not performed only once. This can minimize the impact of noise accumulation on the quality of the final star trail image.

[0177] In this embodiment, noise removal is performed on the star trail mask image every preset first time interval or preset first image interval, which can prevent noise accumulation from affecting the quality of the final star trail image.

[0178] In other scenarios, during the process of synthesizing star trail mask images, some details on the ground may be misdetected as stars, which will accumulate as bright spots in the star mask image. However, unlike star trails, bright spots will not be elongated. Therefore, it is proposed to remove the misdetections. The following embodiments illustrate the misdetection removal process.

[0179] In another embodiment, another method for synthesizing star trail images is provided. Based on the above embodiment, the following steps may be included after S204:

[0180] Acquire a second candidate star trail mask image according to a preset second time interval or a preset second image interval; perform star detection processing on the second candidate star trail mask image to determine a new second candidate star trail mask image.

[0181] In this step, during the star trail mask image synthesis process, a new star trail mask image can be acquired at a preset second time interval or a preset second image interval, which can be greater than the aforementioned preset first time interval or the preset second image interval. For example, it can be acquired every 10 frames or at the capture time of 10 frames. This new star trail mask image is recorded as the second candidate star trail mask image. Star detection processing is then performed on the second candidate star trail mask image. Here, star detection processing can be performed within a small preset range, such as 1 / 4 or 1 / 8 of the size of the second candidate star trail mask image, etc. Points that are not stars are detected and replaced with background pixel values. For example, if the background pixel value is 0, then 0 is used to replace the detected non-star points. Finally, a new second candidate star trail mask image is obtained. The star detection processing here can be performed using the star detection method described above.

[0182] It should be noted that the false detection removal here is a process that is performed periodically every preset second time interval or preset second image interval, and is not performed only once. This can minimize the impact of the accumulation of falsely detected bright spots on the quality of the final star trail image.

[0183] In this embodiment, the star trail mask image is falsely detected and cleared by using star detection every preset second time interval or preset second image interval. This can avoid the accumulation of falsely detected bright spots affecting the quality of the final star trail image.

[0184] The following examples illustrate the process of synthesizing a star trail image from a first star sky image at the current moment based on a second star trail mask image at the current moment, as mentioned above.

[0185] In another embodiment, a different method for synthesizing star trail images is provided, based on the above embodiments, such as... Figure 9 As shown, the above S206 may include the following steps:

[0186] S602, Obtain the preset star trail image corresponding to the current moment.

[0187] In this step, each moment corresponds to a preset star trail image, which can be the star trail image corresponding to the previous moment. For the initial moment, which has no previous moment, an initial star trail image can be preset as its corresponding preset star trail image. In short, the preset star trail image corresponding to each moment can be obtained, and thus the preset star trail image corresponding to the current moment can also be obtained.

[0188] S604, determine the star trail region and non-star trail region in the preset star trail image based on the second star trail mask image.

[0189] In this step, after obtaining the second star trail mask image for the current moment, which includes the star trails at the current moment, the region corresponding to the star trails can be determined from the star trail mask image and denoted as the star trail region. Correspondingly, the region other than the star trail region can also be obtained and denoted as the non-star trail region.

[0190] After obtaining the star trail region and the non-star trail region, you can also obtain the position of each pixel and the corresponding pixel value in each of the star trail region and the non-star trail region.

[0191] S606, Perform composite processing on the first starscape image based on the star trail region and non-star trail region to determine the star trail image at the current moment.

[0192] In this step, after determining the star trail region in the second star trail mask image at the current moment, since the size of the second star trail mask image at the current moment is the same as the size of the first star sky image at the current moment and the size of the preset star trail image, the star trail region can be determined in the first star sky image, and at the same time, the star trail region can also be determined in the preset star trail image.

[0193] Subsequently, as an optional embodiment, the maximum brightness value can be replaced in the star trail region in the preset star trail image and the star trail region in the first star sky image, and the corresponding region in the preset star trail image can be replaced with the non-star trail region in the first star sky image to obtain the star trail image at the current moment.

[0194] Here, a maximum brightness replacement process is performed. Optionally, this involves detecting whether the brightness of pixels in the star trail region of the first starscape image is greater than the brightness of the corresponding pixel in the preset star trail image. In other words, it detects the relative brightness of pixels in the star trail regions of the two images. For example, it checks whether the brightness of pixels in the star trail region of the first starscape image is greater than the brightness of the corresponding pixel in the preset star trail image. If it is greater, the pixel value in the preset star trail image is replaced with the pixel value of the corresponding pixel in the star trail region of the first starscape image. If it is not greater, no pixel value replacement is performed. This maximum brightness replacement process is performed on each pixel in the star trail region, achieving detection of all pixels in the star trail region of the preset star trail image.

[0195] For non-star trail areas in the preset star trail image, the pixel values ​​of the corresponding areas in the first star sky image at the current moment can be used for replacement. In other words, to synthesize the star trail image for the current moment, the star trail area can be replaced with the star trail image using the maximum brightness value, while the non-star trail areas can use the image from the first star sky image at the current moment. This process can then synthesize star trail images for various moments. The background in each frame of the star trail image is adapted to the background at the current moment, thus obtaining a real-time dynamic background star trail image or star trail video.

[0196] For example, the star trail mask image only has pixel values ​​in the star trail region. Assume A1 is a valid point on the preset star trail image at the current moment. Then, a second image (e.g., the first starry sky image) is input, and the point corresponding to A1 is A2. Since A2 is brighter than A1, the pixel value of A2 replaces the pixel value of A1. It should be noted that point A2 in the current image 2 may not be a star in image 2; it could be a brighter part of the sky, or the sun / light spot. This is because we don't want the star trails to be darker than the background during the star trail image synthesis process. Therefore, when the background brightness is higher than the star trail brightness, the star trails should be masked, meaning the pixel value of the star trails will be replaced by the pixel value of the brighter point.

[0197] The brightness mentioned above can be a grayscale value or a channel of another color space. This embodiment mainly uses grayscale values. The brightness can be calculated in various ways, such as using the R+G+B value of a point to represent the brightness of that point, or using the Y channel value of YUV to represent the brightness, or using the V channel value of HSV to represent the brightness, or other methods to calculate the brightness. No specific limitation is made here.

[0198] After determining the star trail image at the current moment, as an optional embodiment, the star trail image at the current moment can be designated as the preset star trail image for the next moment. That is, after determining the star trail image at each moment, the star trail image at each moment can be used as the preset star trail image for its corresponding next moment or the next frame, thus providing a data basis for synthesizing star trail images at subsequent moments. Then, the steps S602-S606 described above can be returned to perform a stacking operation on the star sky images at each moment, ultimately obtaining the star trail images at each moment. Finally, the star trail images at each moment are arranged according to their temporal order to obtain the star trail video.

[0199] It should be noted that, in order to save memory usage, the solution in this embodiment can be stacked in the YUV420 color space.

[0200] In this embodiment, a preset star trail image is acquired, and the star trail region and non-star trail region in the preset star trail image are determined based on the second star trail mask image at the current moment. Then, the first starscape image can be synthesized based on these two regions to obtain the star trail image at the current moment. By combining the star trail image from the previous moment with the star trail region and non-star trail region for star trail image synthesis, the synthesis of star trail images can be effectively achieved, improving the efficiency and accuracy of the obtained star trail images. Furthermore, the pixels in the star trail region can be replaced with the pixels with the maximum brightness value, and the non-star trail regions can be replaced with the starscape image at the current moment. This yields a star trail image with a dynamic background, which is more consistent with reality. Further, by replacing the brighter pixels in the current star trail region with the corresponding brighter pixels from the previous moment, a more realistic depiction of star trail movement can be obtained, thus yielding a more realistic star trail image.

[0201] In actual star trail photography, a situation may arise where bright objects such as the sun or flares pass by. Using the image stacking method described above, these objects might obscure the star trails. However, once the sun has passed or the flares disappear, the original star trails should revert to their original state, rather than maintaining the brightness of the flares indefinitely. See [link to image description]. Figure 10 As shown, the left image is a star trail image when the star trails are obscured by a bright spot, and the right image is a residual star trail image after the bright spot disappears. It can be seen that the residual star trail image significantly affects the visual effect after the bright spot disappears. (It should be noted that although...) Figure 10 Represented as a grayscale image, but in reality... Figure 10 All cases can be color images with color.

[0202] To address this technical problem, another embodiment provides a different method for synthesizing star trail images, based on the above embodiments, such as... Figure 11 As shown, the above method may further include the following steps:

[0203] S702, if the brightness of a non-star target pixel in the first starry sky image is greater than the brightness of the corresponding pixel position in the preset star trail image, then obtain the target pixel value of the target pixel in the preset star trail image.

[0204] In this step, as described in step S606 above, during the replacement of the maximum brightness value, at some point, an object that is not a star may replace a star in the star trail region of the preset star trail image. That is, at that moment, the brightness of a non-star pixel in the starry sky image is greater than the brightness of its corresponding pixel position in the preset star trail image. In this case, the pixel with the replacement pixel value can be obtained from the preset star trail image and recorded as the target pixel. The pixel value of the target pixel in the preset star trail image can be recorded as the target pixel value. At the same time, the target pixel and its target pixel value can be cached for later use.

[0205] It should be noted that this explanation only considers the case where an object that is not a star replaces a star in the preset star trail image at the current moment. However, in actual situations, adjustments can be made based on the specific image frames that are being replaced.

[0206] S704, if the pixel value of the target pixel in the candidate star image is less than the target pixel value, then the pixel value of the target pixel in the star trail image corresponding to the candidate star image is replaced with the target pixel value; the above candidate star image is the star image of the candidate time after the current time.

[0207] In this step, image stacking operations can continue at subsequent moments, i.e., the star trail image synthesis process of each moment in S602-S606 described above can be performed. When synthesizing to a candidate moment, the star sky image corresponding to that candidate moment can be obtained and denoted as the candidate star sky image. If the pixel value of the target pixel in the candidate star sky image is less than the cached target pixel value, it indicates that the sun or bright spot has disappeared. In this case, in order to avoid the residual sun or bright spot affecting the visual effect, after synthesizing the star trail image at this candidate moment, the previously cached target pixel value can be used to replace the pixel value of the target pixel in the star trail image at this candidate moment, so that the sun or bright spot will not remain and the visual effect of the star trail image is guaranteed.

[0208] In this embodiment, when objects such as the sun or light spots obscure the stars in the original star trail image, the pixel values ​​in the current star trail image can be replaced with the pixel values ​​from the original star trail image after the sun or light spots pass by. This ensures that objects such as the sun or light spots do not remain on the star trail image, thus improving the visual effect of the final star trail image.

[0209] In actual star trail photography, the background (non-star parts) of the photo will change continuously during time-lapse photography. Therefore, in this embodiment, the background at which moment is used as the background of the star trail image can be adaptively selected according to the user's needs. The following embodiment will explain this process.

[0210] In another embodiment, a different method for synthesizing star trail images is provided, based on the above embodiments, such as... Figure 12 As shown, the above method may further include the following steps:

[0211] S802, acquire the third star mask image, the third star orbit mask image, and the third star sky image corresponding to any given moment.

[0212] In this step, when the user needs to use the background of any time as the background of the star trail image, the star mask image, star trail mask image, and star sky image at that time can be obtained first, and denoted as the third star mask image, the third star trail mask image, and the third star sky image.

[0213] The methods for obtaining the third star mask image, the third star orbit mask image, and the third star sky image can be the same as those described in the above embodiments, and will not be repeated here.

[0214] S804: Based on the third star mask image and the third star orbit mask image, the star orbit region in the third star sky image is synthesized to determine the star orbit image corresponding to any given moment.

[0215] In this step, after obtaining the third star mask image and the third star trail mask image at that moment, based on the third star mask image and the third star trail mask image, when there are areas in the third star sky image where both stars and star trails exist, a maximum brightness stacking operation is performed with the star trail areas on the preset star trail image from the previous moment. That is, for star trails that have already been stacked, stacking will only occur if a star in the third star sky image passes through the star trail; otherwise, the star trails are fixed, and even if a brighter sun / spot passes by, it will not participate in the stacking. Simultaneously, the non-star trail areas at that moment can replace the non-star trail areas on the preset star trail image from the previous moment, i.e., the background of the star sky image at that moment is used as the background of the star trail image at that moment, ultimately obtaining the star trail image corresponding to that moment. It should be noted that in this embodiment, two star trail images are generally output simultaneously by default: one using the background of the first frame or initial moment, and the other using the background of the last frame or final moment. See also... Figure 13 The grayscale images shown are as follows: the left image is a star trail image using the first frame or initial moment background, and the right image is a star trail image using the last frame or final moment background. If the image is taken from dusk to dawn, using the first frame background will better highlight the star trails, while using the last frame background will better highlight the background.

[0216] Additionally, when a star trail image is needed as the background of the last frame, simply extract the last frame of the star trail video above and use it as the star trail image. For synthesizing star trail images using other frame backgrounds, the method described in this embodiment can be used to perform image synthesis and obtain a synthesized star trail image with the required background.

[0217] In other words, this embodiment can use a specified time point as the background, and after synthesizing the video, it can also simultaneously obtain any number of star trail images with the specified time point as the background.

[0218] In this embodiment, a starry sky image is synthesized based on a star mask image and a star trail mask image at any given time to obtain a star trail image that meets the background requirements. This allows star trail images at any given time to be synthesized according to user needs, thus improving the user experience.

[0219] The following detailed embodiment illustrates the method of this application. Based on the above embodiment, the method may include the following steps:

[0220] S1, Obtain the first starry sky image at the current moment;

[0221] S2, Perform region detection on the first starry sky image to determine the effective region in the first starry sky image; the effective region is the region where stars exist.

[0222] S3, traverse each pixel in the effective area of ​​the first starry sky image, take the current pixel as the center, determine the border surrounding the current pixel according to the preset range, and determine the area contained in the border as the background area.

[0223] S4, Based on the pixel values ​​of the pixels in the background area, determine the first pixel with the largest pixel value and the second pixel with the smallest pixel value in the background area;

[0224] S5: Based on the pixel values ​​of the first pixel, the second pixel, and the current pixel, detect whether the current pixel is a star and obtain the detection result;

[0225] S6. If the detection result is that the current pixel is not a star, then increase the preset range to obtain a new preset range.

[0226] S7. Determine a new background area based on the new preset range, and return to execute S4-S6 above until the preset iteration cutoff condition is met. The iteration cutoff condition includes at least one of the following: the current pixel is a star; the number of iterations reaches the preset number of iterations; the new preset range is greater than or equal to the preset maximum range.

[0227] S8, Based on the detection results, mark the stars in the first starry sky image to determine the first star mask image;

[0228] S9, acquire the first star orbit mask image from the previous moment;

[0229] S10, perform union processing on the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment;

[0230] S11, acquire a first candidate star trail mask image according to a preset first time interval or a preset first image interval; remove noise points in the first candidate star trail mask image to determine a new first candidate star trail mask image;

[0231] S12, acquire the second candidate star trail mask image according to the preset second time interval or the preset second image interval; perform star detection processing on the second candidate star trail mask image to determine a new second candidate star trail mask image;

[0232] S13, Obtain the preset star trail image corresponding to the current moment;

[0233] S14, determine the star trail region and non-star trail region in the preset star trail image based on the second star trail mask image;

[0234] S15, detect whether the brightness of the pixels in the star trail region of the first starry sky image is greater than the brightness of the pixels at the corresponding positions in the preset star trail image;

[0235] S16, if the value is greater than the value, then in the preset star trail image, the pixel value of the pixel point in the star trail region of the first star sky image is used to replace the pixel value at the corresponding pixel position in the preset star trail image; if the value is not greater than the value, then no replacement is performed.

[0236] S17, replace the corresponding region in the preset star trail image with the non-star trail region in the first star sky image to obtain the star trail image at the current moment;

[0237] S18, determine the star trail image at the current moment as the preset star trail image for the next moment;

[0238] S19, If the brightness of a non-star target pixel in the first starry sky image is greater than the brightness of the corresponding pixel in the preset star trail image, then obtain the target pixel value of the target pixel in the preset star trail image.

[0239] S20, if the pixel value of the target pixel in the candidate star image is less than the target pixel value, then the pixel value of the target pixel in the star trail image corresponding to the candidate star image is replaced with the target pixel value; the above candidate star image is the star image of the candidate time after the current time.

[0240] S21, obtain the third star mask image, the third star orbit mask image, and the third star sky image corresponding to any given moment;

[0241] S22, Based on the third star mask image and the third star orbit mask image, the star orbit region in the third star sky image is synthesized to determine the star orbit image corresponding to any given moment.

[0242] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0243] Based on the same inventive concept, this application also provides a star trail image synthesis apparatus for implementing the star trail image synthesis method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more star trail image synthesis apparatus embodiments provided below can be found in the limitations of the star trail image synthesis method described above, and will not be repeated here.

[0244] In one embodiment, such as Figure 14 As shown, a star trail image synthesis device is provided, comprising: a star mask determination module, a star trail mask determination module, and a star trail image synthesis module, wherein:

[0245] The star mask determination module is used to determine a first star mask image based on the first star sky image at the current moment and to obtain a first star orbit mask image at the previous moment; the first star orbit mask image includes the stars at the previous moment and the star orbits formed by the stars at the previous moments.

[0246] The star trail mask determination module is used to fuse the first star mask image and the first star trail mask image to determine the second star trail mask image at the current moment; the second star trail mask image includes the star trail formed by the star trails of the previous moment and the stars at the current moment.

[0247] The star trail image synthesis module is used to synthesize the first star sky image based on the second star trail mask image to determine the star trail image at the current moment.

[0248] In another embodiment, a different star trail image synthesis apparatus is provided. Based on the above embodiments, the star mask determination module may include:

[0249] The star mask determination unit is used to perform star detection processing on the first starry sky image and determine the first star mask image.

[0250] In another embodiment, another star trail image synthesis apparatus is provided. Based on the above embodiments, the star mask determination unit may include:

[0251] The background region determination subunit is used to traverse each pixel on the first starry sky image and determine the background region corresponding to the current pixel according to a preset range, with the current pixel as the center.

[0252] The detection subunit is used to detect whether the current pixel is a star based on the pixels in the background area and the current pixel, and obtain the detection result;

[0253] The star mask determination subunit is used to determine the first star mask image based on the detection results.

[0254] Optionally, the aforementioned star mask determination subunit is specifically used to: if the detection result indicates that the current pixel is not a star, increase the preset range to obtain a new preset range; determine a new background region based on the new preset range; and return to execute the steps described above for detecting whether the current pixel is a star based on the pixels in the background region and the current pixel to obtain the detection result, until the preset iteration cutoff condition is met.

[0255] Optionally, the above iteration cutoff conditions include at least one of the following: the current pixel is a star; the number of iterations reaches a preset number of iterations; the new preset range is greater than or equal to the preset maximum range; the preset maximum range is related to the exposure time and resolution of the first starry sky image.

[0256] In another embodiment, another star trail image synthesis apparatus is provided. Based on the above embodiments, the detection subunit is specifically used to determine the first pixel with the largest pixel value and the second pixel with the smallest pixel value in the background area according to the pixel values ​​of the pixels in the background area; and to detect whether the current pixel is a star according to the pixel values ​​of the first pixel, the second pixel and the current pixel, and to obtain the detection result.

[0257] In another embodiment, another star trail image synthesis apparatus is provided. Based on the above embodiments, the background region determination subunit is specifically used to determine a border surrounding the current pixel point according to a preset range, with the current pixel point as the center; and to determine the area contained within the border point as the background region.

[0258] In another embodiment, another star trail image synthesis apparatus is provided. Based on the above embodiments, the star mask determination unit performs star detection processing on the first starry sky image. Before determining the first star mask image, the apparatus may further include:

[0259] The effective region detection module is used to perform region detection on the first starry sky image and determine the effective region in the first starry sky image; the effective region is the region where stars exist.

[0260] The aforementioned star mask determination unit is specifically used to perform star detection processing on the effective area in the first starry sky image to determine the first star mask image.

[0261] Optionally, the above-mentioned effective region detection module is specifically used to detect whether the color values ​​of the three channels of each point in the first starry sky image meet the invalid threshold condition; if a target point meets the invalid threshold condition, the target point is determined as an invalid point; and the region in the first starry sky image other than the invalid point is determined as an effective region.

[0262] Optionally, the aforementioned effective region detection module is specifically used to perform median filtering on the first starry sky image to determine the median filtered image; and to determine the effective region based on the difference between the first starry sky image and the median filtered image.

[0263] In another embodiment, another star trail image synthesis device is provided. Based on the above embodiment, the star trail mask determination module is specifically used to perform union processing on the first star mask image and the first star trail mask image to determine the second star trail mask image at the current moment.

[0264] In another embodiment, another star trail image synthesis apparatus is provided. Based on the above embodiments, after the star trail mask determination module performs fusion processing on the first star mask image and the first star trail mask image to determine the second star trail mask image at the current moment, the apparatus may further include:

[0265] The noise removal module is used to acquire a first candidate star trail mask image according to a preset first time interval or a preset first image interval; to remove noise points in the first candidate star trail mask image, and to determine a new first candidate star trail mask image.

[0266] In another embodiment, another star trail image synthesis apparatus is provided. Based on the above embodiments, after the star trail mask determination module performs fusion processing on the first star mask image and the first star trail mask image to determine the second star trail mask image at the current moment, the apparatus may further include:

[0267] The false detection removal module is used to acquire a second candidate star trail mask image according to a preset second time interval or a preset second image interval; perform star detection processing on the second candidate star trail mask image to determine a new second candidate star trail mask image.

[0268] In another embodiment, another star trail image synthesis apparatus is provided. Based on the above embodiments, the star trail image synthesis module may include:

[0269] The preset image acquisition unit is used to acquire the preset star trail image corresponding to the current moment;

[0270] The region segmentation unit is used to determine the star trail region and non-star trail region in the preset star trail image based on the second star trail mask image;

[0271] The star trail image synthesis unit is used to synthesize the first star sky image based on the star trail region and non-star trail region to determine the star trail image at the current moment.

[0272] Optionally, the above-mentioned star trail image synthesis unit may include:

[0273] The replacement subunit is used to perform maximum brightness replacement processing on the star trail region in the preset star trail image and the star trail region in the first star sky image, and to replace the corresponding region in the preset star trail image with the non-star trail region in the first star sky image to obtain the star trail image at the current moment.

[0274] Optionally, the aforementioned replacement subunit is specifically used to detect whether the brightness of the pixels in the star trail region of the first star sky image is greater than the brightness of the pixels at the corresponding positions in the preset star trail image; if it is greater, then in the preset star trail image, the pixel values ​​of the pixels in the star trail region of the first star sky image are used to replace the pixel values ​​at the corresponding pixel positions in the preset star trail image.

[0275] In another embodiment, a different star trail image synthesis apparatus is provided. Based on the above embodiments, the apparatus may further include:

[0276] The determination module is used to determine the star trail image at the current moment as the preset star trail image for the next moment.

[0277] In another embodiment, a different star trail image synthesis apparatus is provided. Based on the above embodiments, the apparatus may further include:

[0278] The residual removal module is used to obtain the target pixel value of the target pixel in the preset star trail image if the brightness of a non-star target pixel in the first star sky image is greater than the brightness of the corresponding pixel position in the preset star trail image; if the pixel value of the target pixel in the candidate star sky image is less than the target pixel value, the target pixel value is used to replace the pixel value of the target pixel in the star trail image corresponding to the candidate star sky image; the above-mentioned candidate star sky image is the star sky image of the candidate time after the current time.

[0279] In another embodiment, a different star trail image synthesis apparatus is provided. Based on the above embodiments, the apparatus may further include:

[0280] Any image synthesis module is used to acquire the third star mask image, the third star orbit mask image, and the third star sky image corresponding to any given time; and to perform synthesis processing on the star orbit region in the third star sky image based on the third star mask image and the third star orbit mask image to determine the star orbit image corresponding to any given time.

[0281] Each module in the aforementioned star trail image synthesis device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0282] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 15 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a star trail image synthesis method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0283] Those skilled in the art will understand that Figure 15 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0284] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0285] A first star mask image is determined based on the current starscape image, and a first star orbit mask image is obtained from the previous starscape image. The first star orbit mask image includes the stars from the previous starscape image and the star orbits formed by the stars from previous starscape images. The first star mask image and the first star orbit mask image are fused together to determine a second star orbit mask image for the current starscape image. The second star orbit mask image includes the star orbits from the previous starscape image and the star orbits formed by the stars from the current starscape image. The first starscape image is synthesized based on the second star orbit mask image to determine the star orbit image for the current starscape image.

[0286] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0287] Perform star detection processing on the first starry sky image to determine the first star mask image.

[0288] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0289] Traverse each pixel in the first starry sky image, and determine the background region corresponding to the current pixel according to a preset range, with the current pixel as the center; detect whether the current pixel is a star based on the pixels in the background region and the current pixel, and obtain the detection result; determine the first star mask image based on the detection result.

[0290] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0291] If the detection result indicates that the current pixel is not a star, the preset range is increased to obtain a new preset range; a new background area is determined based on the new preset range, and the process returns to the above steps of detecting whether the current pixel is a star based on the pixels in the background area and the current pixel, and obtaining the detection result, until the preset iteration cutoff condition is met.

[0292] In one embodiment, the iteration cutoff condition includes at least one of the following: the current pixel is a star; the number of iterations reaches a preset number of iterations; the new preset range is greater than or equal to a preset maximum range; the preset maximum range is related to the exposure time and resolution of the first starry sky image.

[0293] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0294] Based on the pixel values ​​of the pixels in the background area, determine the first pixel with the largest pixel value and the second pixel with the smallest pixel value in the background area; based on the pixel values ​​of the first pixel, the second pixel, and the current pixel, detect whether the current pixel is a star and obtain the detection result.

[0295] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0296] Centered on the current pixel, determine the border surrounding the current pixel according to a preset range; the area contained within the border is defined as the background area.

[0297] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0298] Region detection is performed on the first starry sky image to determine the effective region in the first starry sky image; the effective region is the region where stars exist; star detection processing is performed on the effective region of the first starry sky image to determine the first star mask image.

[0299] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0300] The color values ​​of the three channels of each point in the first starry sky image are checked to see if they meet the invalid threshold condition. If a target point meets the invalid threshold condition, the target point is determined as an invalid point. The area in the first starry sky image other than the invalid point is determined as a valid area.

[0301] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0302] The first starry sky image is subjected to median filtering to determine the median filtered image; the effective region is determined based on the difference between the first starry sky image and the median filtered image.

[0303] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0304] Perform a union operation on the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment.

[0305] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0306] A first candidate star trail mask image is obtained according to a preset first time interval or a preset first image interval; noise points in the first candidate star trail mask image are removed to determine a new first candidate star trail mask image.

[0307] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0308] Acquire a second candidate star trail mask image according to a preset second time interval or a preset second image interval; perform star detection processing on the second candidate star trail mask image to determine a new second candidate star trail mask image.

[0309] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0310] Obtain the preset star trail image corresponding to the current moment; determine the star trail region and non-star trail region in the preset star trail image based on the second star trail mask image; perform composite processing on the first star sky image based on the star trail region and non-star trail region to determine the star trail image at the current moment.

[0311] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0312] The maximum brightness value is replaced in the star trail region of the preset star trail image and the star trail region of the first star sky image, and the corresponding region in the preset star trail image is replaced with the non-star trail region in the first star sky image to obtain the star trail image at the current moment.

[0313] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0314] Detect whether the brightness of the pixels in the star trail region of the first star sky image is greater than the brightness of the corresponding pixels in the preset star trail image; if it is greater, replace the pixel value at the corresponding pixel position in the preset star trail image with the pixel value of the pixel in the star trail region of the first star sky image.

[0315] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0316] The star trail image at the current moment is determined as the preset star trail image for the next moment.

[0317] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0318] If the brightness of a non-star target pixel in the first starry sky image is greater than the brightness of the corresponding pixel in the preset star trail image, then the target pixel value of the target pixel in the preset star trail image is obtained; if the pixel value of the target pixel in the candidate starry sky image is less than the target pixel value, then the pixel value of the target pixel in the star trail image corresponding to the candidate starry sky image is replaced with the target pixel value; the above-mentioned candidate starry sky images are starry sky images of candidate times after the current time.

[0319] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0320] Obtain the third star mask image, the third star orbit mask image, and the third star sky image corresponding to any given time. Based on the third star mask image and the third star orbit mask image, perform composite processing on the star orbit region in the third star sky image to determine the star orbit image corresponding to any given time.

[0321] In one embodiment, a shooting device is provided; see [link to previous embodiment]. Figure 1 The example diagram shown includes a camera and the aforementioned computer device connected to the camera.

[0322] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0323] A first star mask image is determined based on the current starscape image, and a first star orbit mask image is obtained from the previous starscape image. The first star orbit mask image includes the stars from the previous starscape image and the star orbits formed by the stars from previous starscape images. The first star mask image and the first star orbit mask image are fused together to determine a second star orbit mask image for the current starscape image. The second star orbit mask image includes the star orbits from the previous starscape image and the star orbits formed by the stars from the current starscape image. The first starscape image is synthesized based on the second star orbit mask image to determine the star orbit image for the current starscape image.

[0324] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0325] Perform star detection processing on the first starry sky image to determine the first star mask image.

[0326] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0327] Traverse each pixel in the first starry sky image, and determine the background region corresponding to the current pixel according to a preset range, with the current pixel as the center; detect whether the current pixel is a star based on the pixels in the background region and the current pixel, and obtain the detection result; determine the first star mask image based on the detection result.

[0328] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0329] If the detection result indicates that the current pixel is not a star, the preset range is increased to obtain a new preset range; a new background area is determined based on the new preset range, and the process returns to the above steps of detecting whether the current pixel is a star based on the pixels in the background area and the current pixel, and obtaining the detection result, until the preset iteration cutoff condition is met.

[0330] In one embodiment, the iteration cutoff condition includes at least one of the following: the current pixel is a star; the number of iterations reaches a preset number of iterations; the new preset range is greater than or equal to a preset maximum range; the preset maximum range is related to the exposure time and resolution of the first starry sky image.

[0331] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0332] Based on the pixel values ​​of the pixels in the background area, determine the first pixel with the largest pixel value and the second pixel with the smallest pixel value in the background area; based on the pixel values ​​of the first pixel, the second pixel, and the current pixel, detect whether the current pixel is a star and obtain the detection result.

[0333] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0334] Centered on the current pixel, determine the border surrounding the current pixel according to a preset range; the area contained within the border is defined as the background area.

[0335] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0336] Region detection is performed on the first starry sky image to determine the effective region in the first starry sky image; the effective region is the region where stars exist; star detection processing is performed on the effective region of the first starry sky image to determine the first star mask image.

[0337] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0338] The color values ​​of the three channels of each point in the first starry sky image are checked to see if they meet the invalid threshold condition. If a target point meets the invalid threshold condition, the target point is determined as an invalid point. The area in the first starry sky image other than the invalid point is determined as a valid area.

[0339] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0340] The first starry sky image is subjected to median filtering to determine the median filtered image; the effective region is determined based on the difference between the first starry sky image and the median filtered image.

[0341] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0342] Perform a union operation on the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment.

[0343] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0344] A first candidate star trail mask image is obtained according to a preset first time interval or a preset first image interval; noise points in the first candidate star trail mask image are removed to determine a new first candidate star trail mask image.

[0345] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0346] Acquire a second candidate star trail mask image according to a preset second time interval or a preset second image interval; perform star detection processing on the second candidate star trail mask image to determine a new second candidate star trail mask image.

[0347] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0348] Obtain the preset star trail image corresponding to the current moment; determine the star trail region and non-star trail region in the preset star trail image based on the second star trail mask image; perform composite processing on the first star sky image based on the star trail region and non-star trail region to determine the star trail image at the current moment.

[0349] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0350] The maximum brightness value is replaced in the star trail region of the preset star trail image and the star trail region of the first star sky image, and the corresponding region in the preset star trail image is replaced with the non-star trail region in the first star sky image to obtain the star trail image at the current moment.

[0351] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0352] Detect whether the brightness of the pixels in the star trail region of the first star sky image is greater than the brightness of the corresponding pixels in the preset star trail image; if it is greater, replace the pixel value at the corresponding pixel position in the preset star trail image with the pixel value of the pixel in the star trail region of the first star sky image.

[0353] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0354] The star trail image at the current moment is determined as the preset star trail image for the next moment.

[0355] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0356] If the brightness of a non-star target pixel in the first starry sky image is greater than the brightness of the corresponding pixel in the preset star trail image, then the target pixel value of the target pixel in the preset star trail image is obtained; if the pixel value of the target pixel in the candidate starry sky image is less than the target pixel value, then the pixel value of the target pixel in the star trail image corresponding to the candidate starry sky image is replaced with the target pixel value; the above-mentioned candidate starry sky images are starry sky images of candidate times after the current time.

[0357] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0358] Obtain the third star mask image, the third star orbit mask image, and the third star sky image corresponding to any given time. Based on the third star mask image and the third star orbit mask image, perform composite processing on the star orbit region in the third star sky image to determine the star orbit image corresponding to any given time.

[0359] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0360] It should be noted that all data involved in this application (including but not limited to data used for analysis, data stored, data displayed, etc.) are data that have been fully authorized by all parties.

[0361] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0362] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0363] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A star trail image synthesis method characterized by, The method includes: The first star image at the current moment is processed by star detection to determine the first star mask image, and the first star trail mask image at the previous moment is obtained; the first star trail mask image includes the stars at the previous moment and the star trails formed by the stars at previous moments. The first star mask image and the first star trail mask image are fused together to determine the second star trail mask image at the current moment; the second star trail mask image includes the star trails formed by the stars at the previous moment and the stars at the current moment. The first starscape image is synthesized based on the second star trail mask image to determine the star trail image at the current moment.

2. The method according to claim 1, characterized in that, The step of performing star detection processing on the first starry sky image to determine the first star mask image includes: Traverse each pixel on the first starry sky image, and determine the background area corresponding to the current pixel according to a preset range, with the current pixel as the center. Based on the pixels in the background area and the current pixel, detect whether the current pixel is a star, and obtain the detection result; The first star mask image is determined based on the detection results.

3. The method according to claim 2, characterized in that, Determining the first star mask image based on the detection result includes: If the detection result indicates that the current pixel is not a star, then the preset range is increased to obtain a new preset range; A new background region is determined based on the new preset range, and the process returns to the step of detecting whether the current pixel is a star based on the pixels in the background region and the current pixel, and obtaining the detection result, until the preset iteration cutoff condition is met.

4. The method according to claim 3, characterized in that, The iteration cutoff condition includes at least one of the following: The current pixel is a star; The preset number of iterations has been reached. The new preset range is greater than or equal to the preset maximum range; the preset maximum range is related to the exposure time and resolution of the first starry sky image.

5. The method according to any one of claims 2-4, characterized in that, The step of detecting whether the current pixel is a star based on the pixels in the background area and the current pixel, and obtaining the detection result, includes: Based on the pixel values ​​of the pixels in the background area, determine the first pixel with the largest pixel value and the second pixel with the smallest pixel value in the background area; Based on the pixel values ​​of the first pixel, the second pixel, and the current pixel, it is determined whether the current pixel is a star, and a detection result is obtained.

6. The method according to any one of claims 2-4, characterized in that, The step of determining the background region corresponding to the current pixel according to a preset range, centered on the current pixel, includes: Determine the border surrounding the current pixel based on a preset range, with the current pixel as the center. The area contained within the border is defined as the background area.

7. The method according to any one of claims 1-4, characterized in that, Before performing star detection processing on the first starry sky image to determine the first star mask image, the method further includes: Region detection is performed on the first starry sky image to determine the effective region in the first starry sky image; the effective region is the region where stars exist. Accordingly, the step of performing star detection processing on the first starry sky image to determine the first star mask image includes: Star detection processing is performed on the effective area in the first starry sky image to determine the first star mask image.

8. The method according to claim 7, characterized in that, The step of performing region detection on the first starry sky image to determine the effective region in the first starry sky image includes: Detect whether the color values ​​of the three channels of each point in the first starry sky image meet the invalid threshold condition; If a target point meets the invalid threshold condition, then the target point is determined to be an invalid point; The region in the first starry sky image, excluding the invalid points, is determined as the valid region.

9. The method according to claim 7, characterized in that, The step of performing region detection on the first starry sky image to determine the effective region in the first starry sky image includes: The first starry sky image is subjected to median filtering to determine the median filtered image; The effective region is determined based on the difference between the first starry sky image and the median filtered image.

10. The method according to claim 1, characterized in that, The step of fusing the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment includes: Perform a union operation on the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment.

11. The method according to claim 1, characterized in that, After fusing the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment, the method further includes: The first candidate star trail mask image is obtained according to a preset first time interval or a preset first image interval; Noise points in the first candidate star trail mask image are removed to determine a new first candidate star trail mask image.

12. The method according to claim 1, characterized in that, After fusing the first star mask image and the first star orbit mask image to determine the second star orbit mask image at the current moment, the method further includes: The second candidate star trail mask image is obtained according to a preset second time interval or a preset second image interval; Star detection processing is performed on the second candidate star trail mask image to determine a new second candidate star trail mask image.

13. The method according to claim 1, characterized in that, The step of synthesizing the first starscape image based on the second star trail mask image to determine the star trail image at the current moment includes: Obtain the preset star trail image corresponding to the current moment; The star trail region and non-star trail region in the preset star trail image are determined based on the second star trail mask image; The first starscape image is synthesized based on the star trail region and the non-star trail region to determine the star trail image at the current moment.

14. The method according to claim 13, characterized in that, The step of synthesizing the first starscape image based on the star trail region and the non-star trail region to determine the star trail image at the current moment includes: The star trail regions in the preset star trail image and the star trail regions in the first star sky image are replaced with their maximum brightness values, and the corresponding regions in the preset star trail image are replaced with non-star trail regions in the first star sky image to obtain the star trail image at the current moment.

15. The method according to claim 14, characterized in that, The process of replacing the maximum brightness value of the star trail region in the preset star trail image and the star trail region in the first starry sky image includes: Detect whether the brightness of the pixels in the star trail region of the first starry sky image is greater than the brightness of the pixels at the corresponding positions in the preset star trail image; If the value is greater than the value in the preset star trail image, the pixel value of the pixel point in the star trail region of the first star sky image is used to replace the pixel value at the corresponding pixel position in the preset star trail image.

16. The method according to any one of claims 13-15, characterized in that, The method further includes: The star trail image at the current moment is determined as the preset star trail image for the next moment.

17. The method according to claim 15, characterized in that, The method further includes: If the brightness of a non-star target pixel in the first starry sky image is greater than the brightness of the corresponding pixel position in the preset star trail image, then the target pixel value of the target pixel in the preset star trail image is obtained. If the pixel value of the target pixel in the candidate star image is less than the target pixel value, then the pixel value of the target pixel in the star trail image corresponding to the candidate star image is replaced by the target pixel value; the candidate star image is a star image at a candidate time after the current time.

18. The method according to claim 1, characterized in that, The method further includes: Obtain the third star mask image, the third star orbit mask image, and the third star sky image corresponding to any given moment; The star trail region in the third starscape image is synthesized based on the third star mask image and the third star trail mask image to determine the star trail image corresponding to any given moment.

19. The method according to claim 1, characterized in that, The method further includes: The star trail images at various times are arranged according to their temporal sequence to obtain a star trail video.

20. A star trail image synthesis device, characterized in that, The device includes: The star mask determination module is used to perform star detection processing on the first star sky image at the current moment, determine the first star mask image, and obtain the first star trail mask image at the previous moment; the first star trail mask image includes the stars at the previous moment and the star trails formed by the stars at previous moments. A star trail mask determination module is used to perform a fusion process on the first star mask image and the first star trail mask image to determine the second star trail mask image at the current moment; the second star trail mask image includes the star trails formed by the star trails at the previous moment and the stars at the current moment; The star trail image synthesis module is used to synthesize the first star sky image based on the second star trail mask image to determine the star trail image at the current moment.

21. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 19.

22. A shooting device, characterized in that, Includes a camera and a computer device as described in claim 21 connected to the camera.

23. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 19.