Image processing method, mobile terminal and storage medium
Through image processing methods, the pixels of star trails are obtained and the RGB information is rearranged. The average RGB value in the neighborhood is calculated to fill the star trail area. This solves the problem that star trails affect the appearance of starry sky photos and enables ordinary users to take starry sky photos without star trails at a low cost.
Patent Information
- Application Number
- CN202110552688.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-20
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2041-05-20
AI Technical Summary
In the prior art, when taking photos of the starry sky, the star trails are affected by the long exposure effect caused by the rotation of the earth, which affects the appearance. Professional equipment and high skills are required, and it is difficult for ordinary users to take photos of the starry sky without star trails.
Through image processing methods, the pixels of star trails are obtained, the RGB information is rearranged according to the grayscale value, the average RGB value in the neighborhood is calculated to fill the star trail area, and pixel points are generated to fill the circle with the center as the center to eliminate the star trails.
It reduces the hardware cost and photography skill requirements for professional starry sky photography, allowing ordinary users to take starry sky photos without star trails.
Smart Images

Figure CN113298771B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and more particularly to an image processing method, a mobile terminal, and a storage medium. Background Art
[0002] As we all know, star photography is an important topic in the field of photography, and it is extremely difficult. It requires a high level of technical skills to set parameters such as exposure and sensitivity. At the same time, when photographing the starry sky, it is necessary to use the camera's strong sensitivity to perform long exposures to capture stars that are invisible to the naked eye. This brings about the problem that the stars in the photo will have long trails due to the rotation of the earth. The longer the exposure time, the longer the star trails. Figure 3 As shown, the left and right sides are photos taken with exposure times of 180 seconds and 120 seconds respectively. The trails of the stars will affect the aesthetics and fail to reflect the "deep and dreamy" side of the universe. In the existing technology, star chasers can adjust the camera's posture in real time according to the rotation of the earth, so that the position of the stars in the picture always remains at the initial moment, thus avoiding the trails caused by long exposure, that is, the "tail" effect. Professional photographers who shoot starry sky often need to be equipped with such star chasers, but such star chasers are expensive. Therefore, how to reduce the hardware cost and photography skills required for shooting professional starry sky so that ordinary users can also take starry sky photos without star trails has become an urgent problem to be solved. Summary of the Invention
[0003] The main purpose of this application is to propose an image processing method, a mobile terminal and a storage medium, which aim to enable users to eliminate star trails caused by long exposure in photos when photographing the starry sky.
[0004] To achieve the above objectives, the present application provides an image processing method, which includes:
[0005] Get the star tracks in the image to be processed;
[0006] Extracting pixels of the star trail, rearranging and saving the RGB information of the pixels in descending order of the grayscale values corresponding to the pixels, and saving the center position of the star trail;
[0007] Calculate the average RGB value of a neighborhood of a preset size around the star trail, and fill the area where the star trail is located according to the average RGB value;
[0008] Generate pixel points according to the saved RGB information, and use the generated pixel points in the rearranged order, with the center position of the star trajectory as the center of the circle and the preset size as the radius, and fill in the order from near to far from the center of the circle.
[0009] Optionally, obtaining star tracks in the image to be processed includes:
[0010] The image to be processed is processed by an image straight line detection algorithm to obtain star tracks.
[0011] Optionally, the processing the image to be processed by using an image line detection algorithm to obtain star tracks includes:
[0012] Processing the image to be processed by an image straight line detection algorithm to obtain a processing result;
[0013] Get the theoretical trajectory of the current position in the current period;
[0014] The processing result is filtered according to the theoretical trajectory, and the filtered result is used as the star trajectory.
[0015] Optionally, obtaining a theoretical trajectory of the current position within a current time period includes:
[0016] The theoretical trajectory in the current time period is calculated according to the current gravity direction, longitude and latitude, magnetic declination and the exposure time when the image to be processed is taken.
[0017] Optionally, the processing the image to be processed by using an image line detection algorithm to obtain star tracks includes:
[0018] Processing the image to be processed by an image straight line detection algorithm to obtain a texture in the image to be processed;
[0019] Star trails are filtered out based on the richness of the texture.
[0020] Optionally, the processing the image to be processed by using an image line detection algorithm to obtain star tracks includes:
[0021] Cutting out the sky area in the image to be processed from the image to be processed;
[0022] The extracted sky area is processed by an image line detection algorithm to obtain star tracks.
[0023] Optionally, the method further includes:
[0024] A preset bias is added to the three channels of the pixels corresponding to the filled pixel points to increase the brightness of the stars.
[0025] Optionally, the method further includes:
[0026] At least one parameter of the image's saturation, contrast, and sharpness is increased to enhance the starry sky visual effect of the image.
[0027] The present application also provides a mobile terminal, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the above-mentioned image processing method when executed by the processor.
[0028] The present application also provides a computer-readable storage medium, characterized in that an image processing program is stored on the computer-readable storage medium, and the image processing program implements the above-mentioned image processing method when executed by a processor.
[0029] The image processing method, mobile terminal and storage medium provided by the present application obtain star trails in the image to be processed; extract the pixels of the star trails, rearrange and save the RGB information of the pixels in descending order of the grayscale values corresponding to the pixels, and save the center position of the star trails; calculate the average RGB value in a neighborhood of a preset size around the star trails, and fill the area where the star trails are located according to the average RGB value; generate pixel points based on the saved RGB information, and use the generated pixel points to fill in the order of the rearrangement, with the center position of the star trail as the center of the circle and the preset size as the radius, in order from near to far from the center of the circle. This can reduce the hardware cost and photography skill requirements required for shooting professional starry skies, so that ordinary users can also take starry sky photos without star trails. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0031] Figure 1 This is a schematic diagram of the hardware structure of a mobile terminal involved in this application;
[0032] Figure 2 This is a communication network system architecture diagram provided by an embodiment of the present application;
[0033] Figure 3 This is a schematic diagram of star trajectories corresponding to different exposure times when photographing the starry sky in the prior art of this application;
[0034] Figure 4 is a flowchart of an image processing method provided by an embodiment of the present application;
[0035] Figure 5 This is an image processing schematic diagram of an embodiment of the image processing method of the present application;
[0036] Figure 6 This is an image processing schematic diagram of another embodiment of the image processing method of the present application;
[0037] Figure 7This is an image processing schematic diagram of another embodiment of the image processing method of the present application;
[0038] Figure 8 This is an image processing schematic diagram of another embodiment of the image processing method of the present application;
[0039] Figure 9 This is an image processing schematic diagram of another embodiment of the image processing method of the present application;
[0040] Figure 10 It is a structural diagram of a mobile terminal provided in one embodiment of the present application. DETAILED DESCRIPTION
[0041] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0042] In the subsequent description, suffixes such as "module," "component," or "unit" used to represent elements are only used to facilitate the description of the present invention and have no specific meaning. Therefore, "module," "component," or "unit" can be used interchangeably.
[0043] The terminal can be implemented in various forms. For example, the terminal described in the present invention may include mobile terminals such as mobile phones, tablet computers, laptop computers, PDAs, portable media players (PMPs), navigation devices, wearable devices, smart bracelets, pedometers, etc., as well as fixed terminals such as digital TVs and desktop computers.
[0044] The following description will be made by taking a mobile terminal as an example. It will be understood by those skilled in the art that, in addition to components specifically used for mobile purposes, the configuration according to the embodiments of the present invention can also be applied to fixed type terminals.
[0045] See also Figure 1 , which is a schematic diagram of the hardware structure of a mobile terminal for implementing various embodiments of the present invention. The mobile terminal 100 may include: an RF (Radio Frequency) unit 101, a WiFi module 102, an audio output unit 103, an A / V (audio / video) input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, a processor 110, and a power supply 111. Those skilled in the art will understand that Figure 1 The structure of the mobile terminal shown in the figure does not constitute a limitation to the mobile terminal. The mobile terminal may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0046] The following combination Figure 1 A detailed introduction to each component of the mobile terminal is given below:
[0047] The RF unit 101 can be used to send and receive information or receive signals during calls. Specifically, it receives downlink information from the base station and transmits it to the processor 110 for processing. It also transmits uplink data to the base station. Typically, the RF unit 101 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, a duplexer, and more. Furthermore, the RF unit 101 can communicate with the network and other devices via wireless communication. The above-mentioned wireless communications may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA2000 (Code Division Multiple Access 2000), WCDMA (Wideband Code Division Multiple Access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access), FDD-LTE (Frequency Division Duplexing-Long Term Evolution) and TDD-LTE (Time Division Duplexing-Long Term Evolution), etc.
[0048] WiFi is a short-range wireless transmission technology. Mobile terminals can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 102. It provides users with wireless broadband Internet access. Figure 1 The WiFi module 102 is shown, but it is understandable that it is not an essential component of the mobile terminal and can be omitted as needed without changing the essence of the invention.
[0049] The audio output unit 103 can convert audio data received by the RF unit 101 or the WiFi module 102 or stored in the memory 109 into an audio signal and output it as sound when the mobile terminal 100 is in a call signal reception mode, a talk mode, a recording mode, a voice recognition mode, a broadcast reception mode, or the like. Furthermore, the audio output unit 103 can also provide audio output related to a specific function performed by the mobile terminal 100 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 103 may include a speaker, a buzzer, or the like.
[0050] The A / V input unit 104 is used to receive audio or video signals. The A / V input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos captured by an image capture device (e.g., a camera) in video capture mode or image capture mode. The processed image frames may be displayed on the display unit 106. The image frames processed by the GPU 1041 may be stored in the memory 109 (or other storage medium) or transmitted via the RF unit 101 or the WiFi module 102. The microphone 1042 may receive sound (audio data) in operating modes such as a phone call mode, a recording mode, and a voice recognition mode, and may process such sound into audio data. In the phone call mode, the processed audio (voice) data may be converted into a format that can be transmitted to a mobile communication base station via the RF unit 101. The microphone 1042 may implement various types of noise cancellation (or suppression) algorithms to eliminate (or suppress) noise or interference generated during the reception and transmission of audio signals.
[0051] The mobile terminal 100 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 1061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 1061 and / or the backlight when the mobile terminal 100 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the mobile phone, such as fingerprint sensors, pressure sensors, iris sensors, molecular sensors, gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be described here.
[0052] The display unit 106 is used to display information input by the user or information provided to the user. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0053] The user input unit 107 can be used to receive input digital or character information, and generate key signal input related to user settings and function control of the mobile terminal. Specifically, the user input unit 107 may include a touch panel 1071 and other input devices 1072. The touch panel 1071, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by the user using a finger, stylus, or any other suitable object or accessory on or near the touch panel 1071) and drive the corresponding connection device according to a pre-set program. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction and detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 110. It can also receive commands sent by the processor 110 and execute them. In addition, the touch panel 1071 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1071, the user input unit 107 may further include other input devices 1072. Specifically, the other input devices 1072 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power keys, etc.), a trackball, a mouse, a joystick, etc., and are not specifically limited here.
[0054] Furthermore, the touch panel 1071 may cover the display panel 1061. When the touch panel 1071 detects a touch operation on or near it, it transmits the information to the processor 110 to determine the type of touch event. Subsequently, the processor 110 provides a corresponding visual output on the display panel 1061 according to the type of touch event. Figure 1 In the embodiment, the touch panel 1071 and the display panel 1061 are two independent components to realize the input and output functions of the mobile terminal. However, in some embodiments, the touch panel 1071 and the display panel 1061 can be integrated to realize the input and output functions of the mobile terminal, which is not limited here.
[0055] The interface unit 108 serves as an interface through which at least one external device can be connected to the mobile terminal 100. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 108 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the mobile terminal 100 or may be used to transmit data between the mobile terminal 100 and an external device.
[0056] Memory 109 can be used to store software programs and various data. Memory 109 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as a sound playback function or an image playback function); the data storage area may store data generated based on the use of the mobile phone (such as audio data, a phone book, etc.). Furthermore, memory 109 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0057] Processor 110 is the control center of the mobile terminal, connecting all components of the mobile terminal using various interfaces and circuits. By running or executing software programs and / or modules stored in memory 109 and accessing data stored in memory 109, it executes various functions of the mobile terminal and processes data, thereby providing overall monitoring of the mobile terminal. Processor 110 may include one or more processing units; preferably, processor 110 may integrate an application processor and a modem processor. The application processor primarily handles the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 110.
[0058] The mobile terminal 100 may also include a power supply 111 (such as a battery) for supplying power to various components. Preferably, the power supply 111 may be logically connected to the processor 110 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.
[0059] although Figure 1 Not shown, the mobile terminal 100 may further include a Bluetooth module, etc., which will not be described in detail here.
[0060] To facilitate understanding of the embodiments of the present invention, the communication network system on which the mobile terminal of the present invention is based is described below.
[0061] See also Figure 2 , Figure 2 A communication network system architecture diagram is provided for an embodiment of the present invention. The communication network system is an LTE system of universal mobile communication technology. The LTE system includes a UE (User Equipment) 201, an Evolved UMTS Terrestrial Radio Access Network (E-UTRAN) 202, an Evolved Packet Core (EPC) 203, and an operator's IP service 204, which are sequentially connected in communication.
[0062] Specifically, UE201 may be the above-mentioned terminal 100, which will not be described in detail here.
[0063] E-UTRAN 202 includes eNodeB 2021 and other eNodeBs 2022 , etc. Among them, eNodeB 2021 can be connected to other eNodeBs 2022 via a backhaul (eg, an X2 interface), and eNodeB 2021 is connected to EPC 203 , and eNodeB 2021 can provide UE 201 with access to EPC 203 .
[0064] EPC 203 may include MME (Mobility Management Entity) 2031, HSS (Home Subscriber Server) 2032, other MMEs 2033, SGW (Serving Gate Way) 2034, PGW (PDN Gate Way) 2035, and PCRF (Policy and Charging Rules Function) 2036. MME 2031 is the control node that handles signaling between UE 201 and EPC 203, providing bearer and connection management. HSS 2032 provides registers for managing functions such as the Home Location Register (not shown) and stores user-specific information such as service features and data rates. All user data can be sent through SGW2034, PGW2035 can provide IP address allocation and other functions for UE 201, PCRF2036 is the policy and charging control policy decision point for service data flow and IP bearer resources, and it selects and provides available policy and charging control decisions for the policy and charging execution function unit (not shown in the figure).
[0065] The IP service 204 may include the Internet, an intranet, an IMS (IP Multimedia Subsystem), or other IP services.
[0066] Although the above description is based on the LTE system as an example, those skilled in the art should know that the present invention is not only applicable to the LTE system, but also to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA, and future new network systems, and is not limited here.
[0067] Based on the above-mentioned mobile terminal hardware structure and communication network system, various embodiments of the method of the present invention are proposed.
[0068] Figure 4 1 is a flowchart of an embodiment of the image processing method provided by the present application. Once the method of this embodiment is triggered by the user, the process in this embodiment is automatically executed by the mobile terminal 100. During execution, each step can be performed in the order shown in the flowchart, or multiple steps can be performed simultaneously according to actual circumstances, which is not limited here. The mobile terminal 100 includes at least one camera. The image processing method provided by the present application includes the following steps:
[0069] Step S1, obtaining star tracks in the image to be processed;
[0070] Step S2, extracting the pixels of the star trail, rearranging and saving the RGB information of the pixels in descending order of the grayscale values corresponding to the pixels, and saving the center position of the star trail;
[0071] Step S3, calculating the average RGB value of a neighborhood of a preset size around the star trail, and filling the area where the star trail is located according to the average RGB value;
[0072] Step S4, generating pixel points based on the saved RGB information, and using the generated pixel points in the rearranged order, with the center position of the star trajectory as the center of the circle, the preset size as the radius, and filling in the order from near to far from the center of the circle.
[0073] Through the above implementation, first, the star trails in the image to be processed are obtained; then, the pixels of the star trails are extracted, and the RGB information of the pixels are rearranged and saved in descending order according to the grayscale values corresponding to the pixels, and the center position of the star trail is saved; then, the average RGB value in a neighborhood of a preset size around the star trail is calculated, and the area where the star trail is located is filled according to the average RGB value; finally, pixel points are generated according to the saved RGB information, and the generated pixel points are used in the rearranged order, with the center position of the star trail as the center of the circle and the preset size as the radius, and the order of distance from the center of the circle is filled in from near to far. This can reduce the hardware cost and photography skill requirements required for shooting professional starry skies, so that ordinary users can also take starry sky photos without star trails.
[0074] The above steps will be described in detail below with reference to specific embodiments.
[0075] In step S1, the star trails in the image to be processed are obtained.
[0076] In this embodiment, the photo to be processed with star trails taken after receiving the shooting command input by the user is used as the image to be processed. After obtaining the image to be processed, the star trails therein can be obtained. It is understandable that the star trails can be the trails of multiple stars in the image to be processed.
[0077] Optionally, the star trails in the image to be processed are immediately acquired after the shooting of the photo to be processed is completed, so that the image to be processed can be processed in a timely manner, thereby feeding back the processed starry sky photo to the user in a timely manner.
[0078] In this embodiment, the step of obtaining star trails in the image to be processed includes:
[0079] Step S11 , processing the image to be processed by an image line detection algorithm to obtain star tracks.
[0080] For example, the image straight line detection algorithm may adopt a fast image straight line detection algorithm EDline. Of course, other image straight line detection algorithms may also be adopted. This embodiment does not limit the type of the specific image straight line detection algorithm adopted.
[0081] In one embodiment, the step of processing the image to be processed using an image line detection algorithm to obtain star trails includes:
[0082] Step S1111, processing the image to be processed by an image line detection algorithm to obtain texture in the image to be processed;
[0083] Step S1112: Filter out star trails according to the richness of the texture.
[0084] In this embodiment, the image to be processed is first processed using an image line detection algorithm to obtain the texture in the image to be processed. Then, star trails are filtered out based on the richness of the texture. In this way, non-star trails with rich textures can be filtered out based on the richness of the texture, and star trails can be obtained.
[0085] Specifically, please refer to Figure 5 , the image to be processed is processed by an image line detection algorithm, and the texture of the image to be processed obtained includes not only the texture of star trails in the sky area, but also the texture of other objects in the non-sky area. In order to eliminate star trails, it is first necessary to filter out the texture of the star trails from the texture in the image to be processed. Because the texture of the sky area is much weaker than that of the non-sky area, the star trails can be further filtered out based on the richness of the texture. For example, please refer to Figure 6 , an edge texture extraction algorithm based on HED (Holistically-Nested Network) can be used to extract the texture of the non-sky area, and the extracted texture of the non-sky area can be cut out from the texture in the image to be processed to obtain the star tracks in the sky area.
[0086] In another embodiment, the step of processing the image to be processed using an image line detection algorithm to obtain star tracks includes:
[0087] Step S1121, extracting the sky area in the image to be processed from the image to be processed;
[0088] Step S1122: Process the extracted sky area using an image line detection algorithm to obtain star tracks.
[0089] In this embodiment, the sky region in the image to be processed is first cut out from the image to be processed; then, the cut-out sky region is processed using an image line detection algorithm to obtain star trails. In this way, the sky region can be cut out from the image to be processed first, and then only the sky region is processed using an image line detection algorithm to obtain star trails.
[0090] Specifically, the sky area in the image to be processed can be cut out from the image to be processed by directly cutting out the sky area from the image to be processed using a sky cutout algorithm, or by cutting out the non-sky area from the image to be processed using a foreground cutout algorithm, and then deleting the cutout non-sky area from the image to be processed to obtain the sky area. Figure 7 , where the black portion is the non-sky region cut out from the image to be processed. This embodiment does not limit the specific method for cutting out the sky region from the image to be processed. After obtaining the sky region, the sky region is processed using an image line detection algorithm to obtain star trails.
[0091] In another embodiment, the step of processing the image to be processed using an image line detection algorithm to obtain star tracks includes:
[0092] Step S1131, processing the image to be processed using an image line detection algorithm to obtain a processing result;
[0093] Step S1132, obtaining the theoretical trajectory of the current position in the current time period;
[0094] Step S1133: Filter the processing result according to the theoretical trajectory, and use the filtered result as the star trajectory.
[0095] In this embodiment, the image to be processed is first processed using an image line detection algorithm to obtain a processing result. Then, a theoretical trajectory for the current position and the current time period is obtained. Finally, the processing result is filtered according to the theoretical trajectory, and the filtered result is used as a star trajectory. In this way, the processing result can be filtered using the theoretical trajectory, and non-star trajectories that do not conform to the theoretical trajectory are filtered out to obtain a star trajectory.
[0096] Specifically, the image to be processed is processed by an image straight line detection algorithm, and the obtained processing result contains not only star tracks but also non-star tracks. By obtaining the theoretical track that the stars should produce in the current position and the current time period, and filtering the processing result with the theoretical track, the non-star tracks that do not conform to the theoretical track can be filtered out to obtain the star track. The theoretical track may include the direction and length of the theoretical track. The processing result can be filtered by the direction of the theoretical track, or by the length of the theoretical track, or by the length and direction of the theoretical track. Please refer to Figure 8 , is a schematic diagram of filtering the processing result by the length and direction of the theoretical trajectory, wherein the short oblique line is the theoretical trajectory and the small rectangle is the processing result.
[0097] In this embodiment, obtaining the theoretical trajectory of the current position in the current time period includes:
[0098] Step S11321 , calculating a theoretical trajectory in the current time period according to the current gravity direction, longitude and latitude, magnetic declination, and exposure time when the image to be processed is captured.
[0099] In this embodiment, the theoretical trajectory in the current time period is calculated based on the current gravity direction, longitude and latitude, magnetic declination, and exposure time when the image to be processed is captured, so that a more accurate theoretical trajectory can be obtained.
[0100] Specifically, the current gravity direction, longitude and latitude, magnetic declination, and exposure time when the image to be processed is captured can be acquired from a mobile terminal that captures the image to be processed.
[0101] In step S2, the pixels of the star trail are extracted, and the RGB information of the pixels are rearranged and saved in descending order of the grayscale values corresponding to the pixels, and the center position of the star trail is saved.
[0102] Specifically, the pixels of the star trails are extracted, and the RGB information of the pixels are rearranged and saved in the order of the grayscale values corresponding to the pixels from large to small, and the center position of the star trails is saved. This allows the saved RGB information to be subsequently filled around the center position of the star trails to reconstruct the star image. Optionally, the pixels of the star trails are extracted, and the RGB information of the pixels are rearranged and saved in the order of the grayscale values corresponding to the pixels from large to small, and the center position of the star trails is saved at the same time. By rearranging the RGB information of the pixels in the order of the grayscale values corresponding to the pixels from large to small, the RGB information can be filled in in the order of the grayscale values corresponding to the pixels from large to small when reconstructing the star image, so that the reconstructed star image is more natural and conforms to objective laws.
[0103] In step S3, the average RGB value of a neighborhood of a preset size around the star trail is calculated, and the area where the star trail is located is filled according to the average RGB value.
[0104] Specifically, the preset size can be determined based on the requirements for the processing effect of the image to be processed, and this embodiment does not limit its specific value. The shape of the neighborhood can be circular, rectangular or other shapes, and this embodiment does not limit its specific shape. It can be understood that by calculating the average RGB value in the neighborhood of the preset size around the star trail, and filling the area where the star trail is located according to the average RGB value, the star trail can be filled with the sky color around it, thereby eliminating the highlighted star trails and making the starry sky temporarily "star-free", which is convenient for subsequent reconstruction of the star image.
[0105] In step S4, pixel points are generated according to the saved RGB information, and the generated pixel points are filled in the order of the rearrangement, with the center position of the star trajectory as the center of the circle and the preset size as the radius, in order from near to far from the center of the circle.
[0106] Specifically, by generating pixel points based on the RGB information saved in step S2, the generated pixel points are used in the rearranged order, with the center position of the star trail as the center of the circle and the preset size as the radius, and filling is performed in order from near to far from the center of the circle. A star image can be reconstructed around the center position of the original star trail, and the RGB information of the reconstructed star image is that of the original star trail, thereby maintaining the brightness and color of the original star trail. Optionally, the filling in order from near to far from the center of the circle can be performed until the saved RGB information is exhausted, thereby further maintaining the brightness and color of the original star trail. The preset size can be determined based on the requirements for the processing effect of the image to be processed, and this embodiment does not limit its specific value.
[0107] In one embodiment, the image processing method further includes:
[0108] Step S5, adding a preset bias to the three channels of the pixel corresponding to the filled pixel point to increase the brightness of the star.
[0109] Specifically, step S5 can be performed after step S4, that is, after generating pixel points based on the saved RGB information, the generated pixel points are filled in the order of the rearrangement, with the center position of the star trajectory as the center of the circle and the preset size as the radius, in the order from near to far from the center of the circle, and a preset bias is added to the three channels of the pixels corresponding to the filled pixel points to increase the brightness of the stars.
[0110] In one embodiment, the image processing method further includes:
[0111] Step S6: improving at least one parameter of the image's saturation, contrast, and sharpness to enhance the starry sky visual effect of the image.
[0112] Specifically, step S6 may be performed after step S4, that is, after generating pixel points according to the stored RGB information, filling the circle with the generated pixel points in the order of rearrangement, with the center of the star trail as the center, the preset size as the radius, and in the order from near to far from the center, and then improving at least one parameter of the saturation, contrast and sharpness of the entire image to improve the starry sky visual effect of the image, please refer to Figure 9 The picture on the left is a schematic diagram of the picture to be processed, and the picture on the right is a schematic diagram of the starry sky photo processed by the image processing method of this application.
[0113] The above embodiment obtains star trails in the image to be processed; extracts the pixels of the star trails, rearranges and saves the RGB information of the pixels in descending order of the grayscale values corresponding to the pixels, and saves the center position of the star trails; calculates the average RGB value in a neighborhood of a preset size around the star trails, and fills the area where the star trails are located according to the average RGB value; generates pixel points based on the saved RGB information, and uses the generated pixel points to fill in the circle in the rearranged order, with the center position of the star trail as the center and the preset size as the radius, in order from near to far from the center of the circle. This can reduce the hardware cost and photography skill requirements required for shooting professional starry skies, so that ordinary users can also take starry sky photos without star trails.
[0114] Figure 10 1 is a schematic structural diagram of a mobile terminal 100 provided in one embodiment of the present application. The mobile terminal 100 includes a memory 109, a processor 110, and a computer program (not shown) stored in the memory and executable on the processor. When the computer program is executed by the processor, the following steps are implemented:
[0115] Get the star tracks in the image to be processed;
[0116] Extracting pixels of the star trail, rearranging and saving the RGB information of the pixels in descending order of the grayscale values corresponding to the pixels, and saving the center position of the star trail;
[0117] Calculate the average RGB value of a neighborhood of a preset size around the star trail, and fill the area where the star trail is located according to the average RGB value;
[0118] Generate pixel points according to the saved RGB information, and use the generated pixel points in the rearranged order, with the center position of the star trajectory as the center of the circle and the preset size as the radius, and fill in the order from near to far from the center of the circle.
[0119] Optionally, obtaining star tracks in the image to be processed includes:
[0120] The image to be processed is processed by an image straight line detection algorithm to obtain star tracks.
[0121] Optionally, the processing the image to be processed by using an image line detection algorithm to obtain star tracks includes:
[0122] Processing the image to be processed by an image straight line detection algorithm to obtain a processing result;
[0123] Get the theoretical trajectory of the current position in the current period;
[0124] The processing result is filtered according to the theoretical trajectory, and the filtered result is used as the star trajectory.
[0125] Optionally, obtaining a theoretical trajectory of the current position within a current time period includes:
[0126] The theoretical trajectory in the current time period is calculated according to the current gravity direction, longitude and latitude, magnetic declination and the exposure time when the image to be processed is taken.
[0127] Optionally, the processing the image to be processed by using an image line detection algorithm to obtain star tracks includes:
[0128] Processing the image to be processed by an image straight line detection algorithm to obtain a texture in the image to be processed;
[0129] Star trails are filtered out based on the richness of the texture.
[0130] Optionally, the processing the image to be processed by using an image line detection algorithm to obtain star tracks includes:
[0131] Cutting out the sky area in the image to be processed from the image to be processed;
[0132] The extracted sky area is processed by an image line detection algorithm to obtain star tracks.
[0133] Optionally, the method further includes:
[0134] A preset bias is added to the three channels of the pixels corresponding to the filled pixel points to increase the brightness of the stars.
[0135] Optionally, the method further includes:
[0136] At least one parameter of the image's saturation, contrast, and sharpness is increased to enhance the starry sky visual effect of the image.
[0137] Through the mobile terminal 100, the star trails in the image to be processed are obtained; the pixels of the star trails are extracted, and the RGB information of the pixels is rearranged and saved in descending order according to the grayscale values corresponding to the pixels, and the center position of the star trail is saved; the average RGB value in a neighborhood of a preset size around the star trail is calculated, and the area where the star trail is located is filled according to the average RGB value; pixel points are generated according to the saved RGB information, and the generated pixel points are used to fill in the circle in the order of the rearrangement, with the center position of the star trail as the center and the preset size as the radius, in order from near to far from the center of the circle. This can reduce the hardware cost and photography skill requirements required for shooting professional starry skies, so that ordinary users can also take starry sky photos without star trails.
[0138] An embodiment of the present application further provides a computer-readable storage medium, wherein an image processing program is stored on the computer-readable storage medium. When the image processing program is executed by a processor, the following steps are implemented:
[0139] Get the star tracks in the image to be processed;
[0140] Extracting pixels of the star trail, rearranging and saving the RGB information of the pixels in descending order of the grayscale values corresponding to the pixels, and saving the center position of the star trail;
[0141] Calculate the average RGB value of a neighborhood of a preset size around the star trail, and fill the area where the star trail is located according to the average RGB value;
[0142] Generate pixel points according to the saved RGB information, and use the generated pixel points in the rearranged order, with the center position of the star trajectory as the center of the circle and the preset size as the radius, and fill in the order from near to far from the center of the circle.
[0143] Optionally, obtaining star tracks in the image to be processed includes:
[0144] The image to be processed is processed by an image straight line detection algorithm to obtain star tracks.
[0145] Optionally, the processing the image to be processed by using an image line detection algorithm to obtain star tracks includes:
[0146] Processing the image to be processed by an image straight line detection algorithm to obtain a processing result;
[0147] Get the theoretical trajectory of the current position in the current period;
[0148] The processing result is filtered according to the theoretical trajectory, and the filtered result is used as the star trajectory.
[0149] Optionally, obtaining a theoretical trajectory of the current position within a current time period includes:
[0150] The theoretical trajectory in the current time period is calculated according to the current gravity direction, longitude and latitude, magnetic declination and the exposure time when the image to be processed is taken.
[0151] Optionally, the processing the image to be processed by using an image line detection algorithm to obtain star tracks includes:
[0152] Processing the image to be processed by an image straight line detection algorithm to obtain a texture in the image to be processed;
[0153] Star trails are filtered out based on the richness of the texture.
[0154] Optionally, the processing the image to be processed by using an image line detection algorithm to obtain star tracks includes:
[0155] Cutting out the sky area in the image to be processed from the image to be processed;
[0156] The extracted sky area is processed by an image line detection algorithm to obtain star tracks.
[0157] Optionally, the method further includes:
[0158] A preset bias is added to the three channels of the pixels corresponding to the filled pixel points to increase the brightness of the stars.
[0159] Optionally, the method further includes:
[0160] At least one parameter of the image's saturation, contrast, and sharpness is increased to enhance the starry sky visual effect of the image.
[0161] The star trails in the image to be processed are obtained through the computer-readable storage medium; the pixels of the star trails are extracted, and the RGB information of the pixels are rearranged and saved in descending order according to the grayscale values corresponding to the pixels, and the center position of the star trail is saved; the average RGB value in a neighborhood of a preset size around the star trail is calculated, and the area where the star trail is located is filled according to the average RGB value; pixel points are generated according to the saved RGB information, and the generated pixel points are used to fill in the circle in the order of the rearrangement, with the center position of the star trail as the center and the preset size as the radius, in order from near to far from the center of the circle. This can reduce the hardware cost and photography skill requirements required for shooting professional starry skies, so that ordinary users can also take starry sky photos without star trails.
[0162] The corresponding technical features in the above-mentioned embodiments can be used interchangeably without causing contradiction or impracticality of the solutions.
[0163] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0164] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0165] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are protected by the present invention.
Claims
1. An image processing method, characterized in that: The method comprises: Get the star tracks in the image to be processed; Extracting pixels of the star trail, rearranging and saving the RGB information of the pixels in descending order of the grayscale values corresponding to the pixels, and saving the center position of the star trail; Calculate the average RGB value of a preset neighborhood around the star trail, and fill the area where the star trail is located according to the average RGB value to fill the star trail with the surrounding sky color and eliminate the highlighted star trails; Pixel points are generated according to the saved RGB information, and the generated pixel points are used in the rearranged order, with the center position of the star trail as the center of the circle and the preset size as the radius, and the pixels are filled in from near to far from the center of the circle to reconstruct the star image around the center position of the original star trail.
2. The image processing method according to claim 1, wherein: The obtaining of star tracks in the image to be processed comprises: The image to be processed is processed by an image straight line detection algorithm to obtain star tracks.
3. The image processing method according to claim 2, wherein: The processing of the image to be processed by using an image straight line detection algorithm to obtain star tracks includes: Processing the image to be processed by an image straight line detection algorithm to obtain a processing result; Get the theoretical trajectory of the current position in the current period; The processing result is filtered according to the theoretical trajectory, and the filtered result is used as the star trajectory.
4. The image processing method according to claim 3, wherein: The method of obtaining the theoretical trajectory of the current position in the current time period includes: The theoretical trajectory in the current time period is calculated according to the current gravity direction, longitude and latitude, magnetic declination and the exposure time when the image to be processed is taken.
5. The image processing method according to claim 2, wherein: The processing of the image to be processed by using an image straight line detection algorithm to obtain star tracks includes: Processing the image to be processed by an image straight line detection algorithm to obtain a texture in the image to be processed; Star trails are filtered out based on the richness of the texture.
6. The image processing method according to claim 2, wherein: The processing of the image to be processed by using an image straight line detection algorithm to obtain star tracks includes: Cutting out the sky area in the image to be processed from the image to be processed; The extracted sky area is processed by an image line detection algorithm to obtain star tracks.
7. The image processing method according to claim 1, wherein: The method further comprises: A preset bias is added to the three channels of the pixels corresponding to the filled pixel points to increase the brightness of the stars.
8. The image processing method according to claim 1, wherein: The method further comprises: At least one parameter of the image's saturation, contrast, and sharpness is increased to enhance the starry sky visual effect of the image.
9. A mobile terminal, characterized in that: The mobile terminal includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the method according to any one of claims 1 to 8 when executed by the processor.
10. A computer-readable storage medium, characterized in that An image processing program is stored on the computer-readable storage medium, and when the image processing program is executed by the processor, the steps of the image processing method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Starry sky image processing method and device
CN110930329A
Trailing star image centering method for space target in CCD image
CN112053310A