Image generating method, device, equipment, and storage medium

The image generation method addresses the issue of residual shadows in converting daytime to nighttime images by adjusting image regions to match scene information, improving realism through shadow removal and alignment with scene characteristics.

JP7537035B2Active Publication Date: 2024-08-20SENSETIME GRP LTD +1
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
JP2023559825
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2021-03-31
Filing Date
2022-01-26
Publication Date
2024-08-20
Estimated Expiration
2042-01-26

AI Technical Summary

Technical Problem

Existing image generation methods fail to effectively convert daytime road scene images into nighttime images without shadows, resulting in low realism due to residual shadows.

Method used

An image generation method that adjusts the rendering state of specific regions in an image to match the scene information by determining areas with mismatched shadows and transforming them to a target rendering state, such as removing shadows or adding rain/snow based on reference areas, using histogram matching and illumination parameters.

Benefits of technology

Improves the realism of generated nighttime images by accurately removing shadows and aligning image content with scene information, enhancing the naturalness and consistency of the transformed images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007537035000005
    Figure 0007537035000005
  • Figure 0007537035000001
    Figure 0007537035000001
  • Figure 0007537035000008
    Figure 0007537035000008
Patent Text Reader

Abstract

The embodiments of the present disclosure provide an image generating method, an apparatus, a device and a storage medium, in which an original image is transformed into a target image of a specific scene, an area to be adjusted in the target image, whose image rendering state does not match scene information of the specific scene, the image rendering state of the area to be adjusted is related to a light ray irradiated to a target object of the original image, the target object including a vehicle, a target rendering state of the area to be adjusted is determined, the target rendering state matches the scene information, and the image rendering state of the area to be adjusted in the target image is adjusted to the target rendering state to obtain a target image, in this way, the shadow rendering state in the generated target image matches the scene information, thereby improving the realism of the generated target image.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] (CROSS-REFERENCE TO RELATED APPLICATIONS) This application is filed based on a Chinese patent application bearing application number 202110351943.9, filed with the China Patent Office on March 31, 2021, and claims priority to the Chinese patent application, the entire contents of which are incorporated herein by reference.

[0002] TECHNICAL FIELD The embodiments of the present disclosure relate to the field of image processing technology, including, but not limited to, an image generating method, an apparatus, a device, and a storage medium. [Background technology]

[0003] In the image generation method of the related art, when an image of a road scene collected during the day needs to be style-transformed and converted into a nighttime image, shadows exist in the image collected during the day, and shadows still exist in the converted image, so the realism of the generated image is not high. Summary of the Invention

[0004] The embodiments of the present disclosure provide an image generation technology solution.

[0005] The technical solution of the embodiment of the present disclosure is realized as follows.

[0006] An embodiment of the present disclosure provides an image generation method, the image generation method comprising: Transforming an original image into a target image of a particular scene; determining an area to be adjusted in the target image, the image rendering state of which does not match scene information of the particular scene, the image rendering state of the area to be adjusted being related to a light ray projected onto a target object in the original image, the target object including a vehicle; determining a target rendering state in the region to be adjusted, the target rendering state matching the scene information; adjusting an image rendering state of the region to be adjusted in the target image to the target rendering state to obtain a target image.

[0007] In some embodiments, the image rendering state includes a shadow rendering state, and determining a target rendering state for the region to be adjusted includes determining a reference region in the processing target image, whose shadow rendering state matches the scene information, and determining the shadow rendering state of the reference region as the target rendering state. In this way, in either a nighttime scene with no light source or a daytime scene with no sunlight, an image region with no shadow state that matches the scene is taken as a reference region, and histogram matching is performed for the region to be adjusted based on the reference region, so that the screen chromaticity presented in the region to be adjusted after processing is the same as that of the reference region.

[0008] In some embodiments, determining the regions in the target image to be adjusted, in which the image rendering state does not match the scene information of the particular scene, includes determining a shadow region in the target image as the region to be adjusted when the scene information is a night scene without a light source or a day scene without sunlight, in this way image regions with unreasonable screen contents can be accurately determined.

[0009] In some embodiments, determining an area in the target image to be adjusted where an image rendering state does not match scene information of the particular scene includes: when the scene information is a night scene with a light source or a daytime scene with sunlight, determining a possible shadow area in the target object based on a direction of light rays irradiated on the target object, and determining a shadow area in the target image other than a first shadow area as an area to be adjusted, where the first shadow area is an intersection of the shadow areas in the target image and the possible shadow areas in the target object. In this way, by determining a shadow area in the target image other than the possible shadow areas in the target object as an area to be adjusted, it is possible to more accurately determine an area in which a shadow rendering state needs to be adjusted.

[0010] In some embodiments, the shadow rendering state of the reference region is a no-shadow rendering state, and adjusting the image rendering state of the region to be adjusted in the processing target image to the target rendering state to obtain the target image includes adjusting the image of the region to be adjusted to a no-shadow state based on the image of the reference region in the processing target image to obtain the target image. In this way, the shadow rendering state in the generated target image is a no-shadow state, which is more consistent with nighttime scenes without light sources and daytime scenes without sunlight.

[0011] In some embodiments, adjusting the image of the region to be adjusted to a no-shade state based on the image of the reference region in the processing target image to obtain the target image includes adjusting a gradient image of the region to be adjusted based on the image of the reference region to obtain an adjusted gradient image, generating an image of a replacement region having a shade rendering state of a no-shade state based on the adjusted gradient image, and replacing the image of the region to be adjusted in the processing target image with the generated image of the replacement region to generate the target image. In this way, the shade rendering state in the generated target image matches scene information, thereby improving the realism of the generated target image.

[0012] In some embodiments, adjusting the gradation image of the area to be adjusted based on the image of the reference area to obtain an adjusted gradation image includes: determining a histogram of the reference area based on the image of the reference area; adjusting the histogram of the area to be adjusted based on the histogram of the reference area to obtain an adjusted histogram; and determining the adjusted gradation image based on the adjusted histogram. In this way, the shadow part of the image can be removed more naturally, thereby improving the realism of the screen content of the obtained image.

[0013] In some embodiments, the image rendering state includes a shadow rendering state, and determining an area to be adjusted in the target image where the image rendering state does not match the scene information includes: determining a possible shadow area of ​​the target object based on a direction of a light ray irradiated on the target object when the scene information is a night scene with a light source or a day scene with sunlight; and determining the possible shadow area of ​​the target object as an area to be adjusted. In this way, the realism and naturalness of the adjusted target image can be improved.

[0014] In some embodiments, adjusting the image rendering state of the region to be adjusted in the processing target image to the target rendering state to obtain a target image includes determining lighting parameters in the specific scene, determining lighting intensity of a target object surface where shadow areas may occur based on the lighting parameters, and rendering the region to be adjusted to obtain the target image. In this way, a target object close to an artificial light source may have a shadow area in the target image, and a target object may have a shadow area when there is natural light, thus improving the realism of the generated target image.

[0015] In some embodiments, the original image is an image collected when it is not raining / snowing, the specific scene is a rainy scene / snowy scene, and adjusting the image rendering state of the region to be adjusted in the target image to obtain a target image includes adding raindrops / snowflakes to the original image to obtain a target image, so that a more realistic target image can be obtained.

[0016] An embodiment of the present disclosure provides an image generating device, the image generating device comprising: a first transformation module configured to transform an original image into a target image of a particular scene; a first determination module configured to determine an area to be adjusted in the processing target image, the image rendering state of which does not match scene information of the particular scene, the image rendering state of the area to be adjusted being related to a light ray cast on a target object in the original image, the target object including a vehicle; a second determination module configured to determine a target rendering state in the region to be adjusted, the target rendering state matching the scene information; a first adjustment module configured to adjust an image rendering state of the region to be adjusted in the target image to the target rendering state to obtain a target image.

[0017] Correspondingly, an embodiment of the present disclosure provides a computer storage medium having computer-executable instructions stored thereon, which, when executed, can realize the steps of the above method.

[0018] An embodiment of the present disclosure provides an electronic device, the electronic device comprising a memory and a processor, the memory storing computer-executable instructions, the computer-executable instructions on the memory, when executed, causing the processor to perform steps of the above-mentioned method.

[0019] An embodiment of the present disclosure provides a computer program comprising computer readable code, which when executed in an electronic device, causes a processor of the electronic device to perform any of the image generating methods described above.

[0020] The embodiments of the present disclosure provide an image generating method, apparatus, device, and storage medium, in which an original image is first transformed to obtain a target image of a specific scene, and then an area to be adjusted in the target image whose image rendering state does not match the scene information is determined, and then the rendering state of the area to be adjusted is adjusted to a target rendering state that matches the scene information to generate a target image whose image rendering state matches the scene information, in this way the shadow rendering state in the generated target image matches the scene information, thereby improving the realism of the generated target image. [Brief description of the drawings]

