An image generation method and apparatus
By generating and fusing local and global brightness mutation images, the problem of insufficient number of brightness mutation images in the prior art is solved, and rich image generation is realized for training artificial intelligence models.
Patent Information
- Application Number
- CN202010177483.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-13
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2040-03-13
AI Technical Summary
The prior art is difficult to effectively generate rich brightness mutation images for training artificial intelligence models, especially because the brightness mutation phenomenon lasts for a short time, resulting in fewer brightness mutation images that can be intercepted.
By acquiring the original image and adjusting the brightness value of the pixel point according to the preset threshold, images including local and global brightness mutation areas are generated, and finally these images are fused with the original image to generate the target image.
This method can easily and quickly automatically generate brightness mutation images for training artificial intelligence models, enrich the image style and accurately simulate the surveillance images collected by surveillance cameras in various scenarios.
Smart Images

Figure CN113393384B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular, to an image generation method and apparatus. Background Art
[0002] Currently, when a high-brightness light source appears in a monitored area, a region with a sudden brightness change will appear in the monitoring screen, resulting in a short-term decline in the quality of the monitoring screen. For example, as Figure 1 shown in the monitoring screen, at night, when the monitoring camera is irradiated by the high beam of a car, a region with a sudden brightness change centered on the car light will appear in the monitoring screen of the monitoring camera, resulting in an inability to clearly display the situation on the road. Generally, a monitoring screen containing a region with a sudden brightness change intercepted from a monitoring video can be input into an artificial intelligence model, and then processed by the artificial intelligence model to finally obtain an improved image.
[0003] Before using the artificial intelligence model to improve the region with a sudden brightness change in the monitoring screen, it is necessary to first train the artificial intelligence model with a large number of brightness mutation images containing regions with sudden brightness changes. And rich, accurate, and a large number of brightness mutation images are the key to training an artificial intelligence model with high accuracy and good stability. Generally, the artificial intelligence model can be trained by intercepting brightness mutation images from past monitoring videos. However, the phenomenon of sudden brightness change often lasts for a short time, so the number of intercepted brightness mutation images is relatively small. Summary of the Invention
[0004] Embodiments of the present invention provide an image generation method and apparatus, which can simply and quickly automatically generate brightness mutation images for training an artificial intelligence model.
[0005] To achieve the above object, the embodiments of the present invention adopt the following technical solutions:
[0006] In a first aspect, an image generation method is provided, including: first obtaining an original image, where the difference between the original brightness values of any two pixel points in the original image is less than or equal to a preset threshold, then generating a local brightness mutation image including N regions with sudden brightness changes according to the original image, and finally fusing the original image with the local brightness mutation image to obtain a target image. Since in the process of generating the target image according to this image generation method, the number, size, shape, and brightness of the regions with sudden brightness changes included in the target image can be set, the styles of the target image are greatly enriched, and the monitoring screens collected by monitoring cameras in various scenarios can be accurately simulated according to requirements. Therefore, brightness mutation images for training an artificial intelligence model can be simply and quickly automatically generated.
[0007] Second aspect, there is provided an image generation method, including: first, obtaining an original image, where the difference between the original brightness values of any two pixel points in the original image is less than or equal to a preset threshold. Then, adjusting the original brightness value of each pixel point in the original image according to a preset brightness value to generate a global brightness mutation image, where the adjusted brightness value of each pixel point in the global brightness mutation image is greater than or less than the original brightness value. Finally, determining the global brightness mutation image as the target image. The target image generated by the above method can generate rich target images by adjusting the preset brightness value, and can simulate the monitoring screen in the case where a strong light source affects the entire monitoring camera.
[0008] Third aspect, there is provided an image generation method, including: first, obtaining an original image, where the difference between the original brightness values of any two pixel points in the original image is less than or equal to a preset threshold. Then, generating a local brightness mutation image according to the original image, where the local brightness mutation image includes N brightness mutation regions, and N is an integer greater than or equal to 1; generating a first target image according to the original image and the local brightness mutation image; adjusting the original brightness value of each pixel point in the original image according to a preset brightness value to generate a global brightness mutation image, where the adjusted brightness value of each pixel point in the global brightness mutation image is greater than or less than the original brightness value; determining the global brightness mutation image as the second target image. Finally, fusing the first target image, the second target image, and the original image to obtain a third target image. The third target image generated by the above method simulates the monitoring screen under the combined action of the two situations described in the first aspect and the second aspect, and can provide richer brightness mutation images for the training of the artificial intelligence model.
[0009] Fourth aspect, there is provided an image generation device, including an acquisition module, a local brightness mutation image generation module, and a fusion module. Among them, the acquisition module is used to obtain an original image, where the difference between the original brightness values of any two pixel points in the original image is less than or equal to a preset threshold; the local brightness mutation image generation module is used to generate a local brightness mutation image according to the original image obtained by the acquisition module, where the local brightness mutation image includes N brightness mutation regions, and N is an integer greater than or equal to 1; the fusion module is used to fuse the local brightness mutation image generated by the local brightness mutation image generation module with the original image obtained by the acquisition module to obtain a target image.
[0010] Fifth aspect, there is provided an image generation device, including an acquisition module, a global brightness mutation image generation module, and a fusion module. Among them, the acquisition module is configured to acquire an original image, and the difference between the original brightness values of any two pixel points in the original image is less than or equal to a preset threshold; the global brightness mutation image generation module is configured to adjust the original brightness value of each pixel point in the original image acquired by the acquisition module according to a preset brightness value to generate a global brightness mutation image, and the adjusted brightness value of each pixel point in the global brightness mutation image is greater than or less than the original brightness value; the fusion module is configured to determine the global brightness mutation image generated by the global brightness mutation image generation module as the target image.
[0011] Sixth aspect, there is provided an image generation device, including an acquisition module, a local brightness mutation image generation module, a global brightness mutation image generation module, and a fusion module. Among them, the acquisition module is configured to acquire an original image, and the difference between the original brightness values of any two pixel points in the original image is less than or equal to a preset threshold; the local brightness mutation image generation module is configured to generate a local brightness mutation image according to the original image acquired by the acquisition module, and the local brightness mutation image includes N brightness mutation regions, where N is an integer greater than or equal to 1; the global brightness mutation image generation module is configured to adjust the original brightness value of each pixel point in the original image acquired by the acquisition module according to a preset brightness value to generate a global brightness mutation image, and the adjusted brightness value of each pixel point in the global brightness mutation image is greater than or less than the original brightness value; the fusion module is configured to generate a first target image according to the original image acquired by the acquisition module and the local brightness mutation image generated by the local brightness mutation image generation module; determine the global brightness mutation image generated by the global brightness mutation image generation module as the second target image; the fusion module is further configured to fuse the first target image, the second target image, and the original image acquired by the acquisition module to obtain a third target image.
[0012] Seventh aspect, there is provided an image generation device, including a memory, a processor, a bus, and a communication interface; the memory is used to store computer execution instructions, and the processor is connected to the memory through the bus; when the image generation device runs, the processor executes the computer execution instructions stored in the memory, so that the image generation device executes the image generation method described in the first aspect, or the image generation method described in the second aspect, or the image generation method described in the third aspect.
[0013] Eighth aspect, there is provided a computer-readable storage medium, the computer-readable storage medium includes computer execution instructions, and when the computer execution instructions run on a computer, the computer is caused to execute the image generation method described in the first aspect, or the image generation method described in the second aspect, or the image generation method described in the third aspect. Description of the Drawings
[0014] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.
[0015] Figure 1 Schematic diagram of a monitoring screen including a brightness mutation region provided by an embodiment of the present invention;
[0016] Figure 2 Schematic diagram of the structure of an image generation device provided by an embodiment of the present invention;
[0017] Figure 3 Flowchart of an image generation method provided by an embodiment of the present invention;
[0018] Figure 4 Schematic diagram of an original image provided by an embodiment of the present invention;
[0019] Figure 5 Schematic diagram of another original image provided by an embodiment of the present invention;
[0020] Figure 6 Flowchart of another image generation method provided by an embodiment of the present invention;
[0021] Figure 7 Schematic diagram of an image including a region provided by an embodiment of the present invention;
[0022] Figure 8 Schematic diagram of a partial brightness mutation image provided by an embodiment of the present invention;
[0023] Figure 9 Schematic diagram of a first target image provided by an embodiment of the present invention;
[0024] Figure 10 Schematic diagram of another first target image provided by an embodiment of the present invention;
[0025] Figure 11 Flowchart of yet another image generation method provided by an embodiment of the present invention;
[0026] Figure 12 Schematic diagram of a global brightness mutation image provided by an embodiment of the present invention;
[0027] Figure 13 Schematic diagram of another global brightness mutation image provided by an embodiment of the present invention;
[0028] Figure 14Flowchart of still another image generation method provided by an embodiment of the present invention;
[0029] Figure 15 Schematic diagram of another third target image provided by an embodiment of the present invention;
[0030] Figure 16 Schematic diagram of another third target image provided by an embodiment of the present invention;
[0031] Figure 17 Schematic structural diagram of another image generation device provided by an embodiment of the present invention. Detailed implementation manners
[0032] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0033] It should be noted that in the embodiments of the present invention, words such as "exemplary" or "for example" are used to represent examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present invention should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Exactly speaking, using words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner.
[0034] It should also be noted that in the embodiments of the present invention, "(English: of)", "corresponding (English: corresponding, relevant)" and "corresponding (English: corresponding)" can sometimes be used interchangeably. It should be pointed out that when not emphasizing their differences, the meanings they express are the same.
[0035] In order to facilitate a clear description of the technical solutions in the embodiments of the present invention, in the embodiments of the present invention, terms such as "first" and "second" are used to distinguish the same items or similar items with basically the same functions and roles. Those skilled in the art can understand that terms such as "first" and "second" do not limit the quantity and execution order.
[0036] To solve the problem that the number of acquired brightness mutation images is small and the brightness mutation situation cannot be accurately reflected, the present application provides an image generation method. The method includes that first, an acquisition module acquires an original image, wherein the difference between the original brightness values of any two pixel points in the original image is less than or equal to a preset threshold. Then, a local brightness mutation image generation module generates a local brightness mutation image including N brightness mutation regions according to the original image acquired by the acquisition module. Finally, a fusion module fuses the original image acquired by the acquisition module and the local brightness mutation image generated by the local brightness mutation image generation module to obtain a target image. Since in the process of generating a target image according to this image generation method, the number, size, shape, and brightness of the brightness mutation regions included in the target image can be set, the styles of the target image are greatly enriched, and the monitoring images collected by a monitoring camera in multiple scenarios can be accurately simulated according to requirements. Thus, the brightness mutation images for training an artificial intelligence model can be automatically generated simply and quickly.
[0037] Next, the implementation manners of the embodiments of the present application will be described in detail with reference to the accompanying drawings.
[0038] Figure 2 An image generation device 100 provided by an embodiment of the present application is used to generate brightness mutation images. The image generation device 100 includes an acquisition module 101, a local brightness mutation image generation module 102, a global brightness mutation image generation module 103, and a fusion module 104. Among them, the acquisition module 101 is respectively connected to the local brightness mutation image generation module 102, the global brightness mutation image generation module 103, and the fusion module 104. The local brightness mutation image generation module 102 is connected to the fusion module 104, and the global brightness mutation image generation module 103 is connected to the fusion module 104. It can be understood that when the image generation device 100 is only used to generate a first target image reflecting local brightness mutation, the image generation device 100 may not include the global brightness mutation image generation module 103; when the image generation device 100 is only used to generate a second target image reflecting global brightness mutation, the image generation device 100 may not include the local brightness mutation image generation module 102.
[0039] The acquisition module 101 is used to acquire an original image, wherein the difference between the original brightness values of any two pixel points in the original image is less than or equal to a preset threshold.
[0040] The local brightness mutation image generation module 102 is used to generate a local brightness mutation image according to the original image acquired by the acquisition module 101. The local brightness mutation image includes N brightness mutation regions, and N is an integer greater than or equal to 1.
[0041] The local brightness mutation image generation module 102 is specifically configured to determine N regions in the original image obtained by the acquisition module 101, where the area of each region is smaller than the area of the original image; adjust the original brightness value of each pixel point within the same region to the first brightness value, and adjust the original brightness value of each pixel point outside the region to the second brightness value; perform brightness gradient processing on each region to determine N brightness mutation regions, and obtain the local brightness mutation image.
[0042] The local brightness mutation image generation module 102 is specifically configured to determine N circular regions with N pixel points as the centers, and the radius of each circular region meets the preset radius range. Among them, the preset radius range is determined according to the minimum width, and the minimum width is the length of the shortest side among the four sides of the original image. The preset radius range is from half of the minimum width to one-fifth of the minimum width.
[0043] The local brightness mutation image generation module 102 is specifically configured to determine the third brightness value of the i-th pixel point within the circular region according to the distance between the i-th pixel point within the circular region and the center of the circle, where i is a positive integer, i ∈ [1, K], and K represents the number of pixel points within the circular region; adjust the first brightness value of the i-th pixel point to the third brightness value of the i-th pixel point.
[0044] The global brightness mutation image generation module 103 is configured to adjust the original brightness value of each pixel point in the original image obtained by the acquisition module 101 according to the preset brightness value to generate the global brightness mutation image, and the adjusted brightness value of each pixel point in the global brightness mutation image is greater than or less than the original brightness value.
[0045] The fusion module 104 is configured to fuse the local brightness mutation image generated by the local brightness mutation image generation module 102 with the original image obtained by the acquisition module 101 to obtain the first target image.
[0046] The fusion module 104 is further configured to determine the global brightness mutation image generated by the global brightness mutation image generation module 103 as the second target image.
[0047] The fusion module 104 is further configured to fuse the first target image, the second target image, and the original image obtained by the acquisition module 101 to obtain the third target image.
[0048] As Figure 3 shown, the image generation method provided by the embodiment of the present application includes the following steps.
[0049] S301. The acquisition module 101 acquires the original image.
[0050] The original image is an image with uniform brightness. By "uniform brightness" it means that the difference in brightness values between any two pixel points in the image is less than or equal to a preset threshold. Here, the preset threshold is a definite value, and the size of the preset threshold can be set according to the actual situation without limitation. For example, as Figure 4 shown, it is an original image where the brightness values of all pixel points are the same. Another example, as Figure 5 shown, the original image can also be a photo with uniform brightness. It can be understood that the present application places no limit on the magnitude of the brightness values of the pixel points in the original picture, but only limits the difference in the brightness values of the pixel points within the image, that is, the difference is less than or equal to the preset threshold.
[0051] In some embodiments, uniform brightness can also mean that the difference in brightness values between any two pixel points in the image is within a preset range, where the preset range can be determined according to the actual situation.
[0052] Optionally, the brightness value of a pixel point in the original image is called the original brightness value.
[0053] After the acquisition module 101 acquires the original image, it sends the original image to the local brightness mutation image generation module 102 and the fusion module 104 respectively, so that the local brightness mutation image generation module 102 generates a local brightness mutation image based on the original image, and the fusion module 104 fuses the original image and the local brightness mutation image to obtain a first target image. For a detailed explanation of generating the first target image, reference can be made to the description in S302 to S303 below.
[0054] S302. The local brightness mutation image generation module 102 generates a local brightness mutation image based on the original image.
[0055] After the local brightness mutation image generation module 102 receives the original image, the local brightness mutation image generation module 102 generates N brightness mutation regions on the original image to obtain a local brightness mutation image. The local brightness mutation image may include N brightness mutation regions, where N is an integer greater than or equal to 1. The area of each brightness mutation region is smaller than the area of the original image. It can be understood that the N brightness mutation regions are used to simulate N strong light source regions in a real monitoring screen.
[0056] When N = 1, it means there is only one strong light source in the monitoring screen. The local brightness mutation image generated by the local brightness mutation image generation module 102 contains one brightness mutation region, and one brightness mutation region is used to simulate one strong light source in the monitoring screen. When N ≥ 2, it means there are multiple strong light sources in the monitoring screen. The local brightness mutation image generated by the local brightness mutation image generation module 102 contains more than two brightness mutation regions, and more than two brightness mutation regions are used to simulate multiple strong light sources in the monitoring screen.
[0057] As shown Figure 6 in FIG. S302 may specifically include S3021 - S3023:
[0058] S3021. The local brightness mutation image generation module 102 determines N regions in the original image.
[0059] In some embodiments, N regions may be randomly delimited in the original image. The area of each of the regions is smaller than the area of the original image. Optionally, different regions may overlap. It should be noted that all regions need to be within the original image.
[0060] The shape of the region depends on the shape of the strong light source to be simulated. The shape of the region may be circular, square, triangular, etc. For example, when the region is used to simulate a circular strong light source, the shape of the region may be circular; when the region is used to simulate a square strong light source, the region may be square. Optionally, multiple regions with different shapes may appear simultaneously in the same local brightness mutation image.
[0061] The method for determining the region may be as follows: First, select any pixel point in the original image, then use this pixel point as the center of the region, determine the shape of the region according to the shape of the strong light source, and determine the first brightness value of the pixel points within the region according to the brightness of the strong light source.
[0062] Exemplarily, when the region is used to simulate a circular light source, the method for determining a circular region may be that the local brightness mutation image generation module 102 first selects a pixel point in the original image, and then uses this pixel point as the center of the circle to determine a circular region.
[0063] It can be understood that if the area of the circular region is too large, then the range affected by the strong light source simulated by this circular region is no longer local, but can affect the entire monitoring screen. Therefore, in order to more reasonably reflect the situation where the local area of the monitoring screen has a brightness mutation caused by a strong light source in reality, it is necessary to limit the area size of the region.
[0064] In some embodiments, the area of the circular region may be determined according to the radius size of the circular region. The size of the radius of the circular region may conform to a preset radius range. The preset radius range may be determined according to the minimum width of the original image. The so-called minimum width is the length of the shortest side among the four sides of the original image. For example, the preset radius range may be from half of the minimum width to one - fifth of the minimum width. In one implementation, the radius of the circular region may satisfy formula (1):
[0065]
[0066] Wherein, r represents the radius of the circular region, k1 represents the first coefficient, W represents the width of the original image, and H represents the height of the original image. The value range of k1 can be determined according to the actual situation. For example, the value range of k1 can be between one fifth and one half.
[0067] Since the areas of the regions are different, the number of pixel points included in each region is different. It is understandable that the number of pixel points included in a region with a larger area is more than that included in a region with a smaller area.
[0068] S3022. The local brightness mutation image generation module 102 adjusts the original brightness value of each pixel point within the same region in the original image to the first brightness value, and adjusts the original brightness value of each pixel point outside the region to the second brightness value.
[0069] This step is to form a sharp contrast between the brightness values of the pixel points within the region and those outside the region, so as to visually highlight the N regions from the original image.
[0070] Exemplarily, if there is only one region and the shape of the region is circular, a coordinate system can be established with two adjacent sides of the original image. Let the coordinates of any point in the original image be (x, y), and the coordinates of the center of the circular region be (m, n). Then, the brightness value of a certain point in the original image after being processed by S3022 satisfies formula (2):
[0071]
[0072] Wherein, I(x, y) represents the magnitude of the brightness value of a certain pixel point in the original image after being processed by S3022, A represents the first brightness value, the value of A can be determined according to the brightness of the strong light source simulated by the circular region, B represents the second brightness value, and the value of B can be determined according to the average value of the original brightness values of each pixel point in the original image. Formula (2) indicates that the brightness value of the pixel points within the circular region is the first brightness value, and the brightness value of the pixel points outside the circular region is the second brightness value.
[0073] It should be noted that the pixel points within different regions can have different first brightness values or the same first brightness value. The brightness values of each pixel point outside the region are the same, that is, the brightness value of each pixel point outside the region is the second brightness value.
[0074] In some embodiments, there is a phenomenon of different regions overlapping. The overlapping part of multiple regions can be defined as the overlapping area. The brightness value of the j-th pixel point in the overlapping area is the sum of the multiple first brightness values of the j-th pixel point in the multiple regions to which it belongs. The j-th pixel point can refer to any pixel point in the overlapping area.
[0075] Figure 7shows the effect diagram after the original image shown in Figure 4 or Figure 5 is processed in step S3022. Figure 7 The circle in is the circular area. Each pixel point within the circular area has the same first brightness value, and each pixel point outside the circular area also has the same second brightness value. Moreover, the brightness value of the pixel points within the circular area is different from that of the pixel points outside the circular area.
[0076] S3023. The local brightness mutation image generation module 102 performs brightness gradient processing on each area to generate a local brightness mutation image.
[0077] As shown in Figure 1 , in practice, the imaging feature of a strong light source in a surveillance image is often that the pixel points at the light source have the highest brightness, and the brightness gradually decreases from the light source to the surrounding pixel points. That is, the strong light source forms a brightness mutation area that diverges from the center to the surrounding in the surveillance image.
[0078] Therefore, in order to simulate this imaging feature of the strong light source, after determining the N areas, the method provided by the embodiments of the present invention may further include gradient processing on the N areas.
[0079] Taking the circular area as an example of the area, how to perform brightness gradient processing on the area will be described below. First, when the i-th pixel point is a pixel point within the circular area, according to the distance of the i-th pixel point within the circular area from the center of the circle, determine the third brightness value of the i-th pixel point within the circular area. i is a positive integer, i ∈ [1, K], and K represents the number of pixel points within the circular area; when the i-th pixel point is a pixel point outside the circular area, determine that the third brightness value of the i-th pixel point is the same as the second brightness value. Then, adjust the first brightness value of the i-th pixel point to the third brightness value of the i-th pixel point determined above.
[0080] Exemplarily, a coordinate system can be established with two adjacent sides of the original image as the coordinate axes. The coordinates of any pixel point in the original image are (x, y), and the coordinates of the center of the circular area are (m, n). Then, the third brightness value I i(x,y) of the i-th pixel point in the original image satisfies formula (3):
[0081]
[0082] Wherein, A represents the first luminance value, and B represents the second luminance value. In the circular area, the third luminance value of the pixel point where the center of the circle is located is the same as the first luminance value of this pixel point. When the i-th pixel point is within the circular area, as the distance of the i-th pixel point from the center of the circle increases, the third luminance value of the i-th pixel point within the circular area decreases; when the i-th pixel point is outside the circular area, the third luminance value of the i-th pixel point is the same as the second luminance value.
[0083] Adjust the luminance value of the i-th pixel point in the original image from the first luminance value to the third luminance value of the i-th pixel point determined according to formula (3). Determine the image after the process of S3023 as the local luminance mutation image.
[0084] Figure 8 gives Figure 7 the local luminance mutation image obtained after the luminance gradient processing.
[0085] After the local luminance mutation image generation module 102 generates the local luminance mutation image, send the local luminance mutation image to the fusion module 104, so that the fusion module 104 can fuse the original image and the local luminance mutation image.
[0086] S303. The fusion module 104 fuses the local luminance mutation image with the original image to generate the first target image.
[0087] After the fusion module 104 fuses the local luminance mutation image with the original image, the first target image is obtained. The fusion method can be to add or subtract the luminance values of the i-th pixel point in each image to be fused to obtain the first target luminance value of the i-th pixel point. In this embodiment, the first target image is the image that can simulate the local luminance mutation area formed by the strong light source in the monitoring screen.
[0088] Exemplarily, the local luminance mutation image can be fused with the original image in the following way. First, assume that I (i)local represents the first target luminance value of the i-th pixel point in the first target image, wherein the i-th pixel point is any pixel point in the first target image, and I (i)local satisfies formula (4):
[0089] I (i)local = I ± k2 × I i (4)
[0090] Wherein, the position of the i-th pixel point in the first target image is the same as the position of the i-th pixel point in the original image. The position of the i-th pixel point in the first target image is the same as the position of the i-th pixel point in the local luminance mutation image. I represents the luminance value of the i-th pixel point in the original image, that is, the original luminance value of the i-th pixel point, and I iis the luminance value of the i-th pixel in the local luminance mutation image, I i Satisfies the above formula (3), where k2 is the second coefficient used to increase or decrease the luminance value of the i-th pixel in the local luminance mutation image, and the value of k2 can be determined according to the actual situation.
[0091] When the “±” in formula (4) takes “+”, it represents positive fusion. The first target luminance value of the i-th pixel in the first target image is the sum of the original luminance value of the i-th pixel and the luminance value of the i-th pixel in the local luminance mutation image. The first target luminance value of the i-th pixel in the first target image is larger than the original luminance value of the i-th pixel in the original image.
[0092] When the “±” in formula (4) takes “-”, it represents negative fusion. The first target luminance value of the i-th pixel in the first target image is the difference between the original luminance value of the i-th pixel and the luminance value of the i-th pixel in the local luminance mutation image. The first target luminance value of the i-th pixel in the first target image is smaller than the original luminance value of the i-th pixel in the original image.
[0093] Then, calculate the first target luminance value of each pixel in turn to generate the first target image.
[0094] Figure 9 shows the local luminance mutation image and Figure 4 the image after positive fusion with the original image shown; Figure 10 shows the local luminance mutation image and Figure 5 the image after positive fusion with the original image shown.
[0095] In practice, there may also be a situation where the luminance of the entire monitoring screen mutates. For example, for an outdoor surveillance camera, when lightning appears, the luminance values of all pixels in the monitoring screen of this surveillance camera will suddenly increase; or for an indoor surveillance camera, when the indoor lighting suddenly fails, the luminance values of all pixels in the monitoring screen of this surveillance camera will suddenly decrease. In response to this situation, as Figure 11 shown, the present invention also provides another image generation method, including the following steps.
[0096] S1101. The acquisition module 101 acquires the original image.
[0097] After the acquisition module 101 acquires the original image, it sends the original image to the global luminance mutation image generation module 103, so that the global luminance mutation image generation module 103 can obtain the global luminance mutation image according to the original image.
[0098] S1102. The global brightness mutation image generation module 103 adjusts the original brightness value of each pixel in the original image according to a preset brightness value to generate a global brightness mutation image.
[0099] In some embodiments, the original brightness value of each pixel in the original image can be increased or decreased by a preset brightness value to generate a global brightness mutation image.
[0100] Exemplarily, the second target brightness value I of the i-th pixel in the global brightness mutation image (i)global satisfies formula (5):
[0101] I (i)global = I ± k3 (5)
[0102] wherein, the position of the i-th pixel in the global brightness mutation image is the same as the position of the i-th pixel in the original image. I represents the brightness value of the i-th pixel in the original image, that is, the original brightness value of the i-th pixel, and k3 is the preset brightness value, and its value can be determined according to the actual situation.
[0103] When the “±” in formula (5) takes “+”, the second target brightness value of the i-th pixel in the global brightness mutation image is the sum of the original brightness value of the i-th pixel and the preset brightness value, and the second target brightness value of the i-th pixel in the global brightness mutation image is larger than the original brightness value of the i-th pixel in the original image.
[0104] When the “±” in formula (5) takes “-”, the second target brightness value of the i-th pixel in the global brightness mutation image is the difference between the original brightness value of the i-th pixel and the preset brightness value, and the second target brightness value of the i-th pixel in the global brightness mutation image is smaller than the original brightness value of the i-th pixel in the original image.
[0105] The adjusted brightness value of each pixel in the global brightness mutation image, that is, the second target brightness value, is greater than the original brightness value of this pixel, or the adjusted brightness value of each pixel in the global brightness mutation image, that is, the second brightness value, is less than the original brightness value of this pixel.
[0106] Figure 12 A global brightness mutation image obtained when the preset brightness value is increased for each pixel in the original image shown in Figure 4 is given; Figure 13 A global brightness mutation image obtained when the preset brightness value is increased for each pixel in the original image shown in Figure 5 is given.
[0107] After the global brightness mutation image generation module 103 generates the global brightness mutation image, the global brightness mutation image generation module 103 sends the global brightness mutation image to the fusion module 104.
[0108] S1103. The fusion module 104 determines the global brightness mutation image as the second target image.
[0109] The second target image is the image that can finally reflect the brightness mutation of the entire monitoring screen. It can be understood that the second target image and the global brightness mutation image can be the same image, that is, the second target brightness value of the i-th pixel point in the second target image is the same as the second target brightness value of the i-th pixel point in the global brightness mutation image, which can also be expressed by formula (5).
[0110] The second target image generated by the above method can generate a rich second target image by adjusting the preset brightness value, and can simulate the monitoring screen in the case where a strong light source affects the entire monitoring camera.
[0111] In practice, there may also be a strong light source that causes local brightness mutation of the monitoring screen and a large strong light source that causes the brightness of the entire monitoring screen to mutate. For this situation, the embodiment of the present invention also provides another image generation method, as Figure 14 shown, including the following steps.
[0112] S1401. The acquisition module 101 acquires the original image.
[0113] The difference between the original brightness values of any two pixel points in the original image is less than or equal to the preset threshold.
[0114] After the acquisition module 101 acquires the original image, it sends the original image to the local brightness mutation image generation module 102, the global brightness mutation image generation module 103, and the fusion module 104 respectively, so that the local brightness mutation image generation module 102 generates a local brightness mutation image according to the original image, the global brightness mutation image generation module 103 generates a global brightness mutation image according to the original image, and the fusion module 104 fuses the local brightness mutation image, the global brightness mutation image, and the original image to obtain the third target image.
[0115] S1402. The local brightness mutation image generation module 102 generates a local brightness mutation image according to the original image.
[0116] The local brightness mutation image generation module 102 first determines N regions in the original image, then adjusts the original brightness value of each pixel point within the same region in the original image to the first brightness value, and adjusts the original brightness value of each pixel point outside the region to the second brightness value. Finally, the local brightness mutation image generation module 102 performs a brightness gradient processing on each region to generate a local brightness mutation image.
[0117] For the specific method of generating the local brightness mutation image, reference can be made to the above S3021 - S3023, which will not be elaborated here.
[0118] After the local brightness mutation image generation module 102 generates the local brightness mutation image, it sends the local brightness mutation image to the fusion module 104, and the fusion module 104 generates the first target image based on the original image and the local brightness mutation image. The method for the fusion module to generate the first target image can be referred to the above S303.
[0119] S1403. The global brightness mutation image generation module 103 adjusts the original brightness value of each pixel point in the original image according to a preset brightness value to generate a global brightness mutation image.
[0120] The adjusted brightness value of each pixel point in the global brightness mutation image is greater than the original brightness value, or the adjusted brightness value of each pixel point in the global brightness mutation image is less than the original brightness value.
[0121] For the specific method of obtaining the global brightness mutation image, reference can be made to the above S1102, which will not be elaborated here.
[0122] After the global brightness mutation image generation module 103 generates the global brightness mutation image, it sends the global brightness mutation image to the fusion module 104, and the fusion module 104 determines the global brightness mutation image generated by the global brightness mutation image generation module 103 as the second target image.
[0123] It should be noted that S1403 can also be executed before S1402, without limitation.
[0124] S1404. The fusion module 104 fuses the first target image, the second target image, and the original image to generate a third target image.
[0125] Exemplarily, the first target image, the second target image, and the original image can be fused in the following way. First, assume that I (i)final represents the third target brightness value of the i-th pixel point in the third target image, where the i-th pixel point is any pixel point in the third target image, and I (i)final satisfies formula (6):
[0126] I(i)final = I (i)global + I (i)local - I (6)
[0127] Among them, the position of the i-th pixel point in the third target image is the same as its positions in the original image, the second target image, and the first target image. I represents the brightness value of the i-th pixel point in the original image, that is, the original brightness value of the i-th pixel point, I (i)global represents the second target brightness value of the i-th pixel point in the second target image, I (i)local represents the first target brightness value of the i-th pixel point in the first target image.
[0128] When the “±” in formula (6) takes “+”, it represents positive fusion, and the third target brightness value of the i-th pixel point in the third target image is the sum of the second target brightness value and the first target brightness value of the i-th pixel point minus the original brightness value of the i-th pixel point.
[0129] When the “±” in formula (6) takes “-”, it represents negative fusion, and the third target brightness value of the i-th pixel point in the third target image is the difference between the second target brightness value and the first target brightness value of the i-th pixel point minus the original brightness value of the i-th pixel point.
[0130] Then, calculate the third target brightness value of each pixel point in sequence to generate the third target image.
[0131] In some other embodiments, for the sake of simplicity in calculation, only the local brightness mutation image and the global brightness mutation image can be fused to obtain the third target image.
[0132] Figure 15 A Figure 4 shown original image, Figure 8 the first target image corresponding to the local brightness mutation image shown, and Figure 12 the third target image after fusing the second target image corresponding to the global brightness mutation image shown are given.
[0133] Figure 16 A Figure 5 shown original image, Figure 8 the first target image corresponding to the local brightness mutation image shown, and Figure 13 the third target image after fusing the second target image corresponding to the global brightness mutation image shown are given.
[0134] The third target image generated by the above method simulates the monitoring screen under the combined action of local brightness mutation and global brightness mutation, and can provide richer brightness mutation images for the training of artificial intelligence models.
[0135] Referring to Figure 17 As shown, an embodiment of the present invention further provides an image generation device, including a memory 1701, a processor 1702, a bus 1703, and a communication interface 1704; the memory 1701 is used to store computer execution instructions, and the processor 1702 is connected to the memory 1701 through the bus 1703; when the image generation device runs, the processor 1702 executes the computer execution instructions stored in the memory 1701, so that the image generation device executes the image generation method provided in the above embodiment.
[0136] In a specific implementation, as an embodiment, the processor 1702 (1702-1 and 1702-2) may include one or more CPUs, such as Figure 17 the CPUs 0 and CPU1 shown in. And as an embodiment, the image generation device may include multiple processors 1702, such as Figure 17 the processor 1702-1 and the processor 1702-2 shown in. Each CPU in these processors 1702 may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). The processor 1702 here may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0137] In this application, the processor 1702 is used to execute the above S301-S303, S1101-S1103, and S1401-S1404.
[0138] The memory 1701 may be a read-only memory 1701 (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1701 may exist independently and be connected to the processor 1702 through the bus 1703. The memory 1701 may also be integrated with the processor 1702.
[0139] In this application, the memory 1701 is used to store the original images acquired by the above-mentioned processor, the local luminance mutation images, global luminance mutation images, first target images, second target images, and third target images generated by the processor based on the original images, as well as the luminance values of the pixel points in each image. The memory is further used to store the first coefficient, the second coefficient, and the preset luminance value. The memory is also used to store computer execution instructions. When the computer instructions run on a computer, the computer can execute the image generation method provided in the above embodiments.
[0140] In a specific implementation, the memory 1701 is used to store the data in this application and the computer execution instructions corresponding to the software program for executing this application. The processor 1702 can perform various functions of the image generation device by running or executing the software program stored in the memory 1701 and calling the data stored in the memory 1701.
[0141] The communication interface 1704 uses any device such as a transceiver for communicating with other devices or communication networks, such as a control system, a radio access network (RAN), a wireless local area network (WLAN), etc. The communication interface 1704 may include a receiving unit to implement the receiving function and a transmitting unit to implement the transmitting function.
[0142] The bus 1703 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, etc. This bus 1703 can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 17 only a thick line is used to represent it herein, but it does not mean that there is only one bus or one type of bus.
[0143] The embodiment of the present invention also provides a computer program. This computer program can be directly loaded into the memory and contains software code. After being loaded and executed by a computer, this computer program can implement the image generation method provided in the above embodiments.
[0144] Those skilled in the art should be able to realize that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, where communication media includes any medium that facilitates the transfer of a computer program from one place to another. The storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0145] Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and simplicity of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0146] In several embodiments provided in this application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form. The units described as separate components may or may not be physically separated, and the components displayed as units may be one physical unit or multiple physical units, that is, they can be located in one place or distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0147] In addition, in each embodiment of the present invention, each functional unit can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The software product is stored in a storage medium and includes several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes.
[0148] As described above, the above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. An image generation method, characterized in that, Including: Obtain an original image, where the difference between the original brightness values of any two pixel points in the original image is less than or equal to a preset threshold; Taking N pixel points as the centers, determine N circular regions, the radius of each circular region conforms to a preset radius range, and the area of each circular region is smaller than the area of the original image; Adjust the original brightness value of each pixel point within the same region to a first brightness value, and adjust the original brightness value of each pixel point outside the region to a second brightness value; Perform brightness gradient processing on each of the regions to determine N brightness mutation regions, obtaining a local brightness mutation image, the local brightness mutation image includes N brightness mutation regions, and N is an integer greater than or equal to 1; Fuse the local brightness mutation image with the original image to obtain a target image; The performing brightness gradient processing on each of the regions includes: According to the distance of the i-th pixel point within the circular region from the center of the circle, determine the third brightness value of the i-th pixel point within the circular region, i is a positive integer, i ∈ [1, K], and K represents the number of pixel points within the circular region; Adjust the first brightness value of the i-th pixel point to the third brightness value of the i-th pixel point.
2. The method according to claim 1, characterized in that The preset radius range is determined according to the minimum width, and the minimum width is the length of the shortest side among the four sides of the original image.
3. The method according to claim 2, wherein The preset radius range is from half of the minimum width to one-fifth of the minimum width.
4. An image generation method, characterized in that, Including: Obtain an original image, where the difference between the original brightness values of any two pixel points in the original image is less than or equal to a preset threshold; Taking N pixel points as the centers, determine N circular regions, the radius of each circular region conforms to a preset radius range, and the area of each circular region is smaller than the area of the original image; Adjust the original brightness value of each pixel point within the same region to a first brightness value, and adjust the original brightness value of each pixel point outside the region to a second brightness value; Perform brightness gradient processing on each of the regions to determine N brightness mutation regions, obtaining a local brightness mutation image, the local brightness mutation image includes N brightness mutation regions, and N is an integer greater than or equal to 1; Generate a first target image according to the original image and the local brightness mutation image; Adjust the original brightness value of each pixel point in the original image according to a preset brightness value to generate a global brightness mutation image, and the adjusted brightness value of each pixel point in the global brightness mutation image is greater than or less than the original brightness value; Determine the global brightness mutation image as the second target image; Fuse the first target image, the second target image and the original image to obtain a third target image; The performing brightness gradient processing on each of the regions includes: According to the distance of the i-th pixel point within the circular region from the center of the circle, determine the third brightness value of the i-th pixel point within the circular region, i is a positive integer, i ∈ [1, K], and K represents the number of pixel points within the circular region; Adjust the first brightness value of the i-th pixel point to the third brightness value of the i-th pixel point.
5. An image generation device, characterized in that, It includes an acquisition module, a local brightness mutation image generation module, and a fusion module; The acquisition module is used to acquire an original image, and the difference between the original brightness values of any two pixel points in the original image is less than or equal to a preset threshold; The local brightness mutation image generation module is specifically used to determine N circular regions with N pixel points as the centers. The radius of each circular region conforms to a preset radius range, and the area of each circular region is smaller than the area of the original image; Adjust the original brightness value of each pixel point within the same region to a first brightness value, and adjust the original brightness value of each pixel point outside the region to a second brightness value; Perform a brightness gradient processing on each region to determine N brightness mutation regions, and obtain a local brightness mutation image. The local brightness mutation image includes N brightness mutation regions, where N is an integer greater than or equal to 1; The fusion module is used to fuse the local brightness mutation image generated by the local brightness mutation image generation module with the original image acquired by the acquisition module to obtain a target image; The local brightness mutation image generation module is specifically used for, According to the distance between the i-th pixel point in the circular region and the center of the circle, determine the third brightness value of the i-th pixel point in the circular region, where i is a positive integer, i ∈ [1, K], and K represents the number of pixel points in the circular region; Adjust the first brightness value of the i-th pixel point to the third brightness value of the i-th pixel point.
6. The device according to claim 5, characterized in that, The preset radius range is determined according to the minimum width, and the minimum width is the length of the shortest side among the four sides of the original image.
7. The device according to claim 6, characterized in that The preset radius range is from half of the minimum width to one-fifth of the minimum width.
8. An image generation device, characterized in that, It includes an acquisition module, a local brightness mutation image generation module, a global brightness mutation image generation module, and a fusion module; The acquisition module is used to acquire an original image, and the difference between the original brightness values of any two pixel points in the original image is less than or equal to a preset threshold; The local brightness mutation image generation module is specifically used to determine N circular regions with N pixel points as the centers. The radius of each circular region conforms to a preset radius range, and the area of each circular region is smaller than the area of the original image; Adjust the original brightness value of each pixel point within the same region to a first brightness value, and adjust the original brightness value of each pixel point outside the region to a second brightness value; Perform a brightness gradient processing on each region to determine N brightness mutation regions, and obtain a local brightness mutation image. The local brightness mutation image includes N brightness mutation regions, where N is an integer greater than or equal to 1; The global brightness mutation image generation module is used to adjust the original brightness value of each pixel point in the original image acquired by the acquisition module according to a preset brightness value to generate a global brightness mutation image, and the adjusted brightness value of each pixel point in the global brightness mutation image is greater than or less than the original brightness value; The fusion module is configured to generate a first target image according to the original image obtained by the acquisition module and the local luminance mutation image generated by the local luminance mutation image generation module; Determine the global luminance mutation image generated by the global luminance mutation image generation module as the second target image; The fusion module is further configured to fuse the first target image, the second target image, and the original image obtained by the acquisition module to obtain a third target image; The local luminance mutation image generation module is specifically configured to Determine a third luminance value of the i-th pixel point in the circular area according to the distance between the i-th pixel point in the circular area and the center of the circle, where i is a positive integer, i ∈ [1, K], and K represents the number of pixel points in the circular area; Adjust the first luminance value of the i-th pixel point to the third luminance value of the i-th pixel point.
9. An image generation device, characterized in that, It includes a memory, a processor, a bus, and a communication interface; the memory is used to store computer execution instructions, and the processor is connected to the memory through the bus; when the image generation device runs, the processor executes the computer execution instructions stored in the memory, so that the image generation device executes the image generation method according to any one of claims 1-3, or the image generation method according to claim 4.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer execution instructions, and when the computer execution instructions run on a computer, the computer executes the image generation method according to any one of claims 1-3, or the image generation method according to claim 4.
Citation Information
Patent Citations
Image processing method and device
CN106296621A
Image processing method and apparatus
CN106504220A