Image brightness adjustment method, computer program product, electronic device and medium
By determining the global and local brightness mapping relationship in image processing, combined with image chunking adjustment, the problem of poor brightness consistency in image brightness consistency adjustment is solved, and the local area consistency of the image and the natural transition of image block boundaries are improved.
Patent Information
- Application Number
- CN202210564955.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-23
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-05-23
AI Technical Summary
The prior art has the problem of poor brightness consistency in image brightness consistency adjustment.
By determining the global brightness mapping relationship and local brightness mapping relationship between the original image and the reference image, combined with image chunking adjustment, histogram matching technology is used to adjust the brightness consistency of the image block to solve the abnormal mutation and block effect problems of the image block.
It improves the brightness consistency of local areas, highlight areas and dark areas of the image, eliminates the transition unnatural phenomenon of image block boundaries, and enhances the effect of image brightness adjustment.
Smart Images

Figure CN115082291B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method, computer program product, electronic device, and medium for adjusting image brightness. Background Art
[0002] During image processing, it is usually necessary to adjust the grayscale value of an image to maintain brightness consistency between different images (eg, two adjacent video frames in the same video).
[0003] In the prior art, the grayscale value of the original image is usually adjusted according to the reference image based on a histogram matching method, so as to adjust the brightness consistency between the original image and the reference image.
[0004] However, when adjusting the brightness consistency of an image in this manner, there is usually a problem of poor image brightness consistency. Summary of the Invention
[0005] The purpose of the embodiments of the present application is to provide a method, a computer program product, an electronic device, and a medium for adjusting image brightness, so as to improve the brightness consistency between different images when adjusting the brightness consistency of different images.
[0006] In one aspect, a method for adjusting image brightness is provided, comprising:
[0007] Based on the grayscale value of each pixel in the original image to be processed and the grayscale value of each pixel in the reference image, a global brightness mapping relationship between the original image and the reference image is determined, as well as local brightness mapping relationships corresponding to multiple pairs of image blocks in the original image and the reference image. The global brightness mapping relationship is used to indicate a conversion relationship between the grayscale values of the pixels in the original image and the pixels at corresponding positions in the reference image. The local brightness mapping relationship of each pair of image blocks is used to indicate a conversion relationship between the grayscale values of the pixels in the original image blocks in each pair of image blocks and the pixels at corresponding positions in the reference image in each pair of image blocks. According to the global brightness mapping relationship and the local brightness mapping relationships, brightness adjustment is performed on each original image block in the original image. Based on the adjusted original image blocks, an adjusted original image is generated.
[0008] In the above implementation process, based on the idea of adjusting brightness consistency by dividing the image into blocks, the brightness consistency of the local area, highlight area and dark area of the image is improved.
[0009] In one embodiment, based on the grayscale value of each pixel in the original image to be processed and the grayscale value of each pixel in the reference image, a global brightness mapping relationship between the original image and the reference image is determined, including: based on the grayscale value of each pixel in the original image, respectively determining the pixel probability of each grayscale value in the original image, the pixel probability of each grayscale value is determined based on the proportion of the number of pixels of each grayscale value to the total number of all pixels in the original image; according to the pixel probability of each grayscale value in the original image, obtaining the probability cumulative distribution function of the original image, the probability cumulative distribution function is used to indicate the cumulative distribution of the pixel probability of each grayscale value in the image; based on the grayscale value of each pixel in the reference image, respectively determining the pixel probability of each grayscale value in the reference image; according to the pixel probability of each grayscale value in the reference image, obtaining the probability cumulative distribution function of the reference image; determining the global brightness mapping relationship based on the probability cumulative distribution function of the original image and the probability cumulative distribution function of the reference image.
[0010] In the above implementation process, the histogram matching method is used to determine the global brightness mapping relationship between the entire image, so that the grayscale value conversion can be performed through the global brightness mapping relationship.
[0011] In one embodiment, determining the local brightness mapping relationship between multiple pairs of image blocks in an original image and a reference image includes: performing the following steps for each pair of image blocks: determining the pixel probability of each grayscale value in the original image block based on the grayscale value of each pixel in the original image block in a pair of image blocks; obtaining a probability cumulative distribution function of the original image block based on the pixel probability of each grayscale value in the original image block, the probability cumulative distribution function being used to indicate the cumulative distribution of the pixel probability of each grayscale value in the image; determining the pixel probability of each grayscale value in the reference image block based on the grayscale value of each pixel in the reference image block in a pair of image blocks; obtaining a probability cumulative distribution function of the reference image block based on the pixel probability of each grayscale value in the reference image block; and determining the local brightness mapping relationship between the pair of image blocks based on the probability cumulative distribution function of the original image block and the probability cumulative distribution function of the reference image block.
[0012] In the above implementation process, the global brightness mapping relationship between local image blocks can be determined by adopting the histogram matching method, so that the grayscale value conversion can be performed based on the global brightness mapping relationship.
[0013] In one embodiment, brightness adjustment is performed on each original image block in the original image based on a global brightness mapping relationship and each local brightness mapping relationship, including: performing the following steps for each pair of image blocks: determining a brightness mapping change rate of the local brightness mapping relationship of the pair of image blocks, where the brightness mapping change rate is used to indicate the slope of a local brightness mapping curve corresponding to the local brightness mapping relationship; determining whether the brightness mapping change rate meets the local mapping condition; if so, performing brightness adjustment on the original image blocks in the pair of image blocks based on the local brightness mapping relationship corresponding to the pair of image blocks; otherwise, performing brightness adjustment on the original image blocks in the pair of image blocks based on the global brightness mapping relationship.
[0014] In the above implementation process, the global brightness mapping relationship and the local brightness mapping relationship are combined. For image blocks with abnormal mutations, the global brightness mapping relationship is used to perform image adjustment. For image blocks without abnormal mutations, the local brightness mapping relationship is used to perform image adjustment. This can solve the abnormality problem caused by the small number of samples in the image block and eliminate the negative gain problem existing in the brightness consistency adjustment based on the image block.
[0015] In one embodiment, there are multiple brightness mapping change rates, and determining whether the brightness mapping change rate meets the local mapping condition includes: if each brightness mapping change rate is less than a change rate threshold, determining that the brightness mapping change rate meets the local mapping condition.
[0016] In the above implementation process, it is possible to determine whether there is an abnormality in the global brightness mapping relationship by using the brightness mapping change rate.
[0017] In one embodiment, an adjusted original image is generated based on each adjusted original image block, including: determining the overlapping area of adjacent original image blocks in the original image, where the original image blocks are divided from the original image according to a target size, and the target size is the size of the overlapping area between adjacent image blocks; for target pixel points in the overlapping area of the original image, screening out multiple target image blocks containing target pixel points from each adjusted original image block, where the target pixel point is any pixel point in the overlapping area; determining the grayscale value and weight of the target pixel point in each target image block; performing weighted summation on the grayscale values of the target pixel points; adjusting the grayscale value of the target pixel point in each target image block according to the weighted summation result to obtain an adjusted target image block; and combining the adjusted target image blocks to obtain an adjusted original image.
[0018] In the above implementation process, the grayscale value of the pixel point in the overlapping area of the image block boundary is adjusted according to the grayscale value and weight of the pixel point in multiple original image blocks, thereby avoiding the unnatural transition phenomenon of the image block boundary and eliminating the problem of blocking effect.
[0019] In one embodiment, determining the weight of the target pixel point in each target image block includes: determining the weight of the target pixel point in each target image block based on the grayscale value of the target pixel point in each target image block after adjustment; or determining the weight of the target pixel point in each target image block based on the distance between the target pixel point and the center point of each target image block.
[0020] In the above implementation process, the weight is determined according to the distance between the target pixel and each image block or the grayscale value in each image block to adjust the grayscale value.
[0021] In one aspect, a device for adjusting image brightness is provided, comprising:
[0022] A determination unit is configured to determine a global brightness mapping relationship between the original image and the reference image, and to determine local brightness mapping relationships corresponding to multiple pairs of image blocks in the original image and the reference image, based on the grayscale values of each pixel in the original image to be processed and the grayscale values of each pixel in the reference image. The global brightness mapping relationship is configured to indicate a grayscale value conversion relationship between pixels in the original image and pixels at corresponding positions in the reference image. The local brightness mapping relationship for each pair of image blocks is configured to indicate a grayscale value conversion relationship between pixels in the original image block in each pair of image blocks and pixels at corresponding positions in the reference image in each pair of image blocks. An adjustment unit is configured to perform brightness adjustment on each original image block in the original image according to the global brightness mapping relationship and the local brightness mapping relationships. A generation unit is configured to generate an adjusted original image based on each adjusted original image block.
[0023] In one embodiment, the determination unit is used to: determine the pixel probability of each grayscale value in the original image based on the grayscale value of each pixel in the original image, and the pixel probability of each grayscale value is determined based on the proportion of the number of pixels of each grayscale value to the total number of all pixels in the original image; obtain the probability cumulative distribution function of the original image according to the pixel probability of each grayscale value in the original image, and the probability cumulative distribution function is used to indicate the cumulative distribution of the pixel probability of each grayscale value in the image; determine the pixel probability of each grayscale value in the reference image based on the grayscale value of each pixel in the reference image; obtain the probability cumulative distribution function of the reference image according to the pixel probability of each grayscale value in the reference image; determine the global brightness mapping relationship according to the probability cumulative distribution function of the original image and the probability cumulative distribution function of the reference image.
[0024] In one embodiment, the determination unit is used to: perform the following steps for each pair of image blocks: determine the pixel probability of each grayscale value in the original image block based on the grayscale value of each pixel in the original image block in the pair of image blocks; obtain the probability cumulative distribution function of the original image block based on the pixel probability of each grayscale value in the original image block, and the probability cumulative distribution function is used to indicate the cumulative distribution of the pixel probability of each grayscale value in the image; determine the pixel probability of each grayscale value in the reference image block based on the grayscale value of each pixel in the reference image block in the pair of image blocks; obtain the probability cumulative distribution function of the reference image block based on the pixel probability of each grayscale value in the reference image block; and determine the local brightness mapping relationship of the pair of image blocks based on the probability cumulative distribution function of the original image block and the probability cumulative distribution function of the reference image block.
[0025] In one embodiment, the adjustment unit is used to: perform the following steps for each pair of image blocks: determine the brightness mapping change rate of the local brightness mapping relationship of the pair of image blocks, where the brightness mapping change rate is used to indicate the slope of the local brightness mapping curve corresponding to the local brightness mapping relationship; determine whether the brightness mapping change rate meets the local mapping condition; if so, adjust the brightness of the original image blocks in the pair of image blocks according to the local brightness mapping relationship corresponding to the pair of image blocks; otherwise, adjust the brightness of the original image blocks in the pair of image blocks according to the global brightness mapping relationship.
[0026] In one embodiment, there are multiple brightness mapping change rates, and the adjustment unit is configured to: if each brightness mapping change rate is less than a change rate threshold, determine that the brightness mapping change rate meets the local mapping condition.
[0027] In one embodiment, the generation unit is used to: determine the overlapping area of adjacent original image blocks in the original image, where the original image blocks are divided from the original image according to a target size, and the target size is the size of the overlapping area between adjacent image blocks; for the target pixel points in the overlapping area of the original image, screen out multiple target image blocks containing the target pixel points from the adjusted original image blocks, where the target pixel point is any pixel point in the overlapping area; determine the grayscale value and weight of the target pixel point in each target image block; perform weighted summation on the grayscale values of the target pixel points; adjust the grayscale value of the target pixel point in each target image block according to the weighted summation result to obtain the adjusted target image block; and combine the adjusted target image blocks to obtain the adjusted original image.
[0028] In one embodiment, the generation unit is used to: determine the weight of the target pixel point in each target image block based on the grayscale value of the target pixel point in each target image block after adjustment; or determine the weight of the target pixel point in each target image block based on the distance between the target pixel point and the center point of each target image block.
[0029] On the one hand, an electronic device is provided, comprising: a memory and a processor, wherein computer program instructions are stored in the memory, and when the computer program instructions are read and executed by the processor, the steps of the method provided in any of the various optional implementations of the above-mentioned image brightness adjustment are executed.
[0030] On the one hand, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are read and executed by a processor, the steps of the method provided in any of the various optional implementations of image brightness adjustment described above are executed.
[0031] In one aspect, a computer program product is provided, comprising computer program instructions, which, when read and executed by a processor, execute the steps of the method provided in any of the various optional implementations of image brightness adjustment described above.
[0032] Other features and advantages of the present application will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present application. The purposes and other advantages of the present application can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0034] Figure 1 A flowchart of an implementation method of an image brightness adjustment method provided in an embodiment of the present application;
[0035] Figure 2 A flowchart of a specific implementation of a method for adjusting image brightness provided in an embodiment of the present application;
[0036] Figure 3 A structural block diagram of a device for adjusting image brightness provided in an embodiment of the present application;
[0037] Figure 4This is a schematic structural diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0038] In recent years, significant progress has been made in the research of AI-based technologies such as computer vision, deep learning, machine learning, image brightness adjustment, and image recognition. Artificial Intelligence (AI) is an emerging science and technology that studies and develops theories, methods, technologies, and application systems for simulating and extending human intelligence. AI is a comprehensive discipline that involves a wide range of technologies, including chips, big data, cloud computing, the Internet of Things, distributed storage, deep learning, machine learning, and neural networks. Computer vision, a key branch of AI, specifically enables machines to understand the world. Computer vision technologies typically include face recognition, liveness detection, fingerprint recognition and anti-counterfeiting verification, biometric recognition, face detection, pedestrian detection, object detection, pedestrian recognition, image brightness adjustment, image recognition, image semantic understanding, image retrieval, text recognition, video processing, video content recognition, behavior recognition, 3D reconstruction, virtual reality, augmented reality, simultaneous localization and mapping, computational photography, and robot navigation and positioning. With the research and advancement of artificial intelligence technology, this technology has been applied in many fields, such as security, urban management, traffic management, building management, park management, facial recognition access, facial recognition attendance, logistics management, warehouse management, robotics, intelligent marketing, computational photography, mobile phone imaging, cloud services, smart homes, wearable devices, unmanned driving, autonomous driving, smart healthcare, facial payment, facial unlocking, fingerprint unlocking, identity verification, smart screens, smart TVs, cameras, mobile Internet, live streaming, facial beauty, makeup, medical cosmetology, and intelligent temperature measurement. The method for adjusting image brightness in the embodiments of the present application also utilizes technologies in artificial intelligence and other aspects.
[0039] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work fall within the scope of protection of the present application.
[0040] It should be noted that similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and should not be understood as indicating or implying relative importance.
[0041] First, some of the terms involved in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.
[0042] Terminal device: can be a mobile terminal, fixed terminal or portable terminal, such as a mobile phone, station, unit, device, multimedia computer, multimedia tablet, Internet node, communicator, desktop computer, laptop computer, notebook computer, netbook computer, tablet computer, personal communication system device, personal navigation device, personal digital assistant, audio / video player, digital camera / camcorder, positioning device, television receiver, radio broadcast receiver, e-book device, gaming device or any combination thereof, including accessories and peripherals of these devices or any combination thereof. It is also foreseeable that the terminal device can support any type of user interface (such as wearable device), etc.
[0043] Server: It can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.
[0044] Grayscale value: refers to the brightness value of each color corresponding to its own color light in a painting, photograph or other visual work.
[0045] Image histogram: It is used to represent the mapping relationship between the statistical characteristics of each grayscale value of an image and the grayscale value of the image. It is used to count the number of pixels or the probability of pixels appearing at each grayscale value in an image. Graphically, it is a two-dimensional graph.
[0046] Histogram normalization, also known as histogram matching, is an image enhancement technique that transforms an image's histogram into a specified shape. The principle is to equalize both image histograms to create the same normalized uniform histogram, using this uniform histogram as a medium. The inverse equalization operation is then performed on the reference image.
[0047] Grayscale distribution function: represents the mapping relationship between each grayscale value x in the image and the pixel probability P(x).
[0048] Brightness mapping relationship: used to indicate the conversion relationship between grayscale values in different images. For example, the brightness mapping relationship can be represented by a brightness mapping table (LUT).
[0049] In the embodiment of the present application, the execution subject is an electronic device for adjusting image brightness. Optionally, the electronic device can be a server or a terminal device, which is not limited here.
[0050] See Figure 1 As shown, it is an implementation flow chart of a method for image brightness adjustment provided by an embodiment of the present application. The specific implementation process of the method is as follows: Step 101: Based on the grayscale value of each pixel in the original image to be processed and the grayscale value of each pixel in the reference image, determine the global brightness mapping relationship between the original image and the reference image, and determine the local brightness mapping relationship corresponding to each of the multiple pairs of image blocks in the original image and the reference image. The global brightness mapping relationship is used to indicate the conversion relationship between the grayscale values of the pixels in the original image and the pixels at the corresponding positions in the reference image. The local brightness mapping relationship of each pair of image blocks is used to indicate the conversion relationship between the grayscale values of the pixels of the original image blocks in each pair of image blocks and the pixels at the corresponding positions in the reference image in each pair of image blocks; Step 102: According to the global brightness mapping relationship and the local brightness mapping relationships, perform brightness adjustment on each original image block in the original image; Step 103: Generate an adjusted original image based on the adjusted original image blocks.
[0051] In one embodiment, when brightness consistency adjustment is required for two images, one of the two images is used as a reference image, and the other image is used as the original image to be processed. For example, when a brightness consistency adjustment request is received for two images with different exposure levels (i.e., image ev0 and image ev2), image ev0 is determined to be the original image, and image ev2 is determined to be the reference image.
[0052] It should be noted that the step of determining the global brightness mapping relationship and the step of determining the local brightness mapping may be performed sequentially or simultaneously, and there is no restriction on the execution order of the two.
[0053] In an embodiment of the present application, based on the idea of adjusting brightness consistency by dividing the image into blocks, combined with the global brightness mapping relationship and the local brightness mapping relationship, the brightness of the original image is adjusted to improve the brightness consistency of the local areas, highlight areas and dark areas of the image.
[0054] Determining the global brightness mapping relationship between the original image and the reference image based on the grayscale value of each pixel in the original image to be processed and the grayscale value of each pixel in the reference image in step 101 may include the following steps:
[0055] S101a1: Based on the grayscale value of each pixel in the original image, determine the pixel probability of each grayscale value in the original image, where the pixel probability of each grayscale value is determined based on the ratio of the number of pixels of each grayscale value to the total number of all pixels in the original image.
[0056] In one embodiment, the number of pixels corresponding to each grayscale value in the original image and the total number of all pixels in the original image are counted, and the probability of the pixel points of each grayscale value is obtained based on the ratio between the number of pixels of each grayscale value and the total number.
[0057] For example, the original image contains 200 pixels, among which 20 pixels have a grayscale value of 50. Then the probability of the pixel corresponding to the grayscale value 50 is 20 / 200=0.1.
[0058] S101a2: Obtain a probability cumulative distribution function of the original image based on the pixel probability of each grayscale value in the original image. The probability cumulative distribution function is used to indicate the cumulative distribution of the pixel probability of each grayscale value in the image.
[0059] In one embodiment, the grayscale distribution function corresponding to the original image is determined based on the pixel probability corresponding to each grayscale value, and the grayscale distribution function corresponding to the original image is integrated to obtain the probability cumulative distribution function of the original image.
[0060] The grayscale distribution function is used to indicate the probability of each grayscale value in the image, that is, it represents the mapping relationship between each grayscale value x and the pixel probability P(x) in the image.
[0061] Optionally, the grayscale distribution function can also be represented by an image histogram. The image histogram is used to represent the mapping relationship between the statistical characteristics of each grayscale value of the image and the grayscale value of the image, and is used to count the number of pixels or pixel probabilities of each grayscale value in an image. Graphically speaking, it is a two-dimensional graph. As an example, the horizontal axis of the image histogram is set to the grayscale value and the vertical axis is set to the pixel probability. Then, based on the grayscale value of each pixel in the original image, an image histogram of the original image can be generated. Furthermore, the grayscale distribution function can also be used to indicate the number of pixels of each grayscale value in the image, etc., which is not limited here.
[0062] The probability cumulative distribution function is used to integrate the pixel probability P(x) to obtain a mapping relationship between the grayscale value x and the probability cumulative result S(x), where S(x) is the sum of the pixel probability P(x) of grayscale values less than or equal to the grayscale value x. Optionally, the probability cumulative distribution function can also be represented by a probability cumulative distribution function (CDF) curve. The horizontal coordinate of the CDF curve is the grayscale value x, and the vertical coordinate is the probability cumulative result S(x).
[0063] S101a3: Based on the grayscale value of each pixel in the reference image, determine the pixel probability of each grayscale value in the reference image.
[0064] In one embodiment, the number of pixels corresponding to each grayscale value in the reference image and the total number of pixels in the reference image are counted, and the probability of pixels for each grayscale value is obtained based on the ratio between the number of pixels for each grayscale value and the total number.
[0065] S101a4: Obtain a probability cumulative distribution function of the reference image based on the pixel probability of each grayscale value in the reference image.
[0066] In one embodiment, a grayscale distribution function corresponding to a reference image is determined based on the pixel probabilities corresponding to each grayscale value, and the grayscale distribution function corresponding to the reference image is integrated to obtain a probability cumulative distribution function of the reference image. Optionally, the grayscale distribution function of the reference image can also be represented as an image histogram.
[0067] It should be noted that the probability cumulative distribution function of the reference image can be determined based on a principle similar to that of determining the probability cumulative distribution function of the original image, which will not be described in detail here.
[0068] It should be noted that determining the probability cumulative distribution function of the original image and determining the probability cumulative distribution function of the reference image can be performed successively or in parallel, and the execution order of the two is not limited here.
[0069] S101a5: Determine a global brightness mapping relationship according to the probability cumulative distribution function of the original image and the probability cumulative distribution function of the reference image.
[0070] Specifically, based on the histogram specification technology (i.e. histogram matching), the global brightness mapping relationship is determined according to the probability cumulative distribution function corresponding to the original image and the probability cumulative distribution function corresponding to the reference image. As an example, the global brightness mapping relationship can also be represented by LUT. The brightness mapping table can also be called a color lookup table. Grayscale value conversion can be performed through the LUT table to achieve brightness adjustment. Among them, histogram specification, i.e. histogram matching, refers to transforming the image histogram of an image into a specified shape, which is an image enhancement technology. The specific principle is: both image histograms are equalized to become the same normalized uniform histogram, and this uniform histogram acts as a medium, and then the inverse equalization operation is performed on the reference image.
[0071] The principle of global brightness mapping can be derived using the following formula: The probability cumulative distribution function of the original image is F1(x1)=S1, and the probability cumulative distribution function of the reference image is F2(x2)=S2. If the reference image and the original image are equalized to become the same normalized uniform histogram, then F1(x1)=S1=S2=F2(x2). Therefore, x2=F2 -1 (S2) = F2 -1 (S1) = F2 -1 (F1(x1)), that is, the global brightness mapping relationship can be expressed as: x2=F2 -1 (F1(x1)).
[0072] Where x1 represents the grayscale value in the original image, x2 represents the grayscale value in the reference image, F1 represents the probability cumulative distribution function of the original image, F2 represents the probability cumulative distribution function of the reference image, S1 represents the probability cumulative result in the original image, and S2 represents the probability cumulative result in the reference image.
[0073] In this way, the global brightness mapping relationship between the original image and the target image can be determined, that is, the mapping relationship (i.e., conversion relationship) between the grayscale values of pixels in the original image and the grayscale values of pixels at corresponding positions in the reference image.
[0074] Furthermore, the original image and the target image can be divided separately to obtain multiple pairs of image blocks. It should be noted that the original image blocks are divided from the original image according to the target size, and the reference image blocks are divided from the reference image according to the target size. The target size is the size of the overlapping area between adjacent image blocks (e.g., adjacent original image blocks or adjacent reference image blocks).
[0075] In one implementation, when obtaining multiple pairs of image blocks, any of the following methods may be used:
[0076] Method 1: Divide the original image according to the location of each reference image block in the reference image to obtain the original image blocks corresponding to the reference image blocks in the original image. The reference image blocks are the image blocks divided from the reference image according to the target size.
[0077] Method 2: Divide the original image and the reference image into blocks according to the target size, and obtain the reference image of each original image block in the original image and its corresponding position in the reference image.
[0078] As an example, using a partial overlap concept, the sum of the initial and target sizes of image blocks is determined to obtain the image block size. The original image is then divided according to the image block size to obtain multiple original image blocks. The reference image is also divided according to the image block size to obtain multiple reference image blocks. Each original image block in the original image is grouped with the corresponding reference image block in the reference image to obtain multiple pairs of image blocks. There is overlapping area between adjacent original image blocks, and there is overlapping area between adjacent reference image blocks.
[0079] The initial size indicates the initial size of the image block. As an example, the initial size is determined based on the image size and the target number of image blocks (e.g., 4). As another example, the initial size is pre-set. In actual applications, the target number of image blocks, the initial size, and the target size can all be set based on the actual application scenario and are not limited here.
[0080] As an example, the image size (including image length and image width) of the original image is obtained, and based on the image size and the number of target image blocks, the initial size (including initial length and initial width) of each original image block is calculated, and the sum of the initial size and the target size (including target length and target width) is determined to obtain the image block size (image block length and image block width) of the original image block, and the original image is divided according to the image block size to obtain multiple original image blocks.
[0081] As an example, the above sizes (including image size, initial size, target size and image block size) can all be described by resolution. For example, the original image has a resolution of 4000*3000 (ie, image size).
[0082] For example, if the original image has a resolution of 4000*3000 and needs to be divided into 10*10 image blocks, the resolution of each image block is (400+overlap)*(300+overlap), where overlap is the target overlap resolution.
[0083] In the embodiment of the present application, each reference image block in the reference image can be obtained based on a principle similar to that of obtaining the original image block, which will not be described in detail here.
[0084] In this way, after the original image and the reference image are divided into blocks, there are overlapping areas between adjacent image blocks (ie, adjacent original image blocks, or adjacent reference image blocks).
[0085] It should be noted that the sizes of different image blocks in the same image can be the same or different. However, the sizes of each set of matching image blocks in the reference image and the original image are consistent.
[0086] In this way, the original image and the reference image can be divided into blocks respectively, and then in the subsequent steps, brightness consistency adjustment can be performed through the matched image blocks.
[0087] In one embodiment, dividing each original image block in the original image and the reference image blocks at corresponding positions in the reference image into the same group to obtain multiple pairs of image blocks may include: dividing image blocks at the same position in different images into the same group according to the image position of each original image block and the image position of each reference image block to obtain multiple pairs of image blocks.
[0088] It should be noted that the reference image represents a first object (including original image blocks and pixels) in the original image and a second object (including original image blocks and pixels) at the corresponding location. This means that the first and second objects have the same coordinate positions or regions in different images. For example, if the coordinates of a pixel in the original image are (0, 0), then the coordinates of that pixel in the reference image are also (0, 0).
[0089] In one embodiment, determining the local brightness mapping relationship between multiple pairs of image blocks in the original image and the reference image in step 101 may include: performing the following steps for each pair of image blocks:
[0090] S101b1: Based on the grayscale value of each pixel in the original image block in a pair of image blocks, determine the pixel probability of each grayscale value respectively.
[0091] S101b2 obtains a probability cumulative distribution function of the original image block based on the pixel probability of each gray value in the original image block. The probability cumulative distribution function is used to indicate the cumulative distribution of the pixel probability of each gray value in the image.
[0092] S101b3: Based on the grayscale value of each pixel in the reference image block in a pair of image blocks, determine the pixel probability of each grayscale value in the reference image.
[0093] S101b4: Obtain a probability cumulative distribution function of the reference image block according to the pixel probability of each grayscale value in the reference image block.
[0094] In the embodiment of the present application, the probability cumulative distribution function of the original image block and the reference image block can be determined based on a principle similar to that of determining the probability cumulative distribution function of the original image and the reference image, which will not be described in detail here.
[0095] It should be noted that the step of determining the probability cumulative distribution function of the original image block and the step of determining the probability cumulative distribution function of the reference image block can be performed successively or in parallel, and the execution order of the two is not limited here.
[0096] S101b5: Determine a local brightness mapping relationship between a pair of image blocks based on the probability cumulative distribution function of the original image block and the probability cumulative distribution function of the reference image block. As an example, the local brightness mapping relationship can also be represented by a brightness mapping table (LUT). Specifically, the local brightness mapping relationship between each pair of image blocks can be determined based on principles similar to those used to determine the global brightness mapping relationship. That is, when executing step 101b5, the specific steps can be referred to above as step 101a5 and are not further described here.
[0097] In one embodiment, performing brightness adjustment on each original image block in the original image based on the global brightness mapping relationship and each local brightness mapping relationship in step 102 may include: performing the following steps for each pair of image blocks: determining a brightness mapping change rate of the local brightness mapping relationship of the pair of image blocks, where the brightness mapping change rate indicates the slope of a local brightness mapping curve corresponding to the local brightness mapping relationship; determining whether the brightness mapping change rate meets the local mapping condition; if so, performing brightness adjustment on the original image blocks in the pair of image blocks based on the local brightness mapping relationship corresponding to the pair of image blocks; otherwise, performing brightness adjustment on the original image blocks in the pair of image blocks based on the global brightness mapping relationship.
[0098] In one embodiment, determining the brightness mapping change rate of the local brightness mapping relationship of a pair of image blocks may include: the local brightness mapping relationship may be represented as a local brightness mapping curve. The horizontal coordinate of the local brightness mapping curve is the grayscale value in the original image block (i.e., the original image grayscale value), and the vertical coordinate is the grayscale value in the reference image block (i.e., the reference image grayscale value). The coordinate point in the local brightness mapping curve is (original image grayscale value, reference image grayscale value). Then, according to the order of the coordinate points in the local brightness mapping curve, the slope corresponding to each n coordinate points, i.e., the brightness mapping change rate, is determined.
[0099] Where n represents the number of set intervals, which is a positive integer. That is, the step size is set to n, and the slope of the local brightness mapping curve for each step size is obtained.
[0100] In practical applications, the value of n can be set according to the actual application scenario, for example, n can be 5, which is not limited here. The number of brightness mapping change rates is multiple.
[0101] The following formula can be used to determine the brightness mapping change rate k:
[0102] k=(x2 n1 -x2 n2 ) / (x1 n1 -x1 n2 );
[0103] Among them, k is the brightness mapping change rate, (x1 n1 , x2 n1 ) represents the n1th coordinate point in the local brightness mapping curve, (x1 n2 , x2 n2 ) represents the n2th coordinate point in the local brightness mapping curve, x1 n1 and x1 n2 Both are original image grayscale values, x2 n1 and x2 n2 are the grayscale values of the reference image. n2-n1 is the number of set intervals n.
[0104] In one embodiment, if there are multiple brightness mapping change rates, determining whether the brightness mapping change rate meets the local mapping condition may include: if each brightness mapping change rate is less than a change rate threshold, determining that the brightness mapping change rate meets the local mapping condition; if there is a brightness mapping change rate among the brightness mapping change rates that is not less than the change rate threshold, determining that the brightness mapping change rate does not meet the local mapping condition.
[0105] Specifically, the local mapping condition and the change rate threshold can be set according to actual application scenarios and are not limited here.
[0106] Furthermore, whether the brightness mapping change rate meets the local mapping condition may be determined according to the number of brightness mapping change rates that are not less than the change rate threshold.
[0107] For example, if the brightness mapping change rates not less than the change rate threshold among the brightness mapping change rates are greater than a set number, it is determined that the brightness mapping change rate does not meet the local mapping condition; otherwise, it is determined that the brightness mapping change rate meets the local mapping condition.
[0108] In actual applications, the set quantity can be set according to the actual application scenario and is not limited here.
[0109] Furthermore, whether the brightness mapping change rate meets the local mapping condition may be determined based on the mean or mean square error of the brightness mapping change rate, and no limitation is imposed thereon.
[0110] For example, if the mean or mean square error of each brightness mapping change rate is less than the brightness mapping change rate of the change rate threshold, it is determined that the brightness mapping change rate meets the local mapping condition; otherwise, it is determined that the brightness mapping change rate meets the local mapping condition.
[0111] In one embodiment, brightness adjustment is performed on an original image block in a pair of image blocks based on a local brightness mapping relationship corresponding to a pair of image blocks, which may include: obtaining a target image grayscale value corresponding to each original image grayscale value based on the local brightness mapping relationship corresponding to the pair of image blocks and the original image grayscale value of each pixel in the original image block in the pair of image blocks, and adjusting the original image grayscale value of each pixel to the corresponding target image grayscale value.
[0112] In one embodiment, brightness adjustment is performed on an original image block in a pair of image blocks according to a global brightness mapping relationship, which may include: obtaining a target image grayscale value corresponding to each original image grayscale value according to the global brightness mapping relationship corresponding to the pair of image blocks and the original image grayscale value of each pixel point in the original image block in the pair of image blocks, and adjusting the original image grayscale value of each pixel point to the corresponding target image grayscale value.
[0113] This is because after the image is divided into blocks, the number of samples (i.e., the number of pixels) in the image blocks is small. When performing brightness mapping statistics on the image blocks, abnormal mutations may occur, that is, within a very small range, the local brightness mapping curve has a large jump. Therefore, in an embodiment of the present application, the global brightness mapping relationship and the local brightness mapping relationship are combined. For image blocks with abnormal mutations, the global brightness mapping relationship is used to perform image adjustment. For image blocks without abnormal mutations, the local brightness mapping relationship is used to perform image adjustment. This can solve the abnormal problem caused by the small number of samples in the image blocks and eliminate the negative gain problem in the brightness consistency adjustment based on the image blocks.
[0114] In one embodiment, performing step 103 to generate an adjusted original image based on the adjusted original image blocks may include the following steps:
[0115] S1031: Determine overlapping areas of adjacent original image blocks in the original image.
[0116] Specifically, there are overlapping image areas between adjacent original image blocks, ie, overlapping areas.
[0117] S1032: For a target pixel point in the overlapping area of the original image, select a plurality of target image blocks containing the target pixel point from the adjusted original image blocks, where the target pixel point is any pixel point in the overlapping area.
[0118] This is because the target pixel in the overlapping region is included in at least two target image blocks. Each pixel in the overlapping region is covered by at least two original image blocks, which can be two, three, or four. The number of original image blocks covering the same pixel can be set based on the actual application scenario and is not limited here.
[0119] S1033: Determine the grayscale value and weight of the target pixel in each target image block, where the weight is determined based on the grayscale value of the target pixel in each target image block after adjustment or the distance between the target pixel and the center point of each target image block.
[0120] In one embodiment, the weight of the target pixel in each target image block is determined according to the grayscale value of the target pixel in each target image block after adjustment, wherein the weight is positively correlated with the grayscale value.
[0121] In one embodiment, the distances between the target pixel and the center point of each target image block are determined, and the weight of the target pixel in each target image block is determined based on the distances, wherein the weight is negatively correlated with the distance.
[0122] As an example, the weight of the target pixel in the target image block i can be:
[0123] wi=(1 / hi) / (1 / h1+1 / h2…+1 / hi…1 / hm);
[0124] Where hi is the distance between the target pixel and the target image block i, and m is the total number of target image blocks.
[0125] In practical applications, the method for determining the distance between a pixel and each original image block can be set according to the actual application scenario and is not limited here. Furthermore, the original image blocks can also be omitted from the filter. This is because the grayscale value of the target pixel in the original image block that does not cover the target pixel is zero. Therefore, even if the original image blocks are not filtered, it will not affect the subsequent weighted summation of the grayscale values.
[0126] S1034: Perform weighted summation on the grayscale values of the target pixel points.
[0127] Specifically, when performing weighted summation on the grayscale values of the target pixel, the following formula can be used:
[0128] Q=q1*w1+q2*w2……qi*wi;
[0129] Among them, Q is the weighted sum of the grayscale values of the target pixel, qi is the grayscale value of the target pixel in the i-th adjusted target image block, and wi is the weight of the target pixel in the i-th adjusted target image block.
[0130] S1035: According to the weighted summation result, adjust the grayscale value of the target pixel point in each target image block to obtain an adjusted target image block; combine the adjusted target image blocks to obtain an adjusted original image.
[0131] Specifically, the grayscale value of the aforementioned pixel is adjusted to the weighted summation result. It should be noted that since the target pixel is any pixel in the original image, after the adjustment of each target image block containing the target pixel is completed, all the original image blocks are adjusted again, and then the adjusted target image blocks are combined to obtain the adjusted original image, that is, all the original image blocks that have been adjusted again are combined to obtain the adjusted original image. In particular, when combining image blocks, adjacent image blocks are overlapped and spliced according to the overlapping areas in the adjacent image blocks to obtain the adjusted original image.
[0132] This is because the image obtained by directly splicing the adjusted original image blocks will have a blocking effect problem, that is, there will be discontinuities at the boundaries of the original image blocks, which makes the image obtained by splicing have obvious defects. Therefore, in the embodiment of the present application, the grayscale value of the pixel point in the overlapping area is adjusted according to the grayscale value of the pixel point in multiple original image blocks, thereby avoiding the unnatural transition phenomenon at the image block boundary and eliminating the blocking effect problem.
[0133] The following uses a specific application scenario to further illustrate the above embodiment. Figure 2 FIG. 1 is a flowchart of a specific implementation of a method for adjusting image brightness provided by an embodiment of the present application. The specific implementation process of the method is as follows:
[0134] Step 200: Receive a brightness consistency adjustment request for an original image and a reference image.
[0135] Step 201: Based on the grayscale value of each pixel in the original image and the grayscale value of each pixel in the reference image, generate image histograms of the original image and the reference image respectively.
[0136] Step 202: Generate a global CDF curve of the original image based on the image histogram of the original image, and generate a global CDF curve of the reference image based on the image histogram of the reference image.
[0137] Step 203: Generate a global LUT table according to the global CDF curve of the original image and the global CDF curve of the reference image.
[0138] Step 204: Based on the overlap concept, the original image and the reference image are divided into blocks to obtain multiple pairs of image blocks.
[0139] Step 205: Determine the local LUT table corresponding to each pair of image blocks.
[0140] Step 206: Determine the brightness mapping change rate of the local brightness mapping relationship of each pair of image blocks.
[0141] Step 207: For each pair of image blocks, if the brightness mapping change rate of the pair of image blocks meets the local mapping condition, brightness adjustment is performed based on the local LUT table of the pair of image blocks; otherwise, brightness adjustment is performed based on the global LUT table.
[0142] Step 208: performing weighted summation on the grayscale value and weight of each pixel in the overlapping area of the original image in each adjusted original image block.
[0143] Step 209: According to the weighted summation result of each pixel point, the grayscale value of the corresponding pixel point in the original image is adjusted to obtain an adjusted original image.
[0144] In the traditional method, brightness consistency adjustment is usually performed based on the entire image. However, this cannot highlight the local image distribution characteristics. When there is a large area of local overexposure or a large area of local black in the image, the traditional brightness consistency adjustment method will adjust these overexposed or black areas to gray, making the brightness consistency of the local area, highlight area and dark area of the image poor. In the embodiment of the present application, based on the idea of adjusting brightness consistency by image block, the brightness consistency of the local area, highlight area and dark area of the image is improved. Furthermore, the global brightness mapping relationship and the local brightness mapping relationship are combined. For image blocks with abnormal mutations, the global brightness mapping relationship is used for image adjustment. For image blocks without abnormal mutations, the local brightness mapping relationship is used for image adjustment. This can solve the abnormal problem caused by the small number of samples in the image block and eliminate the negative gain problem of brightness consistency adjustment based on the image block. Furthermore, the grayscale value of the pixel in the overlapping area of the image block boundary is adjusted by the grayscale value of the pixel in multiple original image blocks and the distance between the pixel and each original image block, thereby avoiding the unnatural transition phenomenon of the image block boundary and eliminating the block effect problem.
[0145] Based on the same inventive concept, an apparatus for adjusting image brightness is also provided in an embodiment of the present application. Since the principle of solving the problem by the above-mentioned apparatus and device is similar to that of an image brightness adjustment method, the implementation of the above-mentioned apparatus can refer to the implementation of the method, and the repeated parts will not be repeated.
[0146] like Figure 3 , which is a structural diagram of a device for adjusting image brightness provided by an embodiment of the present application, including:
[0147] A determination unit 301 is configured to determine a global brightness mapping relationship between the original image and the reference image based on the grayscale value of each pixel in the original image to be processed and the grayscale value of each pixel in the reference image, and to determine local brightness mapping relationships corresponding to each of multiple pairs of image blocks in the original image and the reference image, wherein the global brightness mapping relationship is configured to indicate a grayscale value conversion relationship between pixels in the original image and pixels at corresponding positions in the reference image, and the local brightness mapping relationship for each pair of image blocks is configured to indicate a grayscale value conversion relationship between pixels in the original image block in each pair of image blocks and pixels at corresponding positions in the reference image in each pair of image blocks; an adjustment unit 302 is configured to perform brightness adjustment on each original image block in the original image according to the global brightness mapping relationship and the local brightness mapping relationships; and a generation unit 303 is configured to generate an adjusted original image based on each adjusted original image block.
[0148] In one embodiment, the determination unit 301 is used to: determine the pixel probability of each grayscale value in the original image based on the grayscale value of each pixel in the original image, and the pixel probability of each grayscale value is determined based on the proportion of the number of pixels of each grayscale value to the total number of all pixels in the original image; obtain the probability cumulative distribution function of the original image based on the pixel probability of each grayscale value in the original image, and the probability cumulative distribution function is used to indicate the cumulative distribution of the pixel probability of each grayscale value in the image; determine the pixel probability of each grayscale value in the reference image based on the grayscale value of each pixel in the reference image; obtain the probability cumulative distribution function of the reference image based on the pixel probability of each grayscale value in the reference image; determine the global brightness mapping relationship based on the probability cumulative distribution function of the original image and the probability cumulative distribution function of the reference image.
[0149] In one embodiment, the determination unit 301 is used to: perform the following steps for each pair of image blocks: determine the pixel probability of each grayscale value in the original image block based on the grayscale value of each pixel in the original image block in the pair of image blocks; obtain the probability cumulative distribution function of the original image block based on the pixel probability of each grayscale value in the original image block, and the probability cumulative distribution function is used to indicate the cumulative distribution of the pixel probability of each grayscale value in the image; determine the pixel probability of each grayscale value in the reference image block based on the grayscale value of each pixel in the reference image block in the pair of image blocks; obtain the probability cumulative distribution function of the reference image block based on the pixel probability of each grayscale value in the reference image block; and determine the local brightness mapping relationship of the pair of image blocks based on the probability cumulative distribution function of the original image block and the probability cumulative distribution function of the reference image block.
[0150] In one embodiment, the adjustment unit 302 is used to: perform the following steps for each pair of image blocks: determine the brightness mapping change rate of the local brightness mapping relationship of the pair of image blocks, where the brightness mapping change rate is used to indicate the slope of the local brightness mapping curve corresponding to the local brightness mapping relationship; determine whether the brightness mapping change rate meets the local mapping condition; if so, perform brightness adjustment on the original image blocks in the pair of image blocks according to the local brightness mapping relationship corresponding to the pair of image blocks; otherwise, perform brightness adjustment on the original image blocks in the pair of image blocks according to the global brightness mapping relationship.
[0151] In one embodiment, there are multiple brightness mapping change rates, and the adjustment unit 302 is configured to: if each brightness mapping change rate is less than a change rate threshold, determine that the brightness mapping change rate meets the local mapping condition.
[0152] In one embodiment, the generation unit 303 is used to: determine the overlapping area of adjacent original image blocks in the original image, where the original image blocks are divided from the original image according to a target size, and the target size is the size of the overlapping area between adjacent image blocks; for the target pixel points in the overlapping area of the original image, filter out multiple target image blocks containing the target pixel points from the adjusted original image blocks, where the target pixel point is any pixel point in the overlapping area; determine the grayscale value and weight of the target pixel point in each target image block; perform weighted summation on the grayscale values of the target pixel points; adjust the grayscale value of the target pixel point in each target image block according to the weighted summation result to obtain the adjusted target image block; and combine the adjusted target image blocks to obtain the adjusted original image.
[0153] In one embodiment, the generation unit 303 is used to: determine the weight of the target pixel point in each target image block based on the grayscale value of the target pixel point in each adjusted target image block; or determine the weight of the target pixel point in each target image block based on the distance between the target pixel point and the center point of each target image block.
[0154] In the method, computer program product, electronic device, and medium for image brightness adjustment provided by the embodiments of the present application, a global brightness mapping relationship between the original image and the reference image is determined based on the grayscale value of each pixel in the original image to be processed and the grayscale value of each pixel in the reference image, as well as a local brightness mapping relationship corresponding to each of multiple pairs of image blocks in the original image and the reference image. The global brightness mapping relationship is used to indicate the grayscale value conversion relationship between the pixel points in the original image and the pixel points at corresponding positions in the reference image. Based on the global brightness mapping relationship and the local brightness mapping relationships, brightness adjustment is performed on each original image block in the original image; and based on the adjusted original image blocks, an adjusted original image is generated. In this way, brightness consistency between different images is improved.
[0155] Figure 4 FIG. 4 shows a schematic structural diagram of an electronic device 4000. Figure 4 As shown, the electronic device 4000 includes: a processor 4010 and a memory 4020, and optionally, may also include a power supply 4030, a display unit 4040, and an input unit 4050.
[0156] The processor 4010 is the control center of the electronic device 4000. It uses various interfaces and lines to connect various components, and performs various functions of the electronic device 4000 by running or executing software programs and / or data stored in the memory 4020, thereby monitoring the electronic device 4000 as a whole.
[0157] In the embodiment of the present application, the processor 4010 executes the various steps in the above embodiment when calling the computer program stored in the memory 4020.
[0158] Optionally, processor 4010 may include one or more processing units. Preferably, processor 4010 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and applications, and the modem processor primarily processes wireless communications. It is understood that the modem processor may not be integrated into processor 4010. In some embodiments, the processor and memory may be implemented on a single chip. In some embodiments, they may also be implemented on separate chips.
[0159] The memory 4020 may mainly include a program storage area and a data storage area. The program storage area may store an operating system, various applications, etc., and the data storage area may store data created based on the use of the electronic device 4000. In addition, the memory 4020 may include a high-speed random access memory and a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0160] The electronic device 4000 also includes a power supply 4030 (such as a battery) for supplying power to various components. The power supply can be logically connected to the processor 4010 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.
[0161] The display unit 4040 can be used to display information input by the user or information provided to the user, as well as various menus of the electronic device 4000. In the embodiment of the present invention, it is mainly used to display the display interface of each application in the electronic device 4000 and objects such as text and pictures displayed on the display interface. The display unit 4040 may include a display panel 4041. The display panel 4041 can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.
[0162] The input unit 4050 can be used to receive information such as numbers or characters input by the user. The input unit 4050 may include a touch panel 4051 and other input devices 4052. The touch panel 4051, also known as a touch screen, can receive user touch operations on or near it (for example, operations performed by the user using a finger, a stylus, or any other suitable object or accessory on or near the touch panel 4051).
[0163] Specifically, the touch panel 4051 can detect user touch operations and the signals generated by the touch operations, convert these signals into touch point coordinates, send them to the processor 4010, and receive and execute commands sent by the processor 4010. In addition, the touch panel 4051 can be implemented using various types, such as resistive, capacitive, infrared, and surface acoustic wave. Other input devices 4052 can include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, a joystick, etc.
[0164] Of course, the touch panel 4051 can cover the display panel 4041. When the touch panel 4051 detects a touch operation on or near it, it transmits it to the processor 4010 to determine the type of touch event. Then the processor 4010 provides corresponding visual output on the display panel 4041 according to the type of touch event. Figure 4 In the embodiment, the touch panel 4051 and the display panel 4041 are two independent components to realize the input and output functions of the electronic device 4000, but in some embodiments, the touch panel 4051 and the display panel 4041 can be integrated to realize the input and output functions of the electronic device 4000.
[0165] The electronic device 4000 may also include one or more sensors, such as a pressure sensor, a gravity acceleration sensor, a proximity light sensor, etc. Of course, according to the needs of specific applications, the electronic device 4000 may also include other components such as a camera. Since these components are not the key components used in the embodiments of this application, Figure 4 It is not shown and will not be described in detail.
[0166] Those skilled in the art will understand that Figure 4 The electronic device is merely an example and does not limit the electronic device. The electronic device may include more or fewer components than shown in the figure, or may include a combination of certain components or different components.
[0167] In an embodiment of the present application, a computer-readable storage medium stores computer program instructions. When the computer program instructions are read and executed by a processor, the steps in the above embodiment are executed.
[0168] In an embodiment of the present application, a computer program product includes computer program instructions. When the computer program instructions are read and executed by a processor, the steps in the above embodiment are executed.
[0169] For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing this application, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.
[0170] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0171] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0172] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0173] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0174] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.
[0175] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.
Claims
1. A method for adjusting image brightness, characterized in that: include: Based on the grayscale value of each pixel in the original image to be processed and the grayscale value of each pixel in the reference image, determining a global brightness mapping relationship between the original image and the reference image, and determining local brightness mapping relationships corresponding to each of a plurality of pairs of image blocks in the original image and the reference image, the global brightness mapping relationship being used to indicate a grayscale value conversion relationship between pixels in the original image and pixels at corresponding positions in the reference image, and the local brightness mapping relationship for each pair of image blocks being used to indicate a grayscale value conversion relationship between pixels in the original image block in each pair of image blocks and pixels at corresponding positions in the reference image in each pair of image blocks; performing brightness adjustment on each original image block in the original image according to the global brightness mapping relationship and the local brightness mapping relationships; generating an adjusted original image based on the adjusted original image blocks; The step of adjusting the brightness of each original image block in the original image according to the global brightness mapping relationship and the local brightness mapping relationships includes: For each pair of image patches, perform the following steps: Determining a brightness mapping change rate of a local brightness mapping relationship between a pair of image blocks, where the brightness mapping change rate is used to indicate a slope of a local brightness mapping curve corresponding to the local brightness mapping relationship; determining whether the brightness mapping change rate meets a local mapping condition, and if so, adjusting the brightness of an original image block in the pair of image blocks according to a local brightness mapping relationship corresponding to the pair of image blocks; Otherwise, brightness adjustment is performed on the original image block in the pair of image blocks according to the global brightness mapping relationship.
2. The method according to claim 1, wherein The determining of a global brightness mapping relationship between the original image and the reference image based on the grayscale value of each pixel in the original image to be processed and the grayscale value of each pixel in the reference image includes: Based on the grayscale value of each pixel in the original image, respectively determine the pixel probability of each grayscale value in the original image, where the pixel probability of each grayscale value is determined based on the proportion of the number of pixels of each grayscale value in the total number of all pixels in the original image; Obtaining a probability cumulative distribution function of the original image based on pixel probabilities of each grayscale value in the original image, wherein the probability cumulative distribution function is used to indicate the cumulative distribution of pixel probabilities of each grayscale value in the image; Determining pixel probabilities of each grayscale value in the reference image based on the grayscale value of each pixel in the reference image; Obtaining a probability cumulative distribution function of the reference image according to the pixel probability of each grayscale value in the reference image; The global brightness mapping relationship is determined according to the probability cumulative distribution function of the original image and the probability cumulative distribution function of the reference image.
3. The method according to claim 1 or 2, wherein: The determining of the local brightness mapping relationship between the plurality of pairs of image blocks in the original image and the reference image includes: For each pair of image patches, perform the following steps: Determining pixel probabilities of each grayscale value in the original image block based on the grayscale value of each pixel in the original image block in the pair of image blocks; Obtaining a probability cumulative distribution function of the original image block according to pixel probabilities of each grayscale value in the original image block, wherein the probability cumulative distribution function is used to indicate the cumulative distribution of pixel probabilities of each grayscale value in the image; Determining, based on the grayscale value of each pixel in the reference image block in the pair of image blocks, a probability of a pixel of each grayscale value in the reference image block; Obtaining a probability cumulative distribution function of the reference image block according to pixel probabilities of each grayscale value in the reference image block; The local brightness mapping relationship between the pair of image blocks is determined according to the probability cumulative distribution function of the original image block and the probability cumulative distribution function of the reference image block.
4. The method according to claim 1, wherein The brightness mapping change rate is multiple, and determining whether the brightness mapping change rate meets the local mapping condition includes: If the brightness mapping change rates are all less than the change rate threshold, it is determined that the brightness mapping change rates meet the local mapping condition.
5. The method according to any one of claims 1 to 4, characterized in that The step of generating an adjusted original image based on the adjusted original image blocks includes: determining an overlapping area of adjacent original image blocks in the original image, the original image blocks being divided from the original image according to a target size, where the target size is a size of an overlapping area between adjacent image blocks; For a target pixel point in the overlapping area of the original image, screening out a plurality of target image blocks containing the target pixel point from each adjusted original image block, wherein the target pixel point is any pixel point in the overlapping area; Determining the grayscale value and weight of the target pixel in each target image block; Performing weighted summation on the grayscale values of the target pixel points; Adjusting the grayscale value of the target pixel in each target image block according to the weighted summation result to obtain an adjusted target image block; The adjusted target image blocks are combined to obtain the adjusted original image.
6. The method according to claim 5, wherein Determining the weight of the target pixel point in each target image block includes: Determining the weight of the target pixel in each target image block according to the grayscale value of the target pixel in each target image block after adjustment; Alternatively, the weight of the target pixel point in each target image block is determined respectively according to the distance between the target pixel point and the center point of each target image block.
7. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores computer program instructions, and when the computer program instructions are read and executed by the processor, the method according to any one of claims 1 to 6 is executed.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the method according to any one of claims 1 to 6 is executed.
9. A computer program product, characterized in that The method comprises computer program instructions, and when the computer program instructions are read and executed by a processor, the method according to any one of claims 1 to 6 is executed.
Citation Information
Patent Citations
Image enhancement method based on wide dynamic range and electronic equipment
CN112150399A