[0021] [Figure 1A] FIG. 1 is a schematic diagram of a system architecture of an image generation method to which embodiments of the present disclosure can be applied. [Figure 1B] 1 is an exemplary flowchart of an image generating method according to an embodiment of the present disclosure. [Diagram 2] 13 is another exemplary flowchart of an image generating method according to an embodiment of the present disclosure. [Figure 3A]FIG. 1 is a schematic structural diagram of an image generating system according to an embodiment of the present disclosure. [Figure 3B] FIG. 1 is a schematic diagram of an application scene of an image generation method according to an embodiment of the present disclosure. [Figure 4] FIG. 2 is an implementation framework structural diagram of an image generating method according to an embodiment of the present disclosure. [Diagram 5] FIG. 2 is a schematic diagram of another application scenario of the image generating method according to an embodiment of the present disclosure. [Figure 6] FIG. 1 is a schematic structural diagram of an image generating device according to an embodiment of the present disclosure. [Figure 7] FIG. 2 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0022] The above drawings are incorporated in and constitute a part of this specification, and these drawings illustrate embodiments in accordance with the present disclosure and are used together with the description to explain the technical solutions of the embodiments of the present disclosure.

[0023] In the following description, the terms "first / second / third" do not represent a particular order for objects, but merely distinguish between similar objects. It is understood that "first / second / third" may be interchangeable with the particular order or order of precedence, such that the embodiments of the present disclosure described in some embodiments may be implemented in an order other than the order illustrated or described in some embodiments.

[0024] Unless otherwise defined, technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure pertains. The terms used herein are for the purpose of describing the embodiments of this disclosure only and are not intended to be limiting of this disclosure.

[0025] Before describing the embodiments of the present disclosure in more detail, terms and expressions related to the embodiments of the present disclosure will be explained, and the terms and expressions related to the embodiments of the present disclosure will be interpreted as follows.

[0026] 1) Gaussian Blur: This is a low-pass filter for images. The so-called "blur" can be understood as the value of each pixel being the average of the surrounding pixels.

[0027] 2) Ego vehicle: A vehicle equipped with sensors to sense the surrounding environment. The vehicle coordinate system is fixed to the ego vehicle, with the x-axis pointing in the direction of travel of the vehicle, the y-axis pointing to the left of the direction of travel of the vehicle, and the z-axis pointing upwards perpendicular to the ground, conforming to a right-handed coordinate system. The coordinate system origin is located on the ground below the midpoint of the rear axle.

[0028] The following describes exemplary applications of the image generating device according to the embodiment of the present disclosure, and the device according to the embodiment of the present disclosure may be implemented as various types of user terminals, such as notebook computers, tablet computers, desktop computers, cameras, mobile devices (e.g., personal digital assistants, dedicated messaging devices, portable game devices) with image collection functions, or may be implemented as a server. The following describes exemplary applications when the device is implemented as a terminal or a server.

[0029] The method can be applied to a computer device, and the functions realized by the method can be realized by a processor of the computer device calling a program code, and of course, the program code may be stored in a computer storage medium, and as can be seen from this, the computer device includes at least a processor and a storage medium.

[0030] 1A is a schematic diagram of a system architecture of an image generating method to which an embodiment of the present disclosure can be applied. As shown in FIG. 1A, the system architecture includes an image collecting device 131, a network 132, and an image generating terminal 133. To support an exemplary application, the image collecting device 131 and the image generating terminal 133 can communicate with each other through the network 132, and the image collecting device 131 reports the collected original image to the image generating terminal 133 through the network 202 (or the image generating terminal 133 automatically obtains the original image). In response to the received original image, the image generating terminal 133 first converts the image into a target image of a specific scene, determines an unreasonable region to be adjusted in the target image, and then determines a target rendering state of the region to be adjusted, adjusts the image rendering state of the region to be adjusted to the target rendering state to obtain a target image, and outputs the target image to an image display interface of the image generating terminal 133. In this way, the symmetrical motion state in the target image is matched with the scene information, so that the generated target image is more consistent with the actual scene.

[0031] As an example, the image collection device 131 may be a collection device equipped with a camera or the like. The image generation terminal 133 may be equipped with a computer device equipped with computing capabilities, and the computer device may include, for example, a terminal device or a server or other processing devices. The network 132 may adopt a wired connection method or a wireless connection method. Here, when the image generation terminal 133 is a server, the image collection device 131 communicates with the server through a wired connection, for example, by a bus, and when the image generation terminal 133 is a terminal device, the image collection device 131 communicates with the image generation terminal 133 through a wireless ... performs data communication.

[0032] Alternatively, in some scenarios, the image generation terminal 133 may be a visual processing device with a video acquisition module, such as a host device with a camera. In this case, the image generation method according to the embodiment of the present disclosure can be performed by the image generation terminal 133, and the above system architecture may not include the network 132 and the image acquisition device 131.

[0033] In order to make the objectives, technical solutions and advantages of the embodiments of the present disclosure clearer, the specific technical solutions of the present disclosure will be described in more detail below with reference to the drawings of the embodiments of the present disclosure. The following embodiments are only for illustrating the present disclosure and are not intended to limit the scope of the present disclosure.

[0034] In the following description, references to "some embodiments" mean a subset of all possible embodiments, but it will be understood that "some embodiments" may be the same or different subsets of all possible embodiments and may be combined without conflict.

[0035] FIG. 1B is an exemplary flowchart of an image generating method according to an embodiment of the present disclosure, which will be described with reference to the steps shown in FIG. 1B as shown in FIG. 1B.

[0036] In step S101, an original image is converted into a processing target image of a specific scene.

[0037] In some embodiments, the original image may be an image collected in any scene, and the original image may include an image with complex screen content or an image with simple screen content, for example, a road image collected late at night or a road image collected during the day, etc. The specific scene includes a daytime scene, an evening scene, a rainy / snowy scene, or a sunny scene, etc. Scene information of the specific scene includes the scene from which the processing target image is collected (for example, the brightness and darkness of the light in the scene, the location of the scene, and the objects in the scene, etc.), for example, if the processing target image is a road image in a late-night scene, the scene information includes the brightness and darkness of the road, the location of the road, and objects on the road, such as vehicles and street lights.

[0038] In some possible embodiments, the image to be processed may be an image of a particular scene (eg, a late night scene, an evening scene, or an early morning scene, etc.).

[0039] In step S101, the conversion of the original image into a processing target image of a specific scene can be realized by the following steps.

[0040] The target object is obtained, and the original image is style transformed according to the specific scene to obtain the processed image. The specific process is as follows:

[0041] In the first step, the original image is obtained.

[0042] In some possible embodiments, the original image is an image of any scene collected (eg, a road image collected during the day or a road image collected at night, etc.).

[0043] In the second step, the scene information of the original image is determined.

[0044] In some possible embodiments, after obtaining an original image, a trained classifier is used to determine whether the scene information of the image is a specific scene, for example, if the specific scene is a night scene without a light source, a classifier is used to determine whether the scene information of the image is a night scene without a light source.

[0045] In a third step, if the scene information does not match the specific scene, the original image is style transformed to obtain a target image of the specific scene.

[0046] In some possible embodiments, when the scene information of the original image is significantly different from the specific scene, the scene information of the original image is converted into the specific scene, i.e., the original image is converted into an image of the specific scene, to obtain the target image of the specific scene. For example, when the specific scene is a night scene without a light source and the original image is an image collected during a daytime scene with the sun, the original image collected during the daytime scene with the sun is converted into an image of the nighttime scene without a light source, and the original image is input into the generator to generate the target image corresponding to the nighttime scene without a light source. Alternatively, when the specific scene is a daytime scene with the sun and the original image is an image collected during a nighttime scene without a light source, the original image collected during the nighttime scene without a light source is converted into an image of a daytime scene with the sun, and the original image is input into the generator to generate the target image corresponding to the daytime scene with the sun.

[0047] In some embodiments, if the scene information matches a particular scene, the original image is determined to be the image to be processed.

[0048] For example, if the scene information is the same as or very similar to the specific scene, it means that the original image has the specific scene, so the original image can be used as the processing target image without performing image conversion on the original image. In one specific example, the specific scene is a scene without a light source in the middle of the night, and the original image is an image collected in a scene where night falls, and the scene is similar to the specific scene, and both are nighttime, in this case, the original image is determined as the processing target image.

[0049] After obtaining an original image through the above first to third steps, the scene information of the original image is judged, and if the scene information is not a specific scene, a processing target image having a specific scene is obtained by performing style conversion on the original image.

