Image display method, electronic device, and readable storage medium
By identifying and adjusting the brightness parameters of monochrome regions of an image, and combining contrast enhancement and smoothing algorithms, the contradiction between image display brightness and power consumption in existing technologies has been resolved, achieving efficient battery life for electronic devices.
Patent Information
- Application Number
- CN202310413327.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-14
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2043-04-14
AI Technical Summary
Existing technologies cannot balance power consumption and user experience when reducing the brightness of electronic device image displays, resulting in reduced battery life.
By identifying monochrome regions in an image and reducing their brightness parameters, combined with contrast enhancement and smoothing algorithms, the image display method is optimized to reduce power consumption.
While ensuring a good user experience, it effectively reduces power consumption for image display and improves the battery life of electronic devices.
Smart Images

Figure CN116825048B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing, and more particularly to an image display method, an electronic device, and a readable storage medium. Background Technology
[0002] The main factor affecting the power consumption of electronic devices is image brightness. Higher screen brightness will lead to higher power consumption, but excessively reducing image brightness will not guarantee the image display effect. Summary of the Invention
[0003] In a first aspect, embodiments of this application provide an image processing method, including:
[0004] Obtain the image to be processed;
[0005] One or more regions of the image to be processed are identified as to be adjusted, wherein the regions to be adjusted are monochrome regions in the image to be processed;
[0006] Determine the brightness parameter of each of the regions to be adjusted, adjust the pixel brightness of the pixels in the regions to be adjusted according to the brightness parameter, and determine the first adjusted image, wherein the brightness parameter is a number less than 0.
[0007] In some embodiments, it also includes:
[0008] Convert the first adjusted image to a grayscale image and obtain the contrast of the grayscale image;
[0009] The gain parameter is determined based on the contrast of the grayscale image, wherein the gain parameter is a number greater than 1;
[0010] The grayscale value of the grayscale image is adjusted according to the gain parameter to determine the second adjusted image.
[0011] In some embodiments, it also includes:
[0012] Determine the image brightness of the second adjusted image;
[0013] The image brightness is processed according to a preset smoothing algorithm until the image brightness is less than or equal to the preset brightness, and then a third adjusted image is determined.
[0014] The third adjusted image is transformed to determine the optimized image;
[0015] The image brightness of the second adjusted image is determined by mapping the second adjusted image to the RGB color space and converting the RGB color space to the HSL color space; or, it is determined based on the average pixel value of the second adjusted image; or, the pixel variance is determined based on the average pixel value of the second adjusted image, and then determined based on the pixel variance.
[0016] The preset smoothing algorithm includes Gaussian filtering, median filtering, or bilateral filtering.
[0017] In some embodiments, determining one or more regions of the image to be processed to be adjusted includes:
[0018] The image to be processed is converted into a grayscale image, and the grayscale image is binarized to obtain a black and white image;
[0019] The black and white image is segmented using a contour detection algorithm to obtain all foreground regions;
[0020] One or more regions to be adjusted are identified from all the foreground regions.
[0021] In some embodiments, determining one or more regions to be adjusted from all foreground regions includes:
[0022] Determine the number of pixels in each foreground region, and identify foreground regions with a number of pixels greater than a preset number as regions to be adjusted.
[0023] In some embodiments, it also includes:
[0024] Obtain the red channel value, green channel value, and blue channel value of each pixel in the area to be adjusted;
[0025] For each pixel, input the red channel value, green channel value, and blue channel value of the pixel into the preset parameter model, and obtain the brightness parameter output by the preset parameter model;
[0026] Based on the brightness parameters, the values of the red channel, green channel, and blue channel of the pixel are adjusted to obtain the adjusted pixel.
[0027] The first adjusted image is determined based on all the adjusted pixels;
[0028] The preset parameter model is generated by training based on the red channel values, green channel values, blue channel values, and sample brightness parameters of all sample pixels.
[0029] In some embodiments, it also includes:
[0030] Determine the average brightness of each of the regions to be adjusted;
[0031] The brightness parameter of the area to be adjusted is determined based on the average brightness of the area, wherein the absolute value of the brightness parameter is proportional to the average brightness of the area;
[0032] Based on the brightness parameters, the values of the red channel, green channel, and blue channel of the pixel are adjusted to obtain the adjusted pixel.
[0033] The first adjusted image is determined based on all the adjusted pixels.
[0034] In some embodiments, after determining the first adjusted image, the method further includes:
[0035] The first adjustment image is output to an electronic device for display on the electronic device.
[0036] Secondly, embodiments of this application also provide an electronic device, including a processor;
[0037] Memory used to store processor-executable instructions;
[0038] The processor is configured to implement the image processing method when executing the executable instructions.
[0039] Thirdly, embodiments of this application also provide a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the image processing method described above. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 A schematic flowchart illustrating an image display method provided in one embodiment of this application;
[0042] Figure 2 This is a schematic diagram of an image of the area to be adjusted provided in one embodiment of this application;
[0043] Figure 3 A schematic flowchart illustrating an image display method provided in one embodiment of this application;
[0044] Figure 4 A schematic flowchart illustrating an image display method provided in one embodiment of this application;
[0045] Figure 5 This is a schematic flowchart illustrating the process of determining the region to be adjusted, provided as an embodiment of this application.
[0046] Figure 6A schematic flowchart illustrating an image display method provided in one embodiment of this application;
[0047] Figure 7 A schematic flowchart illustrating an image display method provided in one embodiment of this application;
[0048] Figure 8 A schematic flowchart illustrating an image display method provided in one embodiment of this application;
[0049] Figure 9 A schematic flowchart illustrating an image display method provided in one embodiment of this application;
[0050] Figure 10 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application. Detailed Implementation
[0051] To make the technical solutions and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0052] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and are not used to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same class, and the number of objects is not limited; for example, the first object can be one or more.
[0053] The image display method of this application can be applied to electronic devices with and / or without display functions, such as mobile phones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), and other electronic devices. It can also be applied to databases, servers, and service response systems based on terminal artificial intelligence. This application does not limit the specific type of electronic device. The image display method used in this application can greatly improve the battery life of portable electronic devices. This application will use AR glasses as an example to describe the technical solution in detail, but this does not mean that this application can only be applied to AR glasses. Any electronic device application using the technical solution described in this application will fall within the protection scope of this application.
[0054] With the mature development of augmented reality glasses technology and the rapid iteration of products, more and more people are using AR glasses in their daily lives. AR glasses have the characteristics of good portability and mobility. For example, AR glasses can be used to watch movies, play games and other media viewing and interaction. However, due to the size and weight of AR glasses devices, when they are in high power consumption image display for a long time, the battery life of AR glasses will be greatly reduced. However, although significantly reducing the image display brightness can reduce display power consumption, it will also lead to a decline in user experience.
[0055] This application provides an image display method, an electronic device, and a readable storage medium that can specifically reduce image brightness and display power consumption.
[0056] Figure 1 This is a flowchart illustrating an image display method provided in one embodiment of this application. This application provides an image processing method, including:
[0057] Step 101: Obtain the image to be processed;
[0058] Step 102: Determine one or more regions to be adjusted in the image to be processed, wherein the regions to be adjusted are monochrome regions in the image to be processed;
[0059] Step 103: Determine the brightness parameter of each of the regions to be adjusted, adjust the pixel brightness of the pixels in the regions to be adjusted according to the brightness parameter, and determine the first adjusted image, wherein the brightness parameter is a number less than 0.
[0060] In step 101, if the AR glasses in this application are playing a video, the video to be played is first acquired, the video to be played is divided into image frames, and the image to be processed is determined based on the image frames. If the AR glasses in this application are playing an image, the image to be processed is determined directly based on the image to be played.
[0061] This application optimizes the brightness of the image to be processed before it is rendered by the graphics processing unit (GPU) and projected onto the display component of the AR glasses. This reduces the power consumption of the AR glasses when the image is displayed on the display component. The embodiments of this application can perform targeted brightness and contrast processing on the image. Specifically, different processing is performed according to the characteristics of the image to be processed, including brightness and monochrome area distribution, so that each image to be processed is more suitable for display on the AR glasses after processing, thereby reducing the power consumption of the AR glasses display.
[0062] In step 102, one or more regions to be adjusted in the image to be processed are determined. The regions to be adjusted are monochrome regions in the image to be processed, specifically monochrome contour regions in the image to be processed. Since each image to be processed is applied to different scenarios and serves different objects, large areas of solid color pixels may appear in the image to be processed. There may be one or more solid color regions, and the colors corresponding to different solid color regions may also be different. For one or more monochrome regions, since the image represented by any monochrome region contains fewer user-perceived details, the user's attention to monochrome regions is not high. Even if the brightness of the monochrome regions is appropriately reduced, it will not reduce the user's viewing experience. Therefore, this application first determines one or more regions to be adjusted in the image to be processed. After determining the regions to be adjusted, the contour coordinates of the regions to be adjusted are extracted, all pixels within the contour coordinates are determined, and then the brightness value of each pixel in the regions to be adjusted is reduced, thereby achieving the purpose of reducing the display power consumption of some areas in the image display.
[0063] For example, Figure 2 This is a schematic diagram of an image of the area to be adjusted provided in one embodiment of this application. Figure 9The image to be processed contains clouds, the moon, and stars. The moon and clouds occupy a large area in the image. These monochrome areas can all be used as areas to be adjusted, or a portion of these monochrome areas can be used as areas to be adjusted. For example, if the outline of the moon is large, the brightness of the moon area can be adjusted. This application can select areas that need brightness adjustment from one or more areas to be adjusted based on the size, color, or shape of all areas to be adjusted. For example, larger areas with a wider impact will be adjusted, while smaller areas will not need adjustment. Also, white and gray areas will be adjusted first, while black and yellow areas will not need adjustment. Furthermore, rod-shaped and line-shaped areas will be adjusted first, while circular and matrix areas will not need adjustment.
[0064] In step 103, a brightness parameter for each of the regions to be adjusted is determined. The pixel brightness of the pixels in the regions to be adjusted is then adjusted according to the brightness parameter to determine a first adjusted image. The brightness parameter is a number less than 0. For example, an RGB image includes N pixels, each pixel being a three-dimensional array including three color channels: R, G, and B. That is, the brightness of each pixel is determined by the brightness of the three color channels, and its value is typically between 0 and 255. The brightness of the region to be adjusted can be determined based on the average brightness of all pixels in the region, and then the brightness parameter is determined based on the brightness of the region to be adjusted. It can be understood that the absolute value of the brightness parameter is usually proportional to the brightness of the region to be adjusted; that is, the larger the brightness value of the region to be adjusted, the larger the absolute value of the brightness parameter. For example, the brightness parameter of one region to be adjusted is set to -10, and the brightness parameter of another region to be adjusted is set to -20. It can be understood that the brightness parameter is usually a negative integer.
[0065] For example, the brightness parameter of each pixel in the region to be adjusted can be determined separately. The absolute value of the brightness parameter is proportional to the brightness of the pixel; that is, the larger the brightness value of the pixel, the larger the absolute value of the corresponding brightness parameter. In this application, a brightness parameter can be determined for each pixel in each region to be adjusted, and then the corresponding brightness parameter can be adjusted to determine the first adjusted image. Alternatively, each region to be adjusted can be treated as a whole, a brightness parameter can be determined, and all pixels in the region to be adjusted can be adjusted according to the brightness parameter to determine the first adjusted image.
[0066] Optionally, in the area to be adjusted, this application determines different brightness parameters for different pixels. The brightness parameters are numbers less than 0. That is, this application reduces the original pixel brightness of each pixel in the area to be adjusted by the brightness parameters, and performs appropriate brightness reduction on all pixels. Finally, the brightness reduction processing of the area to be adjusted in the image to be processed is achieved. As for the image to be processed, since the brightness of the image parts with more detailed features is not adjusted, the display effect of the image is guaranteed, and the display brightness of some images is reduced, thereby reducing display power consumption.
[0067] For example, some electronic devices currently adjust display brightness by sensing ambient light through ambient light sensors to dynamically adjust the backlight brightness of the device's screen, thereby optimizing display effects or reducing power consumption. This method adjusts screen brightness by detecting the light intensity of the surrounding environment without considering what brightness is suitable for the actual content to be displayed. Directly adjusting the brightness of the screen backlight can also affect the overall display effect. Therefore, this processing method cannot intelligently adjust for dynamically displayed images, and the brightness of the screen backlight may not match some parts of the image, thus affecting the user's viewing experience.
[0068] This application provides an image display method, an electronic device, and a readable storage medium. The method determines the area to be adjusted by using a monochrome area in the image to be processed, and adjusts the pixel brightness of the pixels in the area to be adjusted according to a brightness parameter. While ensuring normal display effect, the brightness of some areas in the image to be processed is reduced, thereby reducing the display power consumption of the image. Without reducing the user's visual experience, the battery life of the display carrier corresponding to the image to be processed is improved.
[0069] Figure 3 This is a flowchart illustrating an image display method provided in one embodiment of the present application, which further includes:
[0070] Step 301: Convert the first adjusted image to a grayscale image and obtain the contrast of the grayscale image;
[0071] Step 302: Determine the gain parameter based on the contrast of the grayscale image, wherein the gain parameter is a number greater than 1;
[0072] Step 303: Adjust the grayscale value of the grayscale image according to the gain parameter to determine the second adjusted image.
[0073] In some embodiments, after adjusting the brightness of a portion of the monochrome region in the image to be processed, in order to ensure that the display effect is not significantly affected after the brightness adjustment, the contrast of the first adjusted image can also be adjusted to ensure the display quality of the displayed image. In step 301, the first adjusted image can be an RGB image. For example, the first adjusted image can be converted into a single-channel grayscale image, the average brightness of the grayscale image pixels can be determined, and then the square of the difference between the brightness of each pixel and the average brightness is accumulated and summed. The square of the differences of all pixels is divided by the total number of pixels to obtain the variance of all pixels. The contrast of the grayscale image is determined based on the variance.
[0074] Contrast affects visual effects. Generally, the higher the contrast, the clearer the image and the more vivid and vibrant the colors; while the lower the contrast, the darker the overall image. High contrast improves image clarity, detail, and grayscale levels. For example, it can make brighter areas in the first adjusted image brighter and darker areas darker. For instance, the gain parameter of a pixel is lower as its grayscale value is closer to the middle value of the range, and higher as its grayscale value is closer to the extreme values of the range. Furthermore, the gain parameter will exhibit a linear or non-linear curve transformation from the middle value of the range to the extreme values of the range. For example, it can be solved using a linear equation, a ternary function, or an inverse function.
[0075] In step 302, this application can determine the gain parameter by inputting the contrast of the grayscale image into a preset linear equation. The gain parameter is a number greater than 1, that is, this application needs to enhance the grayscale value of the grayscale image to improve the contrast of the grayscale image.
[0076] Optionally, the preset thread may be determined by linearly fitting the sample gain parameter with the contrast of the sample grayscale image.
[0077] In step 303, this application adjusts the grayscale value of each pixel in the grayscale image by means of the gain parameter, thereby improving the overall contrast of the grayscale image, and determines the grayscale image after improving the overall contrast as the second adjusted image.
[0078] For example, combining Figure 1 as well as Figure 3This application can also acquire an image to be processed, determine one or more regions to be adjusted in the image to be processed, wherein the regions to be adjusted are monochrome regions in the image to be processed, and acquire the red channel value, green channel value, and blue channel value of each pixel in the region to be adjusted; for each pixel, input the red channel value, green channel value, and blue channel value of the pixel to a preset parameter model, and acquire the first gain parameter and the first brightness parameter output by the preset parameter model; the preset parameter model is constructed based on the three color channels of all sample pixels, the sample gain parameter and the sample brightness parameter of each sample pixel, thereby determining the first gain parameter and the first brightness parameter of each region to be adjusted, and then adjusting the pixel brightness of the pixels in the region to be adjusted according to the first gain parameter and the first brightness parameter to determine the adjusted image to be processed. Accordingly, after determining the adjusted image to be processed, the method further includes: converting the adjusted image to be processed into a grayscale image, and obtaining the contrast of the grayscale image; determining a second gain parameter from a first preset parameter equation based on the contrast of the grayscale image, and determining a second brightness parameter from a second preset parameter equation based on the contrast of the grayscale image; adjusting the grayscale value of the grayscale image based on the second gain parameter and the second brightness parameter, and determining the adjusted image to be processed.
[0079] based on Figure 3 In the provided embodiments, this application simultaneously reduces the brightness of the area to be adjusted in the image to be processed and enhances the overall contrast of the image to be processed, that is, it achieves simultaneous adjustment of brightness and contrast. Normally, reducing brightness will darken the image. If the contrast is not adjusted, some details of the area to be adjusted may be lost. However, by enhancing the contrast, it is possible to reduce display power consumption while ensuring the display effect.
[0080] Figure 4 This is a flowchart illustrating an image display method provided in one embodiment of the present application, which further includes:
[0081] Step 401: Determine the image brightness of the second adjusted image;
[0082] Step 402: Process the image brightness according to the preset smoothing algorithm until the image brightness is less than or equal to the preset brightness, and determine the third adjusted image;
[0083] Step 403: Convert the third adjusted image to determine the optimized image;
[0084] The image brightness of the second adjusted image is determined by mapping the second adjusted image to the RGB color space and converting the RGB color space to the HSL color space; or, it is determined based on the average pixel value of the second adjusted image; or, the pixel variance is determined based on the average pixel value of the second adjusted image, and then determined based on the pixel variance.
[0085] The preset smoothing algorithm includes Gaussian filtering, median filtering, or bilateral filtering.
[0086] After performing steps 101 to 103 and steps 301 to 303, this application achieves the adjustment of brightness in some monochrome areas of the image to be processed, and also achieves the enhancement of contrast of the first adjusted image. After enhancing the contrast of the first adjusted image, this application needs to further adjust the overall image brightness of the second adjusted image to reduce the overall image brightness of the second adjusted image to below the preset brightness, thereby further reducing display power consumption.
[0087] In step 401, this application can achieve the image brightness of the second adjusted image in three ways. The first way is to map the second adjusted image to the RGB color space, then convert the RGB color space to the HSL color space, and determine the image brightness of the second adjusted image based on the brightness value in the HSL color space. The second way is to determine the brightness based on the average pixel value of the second adjusted image. In such an embodiment, this application can convert the image to a grayscale image, then calculate the average pixel value using a weighted average algorithm, and thus determine the image brightness of the second adjusted image. The third way is to determine the pixel variance based on the average pixel value of the second adjusted image, and then determine the image brightness of the second adjusted image based on the pixel variance.
[0088] In step 402, it is first determined whether the image brightness is greater than the preset brightness. If the image brightness is less than or equal to the preset brightness, it is considered that the image brightness has met the low power consumption display standard and there is no need to reduce the brightness. If the image brightness is greater than the preset brightness, it is considered that the image brightness is too high and the overall brightness of the second adjusted image can be reduced. In this application, a preset smoothing algorithm can be used to process the image brightness until the image brightness is less than or equal to the preset brightness, and then the third adjusted image is determined.
[0089] The preset smoothing algorithm includes Gaussian filtering, median filtering, or bilateral filtering. Median filtering replaces the current pixel value with the mean of the surrounding pixel values. In median filtering, the weight of each pixel in the neighborhood is equal. In Gaussian filtering, the weight of the center point is increased and the weight of pixels farther from the center point is decreased. Based on this, the sum of different weights of each pixel value in the neighborhood is calculated. Bilateral filtering is a filtering method that comprehensively considers spatial and color information and can effectively protect the edge information in the image during the filtering process.
[0090] This application may also first map the second adjusted image to the RGB color space, then convert the RGB color space to the HSL color space, determine the image brightness of the second adjusted image based on the brightness value in the HSL color space, and repeat the following steps: if the image brightness of the second adjusted image is greater than the preset brightness, reduce the image brightness of the second adjusted image according to the preset value; until the image brightness of the second adjusted image is less than or equal to the preset brightness, and determine the third adjusted image.
[0091] For example, in the actual adjustment process, if 255 represents the maximum brightness and 0 represents the minimum brightness, by setting a preset brightness, which can be 128, the image brightness will be less than or equal to 128, thus determining the third adjusted image.
[0092] In step 403, the third adjusted image is converted to determine the optimized image. If the application uses the first method in step 401 to process and determine the image brightness of the second adjusted image, the third adjusted image is still in HSL color space. Further, the HSL color space is converted to an RGB image to determine the optimized image. If the application uses the second or third method in step 401 to process and determine the image brightness of the second adjusted image, the third adjusted image is a grayscale image. Further, the grayscale image is converted to an RGB image to determine the optimized image.
[0093] As an embodiment of this application, this application acquires an image to be processed, determines one or more regions to be adjusted in the image to be processed, wherein the regions to be adjusted are monochrome regions in the image to be processed; determines a brightness parameter for each region to be adjusted, adjusts the pixel brightness of the pixels in the regions to be adjusted according to the brightness parameter, determines a first adjusted image, and determines the first adjusted image as the optimized image.
[0094] As an embodiment of this application, this application acquires an image to be processed, determines one or more regions to be adjusted in the image to be processed, wherein the regions to be adjusted are monochrome regions in the image to be processed; determines a brightness parameter for each region to be adjusted, adjusts the pixel brightness of the pixels in the regions to be adjusted according to the brightness parameter, determines a first adjusted image, converts the first adjusted image into a grayscale image, and acquires the contrast of the grayscale image; determines a gain parameter based on the contrast of the grayscale image, wherein the gain parameter is a number greater than 1; adjusts the grayscale value of the grayscale image according to the gain parameter, determines a second adjusted image, and identifies the second adjusted image as the optimized image.
[0095] As an embodiment of this application, this application acquires an image to be processed, determines one or more regions to be adjusted in the image to be processed, wherein the regions to be adjusted are monochrome regions in the image to be processed; determines a brightness parameter for each region to be adjusted, adjusts the pixel brightness of the pixels in the regions to be adjusted according to the brightness parameter, determines a first adjusted image, converts the first adjusted image into a grayscale image, and acquires the contrast of the grayscale image; determines a gain parameter based on the contrast of the grayscale image, wherein the gain parameter is a number greater than 1; adjusts the grayscale value of the grayscale image according to the gain parameter, and determines a second adjusted image; determines the image brightness of the second adjusted image; processes the image brightness according to a preset smoothing algorithm until the image brightness is less than or equal to a preset brightness, and determines a third adjusted image; converts the third adjusted image, and determines an optimized image.
[0096] As an embodiment of this application, this application acquires an image to be processed, determines one or more regions to be adjusted in the image to be processed, wherein the regions to be adjusted are monochrome regions in the image to be processed; determines a brightness parameter for each region to be adjusted, adjusts the pixel brightness of the pixels in the regions to be adjusted according to the brightness parameter, determines a first adjusted image, and determines the image brightness of the first adjusted image; processes the image brightness according to a preset smoothing algorithm until the image brightness is less than or equal to a preset brightness, determines a third adjusted image; and converts the third adjusted image to determine an optimized image.
[0097] Figure 5 This is a schematic flowchart illustrating the process of determining one or more regions to be adjusted in an embodiment of this application. The process of determining one or more regions to be adjusted in the image to be processed includes:
[0098] Step 501: Convert the image to be processed into a grayscale image, binarize the grayscale image, and obtain a black and white image;
[0099] Step 502: Segment the black and white image using a contour detection algorithm to obtain all foreground regions;
[0100] Step 503: Determine one or more regions to be adjusted from all the foreground regions.
[0101] In step 501, the image to be processed can be viewed as a matrix. An image containing RGB values can be considered a three-dimensional matrix, where the first dimension is the length, the second is the width, and the third dimension represents the values of G, B, and R respectively. It can be seen as a superposition of these three colors. When converting the image to grayscale, the expected values of the RGB primary colors of each pixel are calculated according to certain coefficient ratios. Then, all RGB values of each pixel are set to the expected values for that point. The RGB coefficients for converting a color image to a grayscale image are 0.299, 0.587, and 0.114, respectively, and can be determined using the following formula:
[0102] Y = 0.229R + 0.587G + 0.114B (1)
[0103] Where Y is the grayscale pixel value, R is the red pixel value, G is the green pixel value, and B is the blue pixel value.
[0104] Furthermore, based on the grayscale image, binarization processing from 0 to 1 is performed. First, the expected value of the entire matrix is calculated, and this expected value is used as the critical point for binarization. Then, each pixel is traversed. If the pixel value is greater than or equal to the expected value, its value is changed to 1; otherwise, it is changed to 0, thereby realizing the binarization processing of the grayscale image and obtaining a black and white image.
[0105] In step 502, this application may use the contour detection algorithm in the cross-platform computer vision and machine learning software library OpenCV to segment the black and white image, determine the foreground region and background region in the black and white image, wherein the foreground region is the region of interest, and the background region is the region of no interest, and determine all foreground regions.
[0106] In step 503, this application can determine all foreground regions from the black and white image, extract all monochrome regions from these regions of interest, and determine the monochrome regions as one or more regions to be adjusted.
[0107] Optionally, determining one or more regions to be adjusted from all the foreground regions includes:
[0108] Determine the number of pixels in each foreground region, and identify foreground regions with a number of pixels greater than a preset number as regions to be adjusted.
[0109] For the image to be processed, if the area to be adjusted occupies a small proportion of the image, adjusting the brightness of each area would increase computational power consumption. Although this process can adjust the brightness of the area to be adjusted, the actual power reduction is weak and it will further increase computational power consumption. To solve this technical problem, this application needs to screen all foreground areas and only adjust the brightness of the areas to be adjusted that occupy a large proportion of the image to be processed, thereby truly achieving the goal of reducing display power consumption. The proportion of the area to be adjusted in the image to be processed can be determined by the total number of pixels corresponding to its foreground area and the total number of pixels in the image to be processed, or the foreground area with a number of pixels greater than a preset number can be determined as the area to be adjusted.
[0110] In other embodiments, a bounding box algorithm can be used to process each foreground region to determine the region to be adjusted. The larger the predicted value, the larger the area of the foreground region; the smaller the predicted value, the smaller the area of the foreground region. Foreground regions with an area greater than a preset area are determined as regions to be adjusted. In another variation, the areas of the foreground regions are sorted in descending order, and a preset number of foreground regions are selected as regions to be adjusted in descending order of area.
[0111] Figure 6 The fourth schematic flowchart of an image display method provided in one embodiment of this application further includes:
[0112] Step 601: Obtain the red channel value, green channel value, and blue channel value of each pixel in the area to be adjusted;
[0113] Step 602: For each pixel, input the red channel value, green channel value and blue channel value of the pixel into the preset parameter model, and obtain the brightness parameter output by the preset parameter model;
[0114] Step 603: Adjust the red channel value, green channel value, and blue channel value of the pixel based on the brightness parameter to obtain the adjusted pixel;
[0115] Step 604: Determine the first adjusted image based on all the adjusted pixels;
[0116] The preset parameter model is generated by training based on the red channel values, green channel values, blue channel values, and sample brightness parameters of all sample pixels.
[0117] As an optional embodiment of determining the first adjusted image in this application, in step 601, the pixel value of each pixel is composed of its red channel value, green channel value and blue channel value. Therefore, in order to determine the brightness parameter, this application first obtains the red channel value, green channel value and blue channel value of each pixel in the area to be adjusted.
[0118] In step 602, this application aims to determine the corresponding brightness parameter for each pixel in the region to be adjusted. Therefore, for any pixel, the red channel value, green channel value, and blue channel value of the pixel are input to a preset parameter model to obtain the brightness parameter output by the preset parameter model. The preset parameter model can be a preset linear equation or a neural network model. Specifically, if the preset parameter model is a preset linear equation, it is determined by linear fitting based on the red channel value, green channel value, blue channel value, and sample brightness parameter of all sample pixels. If the preset parameter model is a neural network model, it is trained and generated based on the red channel value, green channel value, blue channel value, and sample brightness parameter of all sample pixels.
[0119] In step 603, the red channel values, green channel values, and blue channel values of the pixel are adjusted based on the brightness parameters to obtain the adjusted pixel. In an optional embodiment, the following formula can be used as a reference:
[0120] g(i,j)=α*f(i,j)+β (2)
[0121] In equation (2), g(i,j) is a three-dimensional array of pixels after adjustment, f(i,j) is a three-dimensional array of each pixel in the region to be adjusted, α is a gain parameter, β is a brightness parameter, and the three-dimensional array includes the red channel value, green channel value and blue channel value of the pixel.
[0122] In another embodiment, the second adjusted image is mapped to the RGB color space, that is, the red channel value, green channel value and blue channel value of the pixel are determined, the RGB color space is then converted to the HSL color space, the brightness value in the HSL color space is determined, and the brightness value in the HSL color space is adjusted based on the brightness parameter to obtain the adjusted pixel.
[0123] In step 604, all pixels are traversed, and the operations of steps 602 to 603 are performed to determine the adjusted pixels corresponding to all pixels, and the first adjusted image is determined based on all the adjusted pixels.
[0124] Figure 7 This is a flowchart illustrating an image display method provided in one embodiment of the present application, which further includes:
[0125] Step 701: Determine the average brightness of each of the regions to be adjusted;
[0126] Step 702: Determine the brightness parameter of the area to be adjusted based on the average brightness of the area, wherein the absolute value of the brightness parameter is proportional to the average brightness of the area;
[0127] Step 703: Adjust the red channel value, green channel value, and blue channel value of the pixel based on the brightness parameter to obtain the adjusted pixel;
[0128] Step 704: Determine the first adjusted image based on all the adjusted pixels.
[0129] As another optional embodiment of determining the first adjustment image in this application, in step 701, since the image content displayed in different areas to be adjusted is located in different positions in the image to be processed, the average brightness of different areas to be adjusted is also different. For each area to be adjusted, the brightness of each pixel in the area to be adjusted is determined, and the average value is taken as the average brightness of the area to be adjusted.
[0130] In step 702, the brightness parameter of the area to be adjusted is determined based on the average brightness of the area. The absolute value of the brightness parameter is proportional to the average brightness of the area. Since the larger the average brightness of the area to be adjusted, the greater the range of brightness adjustment, and consequently the larger the absolute value of the brightness parameter of the area to be adjusted, the absolute value of the brightness parameter is proportional to the average brightness of the area. In this application, the brightness parameter of the area to be adjusted can be determined by multiplying the average brightness of the area by a preset coefficient. This application can also process the average brightness of the area using a preset linear equation, quadratic equation, or other functional equation to determine the brightness parameter of the area to be adjusted.
[0131] In step 703, after determining the brightness parameters of the area to be adjusted, the red channel value, green channel value and blue channel value of each pixel are adjusted according to the brightness parameters to obtain the adjusted red channel value, green channel value and blue channel value, and the adjusted pixel is determined according to the adjusted red channel value, green channel value and blue channel value.
[0132] In step 704, all pixels are traversed until all adjusted pixels are determined, and the first adjusted image is determined based on all adjusted pixels.
[0133] Figure 8 This is a flowchart illustrating an image display method provided in one embodiment of the present application. After determining the first adjusted image, the method further includes:
[0134] The first adjustment image is output to an electronic device for display on the electronic device.
[0135] The specific steps of steps 801 to 803 can be referred to the specific steps of steps 101 to 103 above. Specifically, the image to be processed is obtained; one or more regions to be adjusted in the image to be processed are determined, and the regions to be adjusted are monochrome regions in the image to be processed; the brightness parameter of each region to be adjusted is determined, and the pixel brightness of the pixels in the regions to be adjusted is adjusted according to the brightness parameter to determine the first adjusted image, wherein the brightness parameter is a number less than 0.
[0136] In step 804, the first adjusted image is output to an electronic device to display the first adjusted image on the electronic device. In this embodiment, the present application can reduce display power consumption by reducing the brightness of local areas in the image to be processed.
[0137] In some embodiments, the second adjusted image is output to an electronic device to display the second adjusted image on the electronic device. The embodiments of this application can also improve the contrast of the displayed image and reduce the brightness of local areas in the image to be processed while ensuring image clarity, thereby reducing display power consumption.
[0138] In some embodiments, the third adjusted image is output to an electronic device to display the third adjusted image on the electronic device. The embodiments of this application can adjust the overall brightness of the image so that the average brightness of the image to be processed is lower than a preset threshold. This not only improves the contrast of the displayed image, but also reduces display power consumption by reducing the brightness of local areas in the image to be processed while ensuring image clarity. Furthermore, it can significantly reduce display power consumption by reducing the overall brightness.
[0139] Figure 9 This is a flowchart illustrating an image display method provided in one embodiment of this application. This application performs pixel transformation on the image frame output by the system, identifies large solid color areas and reduces their brightness, and then adjusts the image contrast and overall image brightness before sending the processed image to the display unit for display.
[0140] Optionally, the electronic device in this application is AR glasses, and the display unit is a lens. The display of the AR glasses device is achieved by projecting the image to be processed onto the lens of the AR glasses through an optical engine, and finally presenting it to the user. However, due to the special nature of AR glasses, images need to be displayed on the lens, so the image has a certain degree of light transmission, which can easily lead to poor display effects and unclear images for the user. In addition, the power consumption of the optical engine display accounts for a large proportion of the overall power consumption, and the main factor affecting display power consumption is the screen brightness. The higher the brightness, the higher the power consumption. Due to the size limitations of AR glasses, the battery capacity is small, which cannot guarantee a long display time.
[0141] This application embodiment outputs the first adjusted image to an electronic device for display on the electronic device. By reducing the brightness of local areas in the image to be processed, the display power consumption is reduced, thereby improving the battery life of the AR glasses.
[0142] Optionally, this application improves the contrast of the displayed image by outputting the second adjusted image to an electronic device and displaying the second adjusted image on the electronic device. While ensuring image clarity, it reduces the brightness of local areas in the image to be processed, thereby reducing display power consumption and solving the problem of poor display effect of AR glasses and unclear image perceived by users.
[0143] Optionally, this application adjusts the overall brightness of an image by outputting the third adjusted image to an electronic device and displaying the third adjusted image on the electronic device, so that the average brightness of the image to be processed is lower than a preset threshold. This not only improves the contrast of the displayed image, but also reduces display power consumption by reducing the brightness of local areas in the image to be processed while ensuring image clarity. Furthermore, by reducing the overall brightness, it can significantly reduce display power consumption and greatly improve the battery life of AR glasses.
[0144] Figure 10 This is a schematic diagram of the structure of the electronic device provided in this application. For example... Figure 10As shown, the electronic device may include a processor 110, a communications interface 120, a memory 130, and a communication bus 140, wherein the processor 110, the communications interface 120, and the memory 130 communicate with each other via the communication bus 140. The processor 110 can call logical instructions in the memory 130 to execute an image display method, which includes: acquiring an image to be processed; determining one or more adjustable regions of the image to be processed, wherein the adjustable regions are monochrome regions in the image to be processed; determining a brightness parameter for each adjustable region; adjusting the pixel brightness of pixels in the adjustable regions according to the brightness parameter; and determining a first adjusted image, wherein the brightness parameter is a number less than 0.
[0145] Furthermore, the logical instructions in the aforementioned memory 130 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0146] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the methods provided in the above-described method embodiments. The method includes: acquiring an image to be processed; determining one or more regions to be adjusted in the image to be processed, wherein the regions to be adjusted are monochrome regions in the image to be processed; determining a brightness parameter for each region to be adjusted; adjusting the pixel brightness of pixels in the regions to be adjusted according to the brightness parameter; and determining a first adjusted image, wherein the brightness parameter is a number less than 0.
[0147] In another aspect, this application also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the image display method provided in the above-described method embodiments. The method includes: acquiring an image to be processed; determining one or more regions to be adjusted in the image to be processed, wherein the regions to be adjusted are monochrome regions in the image to be processed; determining a brightness parameter for each region to be adjusted; adjusting the pixel brightness of pixels in the regions to be adjusted according to the brightness parameter; and determining a first adjusted image, wherein the brightness parameter is a number less than 0.
[0148] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0149] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0150] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. An image processing method, characterized in that, include: Obtain the image to be processed; One or more regions of the image to be processed are identified as to be adjusted, wherein the regions to be adjusted are monochrome regions in the image to be processed; Determine the brightness parameter of each of the regions to be adjusted, adjust the pixel brightness of the pixels in the regions to be adjusted according to the brightness parameter, and determine the first adjusted image, wherein the brightness parameter is a number less than 0; Determining one or more regions of the image to be processed includes: The image to be processed is converted into a grayscale image, and the grayscale image is binarized to obtain a black and white image; The black and white image is segmented using a contour detection algorithm to obtain all foreground regions; One or more regions to be adjusted are identified from all the foreground regions.
2. The image processing method according to claim 1, characterized in that, Also includes: Convert the first adjusted image to a grayscale image and obtain the contrast of the grayscale image; The gain parameter is determined based on the contrast of the grayscale image, wherein the gain parameter is a number greater than 1; The grayscale value of the grayscale image is adjusted according to the gain parameter to determine the second adjusted image.
3. The image processing method according to claim 2, characterized in that, Also includes: Determine the image brightness of the second adjusted image; The image brightness is processed according to a preset smoothing algorithm until the image brightness is less than or equal to the preset brightness, and then a third adjusted image is determined. The third adjusted image is transformed to determine the optimized image; The image brightness of the second adjusted image is determined by mapping the second adjusted image to the RGB color space and converting the RGB color space to the HSL color space; or, it is determined based on the average pixel value of the second adjusted image; or, the pixel variance is determined based on the average pixel value of the second adjusted image, and then determined based on the pixel variance. The preset smoothing algorithm includes Gaussian filtering, median filtering, or bilateral filtering.
4. The image processing method according to claim 1, characterized in that, The step of determining one or more regions to be adjusted from all the foreground regions includes: Determine the number of pixels in each foreground region, and identify foreground regions with a number of pixels greater than a preset number as regions to be adjusted.
5. The image processing method according to claim 1, characterized in that, Also includes: Obtain the red channel value, green channel value, and blue channel value of each pixel in the area to be adjusted; For each pixel, input the red channel value, green channel value, and blue channel value of the pixel into the preset parameter model, and obtain the brightness parameter output by the preset parameter model; Based on the brightness parameters, the values of the red channel, green channel, and blue channel of the pixel are adjusted to obtain the adjusted pixel. The first adjusted image is determined based on all the adjusted pixels; The preset parameter model is generated by training based on the red channel values, green channel values, blue channel values, and sample brightness parameters of all sample pixels.
6. The image processing method according to claim 1, characterized in that, Also includes: Determine the average brightness of each of the regions to be adjusted; The brightness parameter of the area to be adjusted is determined based on the average brightness of the area, wherein the absolute value of the brightness parameter is proportional to the average brightness of the area; Based on the brightness parameters, the values of the red channel, green channel, and blue channel of the pixel are adjusted to obtain the adjusted pixel. The first adjusted image is determined based on all the adjusted pixels.
7. The image processing method according to claim 1, characterized in that, After determining the first adjusted image, the process also includes: The first adjustment image is output to an electronic device for display on the electronic device.
8. An electronic device, characterized in that, Including the processor; Memory used to store processor-executable instructions; The processor is configured to implement the image processing method according to any one of claims 1 to 7 when executing the executable instructions.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the image processing method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for over-driving control of regional dimming
CN105390096A
KR20200001302A