Image display method, device, electronic equipment and program product
By correcting the average grayscale value of the image and analyzing the brightness response characteristics of the display screen, adjusting the grayscale value of the image pixel points, the problem of unbalanced brightness in high-illumination and low-illumination scenes is solved, and the recognition and display effect of the image are improved .
Patent Information
- Application Number
- CN202410881634.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-07-02
AI Technical Summary
The prior art is difficult to equalize image brightness in high and low illumination scenarios, resulting in the image being darker or brighter, and the details in the image cannot be effectively recognized.
By obtaining the average grayscale value of the target image, if it does not fall into the preset grayscale range, the grayscale correction value is obtained, and the compensation value is determined based on the brightness response characteristics of the display screen, and the grayscale value of the image pixel points is adjusted. , achieve brightness balance.
The image brightness balance is achieved in high-illumination and low-illumination scenes, the image recognition is improved, and the brightness response characteristics of the display screen is taken into account. The adjusted image display effect is more in line with the characteristics of the display screen.
Smart Images

Figure CN118413640B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image display method, device, electronic equipment and program product. Background Art
[0002] In image acquisition applications, night vision, backlight, strong light and other conditions often occur, resulting in dark or bright images with low recognizability. Images need to be processed to improve image quality so that details in unrecognizable images can be recognized by users or machines.
[0003] Common image processing is to process low-light images, and enhance the brightness of low-light images (night vision, backlight and other scenes) through brightness transformation method, homomorphic filtering method, gradient domain enhancement method and Retinex enhancement method, but the above methods cannot make the brightness in highlight images more balanced.
[0004] Therefore, a method for adjusting the brightness of an image in high-illuminance and low-illuminance scenes is needed to balance the brightness of the image and make the details in the image easier to identify. Summary of the invention
[0005] The present application provides an image display method, device, electronic device and program product for adjusting the brightness of an image in high-illuminance and low-illuminance scenes to balance the image brightness.
[0006] In order to achieve the above technical objectives, this application adopts the following technical solutions:
[0007] In a first aspect, an embodiment of the present application provides an image display method, the method comprising:
[0008] Acquire a target image, and determine an average grayscale value of the target image based on the original grayscale value of each pixel in the target image;
[0009] If the average grayscale value does not fall within the preset grayscale range, the average grayscale value is corrected to obtain a grayscale correction value; if the average grayscale value is greater than the upper limit of the preset grayscale range, the grayscale correction value is less than or equal to the upper limit of the preset grayscale range; or, if the average grayscale value is less than the lower limit of the preset grayscale range, the grayscale correction value is greater than or equal to the lower limit of the preset grayscale range;
[0010] Determine a target compensation value based on the grayscale correction value and the corresponding brightness response characteristics of the display screen;
[0011] Based on the target compensation value, the original grayscale value of each pixel in the target image is adjusted to obtain the target grayscale value corresponding to each pixel, and the target image is displayed on the display screen according to the target grayscale value corresponding to each pixel.
[0012] The technical solution provided by the present application brings at least the following beneficial effects: by correcting the average grayscale value of the target image that does not fall within the preset grayscale range, after obtaining the grayscale correction value, based on the grayscale correction value and the brightness response characteristics corresponding to the display screen, the target compensation value is determined, and then based on the target compensation value, the original grayscale value of each pixel in the target image is adjusted to obtain the target grayscale value corresponding to each pixel. Since the grayscale correction value after correction of the average grayscale value greater than the upper limit value of the preset grayscale range is less than or equal to the upper limit value of the preset grayscale range, the target grayscale value corresponding to each pixel will be less than its original grayscale value, thus achieving the reduction of the brightness of the high-illuminance image, and since the grayscale correction value after correction of the average grayscale value less than the lower limit value of the preset grayscale range is greater than or equal to the lower limit value of the preset grayscale range, the target grayscale value corresponding to each pixel will be greater than its original grayscale value, thus achieving the enhancement of the brightness of the low-illuminance image. Therefore, the method provided in the present application can adjust the brightness of the image in high-illuminance scenes, and can also adjust the brightness of the image in low-illuminance scenes. The image brightness is more balanced, and the details in the image are easier to identify. In addition, the brightness response characteristics corresponding to the display screen are taken into account when calculating the target compensation value. The image after brightness adjustment is displayed on the display screen and is more in line with the display effect of the display screen.
[0013] In one possible implementation, if the average grayscale value does not fall within a preset grayscale range, the average grayscale value is corrected to obtain a grayscale correction value, including: if the average grayscale value is less than a first grayscale threshold or the average grayscale value is greater than a second grayscale threshold, determining the preset grayscale value as the grayscale correction value obtained after correcting the average grayscale value, the first grayscale threshold is less than the lower limit of the preset grayscale range, and the second grayscale threshold is greater than the upper limit of the preset grayscale range; or, if the average grayscale value is greater than or equal to the first grayscale threshold, and the average grayscale value is less than the lower limit of the preset grayscale range, determining the lower limit of the preset grayscale range as the grayscale correction value obtained after correcting the average grayscale value; or, if the average grayscale value is less than or equal to the second grayscale threshold, and the average grayscale value is greater than the upper limit of the preset grayscale range, determining the upper limit of the preset grayscale range as the grayscale correction value obtained after correcting the average grayscale value.
[0014] In a possible implementation, the method also includes: counting the pixel probability corresponding to each grayscale interval in multiple grayscale intervals, the pixel probability is used to characterize the ratio between the number of pixel points in the target image whose original grayscale value falls within the grayscale interval and the total number of pixel points in the target image; if the average grayscale value does not fall within the preset grayscale range, correcting the average grayscale value to obtain a grayscale correction value, including: if the pixel probabilities corresponding to all grayscale intervals fall within the preset probability range, and the average grayscale value does not fall within the preset grayscale range, correcting the average grayscale value to obtain a grayscale correction value.
[0015] In a possible implementation, the method further includes: if the pixel probability corresponding to any grayscale interval does not fall within a preset probability range, determining a preset grayscale value as a grayscale correction value of the average grayscale value.
[0016] In one possible implementation, a target compensation value is determined based on a grayscale correction value and a brightness response characteristic corresponding to a display screen, including: determining an average brightness corresponding to the display screen through the brightness response characteristic of the display screen; and determining a target compensation value based on the grayscale correction value and the average brightness.
[0017] In one possible implementation, the average brightness corresponding to the display screen is determined by the brightness response characteristics of the display screen, including: determining a brightness coefficient based on the brightness response characteristics of the display screen; determining the brightness output of the display screen corresponding to each grayscale value input to the display screen based on the brightness response characteristics and the brightness coefficient; determining the average value of the brightness output of the display screen corresponding to each grayscale value input to the display screen as the average brightness corresponding to the display screen; determining a target compensation value based on a grayscale correction value and the average brightness, including: obtaining a reference average grayscale value and a reference average brightness of the display screen under a standard brightness response characteristic; determining an actual reference average grayscale value of the display screen based on the reference average grayscale value, the reference average brightness and the average brightness; and determining a target compensation value based on the grayscale correction value and the actual reference average grayscale value of the display screen.
[0018] In a possible implementation, when the target compensation value is not 1, the original grayscale value of each pixel in the target image is adjusted based on the target compensation value to obtain the target grayscale value corresponding to each pixel, including: when the difference between the first compensation value and the target compensation value is greater than the upper limit of the preset difference range, based on the difference between the first compensation value and the preset compensation variable, the original grayscale value of each pixel in the target image is adjusted to obtain the target grayscale value corresponding to each pixel; or, when the difference between the first compensation value and the target compensation value is less than the lower limit of the preset difference range, based on the sum of the first compensation value and the preset compensation variable, the original grayscale value of each pixel in the target image is adjusted to obtain the target grayscale value corresponding to each pixel; or, when the difference between the first compensation value and the target compensation value is within the preset difference range, the original grayscale value of each pixel in the target image is adjusted based on the target compensation value to obtain the target grayscale value corresponding to each pixel.
[0019] In a second aspect, the present application provides an image display device, comprising:
[0020] A transmission module, used for acquiring a target image;
[0021] A processing module, used for determining an average grayscale value of the target image based on the original grayscale value of each pixel in the target image;
[0022] The processing module is further configured to correct the average grayscale value to obtain a grayscale correction value if the average grayscale value does not fall within the preset grayscale range; if the average grayscale value is greater than the upper limit of the preset grayscale range, the grayscale correction value is less than or equal to the upper limit of the preset grayscale range; or if the average grayscale value is less than the lower limit of the preset grayscale range, the grayscale correction value is greater than or equal to the lower limit of the preset grayscale range;
[0023] The processing module is also used to determine a target compensation value based on the grayscale correction value and the brightness response characteristics corresponding to the display screen;
[0024] The processing module is also used to adjust the original grayscale value of each pixel in the target image based on the target compensation value to obtain the target grayscale value corresponding to each pixel;
[0025] The display module is used to display the target image on the display screen according to the target grayscale value corresponding to each pixel point.
[0026] In one possible implementation, the processing module is specifically used to: if the average grayscale value is less than a first grayscale threshold or the average grayscale value is greater than a second grayscale threshold, determine the preset grayscale value as a grayscale correction value obtained after correcting the average grayscale value, the first grayscale threshold is less than a lower limit value of a preset grayscale range, and the second grayscale threshold is greater than an upper limit value of the preset grayscale range; or, if the average grayscale value is greater than or equal to the first grayscale threshold, and the average grayscale value is less than the lower limit value of the preset grayscale range, determine the lower limit value of the preset grayscale range as the grayscale correction value obtained after correcting the average grayscale value; or, if the average grayscale value is less than or equal to the second grayscale threshold, and the average grayscale value is greater than the upper limit value of the preset grayscale range, determine the upper limit value of the preset grayscale range as the grayscale correction value obtained after correcting the average grayscale value.
[0027] In a possible implementation, the processing module is also used to count the pixel probability corresponding to each grayscale interval in multiple grayscale intervals, and the pixel probability is used to characterize the ratio between the number of pixel points in the target image whose original grayscale values fall within the grayscale interval and the total number of pixel points in the target image; the processing module is specifically used to correct the average grayscale value to obtain a grayscale correction value if the pixel probabilities corresponding to all grayscale intervals fall within a preset probability range and the average grayscale value does not fall within the preset grayscale range.
[0028] In a possible implementation, the processing module is further configured to determine a preset grayscale value as a grayscale correction value of the average grayscale value if the pixel probability corresponding to any grayscale interval does not fall within a preset probability range.
[0029] In a possible implementation, the processing module is specifically used to: determine the average brightness corresponding to the display screen through the brightness response characteristics of the display screen; and determine the target compensation value based on the grayscale correction value and the average brightness.
[0030] In one possible implementation, the processing module is specifically used to: determine the brightness coefficient based on the brightness response characteristics of the display screen; determine the brightness output of the display screen corresponding to each grayscale value input to the display screen based on the brightness response characteristics and the brightness coefficient; determine the average value of the brightness output of the display screen corresponding to each grayscale value input to the display screen as the average brightness corresponding to the display screen; the acquisition module is also used to obtain the reference average grayscale value and reference average brightness of the display screen under the standard brightness response characteristics; the processing module is specifically used to: determine the actual reference average grayscale value of the display screen based on the reference average grayscale value, the reference average brightness and the average brightness; determine the target compensation value based on the grayscale correction value and the actual reference average grayscale value of the display screen.
[0031] In a possible implementation, the transmission module is also used to obtain a first compensation value corresponding to the previous frame of the target image; the processing module is specifically used to: when the difference between the first compensation value and the target compensation value is greater than the upper limit of the preset difference range, based on the difference between the first compensation value and the preset compensation variable, adjust the original grayscale value of each pixel in the target image to obtain the target grayscale value corresponding to each pixel; or, when the difference between the first compensation value and the target compensation value is less than the lower limit of the preset difference range, based on the sum of the first compensation value and the preset compensation variable, adjust the original grayscale value of each pixel in the target image to obtain the target grayscale value corresponding to each pixel; or, when the difference between the first compensation value and the target compensation value is within the preset difference range, adjust the original grayscale value of each pixel in the target image based on the target compensation value to obtain the target grayscale value corresponding to each pixel.
[0032] In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement any one of the image display methods provided in the first aspect.
[0033] In a fourth aspect, the present application provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement any one of the image display methods provided in the first aspect above.
[0034] In a fifth aspect, the present application provides a computer program product, comprising computer instructions, which, when executed by a processor, implement any one of the image display methods provided in the first aspect.
[0035] For the specific description of the second to fifth aspects and their various implementations in the present application, reference may be made to the detailed description in the first aspect and its various implementations; and for the beneficial effects of the second to fifth aspects and their various implementations, reference may be made to the beneficial effects analysis in the first aspect and its various implementations, which will not be repeated here.
[0036] These and other aspects of the present application will become more apparent from the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A schematic diagram of the structure of an image display system applicable to an image display method provided in an embodiment of the present application;
[0038] Figure 2 A schematic diagram of the hardware composition of a computing device provided in an embodiment of the present application;
[0039] Figure 3 A flowchart of an image display method provided in an embodiment of the present application;
[0040] Figure 4 A schematic diagram of an application scenario of an image display method provided in an embodiment of the present application;
[0041] Figure 5 A logic diagram of an image display method provided in an embodiment of the present application;
[0042] Figure 6 A schematic diagram of the structure of an image display device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0044] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. The terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present application, unless otherwise specified, "multiple" means two or more.
[0045] To facilitate understanding, the basic concepts of some terms or technologies involved in the embodiments of the present application are first briefly introduced and explained.
[0046] In image acquisition applications, night vision, backlight, strong light and other conditions often occur, resulting in dark or bright images with low recognizability. Images need to be processed to improve image quality so that details in unrecognizable images can be recognized by users or machines.
[0047] Common image processing is to process low-light images, and enhance the brightness of low-light images (night vision, backlight and other scenes) through brightness transformation method, homomorphic filtering method, gradient domain enhancement method and Retinex enhancement method, but the above methods cannot make the brightness in highlight images more balanced.
[0048] Therefore, a method for adjusting the brightness of an image in high-illuminance and low-illuminance scenes is needed to balance the brightness of the image and make the details in the image easier to identify.
[0049] In this regard, an embodiment of the present application provides an image display method, which corrects the average grayscale value of the target image that does not fall within the preset grayscale range, obtains the grayscale correction value, and then determines the target compensation value based on the grayscale correction value and the brightness response characteristics corresponding to the display screen, and then adjusts the original grayscale value of each pixel in the target image based on the target compensation value to obtain the target grayscale value corresponding to each pixel. Since the grayscale correction value after correction of the average grayscale value greater than the upper limit of the preset grayscale range is less than or equal to the upper limit of the preset grayscale range, the target grayscale value corresponding to each pixel will be less than its original grayscale value, thus achieving the reduction of the brightness of the high-illuminance image, and since the grayscale correction value after correction of the average grayscale value less than the lower limit of the preset grayscale range is greater than or equal to the lower limit of the preset grayscale range, the target grayscale value corresponding to each pixel will be greater than its original grayscale value, thus achieving the enhancement of the brightness of the low-illuminance image. Therefore, the method provided in the present application can adjust the brightness of the image in high-illuminance scenes, and can also adjust the brightness of the image in low-illuminance scenes. The image brightness is more balanced, and the details in the image are easier to identify. In addition, the brightness response characteristics corresponding to the display screen are taken into account when calculating the target compensation value. The image after brightness adjustment is displayed on the display screen and is more in line with the display effect of the display screen.
[0050] Please refer to Figure 1 , which shows an image display system to which the image display method provided by the present application is applicable. Figure 1 As shown, the image display system 1 includes an image acquisition device 10 , an electronic device 20 and a display device 30 .
[0051] The electronic device 20 establishes communication connections with the image acquisition device 10 and the display device 30. It should be understood that the connection method can be a wireless connection, such as a Bluetooth connection, a wireless fidelity (Wi-Fi) connection, etc.; or the connection method can also be a wired connection, such as an optical fiber connection, etc., which is not limited.
[0052] In some embodiments, the image acquisition device 10 is used to acquire images and send the images to the electronic device 20 .
[0053] In some embodiments, the electronic device 20 is used to receive the image sent by the image acquisition device 10 and perform brightness processing on the image. The specific brightness processing process can be: determine the average grayscale value of the target image based on the original grayscale value of each pixel in the target image; if the average grayscale value does not fall into the preset grayscale range, correct the average grayscale value to obtain a grayscale correction value; when the average grayscale value is greater than the upper limit of the preset grayscale range, the grayscale correction value is less than or equal to the upper limit of the preset grayscale range; or, when the average grayscale value is less than the lower limit of the preset grayscale range, the grayscale correction value is greater than or equal to the lower limit of the preset grayscale range; determine the target compensation value based on the grayscale correction value and the brightness response characteristics corresponding to the display screen; based on the target compensation value, adjust the original grayscale value of each pixel in the target image to obtain the target grayscale value corresponding to each pixel. The electronic device 20 is also used to control the display device 30 to display the image based on the target grayscale value corresponding to each pixel.
[0054] In some embodiments, the display device 30 is used to display an image according to a target grayscale value corresponding to each pixel.
[0055] In some embodiments, the electronic device 20 and the display device 30 may be as follows: Figure 1 As shown in , there are two independent devices.
[0056] Optionally, the display device 30 and the electronic device 20 are integrated together, that is, the electronic device 20 has a display screen. After the electronic device 20 determines the target grayscale value corresponding to each pixel in the image sent by the image acquisition device 10, it displays the image on the display screen according to the target grayscale value corresponding to each pixel.
[0057] In some embodiments, the electronic device 20 may establish communication connections with multiple display devices 30 and display images on the multiple display devices 30 .
[0058] In some embodiments, the image acquisition device 10 may be a camera, a dome camera, a pan-tilt camera, etc. The embodiment of the present application does not limit the specific implementation of the image acquisition device 10.
[0059] In some embodiments, the electronic device 20 may be a device or component having the above-mentioned image processing capability, such as a computer, a central processing unit (CPU), a general-purpose processor network processor (NP), a digital signal processor (DSP), a microprocessor, a microcontroller, a programmable logic device (PLD), or any combination thereof. The electronic device 20 may also be other devices having processing functions, such as circuits, components, or software modules, and the embodiments of the present application do not impose any restrictions on this.
[0060] In some embodiments, the display device 30 may be a liquid crystal display or an organic light-emitting diode (OLED) display. The specific type, size, and resolution of the display device 30 are not specifically limited. It is understood by those skilled in the art that the display device 30 may be modified in performance and configuration as needed.
[0061] The hardware structure of the electronic device 20 includes: Figure 2 The computing device shown in FIG. Figure 2 Taking the computing device shown as an example, the hardware structure of the electronic device 20 is introduced.
[0062] like Figure 2 As shown, the computing device may include a processor 401, a memory 402, a communication interface 403, and a bus 404. The processor 401, the memory 402, and the communication interface 403 may be connected via a bus 404.
[0063] The processor 401 is the control center of the computing device, and can be a processor or a general term for multiple processing elements. For example, the processor 401 can be a general-purpose central processing unit (CPU) or other general-purpose processors. Among them, the general-purpose processor can be a microprocessor or any conventional processor.
[0064] As an embodiment, the processor 401 may include one or more CPUs, such as Figure 2 CPU 0 and CPU 1 are shown in .
[0065] The memory 402 may be a read-only memory (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, an electrically erasable programmable read-only memory (EEPROM), a disk storage medium or other magnetic storage device, 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.
[0066] In a possible implementation, the memory 402 may exist independently of the processor 401, and the memory 402 may be connected to the processor 401 via a bus 404 to store instructions or program codes. When the processor 401 calls and executes the instructions or program codes stored in the memory 402, the model deployment method provided in the embodiment of the present application can be implemented.
[0067] In another possible implementation, the memory 402 may also be integrated with the processor 401 .
[0068] The communication interface 403 is used for the computing device to connect with other devices through a communication network, which may be Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc. The communication interface 403 may include a receiving unit for receiving data and a sending unit for sending data.
[0069] The bus 404 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 2 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0070] It should be pointed out that Figure 2 The structure shown in the figure does not constitute a limitation on the computing device, except Figure 2In addition to the components shown, the computing device may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0071] The implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0072] The image display method provided in the embodiment of the present application can be executed by the above-mentioned electronic device 20.
[0073] like Figure 3 As shown, an embodiment of the present application provides an image display method, which includes the following steps:
[0074] S101, acquiring a target image, and determining an average grayscale value of the target image based on the original grayscale value of each pixel in the target image.
[0075] For example, an electronic device obtains a frame of image, first calculates the sum of the grayscale values of all pixels in the image in each of the three color channels, and then calculates the average grayscale value of the image:
[0076] ;
[0077] ;
[0078] ;
[0079] Among them, SumR represents the sum of the grayscale values of all pixels in the image in the R channel of the three color channels, SumG represents the sum of the grayscale values of all pixels in the image in the G channel of the three color channels, and SumB represents the sum of the grayscale values of all pixels in the image in the B channel of the three color channels. Represents the grayscale value of the R channel of the i-th pixel in the three color channels, Represents the grayscale value of the G channel of the i-th pixel in the three color channels, Represents the gray value of the B channel of the i-th pixel in the three color channels, then the average gray value Avr of the image is:
[0080] .
[0081] For images with different color depths, the range of the average grayscale value of the image is also different. For example, for an image with 8-bit color depth, the range of its average grayscale value is 0~255, and for an image with 10-bit color depth, the range of its average grayscale value is 0~1023.
[0082] As another example, the electronic device may also convert the acquired target image into a grayscale image, directly calculate the mean of the grayscale values of all pixels in the grayscale image, and use the calculated mean as the average grayscale value of the target image.
[0083] S102: If the average grayscale value does not fall within the preset grayscale range, the average grayscale value is corrected to obtain a grayscale correction value.
[0084] Among them, when the average grayscale value is greater than the upper limit value of the preset grayscale range, the grayscale correction value is less than or equal to the upper limit value of the preset grayscale range; or, when the average grayscale value is less than the lower limit value of the preset grayscale range, the grayscale correction value is greater than or equal to the lower limit value of the preset grayscale range.
[0085] In some embodiments, if the average grayscale value does not fall within a preset grayscale range, the electronic device corrects the average grayscale value to obtain a grayscale correction value, which can be specifically implemented as follows: if the average grayscale value is less than a first grayscale threshold or the average grayscale value is greater than a second grayscale threshold, the electronic device determines the preset grayscale value as the grayscale correction value obtained after correcting the average grayscale value, the first grayscale threshold is less than the lower limit value of the preset grayscale range, and the second grayscale threshold is greater than the upper limit value of the preset grayscale range; or, if the average grayscale value is greater than or equal to the first grayscale threshold, and the average grayscale value is less than the lower limit value of the preset grayscale range, the electronic device determines the lower limit value of the preset grayscale range as the grayscale correction value obtained after correcting the average grayscale value; or, if the average grayscale value is less than or equal to the second grayscale threshold, and the average grayscale value is greater than the upper limit value of the preset grayscale range, the electronic device determines the upper limit value of the preset grayscale range as the grayscale correction value obtained after correcting the average grayscale value.
[0086] For example, the first grayscale threshold is x1, the lower limit of the preset grayscale range is x2, the upper limit of the preset grayscale range is x3, the second grayscale threshold is x4, x1<x2<x3<x4, assuming that the preset grayscale value is x0, then for an image with 8-bit color depth, when the different value ranges of the average grayscale value Avr of the image are different from the corrected grayscale correction value The corresponding relationship between them is as follows:
[0087] When 0≤Avr<x1, =x0;
[0088] When x4<Avr≤255, =x0;
[0089] When x1≤Avr<x2, =x2;
[0090] When x3<Avr≤x4, =x3.
[0091] For Avr greater than or equal to x2 and less than or equal to x3, Avr itself is used as its corresponding grayscale correction value.
[0092] Specifically, for an image with a color depth of 8 bits, the preset grayscale value is 128, the first grayscale threshold is 10, the lower limit of the preset grayscale range is 98, the upper limit of the preset grayscale range is 148, the second grayscale threshold is 245, and the grayscale correction value is 10. The corresponding relationship between the average gray value Avr of the image is as follows:
[0093] ;
[0094] when When , it indicates that the image is in a dark state as a whole. Even if the image is globally enhanced in brightness, the enhancement effect will not be very good. When , it indicates that the image is brighter as a whole. Even if the image brightness is reduced globally, the effect will not be very good. Therefore, the average grayscale mean of the image can be directly corrected to 128. This is equivalent to not performing brightness enhancement or brightness reduction processing on the image. In the subsequent display process, it only needs to be displayed according to the brightness response characteristics of the screen.
[0095] In this way, by correcting the average grayscale value of the image, when the average grayscale value is greater than the upper limit of the preset grayscale range, the grayscale correction value is less than or equal to the upper limit of the preset grayscale range, then the target grayscale value corresponding to each pixel point will be less than its original grayscale value, thus achieving a reduction in the brightness of the high-illuminance image. When the average grayscale value is less than the lower limit of the preset grayscale range, the grayscale correction value is greater than or equal to the lower limit of the preset grayscale range, then the target grayscale value corresponding to each pixel point will be greater than its original grayscale value, thus achieving an enhancement in the brightness of the low-illuminance image. Therefore, the method provided in the present application can adjust the brightness of the image in the high-illuminance scene as well as the low-illuminance scene, so that the image brightness is more balanced and the details in the image are easier to identify.
[0096] For images with different color depths, the preset grayscale value, the first grayscale threshold, the lower limit of the preset grayscale range, the upper limit of the preset grayscale range, and the second grayscale threshold can be set to values different from those in the above examples. For example, for an image with a 10-bit color depth, the preset grayscale value can be set to 512, the first grayscale threshold to 40, the lower limit of the preset grayscale range to 392, the upper limit of the preset grayscale range to 792, and the second grayscale threshold to 980.
[0097] In some embodiments, the electronic device will also count the pixel probabilities corresponding to each grayscale interval in multiple grayscale intervals, and the pixel probability is used to characterize the ratio between the number of pixels in the target image whose original grayscale values fall within the grayscale interval and the total number of pixels in the target image; if the average grayscale value does not fall within the preset grayscale range, the electronic device corrects the average grayscale value to obtain a grayscale correction value, which can be specifically implemented as follows: if the pixel probabilities corresponding to all grayscale intervals fall within the preset probability range, and the average grayscale value does not fall within the preset grayscale range, the electronic device corrects the average grayscale value to obtain a grayscale correction value.
[0098] In one example, the electronic device first divides the image into multiple grayscale intervals based on the number of grayscale intervals set by the user and the color depth of the image. For example, for an image with an 8-bit color depth, assuming that the user sets the number of grayscale intervals, [0, 255] can be divided into 4 grayscale intervals, namely: [0, 63), [63, 127), [127, 191) and [191, 255].
[0099] As another example, the number of pixels falling into each grayscale interval can be counted by establishing a grayscale interval histogram. Figure 4 As shown, the horizontal axis of the grayscale interval histogram is the above four grayscale intervals, and the vertical axis is the pixel probability. If there are 100 pixels in the image, there are 26 pixels falling into the grayscale interval [0, 63), 24 pixels falling into the grayscale interval [63, 127), 33 pixels falling into the grayscale interval [127, 191), and 17 pixels falling into the grayscale interval [191, 255]. The pixel probabilities corresponding to each grayscale interval are 26%, 24%, 33%, and 17%, respectively. If the preset probability range is [15%, 35%], it can be determined that the pixel probabilities corresponding to these four grayscale intervals all fall within the preset probability range, indicating that the grayscale value distribution of the entire image is relatively uniform, that is, the brightness distribution on the image is relatively uniform. If the pixel probability corresponding to each grayscale interval falls within the preset probability range, and the average grayscale value of the target image is 92, it can be determined that the average grayscale value of the target image does not fall within the preset grayscale range [98, 148], and then the average grayscale value of the target image can be corrected to obtain the grayscale correction value. If the pixel probability corresponding to each grayscale interval falls within the preset probability range, and the average grayscale value of the target image falls within the preset grayscale range, it can be determined that the number of pixels on the target image whose grayscale values fall into different grayscale intervals is relatively balanced, and the brightness of the entire target image is also relatively balanced, and then there is no need to correct the average grayscale value of the target image, and the average grayscale value of the target image can be directly used for subsequent calculations.
[0100] In this way, correcting the average grayscale value of the target image can be understood as correcting the grayscale values of all pixels in the image. That is to say, the correction process is a process of enhancing or reducing the overall brightness of the image. When the pixel probability corresponding to any grayscale interval does not fall within the preset probability range, it indicates that the brightness distribution of the pixels in the image is too concentrated, and the effect of global brightness enhancement or global brightness reduction is not good. Only by correcting the average grayscale value of the image with a relatively balanced pixel brightness distribution, a better display effect can be obtained when displaying the target image based on the target grayscale value corresponding to each pixel determined in the subsequent process.
[0101] In some embodiments, if the pixel probability corresponding to any grayscale interval does not fall within the preset probability range, the electronic device determines the preset grayscale value as the grayscale correction value of the average grayscale value. That is, if the pixel probability corresponding to any grayscale interval does not fall within the preset probability range, even if the average grayscale value of the target image falls within the preset grayscale range, the average grayscale value of the target image will be corrected to the preset grayscale value.
[0102] The preset probability range can be a probability range determined by the user through multiple experiments in advance. When the pixel probabilities corresponding to all grayscale intervals fall within the preset probability range, the display effect after grayscale correction of the image can meet the user's needs. Alternatively, the preset probability range can also be a probability range customized by the user according to his own needs. For example, the preset probability range can be (2%, 40%).
[0103] In this way, since the pixel probability corresponding to any grayscale interval does not fall within the preset probability range, it means that the brightness distribution of the pixels in the target image is uneven and too concentrated. For images with too concentrated pixel brightness distribution, the effects of panoramic brightness enhancement or global brightness reduction are not good. In this case, by correcting the average grayscale value to the preset grayscale value, it can be equivalent to not performing brightness enhancement or brightness reduction processing on the target image in the subsequent process, and an image with a worse display effect than the original target image will not be output.
[0104] Optionally, each grayscale interval corresponds to a preset probability range. If the pixel probability corresponding to any grayscale interval does not fall within the preset probability range corresponding to the grayscale interval, the electronic device determines the preset grayscale value as the grayscale correction value of the average grayscale value.
[0105] S103: Determine a target compensation value based on the grayscale correction value and the brightness response characteristics of the display screen.
[0106] In some embodiments, step S103 may be specifically implemented as follows: the electronic device determines the average brightness corresponding to the display screen through the brightness response characteristics of the display screen; the electronic device determines the target compensation value based on the grayscale correction value and the average brightness.
[0107] Among them, the brightness response characteristics of the display screen are characterized by gamma, which defines the exponential relationship between the grayscale value input to the display screen and the brightness output by the display screen.
[0108] Specifically, the electronic device determines a brightness coefficient based on the brightness response characteristics of the display screen; determines the brightness output of the display screen corresponding to each grayscale value input to the display screen based on the brightness response characteristics and the brightness coefficient; determines the average value of the brightness output of the display screen corresponding to each grayscale value input to the display screen as the average brightness corresponding to the display screen; obtains a reference average grayscale value and a reference average brightness of the display screen under the standard brightness response characteristics; determines an actual reference average grayscale value of the display screen based on the reference average grayscale value, the reference average brightness and the average brightness; determines a target compensation value based on the grayscale correction value and the actual reference average grayscale value of the display screen.
[0109] The grayscale value input to the display screen and the brightness output by the display screen satisfy the following relationship:
[0110] ;
[0111] Where i represents the grayscale value of the input display screen, i=0, 1, 2, ... 255, It represents the brightness of the display screen output corresponding to the gray value i, and a is the brightness coefficient.
[0112] Gamma can be directly obtained from the working parameters of the display screen. Based on the brightness of the display screen output corresponding to a preset grayscale value (for example, the brightness of the display screen corresponding to the preset grayscale value 255 is 100), and the gamma value of the display screen, the brightness coefficient a can be calculated. Then, according to the brightness coefficient a and the actual gamma value of the display screen, the brightness of the display screen output corresponding to each grayscale value input to the display screen can be determined, and then the average brightness lv corresponding to the display screen can be calculated:
[0113] ;
[0114] Where i = 0, 1, 2, ..., k. k is the maximum grayscale value of an image with a color depth of x bits.
[0115] When the color depth of the image is different, the average brightness of the display screen corresponding to the image is also different. For example, an image with an 8-bit color depth includes 256 grayscale values, and the maximum grayscale value is 255. The k value corresponding to the image with an 8-bit color depth is 255. For another example, a 10-bit color depth image includes 1024 grayscale values, and the maximum grayscale value is 1023. Then the k value corresponding to the 10-bit color depth image is 1023. .
[0116] GammaB represents the standard brightness response characteristic, refB represents the reference average grayscale value of the display screen under the standard brightness response characteristic, and lvB represents the reference average brightness of the display screen under the standard brightness response characteristic. The actual reference average grayscale value of the display screen can be expressed as:
[0117] ;
[0118] The lv in this formula is the average brightness corresponding to the display screen determined based on the actual brightness response characteristics of the display screen.
[0119] In practical applications, the standard brightness response characteristic is gamma = 2.2. When gamma is 2.2, the reference average grayscale value of the display screen is 128, and the reference average brightness is 31.323. At this time, the actual reference average grayscale value of the display screen can be expressed as .
[0120] The brightness value of the display screen corresponding to the preset grayscale value of 255 will not affect the actual reference average grayscale value of the actual screen. Take the display screen displaying an image with 8-bit color depth as an example: for example, when gamma is 2.2, and the brightness of the display screen corresponding to the pre-calibrated grayscale value of 255 is 100, the actual reference average grayscale value corresponding to the display screen is 128, and the average brightness corresponding to the display screen is 31.323; for another example, when gamma is 2.2, and the brightness of the display screen corresponding to the pre-calibrated grayscale value of 255 is 1, the actual reference average grayscale value corresponding to the display screen is 128, and the average brightness corresponding to the display screen is 0.31323; for another example, when gamma is 2.3, and the brightness of the display screen corresponding to the pre-calibrated grayscale value of 255 is 100, the actual reference average grayscale value corresponding to the display screen is , the average brightness of the display screen is 30.38; for example, when gamma is 2.3, and the brightness of the display screen corresponding to the pre-calibrated grayscale value of 255 is 1, the actual reference average grayscale value corresponding to the display screen is , the corresponding average brightness of the display screen is 0.3038.
[0121] Then, based on ref and Mean, the target compensation value Gamma can be obtained:
[0122] ;
[0123] This formula can be simplified to obtain:
[0124] ;
[0125] For example, when the image color depth is 8it and the standard brightness response characteristic gamma is 2.2, the target compensation value is When the color depth of the image is different, and / or the standard brightness response characteristics of the display screen are different, k and ref in the calculation formula of the target compensation value Gamma will also change accordingly.
[0126] In this way, the brightness response characteristics of the display screen are taken into consideration when determining the target compensation value, and finally, when the subsequent image display process is performed based on the determined target compensation value, the image display effect is more in line with the characteristics of the display screen.
[0127] Based on this, since the preset gray value is set to not compensate the image in the subsequent processing process, the target compensation value is obtained. , then the preset gray value is the actual reference average gray value ref of the display screen. In this way, when the gray correction value Mean is ref, , when compensating the image based on the target compensation value in the subsequent process, it is equivalent to not performing brightness enhancement or brightness reduction processing on the target image, and will not output an image with a worse display effect than the original target image. For example, when the image color depth is 8 bits and the standard brightness response characteristic gamma is 2.2, the actual reference average grayscale value corresponding to the display screen is 128; when the image color depth is 10 bits and the standard brightness response characteristic gamma is 2.3, the actual reference average grayscale value corresponding to the display screen is 124.
[0128] S104, adjusting the original grayscale value of each pixel in the target image based on the target compensation value to obtain the target grayscale value corresponding to each pixel, and displaying the target image on the display screen according to the target grayscale value corresponding to each pixel.
[0129] Exemplarily, the adjusted target grayscale value cGray corresponding to each grayscale value j is:
[0130] ;
[0131] In this way, the target grayscale value corresponding to the original grayscale value of each pixel in the target image can be calculated based on the target compensation value, and then the target image can be displayed on the display screen based on the target grayscale value to obtain a better display effect.
[0132] In some embodiments, when the target compensation value is not 1, the electronic device adjusts the original grayscale value of each pixel in the target image based on the target compensation value to obtain the target grayscale value corresponding to each pixel, which can be specifically implemented as follows: the electronic device obtains the first compensation value corresponding to the previous frame of the target image; when the difference between the first compensation value and the target compensation value is greater than the upper limit of the preset difference range, the electronic device adjusts the original grayscale value of each pixel in the target image based on the difference between the first compensation value and the preset compensation variable to obtain the target grayscale value corresponding to each pixel; or, when the difference between the first compensation value and the target compensation value is less than the lower limit of the preset difference range, the electronic device adjusts the original grayscale value of each pixel in the target image based on the sum of the first compensation value and the preset compensation variable to obtain the target grayscale value corresponding to each pixel; or, when the difference between the first compensation value and the target compensation value is within the preset difference range, the electronic device adjusts the original grayscale value of each pixel in the target image based on the target compensation value to obtain the target grayscale value corresponding to each pixel.
[0133] For example, the first compensation value of the previous target image is GammaA, and the target compensation value of the current target image is Gamma. The difference between GammaA and Gamma is compared. If the value of GammaA-Gamma is greater than the upper limit of the preset difference range, , then it is determined to reduce the preset compensation variable based on GammaA (For example, 0.05), that is, the actual compensation value GammaS corresponding to the target image of the current frame is GammaA- ; If the value of GammaA-Gamma is less than the lower limit of the preset difference range , then it is determined to add a preset compensation variable based on GammaA , that is, the actual compensation value GammaS corresponding to the target image of the current frame is GammaA+ If the difference between GammaA and Gamma is within the preset difference range, the actual compensation value GammaS corresponding to the target image of the current frame is Gamma. The above compensation value comparison and compensation value adjustment process is performed for each frame of the image.
[0134] Then the adjusted target gray value cGray corresponding to each gray value j calculated based on the actual compensation value is:
[0135] ;
[0136] When the image color depth is 8 bits, the adjusted target gray value cGray corresponding to each gray value j is:
[0137] ;
[0138] When the color depth of the image is 10 bits, the adjusted target gray value cGray corresponding to each gray value j is:
[0139] .
[0140] In this way, when the target compensation value is not 1, that is, when the image brightness needs to be enhanced or reduced, by comparing the first compensation value and the target compensation value, the first compensation value is gradually adjusted based on the comparison result, and then gradually adjusted to the target compensation value. The display effects of images of adjacent frames are closer, the transition between images is more natural, and finally the target image displayed has a better display effect.
[0141] In some embodiments, the electronic device determines a target compensation value for each frame of image, or the electronic device determines the target compensation value once every preset number of frames of image.
[0142] Figure 3 The technical solution shown brings at least the following beneficial effects: by correcting the average grayscale value of the target image that does not fall within the preset grayscale range, after obtaining the grayscale correction value, the target compensation value is determined based on the grayscale correction value and the brightness response characteristics corresponding to the display screen, and then based on the target compensation value, the original grayscale value of each pixel in the target image is adjusted to obtain the target grayscale value corresponding to each pixel. Since the grayscale correction value after correction of the average grayscale value greater than the upper limit of the preset grayscale range is less than or equal to the upper limit of the preset grayscale range, the target grayscale value corresponding to each pixel will be less than its original grayscale value, thus achieving the reduction of the brightness of the high-illuminance image, and since the grayscale correction value after correction of the average grayscale value less than the lower limit of the preset grayscale range is greater than or equal to the lower limit of the preset grayscale range, the target grayscale value corresponding to each pixel will be greater than its original grayscale value, thus achieving the enhancement of the brightness of the low-illuminance image. Therefore, the method provided in the present application can adjust the brightness of the image in high-illuminance scenes, and can also adjust the brightness of the image in low-illuminance scenes. The image brightness is more balanced, and the details in the image are easier to identify. In addition, the brightness response characteristics corresponding to the display screen are taken into account when calculating the target compensation value. The image after brightness adjustment is displayed on the display screen and is more in line with the display effect of the display screen.
[0143] The above-mentioned image display method can be applied to any scenario in which an image is displayed on a display screen. In the process of displaying the image on the display screen, the image is processed by the image display method provided in the present application, and the image finally displayed on the display screen is more in line with the display characteristics of the display screen, and the image display effect is better.
[0144] The above-mentioned image display method can be applied to the scene of spliced display screens. For example, the above-mentioned image display method is used to enhance or reduce the brightness of the sub-image area to be displayed on each sub-display screen in the spliced display screen, and finally the display effect of each sub-image area is better and more in line with the screen characteristics of its corresponding sub-display screen. Alternatively, based on the brightness response characteristics of each sub-display screen, the brightness of the original entire target image is enhanced or reduced, and finally a processed image corresponding to each sub-display screen is obtained, and then the sub-image area to be displayed on the corresponding sub-display screen is cropped from the processed image, and the cropped sub-image area is displayed on the corresponding sub-display screen.
[0145] In summary, Figure 5 The following is a logic diagram showing the image display method provided by the present application:
[0146] First, the electronic device obtains the brightness response characteristics of the display screen;
[0147] Then the image is input into the electronic device, the image features (pixel probability corresponding to each grayscale interval and grayscale correction value) of the image are analyzed, and the average grayscale value of the image is calculated;
[0148] Determine a target compensation value based on an average gray value of the image and image features of the image;
[0149] Based on the target compensation value, the image of the current frame is gradually compensated;
[0150] Output and display the compensated image.
[0151] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to achieve the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. It should be easy to realize that the technical goals in this field are combined with the units and algorithm steps of each example described in the embodiments disclosed in this article, and the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical goals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0152] like Figure 6As shown, the embodiment of the present application further provides an image display device, which is used in the image display method shown in the above method embodiment. The image display device 500 includes: a transmission module 501, a processing module 502 and a display module 503.
[0153] Among them, the transmission module 501 is used to obtain the target image; the processing module 502 is used to determine the average grayscale value of the target image based on the original grayscale value of each pixel in the target image; the processing module 502 is also used to correct the average grayscale value if the average grayscale value does not fall into the preset grayscale range to obtain a grayscale correction value; when the average grayscale value is greater than the upper limit value of the preset grayscale range, the grayscale correction value is less than or equal to the upper limit value of the preset grayscale range; or, when the average grayscale value is less than the lower limit value of the preset grayscale range, the grayscale correction value is greater than or equal to the lower limit value of the preset grayscale range; the processing module 502 is also used to determine the target compensation value based on the grayscale correction value and the brightness response characteristics corresponding to the display screen; the processing module 502 is also used to adjust the original grayscale value of each pixel in the target image based on the target compensation value to obtain the target grayscale value corresponding to each pixel; the display module 503 is used to display the target image on the display screen according to the target grayscale value corresponding to each pixel.
[0154] In one possible implementation, the processing module 502 is specifically used to: if the average grayscale value is less than a first grayscale threshold or the average grayscale value is greater than a second grayscale threshold, determine the preset grayscale value as a grayscale correction value obtained after correcting the average grayscale value, the first grayscale threshold is less than a lower limit value of a preset grayscale range, and the second grayscale threshold is greater than an upper limit value of the preset grayscale range; or, if the average grayscale value is greater than or equal to the first grayscale threshold, and the average grayscale value is less than the lower limit value of the preset grayscale range, determine the lower limit value of the preset grayscale range as the grayscale correction value obtained after correcting the average grayscale value; or, if the average grayscale value is less than or equal to the second grayscale threshold, and the average grayscale value is greater than the upper limit value of the preset grayscale range, determine the upper limit value of the preset grayscale range as the grayscale correction value obtained after correcting the average grayscale value.
[0155] In another possible implementation, the processing module 502 is also used to count the pixel probability corresponding to each grayscale interval in multiple grayscale intervals, and the pixel probability is used to characterize the ratio between the number of pixel points in the target image whose original grayscale values fall within the grayscale interval and the total number of pixel points in the target image; the processing module 502 is specifically used to correct the average grayscale value to obtain a grayscale correction value if the pixel probabilities corresponding to all grayscale intervals fall within a preset probability range and the average grayscale value does not fall within the preset grayscale range.
[0156] In another possible implementation, the processing module 502 is further configured to determine a preset grayscale value as a grayscale correction value of the average grayscale value if the pixel probability corresponding to any grayscale interval does not fall within a preset probability range.
[0157] In another possible implementation, the processing module 502 is specifically used to: determine the average brightness corresponding to the display screen according to the brightness response characteristics of the display screen; and determine the target compensation value based on the grayscale correction value and the average brightness.
[0158] In another possible implementation, the processing module 502 is specifically used to: determine the brightness coefficient based on the brightness response characteristics of the display screen; determine the brightness output of the display screen corresponding to each grayscale value input to the display screen based on the brightness response characteristics and the brightness coefficient; determine the average value of the brightness output of the display screen corresponding to each grayscale value input to the display screen as the average brightness corresponding to the display screen; the acquisition module 501 is also used to obtain the reference average grayscale value and reference average brightness of the display screen under the standard brightness response characteristics; the processing module 502 is specifically used to: determine the actual reference average grayscale value of the display screen based on the reference average grayscale value, the reference average brightness and the average brightness; determine the target compensation value based on the grayscale correction value and the actual reference average grayscale value of the display screen.
[0159] In another possible implementation, the transmission module 501 is also used to obtain a first compensation value corresponding to the target image of the previous frame; the processing module 502 is specifically used to: when the difference between the first compensation value and the target compensation value is greater than the upper limit of the preset difference range, based on the difference between the first compensation value and the preset compensation variable, adjust the original grayscale value of each pixel in the target image to obtain the target grayscale value corresponding to each pixel; or, when the difference between the first compensation value and the target compensation value is less than the lower limit of the preset difference range, based on the sum of the first compensation value and the preset compensation variable, adjust the original grayscale value of each pixel in the target image to obtain the target grayscale value corresponding to each pixel; or, when the difference between the first compensation value and the target compensation value is within the preset difference range, adjust the original grayscale value of each pixel in the target image based on the target compensation value to obtain the target grayscale value corresponding to each pixel.
[0160] It should be noted that Figure 6 The division of modules in the example is schematic and is only a logical function division. There may be other division methods in actual implementation. For example, two or more functions may be integrated into one processing module. The above integrated modules may be implemented in the form of hardware or software function modules.
[0161] Another embodiment of the present application further provides an electronic device, the electronic device comprising a memory and a processor; the memory and the processor are coupled; the memory is used to store computer program codes, and the computer program codes include computer instructions. When the processor executes the computer instructions, the image display device 500 executes each step executed by the electronic device in the method flow shown in the above method embodiment.
[0162] In actual implementation, the transmission module 501, the processing module 502 and the display module 503 can be implemented by the processor of the electronic device calling the computer program code in the memory. The specific execution process can refer to the description of the above image display method part, which will not be repeated here.
[0163] Another embodiment of the present application further provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer device, the computer device executes each step executed by the electronic device in the method flow shown in the above method embodiment.
[0164] In another embodiment of the present application, a computer program product is provided. The computer program product includes computer instructions. When the computer instructions are executed on a computer device, the computer device executes each step executed by the electronic device in the method flow shown in the above method embodiment.
[0165] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer execution instruction is loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that can be accessed by the computer or a data storage device such as a server, data center, etc. that contains one or more servers that can be integrated with the medium. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), etc.
[0166] The above is only a specific implementation of the present application. Those skilled in the art may conceive of changes or substitutions based on the specific implementation provided by the present application, which should all be included in the protection scope of the present application.
Claims
1. An image display method, characterized in that: include: Acquire a target image, and determine an average grayscale value of the target image based on the original grayscale value of each pixel in the target image; If the average grayscale value does not fall within the preset grayscale range, correcting the average grayscale value to obtain a grayscale correction value; When the average grayscale value is greater than the upper limit of the preset grayscale range, the grayscale correction value is less than or equal to the upper limit of the preset grayscale range; Alternatively, when the average grayscale value is less than the lower limit of the preset grayscale range, the grayscale correction value is greater than or equal to the lower limit of the preset grayscale range; Determining a target compensation value based on the grayscale correction value and a brightness response characteristic corresponding to the display screen; Based on the target compensation value, adjusting the original grayscale value of each pixel in the target image to obtain the target grayscale value corresponding to each pixel, and displaying the target image on the display screen according to the target grayscale value corresponding to each pixel; If the average grayscale value does not fall within the preset grayscale range, the average grayscale value is corrected to obtain a grayscale correction value, including: If the average grayscale value is less than the first grayscale threshold or the average grayscale value is greater than the second grayscale threshold, the preset grayscale value is determined to be the grayscale correction value obtained after correcting the average grayscale value, the first grayscale threshold is less than the lower limit of the preset grayscale range, and the second grayscale threshold is greater than the upper limit of the preset grayscale range; or If the average grayscale value is greater than or equal to a first grayscale threshold value, and the average grayscale value is less than a lower limit value of the preset grayscale range, the lower limit value of the preset grayscale range is determined as the grayscale correction value obtained after correcting the average grayscale value, and the first grayscale threshold value is less than the lower limit value of the preset grayscale range; or, If the average grayscale value is less than or equal to the second grayscale threshold, and the average grayscale value is greater than the upper limit value of the preset grayscale range, the upper limit value of the preset grayscale range is determined as the grayscale correction value obtained after correcting the average grayscale value, and the second grayscale threshold is greater than the upper limit value of the preset grayscale range.
2. The method according to claim 1, characterized in that The method further comprises: Counting the pixel probability corresponding to each of the plurality of grayscale intervals, the pixel probability being used to represent the ratio between the number of pixel points whose original grayscale values in the target image fall within the grayscale interval and the total number of pixel points in the target image; If the average grayscale value does not fall within the preset grayscale range, the average grayscale value is corrected to obtain a grayscale correction value, including: If the pixel probabilities corresponding to all the grayscale intervals fall within the preset probability range, and the average grayscale value does not fall within the preset grayscale range, the average grayscale value is corrected to obtain the grayscale correction value.
3. The method according to claim 2, characterized in that The method further comprises: If the pixel probability corresponding to any one of the grayscale intervals does not fall within the preset probability range, the preset grayscale value is determined as the grayscale correction value of the average grayscale value.
4. The method according to claim 1, characterized in that The step of determining a target compensation value based on the grayscale correction value and a brightness response characteristic corresponding to the display screen includes: Determining an average brightness corresponding to the display screen according to the brightness response characteristics of the display screen; The target compensation value is determined based on the grayscale correction value and the average brightness.
5. The method according to claim 4, characterized in that The determining the average brightness corresponding to the display screen according to the brightness response characteristic of the display screen includes: Determining a brightness coefficient based on a brightness response characteristic of the display screen; Determining the brightness output of the display screen corresponding to each grayscale value input to the display screen based on the brightness response characteristic of the display screen and the brightness coefficient; Determine the average value of the brightness output by the display screen corresponding to each grayscale value input to the display screen as the average brightness corresponding to the display screen; The determining the target compensation value based on the grayscale correction value and the average brightness includes: Obtaining a reference average grayscale value and a reference average brightness of a display screen under a standard brightness response characteristic; Determining an actual reference average grayscale value of the display screen based on the reference average grayscale value, the reference average brightness, and the average brightness; The target compensation value is determined based on the grayscale correction value and an actual reference average grayscale value of the display screen.
6. The method according to any one of claims 1 to 5, characterized in that: When the target compensation value is not 1, adjusting the original grayscale value of each pixel in the target image based on the target compensation value to obtain the target grayscale value corresponding to each pixel includes: Obtaining a first compensation value corresponding to the previous frame of the target image; When the difference between the first compensation value and the target compensation value is greater than the upper limit of the preset difference range, the original grayscale value of each pixel in the target image is adjusted based on the difference between the first compensation value and the preset compensation variable to obtain the target grayscale value corresponding to each pixel; or When the difference between the first compensation value and the target compensation value is less than the lower limit of the preset difference range, the original grayscale value of each pixel in the target image is adjusted based on the sum of the first compensation value and the preset compensation variable to obtain the target grayscale value corresponding to each pixel; or When the difference between the first compensation value and the target compensation value is within the preset difference range, the original grayscale value of each pixel in the target image is adjusted based on the target compensation value to obtain the target grayscale value corresponding to each pixel.
7. An image display device, characterized in that: include: A transmission module, used for acquiring a target image; A processing module, used for determining an average grayscale value of the target image based on the original grayscale value of each pixel in the target image; The processing module is further configured to correct the average grayscale value to obtain a grayscale correction value if the average grayscale value does not fall within a preset grayscale range; When the average grayscale value is greater than the upper limit of the preset grayscale range, the grayscale correction value is less than or equal to the upper limit of the preset grayscale range; Alternatively, when the average grayscale value is less than the lower limit of the preset grayscale range, the grayscale correction value is greater than or equal to the lower limit of the preset grayscale range; The processing module is further used to determine a target compensation value based on the grayscale correction value and a brightness response characteristic corresponding to the display screen; The processing module is further used to adjust the original grayscale value of each pixel in the target image based on the target compensation value to obtain the target grayscale value corresponding to each pixel; A display module, used for displaying the target image on the display screen according to the target grayscale value corresponding to each pixel point; The processing module is specifically used for: If the average grayscale value is less than the first grayscale threshold or the average grayscale value is greater than the second grayscale threshold, determining the preset grayscale value to be the grayscale correction value obtained after correcting the average grayscale value, the first grayscale threshold is less than the lower limit value of the preset grayscale range, and the second grayscale threshold is greater than the upper limit value of the preset grayscale range; or, If the average grayscale value is greater than or equal to a first grayscale threshold value, and the average grayscale value is less than a lower limit value of the preset grayscale range, the lower limit value of the preset grayscale range is determined as the grayscale correction value obtained after correcting the average grayscale value, and the first grayscale threshold value is less than the lower limit value of the preset grayscale range; or, If the average grayscale value is less than or equal to the second grayscale threshold, and the average grayscale value is greater than the upper limit value of the preset grayscale range, the upper limit value of the preset grayscale range is determined as the grayscale correction value obtained after correcting the average grayscale value, and the second grayscale threshold is greater than the upper limit value of the preset grayscale range.
8. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 6.
9. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