[0050] In step S102, regions in the target image that have image rendering conditions that do not match the scene information of the particular scene are determined to be adjusted.

[0051] In some examples, the image rendering state of the region to be adjusted is related to the light rays irradiated on the target object of the original image, the target object includes a vehicle, in some possible embodiments, the target object may be an object that may be shaded under the irradiation of the light rays, and may be any vehicle, traffic sign, pedestrian or animal, etc. included in the screen content of the processing target image, for example, the processing target image is a nighttime urban road image, the image includes buildings, road surface and vehicles parked on the roadside, etc. In this case, the target objects that may be shaded under the irradiation of the light rays are buildings and vehicles.

[0052] An image rendering state is a rendering state of a target object when there is a light source or when there is no light source, and the image rendering state includes at least a shaded state and a non-shaded state. Here, the light source includes an artificial light source and a natural light source, and the artificial light source includes a light source such as a street light, a building light, or a vehicle light. An image rendering state that does not match the scene information is a state in which an image rendering state generated by an object in an image in the scene information does not match the actual scene. For example, in a night scene, when there is no light source (i.e., no artificial light source and no moonlight), no shadow is generated on the object, so the shade rendering state that does not match the night scene without a light source is a shaded state, and in a scene illuminated by sunlight during the day, the object is shaded, so the shade rendering state that does not match the daytime scene with the sun is a non-shaded state.

[0053] In some possible embodiments, the shadow rendering states of the shadow and non-shadow regions in the processing target image are determined to match the scene information by segmenting the shadow and non-shadow regions in the processing target image, for example, the scene information is a night scene without a light source, and the shadow rendering state that does not match the scene is a shaded state, and after segmenting the shadow and non-shadow regions in the processing image, the shadow regions in the processing target image whose shadow rendering state is a shaded state are determined to be the regions to be adjusted.

[0054] In step S103, a target rendering state for the region to be adjusted is determined.

[0055] In some embodiments, the target rendering state that matches the scene information is a state in which a target object actually has a shadow in the scene information. When the scene information is a night scene without a light source, a no-shadow state is determined as the target rendering state that matches the scene information, and when the scene information is a day scene with the sun or a night scene with a light source, a shadowed state is determined as the target rendering state that matches the scene information, so that the determined target rendering state can completely match the scene information and match the actual scene. For example, in a night scene without a light source, no shadow is generated on the object, so the target rendering state that matches the night scene without a light source is a no-shadow state, and in a day scene with the sun, a shadow is generated on the target object due to the illumination of the sun, so the target rendering state that matches the day scene with the sun is a shadowed state.

[0056] In one specific example, the scene information is a night scene without a light source, and the target rendering state that matches the scene information is a shadow-free state. For example, take the image to be processed as a road image, when the image includes a vehicle and a tree parked on the roadside, after dividing the shadow area of ​​the image to be processed, if a vehicle shadow occurs around the vehicle, the image area occupied by the shadow is the area to be adjusted, and the area in the image whose shadow rendering state is a shadow-free state is the area having a target rendering state.

[0057] In another example, when the scene information is a night scene with a light source, for example, when there is an artificial light source such as a street lamp, the target rendering state that matches the scene information is a shaded state. For example, when the image to be processed is a road image, if the image includes a vehicle and a tree parked on the roadside, after dividing the shaded region of the image to be processed, if there is no vehicle shadow around the vehicle, the image region occupied by the vehicle periphery is the region to be adjusted, and the region in the image where the shaded rendering state is a shaded state is the region having a target rendering state.

[0058] In some embodiments, if the particular scene is a rainy scene, the regions to be adjusted that do not match the scene are image regions that do not include raindrops, and if the particular scene is a snowy scene, the regions to be adjusted that do not match the scene are image regions that do not include snowflakes.

[0059] In one example, take the scene information as a rainy / snowy scene. If the original image is an image collected when it is not raining / snowing, the area to be adjusted is the unobstructed area (i.e., the open-air area) in the original image. In this case, raindrops / snowflakes are added to the area to be adjusted to obtain a target image that matches the rainy / snowy scene.

[0060] Or, take the scene information as an example of a scene without rain / snow, if the original image is collected when it is not raining / snowing, the region to be adjusted is the region containing raindrops / snowflakes in the original image, in which case the raindrops / snowflakes are removed from the region to be adjusted to obtain a target image that matches the scene information. In this way, for an image of a scene with rain / snow, the raindrops / snowflakes are added to or removed from the original image according to the scene information of the specific scene to obtain a more realistic target image.

[0061] In another embodiment, when the scene information is a nighttime rainy / snowy scene and the original image is an image collected during the day when it is not raining / snowing, the original image is first converted into an image of a nighttime scene, the shadow areas in the converted image are adjusted, and then raindrops / snowflakes are added to the obtained image to obtain a target image.

[0062] In step S104, the image rendering state of the region to be adjusted in the processing target image is adjusted to the target rendering state to obtain a target image.

[0063] In some examples, the image rendering state of the region to be adjusted in the target image is transformed so that the region to be adjusted has a target rendering state that matches the scene information, thereby obtaining a target image. In some possible embodiments, the image rendering state of the region to be adjusted in the target image may be adjusted to the target rendering state to obtain the target image, or an image region having a target rendering state may be generated according to the target rendering state and the screen content of the region to be adjusted, and the region to be adjusted in the target image may be replaced with the image region to obtain the target image.

[0064] For example, when the scene information is a night scene with no light source and the target rendering state is a shadowed state, the shadow rendering state of the region to be adjusted is a shadowless state, and the shadowless state of the region to be adjusted in the target image may be adjusted to the target rendering state to obtain the target image, or an image region having a shadowless state may be generated according to the shadowless state and the screen content of the region to be adjusted, and the region to be adjusted in the target image may be replaced with the image region, and a smoothing process may be performed on the replaced image to generate the target image. In this way, the shadow rendering state in the generated target image is a shadowless state that matches the night scene with no light source, thereby improving the realism of the generated target image.

[0065] In an embodiment of the present disclosure, regions to be adjusted in a target image whose shadow rendering state does not match the scene information are determined, and then the shadow rendering states of the regions to be adjusted are adjusted to a target rendering state that matches the scene information to generate a target image whose shadow rendering state matches the scene information, thereby improving the realism of the generated target image.

[0066] In some embodiments, the process of determining the area to be adjusted in the above step S102 can be realized by an image segmentation neural network, which may be any network for image segmentation, and the realization process is as follows:

[0067] The neural network labels the areas to be adjusted and the reference areas with a detection frame, which allows accurate prediction of the areas to be adjusted and the reference areas in the image to be processed; i.e., the image segmentation network labels the areas to be adjusted and the reference areas in the image to be processed using a detection frame to label the areas to be adjusted and the reference areas.

[0068] In some possible embodiments, the image segmentation network may be any type of neural network (e.g., a fully convolutional neural network, a dilated convolutional network, an analytical network, etc.) The image to be processed is input to the trained image segmentation network, and the image segmentation network uses a rectangular frame to label the location of the region to be adjusted and the reference region in the image to be processed, thereby labeling the region to be adjusted and the reference region.

[0069] In some embodiments, the training process of the image segmentation network can be accomplished by the following steps.

[0070] In the first step, a training image is input to a training image segmentation network to predict the location information of regions in the training image where the shadow rendering state does not match the scene information and should be adjusted.

[0071] In some possible embodiments, a trained image segmentation network is used to detect regions to be adjusted in a training image, and the trained image segmentation network is trained using a large number of training images, i.e., a large number of training images are input to the trained image segmentation network to make a first stage prediction for the location of the regions to be adjusted in the training image.

[0072] In the second step, a predicted loss for the location of the region to be adjusted is determined based on the actual location of the region in the training images.

[0073] In some possible embodiments, the difference between the actual position information of the labeled regions to be trained in the training image and the predicted position information of the regions to be trained is used to determine the prediction loss. The actual position information of the regions to be trained is used to determine the accuracy of the multiple position information predicted by the trained image segmentation network, thereby determining the prediction loss.

[0074] In the third step, the network parameters of the trained image segmentation network are adjusted based on the prediction loss to obtain the image segmentation network.

[0075] In some possible embodiments, the actual position information of the region to be adjusted is combined to determine the accuracy of each predicted position information, and the accuracy is fed back to the image division network, so that the image division network adjusts network parameters such as weight parameters, thereby improving the accuracy of neural network detection. For example, obtain the position information of 100 regions to be adjusted, and first use a neural network to perform operations such as convolution and deconvolution to obtain the reliability of the position information of the 100 regions to be adjusted. In the training stage, the parameters of the image division network are randomly initialized, so the roughly estimated reliability of the position information of the 100 regions to be adjusted is also random. When trying to improve the accuracy of the position information predicted by the image division network, it is necessary to tell the neural network which of the 100 position information is correct and which is incorrect. Based on this, the comparison function is used to compare the 100 pieces of location information with the actual location information, and if the similarity between the location information and the actual location information is greater than a predetermined similarity threshold, output 1, otherwise output 0; thus, the comparison function outputs 200 comparison values ​​(0, 1); then, the 200 comparison values ​​are input to the trained image segmentation network, thereby making the trained image segmentation network monitor the location information using a loss function, so that for location information with a comparison value of 1, the reliability of the location information is increased, and for location information with a comparison value of 0, the reliability of the location information is decreased; thus, the reliability of each piece of location information is obtained, that is, the detection result of the location information is obtained. Finally, the weight parameters of the image segmentation network are adjusted using the prediction loss corresponding to the location information to obtain a trained image segmentation network. For example, the weight parameters are the neuron weights of a neural network, etc. The prediction loss is the cross entropy loss of the positive example samples and the negative example samples. The prediction loss is used to adjust parameters such as the weights of the neural network, so that the prediction results of the adjusted image segmentation network become more accurate.

[0076] The above process is a process of training an image segmentation network, and is repeated multiple times based on the predicted position of the area to be adjusted obtained by predicting the input image to be processed and the actual position of the area to be adjusted, so that the prediction loss of the position information output by the image segmentation network after training meets the convergence condition, thereby improving the accuracy of the area to be adjusted detected by the neural network.

[0077] In some embodiments, when the image rendering state includes a shadow rendering state, the target rendering state to which the area to be adjusted needs to be switched can be determined in the following two ways, that is, step S103 can be realized in the following two ways:

[0078] Method 1: In step S111, a reference region whose shadow rendering state matches the scene information is determined in the target image.

[0079] In some embodiments, the shadow rendering state includes a shaded state and a non-shaded state, and when the shadow rendering state of the region to be adjusted does not match the scene information, the shadow rendering state of the reference region that is different from the shadow rendering state of the region to be adjusted is a state that matches the scene information. For example, when the scene information is a night scene without a light source, the region to be adjusted is a shadow region caused by a target object in an image in a night scene without a light source, and based on this, the reference region is an image region in the image without shadows.

[0080] In some possible embodiments, when the scene information is a night scene without a light source, a no-shadow region in the processing target image, in which the shadow rendering state is a no-shadow state, is taken as a reference region. In this way, in a night scene without a light source, since the illumination is dim, the target object does not have a shadow in the night scene image in a normal case, so the no-shadow region is taken as a reference region, and the region to be adjusted can be adjusted according to the reference region so as to be more in line with the law of nature.

[0081] In step S112, the shadow rendering state of the reference region is determined as the target rendering state.

[0082] In some embodiments, after determining a reference region in the image to be processed, the shaded rendering state of the reference region is taken as the target rendering state to which the region to be adjusted needs to be transformed.

[0083] In some possible embodiments, when the scene information is a night scene without a light source or a day scene without sunlight, an image area in the image to be processed in which the shadow rendering state is a shadow-free state is determined as the reference area. In this way, regardless of whether the scene is a night scene without a light source or a day scene without sunlight, an image area in a shadow-free state that matches the scene is taken as the reference area, which is advantageous to perform histogram matching for the area to be adjusted based on the reference area, and the screen chromaticity presented in the area to be adjusted after processing is the same as that of the reference area.

[0084] When the scene information is a night scene with a light source or a daytime scene with the sun, an image area in the image to be processed in a shaded state is determined as a reference area. In this way, regardless of whether the scene is a light source or a daytime scene with the sun, an image area in a shaded state that matches the scene is set as a reference area, which is advantageous for performing histogram matching on the area to be adjusted based on the reference area, and the screen chromaticity presented in the area to be adjusted after processing is the same as that of the reference area. In this way, an image area in a shaded state that matches the scene information is set as a reference area, and histogram matching is performed on the area to be adjusted and the reference area, so that the histograms of the area to be adjusted and the reference area match, and the screen effect of the target image is more natural.

[0085] In method 1, an image region in the image to be processed whose shadow rendering state matches the scene information is determined, and a target rendering state is determined so that the color of the region to be adjusted after shadow adjustment matches the color of other regions.

[0086] Method 2: Obtain a target rendering state by analyzing the lighting parameters of the scene information and determining the shadow rendering state that matches the lighting parameters.

[0087] In some embodiments, the lighting parameters include lighting intensity and light beam angle, etc. When the lighting intensity is relatively strong (e.g., the lighting intensity is greater than a certain threshold), the target rendering state is determined to be a shadowed state, and when the lighting intensity is relatively weak (e.g., the lighting intensity is less than a certain threshold), the target rendering state is determined to be a shadowless state. In this way, in the second method, the target rendering state is set by analyzing scene information of the image to be processed, so that the set target rendering state can be more consistent with the requirements of the scene.

[0088] In some embodiments, when the scene information is a night scene without a light source or a day scene without sunlight, the area where shadow occurs is the area to be adjusted, that is, step S102 can be realized by the following process.

[0089] When the scene information is a nighttime scene without a light source or a daytime scene without sunlight, a shadow area in the processing target image is determined as the area to be adjusted.

[0090] In some embodiments, in the case of a night scene without a light source or a daytime scene without sunlight, the target object does not have a shadow, so if the target object has a shadow in the target image, it means that the shadow area is unreasonable, and based on this, in the target object of the target image to be processed, the object with a shadow is selected as the target object, so that the unreasonable image area can be subsequently determined from the target image to be processed. In one specific example, when the target image is a road image of a night scene without a light source, the target object that may have a shadow under the irradiation of light includes a vehicle, where the shadow rendering state of the shadow area generated by the vehicle is a shadowed state, and the shadow area generated by the vehicle is the area to be adjusted.

[0091] In some embodiments, FIG. 2 is another exemplary flowchart of an image generation method according to embodiments of the present disclosure, which will be described below with reference to FIGS.

[0092] In step S201, if the scene information is a night scene with a light source or a day scene with sunlight, a possible shadow area on the target object is determined based on the direction of the light irradiated on the target object.

[0093] In some embodiments, in a daytime scene with sunlight or when the light source at night is moonlight, the direction of the light shining on the target object is determined to determine possible shadow areas on the target object; in a nighttime scene with a light source, when the light source is an artificial light source, not only the direction of the light shining on the target object needs to be determined, but also the distance between the target object and the artificial light source needs to be determined, thereby determining possible shadow areas on the target object, and the process for achieving this is as shown in steps S221 and S222.

[0094] In step S202, the shaded areas in the image to be processed other than the first shaded area are determined as areas to be adjusted.

[0095] In some embodiments, the first shadow area is the intersection of a shadow area in the to-be-processed image and a possible shadow area in the target object.

[0096] The above steps S201 and S202 provide a method for determining an area to be adjusted from the image to be processed when the scene information is a nighttime scene with a light source or a daytime scene with sunlight. In this method, the shadow areas in the image to be processed other than the shadow areas that may occur in the target object are set as the areas to be adjusted, so that the areas that need to have their shadow rendering state adjusted can be more accurately determined.

[0097] In another embodiment, when the scene information is a night scene with a light source, for example, if the light source is an artificial light source, the area having shadows outside the illumination range of the light source is determined as the area to be adjusted. In this case, step S102 can be realized by the following process.

[0098] In the image to be processed, a shadow area occurring in a target object where the distance from the light source is greater than a predetermined distance threshold is determined as an area to be adjusted.

[0099] In some embodiments, the shadow area generated on the target object where the shadow area may occur may be an image area away from the light source. The distance between the artificial light source and the target object is greater than a predetermined distance threshold, which means that the target object is not within the illumination range of the artificial light source, that is, when the artificial light source is in an operating state, the target object cannot be shaded, which means that the shadow area generated by the target object is unreasonable. When there are artificial light sources at night, the distance between the artificial light source and each target object is determined. First, the illumination range of the artificial light source is determined, and then the distance between the artificial light source and each target object is determined to determine whether the target object is within the illumination range of the artificial light source. In one specific example, the image to be processed is an urban road image of a night scene with street lights, and when the scene has street lights that are on, the target objects are buildings and trees. The distance between the street lights and the buildings and the distance between the street lights and the trees are respectively determined to determine whether the buildings and trees are within the illumination range of the street lights, that is, whether the buildings and trees can be shaded by the illumination of the street lights. If the target object is not within the illumination range of the streetlight, the shadow area caused by the target object is the area to be adjusted.

[0100] As described above, a method for determining an area to be adjusted in an image to be processed when the scene information is a nighttime scene with an artificial light source is provided. In this method, when the scene information is a nighttime scene with an artificial light source, it is determined whether a shadow area has occurred in a target object outside the light irradiation range in the image, and the unreasonable shadow area is determined to be the area to be adjusted.

[0101] After steps S201 and S202 determine the image region whose shadow rendering state is a shaded state as the region to be adjusted, steps S103 and S104 can be realized by the following steps S203 and S204, respectively, to process the region to be adjusted and obtain a target image.

[0102] In step S203, the no-shadow state is determined as the target rendering state that matches the scene information.

[0103] In some embodiments, when the scene information is a night scene without a light source or a daytime scene without sunlight, the target object will not have shadows, so if there is no shadow in the image to be processed, it means that the image is reasonable, that is, it matches the scene information. Based on this, in the image to be processed, the non-shadow area can be used as the reference area, that is, the target rendering state that matches the scene information is a shadow-free state.

[0104] In step S204, the image in the area to be adjusted in the processing target image is adjusted to a shadow-free state based on the image in the reference area, thereby obtaining the target image.

[0105] In some embodiments, the target image is obtained by adjusting the shading state of the region to be adjusted in the processing target image to remove the shading of the region. In some possible embodiments, the histogram of the reference region in the shading state can be matched to the histogram of the region to be adjusted to remove the shading of the region to be adjusted, so that the tone of the non-shaded image region in the target image matches, or the shading of the region to be adjusted can be removed in other ways, such as performing maximum filtering and then minimum filtering on the tone image of the region to be adjusted. If the image background of the region to be adjusted is relatively dark and the target object is relatively bright, the shading of the region to be adjusted can be removed by performing minimum filtering and then maximum filtering on the region to be adjusted, a non-shading image that matches the screen content of the region to be adjusted can be selected from a predetermined image library to replace the region to be adjusted, or the shading of the region to be adjusted can be removed by decomposing the shade image.

[0106] In the embodiment of the present disclosure, the area to be adjusted in the target image is determined, and the image of the area to be adjusted is adjusted from the shaded state to the unshaded state according to the image of the reference area to obtain a target image. Alternatively, the target image can be obtained by performing a shade removal process on the area to be adjusted in the target image without using other areas to replace the area to be adjusted. In this way, the shade rendering state in the generated target image is unshaded, which is more consistent with night scenes without light sources and day scenes without sunlight.

[0107] In some possible embodiments, the target image is generated by adjusting the grayscale of the area to be adjusted based on the grayscale of the reference area, that is, step S204 can be realized by the following steps:

[0108] In step S241, the gradation image of the area to be adjusted is adjusted based on the image of the reference area to obtain an adjusted gradation image.

[0109] In some embodiments, a grayscale image of a reference region is first determined. The reference region may be determined from the to-be-processed image, i.e., an image region in the to-be-processed image that has a shadow rendering state that matches the scene is taken as the reference region. The reference region may be an image region that is generated after a target rendering state is set based on the target rendering state and the screen content of the image of the region to be adjusted.

[0110] In some possible embodiments, a grayscale image of the reference area is obtained by determining a histogram of the reference area. For example, after determining the reference area, a histogram of the reference area can be generated based on the image of the reference area, and a grayscale image of the reference area can be generated based on the histogram. In one specific example, when the scene information is a night scene without a light source, the target rendering state is a no-shadow state. In the image to be processed, when there is no artificial light source, the shaded area of ​​the image area is the area to be adjusted, and the unshaded area of ​​the image area is the reference area, and a grayscale image of the unshaded area is generated by determining a histogram of the unshaded area.

[0111] Then, the gradation image of the area to be adjusted is adjusted based on the gradation image of the reference area to obtain an adjusted gradation image. The gradation image of the area to be adjusted may be obtained by determining a histogram of the area to be adjusted. For example, after determining the area to be adjusted, a histogram of the area to be adjusted can be generated based on the image of the area to be adjusted, and a gradation image of the area to be adjusted can be generated based on the histogram. The gradation image of the reference area is used as a reference for adjusting the gradation image of the area to be adjusted, thereby matching the obtained adjusted gradation image with the gradation image of the reference area, that is, matching the color shades of the color images corresponding to the two gradation images.

[0112] In some possible embodiments, the adjustment of the grayscale image of the area to be adjusted can be achieved by the following process.

[0113] First, determine the histogram of the reference area according to the image of the reference area, and adjust the histogram of the area to be adjusted according to the histogram of the reference area to obtain an adjusted histogram, for example, perform histogram matching on the histogram of the area to be adjusted and the histogram of the reference area to obtain the adjusted histogram. Take the histogram of the reference area as a target histogram, and convert the histogram of the area to be adjusted into the target histogram to make the histogram of the reference area and the histogram of the area to be adjusted match, that is, make the histogram of the area to be adjusted match the histogram of the reference area to make the color tone of the two areas match, thus the shading rendering state of the area to be adjusted is consistent with that of the reference area, and both of them can match the scene information, that is, are reasonable shading states in the scene.

[0114] Then, the adjusted grayscale image is adjusted based on the adjusted histogram. For example, the adjusted histogram grayscale image is generated based on the adjusted histogram, that is, the adjusted grayscale image can be obtained. In some possible embodiments, in the case of a night scene without a light source, the reference region is a non-shadow region in the image to be processed. The adjusted histogram can be obtained by determining the histogram of the non-shadow region, and converting the histogram of the region to be adjusted to the histogram of the non-shadow region, that is, removing the shadow of the region to be adjusted.

[0115] In step S242, an image of a replacement region in which the shadow rendering state is a no-shadow state is generated based on the adjusted grayscale image.

[0116] In some embodiments, the adjusted histogram is used to generate a gradient image of the adjusted histogram, and then the gradient image is rendered with reference to the screen content of the area to be adjusted to generate an image of the replacement area without shading.

[0117] In step S243, the image in the area to be adjusted in the processing target image is replaced with the image in the replacement area that has been generated, thereby generating a target image.

[0118] In some embodiments, a target image is generated by determining an image of a replacement region in the target image where the shadow rendering state does not match the scene information, determining an area in the target image that is occupied by an area to be adjusted, replacing the image of the replacement region with the image of the replacement region, and performing a smoothing process on the replaced image.

[0119] In one specific example, take the scene information as a night scene without a light source, the target image is a road image, the region to be adjusted whose shadow rendering state does not match the scene information is a shadow region, the image of the replacement region is an image whose shadow rendering state is a no-shadow state, and the no-shadow image region is used to replace the image of the region to be adjusted to obtain a target image whose shadow rendering state matches the scene information, in this way the shadow rendering state in the generated target image matches the scene information, thereby improving the realism of the generated target image.

[0120] In some possible embodiments, after replacing the region to be adjusted with the replacement region, a target image is generated for further smoothing processing on the replaced image, that is, step S243 can be realized by the following steps:

[0121] In a first step, a shape and size of the image of the replacement region is adjusted to match a shape and size of the image of the region to be adjusted, thereby obtaining an adjusted image of the replacement region.

[0122] In some possible embodiments, first, size information of the image of the replacement region is determined. After the replacement region is determined, size information of the replacement region needs to be determined, and the size information of the replacement region includes at least area, perimeter, length, width, edge shape, etc. Then, the area of ​​the image of the region to be adjusted in the processing target image is determined. In some possible embodiments, the area of ​​the detection frame can be set as the area of ​​the region to be adjusted in the processing target image by labeling the region to be adjusted with a detection frame by an image segmentation network. Finally, the image size information of the replacement region is adjusted based on the area to obtain an adjusted image of the replacement region. In some possible embodiments, the image size information of the replacement region is adjusted based on the area of ​​the region to be adjusted in the processing target image, thereby making the adjusted image size information of the replacement region match the image size of the region to be adjusted.

[0123] In a second step, the image of the adjusted replacement area is used to replace the image of the area to be adjusted in the processing target image, and a smoothing process is performed on the edges of the image of the adjusted replacement area to generate a target image.

[0124] In some possible embodiments, first, the image of the region to be adjusted is replaced with the image of the adjusted replacement region to generate a candidate image. That is, in the image to be processed, the image after replacement (i.e., the candidate image) is obtained by replacing the region to be adjusted with the adjusted replacement region. In one specific example, when the scene information is a night scene without a light source and the image to be processed is a road image, the region to be adjusted is a shadow region whose shadow rendering state does not match the night scene without a light source. For example, when there is no light source, the presence of tree shadows in the image means that the display method of the image region occupied by the tree shadow is unreasonable. In this case, the adjusted replacement region includes trees without shadows, and the size of the image of the replacement region is adjusted to obtain the image of the adjusted replacement region. Thus, the image of the region to be adjusted is replaced with the image of the adjusted replacement region to generate a target image. Then, a smoothing process is performed on the candidate image to generate a target image. In some possible embodiments, a smoothing process may be performed on the region where the replacement operation occurs in the candidate target to remove image noise in the region, or a smoothing process may be performed on the entire candidate image to remove noise in the entire image, thereby obtaining a target image.

[0125] In an embodiment of the present disclosure, the image of the replacement area is resized, the image of the adjusted replacement area after size adjustment is used to replace the image of the area to be adjusted, and a smoothing process is performed on the replaced image, so that the generated target image is more reasonable and clearer.

[0126] In some embodiments, when the scene information is a night scene with a light source, for example, when the light source is an artificial light source, the shadow area that may occur on the target object within the light source illumination range can be set as the area to be adjusted by the following steps.

[0127] In step S221, if the scene information is a night scene with a light source or a day scene with sunlight, a possible shadow area on the target object is determined based on the direction of the light irradiated on the target object.

[0128] In some embodiments, the direction of the light rays projected on the target object is analyzed to determine possible shadow areas of the target object in the processed image. In a night scene with a light source or a daytime scene with sunlight, a shadow rendering state that matches the actual scene is one in which the target object has shadows.

[0129] In step S222, possible shadow regions in the target object are determined as regions to be adjusted.

[0130] In some embodiments, first, among the target objects included in the image to be processed, determine the target objects that are relatively close to the artificial light source, and then determine the target objects that do not have a shadow area from these relatively close target objects.The target object is relatively close to the artificial light source, which means that the target object is within the illumination range of the artificial light source, so in a night scene with an artificial light source, the target object within the illumination range of the artificial light source may have a shadow.The target object does not have a shadow area, so it is unreasonable.Therefore, it is necessary to make the shadow area that may occur in the target object that does not have a shadow area the area to be adjusted.

[0131] In some embodiments, a possible shadow area of ​​a target object where no shadow area occurs may be determined based on an image area occupied by the target object and an illumination direction of an artificial light source. That is, by analyzing an illumination direction of an artificial light source based on an image area occupied by the target object, an area of ​​a shadow and a position of a shadow caused by the target object when illuminated by the artificial light source can be estimated, and an image area corresponding to the area of ​​the shadow and the position of the shadow can be determined as a possible shadow area of ​​the target object.

[0132] When there is an artificial light source in a nighttime scene, the shadow area that may occur on the target object within the light source illumination range is determined as the area that needs to be adjusted; alternatively, in a nighttime scene with moonlight or a daytime scene with sunlight, the shadow area that may occur on the target object is determined as the area that needs to be adjusted.

[0133] In one possible embodiment, the relative position of the light source and the target object may change. For example, the original image is collected in the morning under sunlight, and now it is afternoon. Obviously, the relative position of the sunlight and the target object will change. In this case, the shadow area that may occur on the target object needs to be determined again based on the current light source's irradiation direction, and thus the area to be adjusted is determined. Then, the lighting parameters of the current light source are determined, and the area to be adjusted is rendered based on the lighting intensity of the light source illuminating the target object surface, to obtain the target image. In this way, the realism and naturalness of the final target image after adjustment can be improved.

[0134] In some embodiments, there may be multiple regions to be adjusted in the image to be processed, for example, the scene information is a nighttime scene with an artificial light source, and the image to be processed contains a target object that is relatively close to the artificial light source, while at the same time containing artificial objects that are relatively far from the artificial light source. In this case, the regions in the image to be processed where shadows may occur on the target object within the illumination range of the artificial light source, and the regions where shadows exist outside the illumination range of the light source, are both regions to be adjusted that need to be adjusted.

[0135] In some embodiments, when the scene information is a night scene with a light source, taking the light source as moonlight as an example, the area to be adjusted can be determined in the following manner.

[0136] In step S231, if the scene information of the image to be processed is a night scene with moonlight, a target object that can be illuminated by moonlight is determined.

[0137] In step S232, a shadow area that may occur in a target object that can be illuminated by moonlight and that does not have a shadow area is determined as an area to be adjusted.

[0138] In some embodiments, if the scene information is a daytime scene with the sun, the area to be adjusted can be determined in the following manner.

[0139] In step S241, if the scene information in the processing target image is a daytime scene with sunlight, a target object that can be illuminated by sunlight is determined.

[0140] In step S242, a shadow area that may occur on a target object that can be illuminated by sunlight and in which no shadow occurs is determined as the area to be adjusted.

[0141] In some embodiments, after determining the area to be adjusted, the area to be adjusted can be adjusted to obtain the target image by the following process.

[0142] In a first step, the lighting parameters for a particular scene are determined.

[0143] In some embodiments, for a nighttime scene with an artificial light source, if it is determined that the artificial light source is in an operational state (i.e., on state), the lighting parameters include lighting intensity, light ray direction, lighting brightness, etc. For a nighttime scene with moonlight or daytime scene with sunlight, the current lighting parameters of the moonlight or sunlight shining on the ground are determined.

[0144] In a second step, an illumination intensity of a target object surface where a shadow region may occur is determined based on the illumination parameters, and the region to be adjusted is rendered to obtain the target image.

[0145] In one specific example, in a night scene with an artificial light source, the processing target image includes a vehicle and a street light, where the artificial light source is a street light, and the illumination intensity and light ray irradiation direction of the street light are analyzed to determine a shadow area that may be caused by the vehicle in the processing target image, and the shadow area that may be caused by the vehicle in the processing target image is rendered according to the illumination intensity of the vehicle surface to obtain an image of a replacement area. The obtained image of the replacement area is used to replace the image of the area to be adjusted to generate a target image.

[0146] In an embodiment of the present disclosure, in a night scene with an artificial light source, or a night scene with the moon, or a daytime scene with sunlight, where the target object is within the illumination range of the artificial light source, possible shadow areas of the target object are rendered in the processing target image based on the lighting parameters, so that the target object close to the artificial light source in the target image can have a shadow area, and the target object can have a shadow area when there is natural light, thus improving the realism of the generated target image.

[0147] The following describes an exemplary application of an embodiment of the present disclosure in one practical application scenario, taking as an example an image transform collected in a daytime scene with sunlight to a nighttime scene without a light source, a target rendering state that matches the scene information is a shadow-free state, and the area to be adjusted is a shadow area.

[0148] The embodiments of the present disclosure provide a method for removing shadows in night scenes without a light source, which is based on an image generation method and a histogram matching method, and performs shadow area segmentation, histogram matching and image generation on the obtained daytime scene image, thereby solving the problem of unreasonable shadow areas occurring when the image of a daytime scene with sunlight is directly converted into a night scene without a light source. The embodiments of the present disclosure can effectively remove the shadows in the generated image, and improve the realism of the generated night scene image.

[0149] FIG. 3A is a schematic structural diagram of the configuration of an image generating system according to an embodiment of the present disclosure, and will be described below with reference to FIG. 3A.

[0150] The image generation system according to the embodiment of the present disclosure includes a generator 301 and a discriminator 302. First, an original image of a daytime scene with sunlight is input to the generator 301 from an input terminal 303.

[0151] Thereafter, a generator 301 generates a nighttime scene image (the image to be processed in the above embodiment, for example, image 322 in FIG. 3B), and an output terminal 304 outputs the generated nighttime scene image to a discriminator 302.

[0152] In some embodiments, image 321 in FIG. 3B is an original image, image 322 is a night image obtained by converting the daytime scene with sunlight in image 321 into a nighttime scene without a light source, and dividing image 321 into shadow and non-shadow regions and performing histogram matching on the shadow and non-shadow regions to obtain shadow-removed image 323, and finally using a GAN network to convert the daytime scene with sunlight in shadow-removed image 323 into a nighttime scene without a light source to obtain nighttime image 324. As can be seen from FIG. 3B, compared with image 322, nighttime image 324 has no shadows and is more consistent with the nighttime scene without a light source, which improves the realism of the image screen.

[0153] In some possible embodiments, the acquired night scene images and the generated night scene images of a night scene without a light source are input to the discriminator 302 .

[0154] Then, a discriminator 302 distinguishes whether the night scene image is a collected night scene image or a generated night scene image, thus obtaining an actual image 305 and a transformed image 306, respectively.

[0155] Finally, we improve the realism of the nighttime scenes generated by the generator by continuously optimizing the loss functions of the generator and the classifier.

[0156] In some embodiments, after obtaining a daytime image of a daytime scene with sunlight, before converting the daytime image into a nighttime image, a shadow removal operation is first performed on the daytime image, and then scene transformation is performed on the image after the shadow removal to obtain a more realistic nighttime image, as shown in FIG. 4. FIG. 4 is an implementation framework structure diagram of an image generation method according to an embodiment of the present disclosure, and the following description will be given with reference to FIG. 4.

[0157] The day image capture module 401 is configured to capture images of a daytime scene with sunlight to obtain a daytime image.

[0158] The shadow segmentation network module 402 is configured to segment the day image into shadow regions 431 and non-shadow regions 432 .

[0159] In some embodiments, an image segmentation network is used to obtain shadow regions from a daytime image, thereby obtaining shadow and non-shadow regions. In embodiments of the present disclosure, an image segmentation network (the network structure is not particularly limited here, for example, a fully convolutional network, a semantic segmentation network, a Visual Geometry Group (VGG) network, a refinement network (RefineNet), etc.) is optimized and trained to obtain an image shadow extraction network that can accurately identify image shadow regions. The image shadow extraction network is used to segment the shadow and non-shadow regions in the daytime image. Thus, the shadow and non-shadow regions in the daytime image can be obtained simultaneously.

[0160] The histogram matching module 403 matches the histograms of the shaded region 431 and the non-shaded region 432 through a histogram matching method.

[0161] In some embodiments, through the histogram matching method, the shaded regions obtain a histogram distribution that matches that of the non-shaded regions, so that the shade of the shaded regions and the shade of the non-shaded regions match. Because the histogram distributions of the shaded regions and the non-shaded regions are significantly different, the embodiments of the present disclosure perform histogram matching on the shaded regions and the non-shaded regions to convert the histogram of the shaded regions into a target histogram (non-shaded region), thus converting the image of the shaded regions into an image of a non-shaded region.

[0162] The shadow-free day image acquisition module 404 removes the shadows in the day image by histogram matching to obtain a shadow-free day image.

[0163] In some embodiments, the transformed shadow-free region is pasted onto the original image, i.e., the transformed shadow-free region is pasted onto the daytime image to obtain a shadow-free image of the daytime scene with sunlight.

[0164] The image generation network module 405 is configured to convert a shadow-free daytime image from a daytime scene with sunlight to a nighttime scene without a light source to obtain a nighttime image.

[0165] In some embodiments, the image generation network shown in FIG. 3A is used to convert a daytime scene with sun in a daytime image without shadows to a nighttime scene without a light source to obtain a nighttime image.

[0166] The final result output module 406 is configured to perform a smoothing process on the surrounding images of the replacement shadow regions using a smoothing technique to obtain the final night image.

[0167] In some embodiments, after replacing the shadow areas in the original image with the shadow-removed areas, the image is as shown in FIG. 5 , which is a schematic diagram of another application scenario of the image generation method according to the embodiments of the present disclosure, where the original image 501 is an image collected in a daytime scene with sunlight, and the target image generation process is as follows:

[0168] First, shadow detection is performed on an original image 501, and shadow regions 502, 503, and 504 are labeled with rectangular frames.

[0169] Then, the regions labeled with rectangular frames (i.e., shadow regions 502, 503, and 504, which correspond to the regions to be adjusted in the above embodiment) are extracted and enlarged to sequentially obtain enlarged shadow regions 511, 512, and 513. Then, the images are converted to night scene images to sequentially obtain shadowed night images 521, 522, and 523.

[0170] Finally, the histograms of the shadowed nighttime images 521, 522 and 523 are transformed into histograms of the shadow-free regions by histogram matching to obtain the shadow-removed images 531, 532 and 533 (the target images in the above embodiment).

[0171] In the embodiment of the present disclosure, an image segmentation network is used to obtain the shadowed and non-shadowed regions, and then the histograms of the shadowed and non-shadowed regions are matched to obtain the image after the shadows are removed, and finally, an image generation method is used to convert the image of a daytime scene with the sun into a nighttime scene without a light source to generate a nighttime scene image without the shadowed regions. In this way, the shadows in the image generated at night are effectively removed, thereby improving the realism of the generated nighttime scene image and making it more suitable for the actual nighttime scene.

[0172] An embodiment of the present disclosure provides an image generating device. FIG. 6 is a schematic structural diagram of an image generating device according to an embodiment of the present disclosure. As shown in FIG. 6, the image generating device 600 includes: a first transformation module 601 configured to transform an original image into a target image of a particular scene; a first determination module 602 configured to determine an area to be adjusted in the processing target image, the image rendering state of which does not match scene information of the particular scene, the image rendering state of the area to be adjusted being related to a light ray cast on a target object in the original image, the target object including a vehicle; a second determination module 603 configured to determine a target rendering state in the region to be adjusted, the target rendering state matching the scene information; a first adjustment module 604 configured to adjust an image rendering state of the region to be adjusted in the target image to obtain a target image.

[0173] In the image generating device, the image rendering state includes a shadow rendering state, and the second determination module 603 is a first determination sub-module configured to determine a reference region in the processing target image whose shadow rendering state matches the scene information; and a second determination sub-module configured to determine a shadow rendering state of the reference region as the target rendering state.

[0174] In the above image generating device, the first determination module 602 further comprises: When the scene information is a nighttime scene without a light source or a daytime scene without sunlight, a shadow area in the processing target image is determined as the area to be adjusted.

[0175] In the above image generating device, the first determination module 602: a third determination submodule configured to determine a possible shadow area of ​​the target object based on a direction of a light ray irradiated on the target object when the scene information is a night scene with a light source or a day scene with sunlight; and a fourth determination sub-module configured to determine a shadow area in the processing target image other than a first shadow area as an area to be adjusted, the first shadow area being an intersection of a shadow area in the processing target image and a shadow area that may occur in the target object.

[0176] In the image generating device, the shaded rendering state of the reference region is a shaded-free rendering state, and the first adjustment module 604: The processing target image further includes a first adjustment sub-module configured to adjust the image of the region to be adjusted to a shadow-free state based on the image of the reference region to obtain the target image.

[0177] In the above image generating device, the first adjustment submodule: a first adjustment unit configured to adjust the gradation image of the area to be adjusted based on the image of the reference area to obtain an adjusted gradation image; a first generating unit configured to generate an image of a replacement region having a shadow rendering state of a no-shadow state based on the adjusted grayscale image; and a second generation unit configured to replace the image of the region to be adjusted in the processing target image with the generated image of the replacement region to generate the target image.

[0178] In the image generating device, the first adjustment unit is a first determination subunit configured to determine a histogram of the reference region based on an image of the reference region; a first adjustment subunit configured to adjust the histogram of the region to be adjusted based on the histogram of the reference region to obtain an adjusted histogram; and a second determining subunit configured to determine the adjusted greyscale image based on the adjusted histogram.

[0179] In the image generating device, the image rendering state includes a shadow rendering state, and the first determination module 602: a fifth determination submodule configured to determine a possible shadow area of ​​the target object based on a direction of a light ray irradiated on the target object when the scene information is a night scene with a light source or a day scene with sunlight; and a sixth determining sub-module configured to determine possible shadow areas in the target object as areas to be adjusted.

[0180] In the above image generating device, the first adjustment module 604 is a seventh determining sub-module configured to determine lighting parameters for the particular scene; A first rendering sub-module configured to determine an illumination intensity of a target object surface where a shadow region may occur based on the illumination parameters, and to render the region to be adjusted to obtain the target image.

[0181] In the above image generating device, the original image is an image collected when it is not raining / snowing, and the specific scene is a rainy scene / snowy scene, and the first adjustment module 604: A first adding sub-module is configured to add raindrops / snowflakes to the original image to obtain a target image.

[0182] It should be noted that the above description of the apparatus embodiment is similar to the description of the above method embodiment, and has the same beneficial technical effects as the method embodiment. For technical details not disclosed in the apparatus embodiment of the present disclosure, please do not refer to the description of the method embodiment of the present disclosure.

[0183] It should be noted that in the embodiments of the present disclosure, the above image generating method may be realized in the form of a software functional module and stored in a computer-readable storage medium when sold or used as a standalone product. Based on this understanding, the essential part of the technical solution of the embodiments of the present disclosure, i.e., the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product is stored in one storage medium and includes several instructions for causing a computer device (which may be a terminal, a server, etc.) to execute all or part of the method described in each embodiment of the present disclosure. The above-mentioned storage medium includes various media that can store program code, such as a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk. Thus, the embodiments of the present disclosure are not limited to any specific combination of hardware and software.

[0184] Correspondingly, an embodiment of the present disclosure further provides a computer program product, the computer program product including computer-executable instructions that, when executed, can realize steps of an image generation method according to an embodiment of the present disclosure.

[0185] Correspondingly, an embodiment of the present disclosure further provides a computer storage medium having computer-executable instructions stored therein, the computer storage medium causing the processor to perform steps of the image generation method according to the above embodiment when executed by the processor.

[0186] Correspondingly, an embodiment of the present disclosure provides a computer device, and FIG. 7 is a schematic structural diagram of the configuration of a computer device according to an embodiment of the present disclosure. As shown in FIG. 7, the computer device 700 includes a processor 701, at least one communication bus, a communication interface 702, at least one external communication interface, and a memory 703. Here, the communication interface 702 is configured to realize a communication connection between these components. Here, the communication interface 702 may include a display screen, and the external communication interface may include a standard wired interface and a wireless interface. Here, the processor 701 is configured to execute an image processing program stored in the memory to realize the steps of the image generating method according to the above embodiment.

[0187] The above description of the image generating device, computer device and storage medium embodiments are similar to the above description of the method embodiments, and have the same beneficial technical effects as the corresponding method embodiments. Due to the limited number of pages, please refer to the description of the above method embodiments and understand that the present disclosure will not be repeated. For technical details not disclosed in the image generating device, computer device and storage medium embodiments of the present disclosure, please do not refer to the description of the method embodiments of the present disclosure.

[0188] It should be understood that "one embodiment" or "one example" referred to throughout this specification means that the target feature, structure, or characteristic associated with the example is included in at least one example of the present disclosure. Therefore, "in one embodiment" or "in one example" appearing in this specification does not necessarily refer to the same example. Furthermore, these target features, structures, or characteristics can be freely combined as necessary in one or more examples. In each example of the present disclosure, it should be understood that the magnitude of the numbers of each process above does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not form any limitation on the implementation process of the examples of the present disclosure. The numbers of the examples of the present disclosure described above are adopted only for explanation, not to represent the superiority or inferiority of the examples.

[0189] It should be noted that, as used herein, the terms "comprising," "comprising," or other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that includes a set of elements not only includes those elements, but also includes other elements not expressly listed or that are inherent to those processes, methods, articles, or apparatus. Unless specifically limited, an element qualified with the term "comprising" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0190] In some embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can be realized in other ways. The above device embodiments are merely illustrative, for example, the division of the modules is merely a division of logical functions, and in actual implementation, there are other division methods, for example, multiple modules or components can be integrated or integrated into another system, or some features can be ignored or not implemented. Furthermore, the mutual coupling or direct coupling or communication connection between each component shown or discussed may be an indirect coupling or communication connection via some interfaces, devices or units, and may be electrical, mechanical or other forms.

[0191] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, may be located in one location or may be distributed across multiple network units, and some or all of the units may be selected according to actual needs to embody the purpose of the technical solution of this embodiment.

[0192] Furthermore, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, each unit may be used separately as one unit, or two or more units may be integrated into one unit. The above integrated units may be embodied in the form of hardware or in the form of hardware and software functional units. It is obvious to those skilled in the art that all or part of the steps of the above method embodiments may be implemented by instructing relevant hardware by a program, and the above program may be stored in a computer-readable storage medium, and when the program is executed, the steps of the above method embodiments are performed. The storage medium includes various media that can store program codes, such as mobile storage devices, read-only memories (ROMs), magnetic memories, or optical disks.

[0193] Alternatively, the above-mentioned integrated units of the present disclosure may be realized in the form of a software functional module and stored in a computer-readable storage medium when sold or used as a standalone product. Based on this understanding, the essential part of the technical solution of the embodiments of the present disclosure, i.e., the part that contributes to the prior art, may be embodied in the form of a software product, and the computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes various media that can store program code, such as removable storage, ROM, magnetic memory, or optical disk. The above content is merely a specific embodiment of the present disclosure, and the protection scope of the present disclosure is not limited thereto. Any modifications or replacements that a person skilled in the art can easily think of within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims. [Industrial Applicability]

[0194] An embodiment of the present disclosure provides an image generation method, apparatus, device, and storage medium, in which an original image is converted into a target image of a specific scene, an area to be adjusted in the target image, whose image rendering state does not match scene information of the specific scene, the image rendering state of the area to be adjusted is related to a light ray irradiated to a target object in the original image, the target object including a vehicle, a target rendering state for the area to be adjusted, the target rendering state matching the scene information, and adjusting the image rendering state of the area to be adjusted in the target image to the target rendering state to obtain a target image.

Claims

1. 1. A method of image generation performed by an electronic device, comprising: Transforming the original image into a target image of a particular scene; determining an area to be adjusted in the target image, the image rendering state of which does not match scene information of the particular scene, the image rendering state of the area to be adjusted being related to a light ray projected onto a target object in the original image, the target object including a vehicle; determining a target rendering state in the region to be adjusted, the target rendering state matching the scene information; adjusting an image rendering state of the region to be adjusted in the target image to the target rendering state to obtain a target image.

2. The image rendering state includes a shadow rendering state, and determining a target rendering state for the region to be adjusted includes: determining a reference region in the target image whose shadow rendering state matches the scene information; determining a shadow rendering state of the reference region as the target rendering state. The image generating method according to claim 1 .

3. Determining areas in the target image to be adjusted where the image rendering state does not match the scene information of the particular scene includes: When the scene information is a nighttime scene without a light source or a daytime scene without sunlight, a shadow area in the processing target image is determined as the area to be adjusted. The image generating method according to claim 2.

4. Determining areas in the target image to be adjusted where the image rendering state does not match the scene information of the particular scene includes: determining a possible shadow area of ​​the target object based on a direction of a light ray irradiated on the target object when the scene information is a night scene with a light source or a day scene with sunlight; determining, as an area to be adjusted, a shadow area in the processing target image other than a first shadow area, the first shadow area being an intersection of a shadow area in the processing target image and a possible shadow area occurring in the target object; 4. The image generating method according to claim 2 or 3.

5. a shaded rendering state of the reference region is a shaded rendering state, and adjusting an image rendering state of the region to be adjusted in the target image to the target rendering state to obtain a target image, adjusting the image of the area to be adjusted to a shadow-free state based on the image of the reference area in the processing target image to obtain the target image.

5. The image generating method according to claim 3 or 4.

6. In the processing target image, adjusting the image of the area to be adjusted to a shadow-free state based on the image of the reference area to obtain the target image, adjusting the gradation image of the area to be adjusted based on the image of the reference area to obtain an adjusted gradation image; generating an image of a replacement region having a shadow rendering state of a no-shadow state based on the adjusted grayscale image; and replacing the image of the region to be adjusted in the processing target image with the generated image of the replacement region to generate the target image. The image generating method according to claim 5.

7. Adjusting the gradation image of the area to be adjusted based on the image of the reference area to obtain an adjusted gradation image, determining a histogram of the reference region based on an image of the reference region; adjusting the histogram of the region to be adjusted based on the histogram of the reference region to obtain an adjusted histogram; determining the adjusted gradient image based on the adjusted histogram. The image generating method according to claim 6.

8. the image rendering state includes a shadow rendering state, and determining areas in the target image to be adjusted where the image rendering state does not match the scene information includes: determining a possible shadow area of ​​the target object based on a direction of a light ray irradiated on the target object when the scene information is a night scene with a light source or a day scene with sunlight; determining possible shadow areas of the target object as areas to be adjusted; 8. The image generating method according to claim 1.

9. adjusting the image rendering state of the region to be adjusted in the processing target image to the target rendering state to obtain a target image, determining lighting parameters for the particular scene; determining an illumination intensity of a target object surface where shadow regions may occur based on the illumination parameters, and rendering the region to be adjusted to obtain the target image. The image generating method according to claim 8.

10. The original image is an image collected when it is not raining / snowing, and the specific scene is a rainy scene / snowy scene; adjusting the image rendering state of the region to be adjusted in the processing target image to the target rendering state to obtain a target image, adding raindrops / snowflakes to the original image to obtain a target image; 10. The image generating method according to claim 1.

11. 1. An image generating device, comprising: a first transformation module configured to transform the original image into a target image of a particular scene; a first determination module configured to determine an area to be adjusted in the processing target image, the image rendering state of which does not match scene information of the particular scene, the image rendering state of the area to be adjusted being related to a light ray cast on a target object in the original image, the target object including a vehicle; and a second determination module configured to determine a target rendering state in the region to be adjusted, the target rendering state matching the scene information; a first adjustment module configured to adjust an image rendering state of the region to be adjusted in the target image to the target rendering state to obtain a target image.

12. A computer storage medium having computer-executable instructions stored thereon, comprising: A computer storage medium having computer-executable instructions which, when executed, can implement the method of any one of claims 1 to 10.

13. An electronic device, 11. An electronic device comprising a memory and a processor, the memory storing computer executable instructions that, when executed, cause the processor to perform the steps of the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Real-time rendering method and device based on dynamic illumination change

    CN111260769A

  • Evaluation system for image processing algorithm

    JP2010033321A

  • Photographing apparatus, photographing support method, and photographing support program

    JP2015149611A

  • Image processing system, control method of the same, program, and recording medium

    JP2016072694A

  • Image composition method and device

    JP2017016663A