Movatterモバイル変換


[0]ホーム

URL:


CN113658564B - Image color depth conversion method and electronic equipment - Google Patents

Image color depth conversion method and electronic equipment
Download PDF

Info

Publication number
CN113658564B
CN113658564BCN202111002687.9ACN202111002687ACN113658564BCN 113658564 BCN113658564 BCN 113658564BCN 202111002687 ACN202111002687 ACN 202111002687ACN 113658564 BCN113658564 BCN 113658564B
Authority
CN
China
Prior art keywords
grayscale
gray
scale
target
original
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN202111002687.9A
Other languages
Chinese (zh)
Other versions
CN113658564A (en
Inventor
梁达鹏
龙凤
石萌
赵晶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BOE Technology Group Co Ltd
Beijing BOE Display Technology Co Ltd
Original Assignee
BOE Technology Group Co Ltd
Beijing BOE Display Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BOE Technology Group Co Ltd, Beijing BOE Display Technology Co LtdfiledCriticalBOE Technology Group Co Ltd
Priority to CN202111002687.9ApriorityCriticalpatent/CN113658564B/en
Publication of CN113658564ApublicationCriticalpatent/CN113658564A/en
Application grantedgrantedCritical
Publication of CN113658564BpublicationCriticalpatent/CN113658564B/en
Expired - Fee Relatedlegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The invention discloses a method for converting image color depth and electronic equipment, wherein the method comprises the following steps: acquiring original gray scale data of each pixel in an original image; equally dividing an original gray scale range of an original image into a plurality of continuous gray scale intervals, wherein the gray scale intervals correspond to gray scale values in a target gray scale range of a target image one by one; mapping the gray scale value corresponding to the gray scale interval in which the original gray scale value corresponding to each sub-pixel in the original gray scale data is located to be the target gray scale value of the corresponding pixel in the target image; the color depth of the original image is greater than that of the target image; in the mapping process, when the original gray-scale value corresponding to each sub-pixel in the original gray-scale data is located in the same gray-scale interval, if the gray-scale difference between the original gray-scale values corresponding to any two sub-pixels in the original gray-scale data is greater than a set threshold, the target gray-scale values corresponding to any two sub-pixels in the target image are adjusted to be different gray-scale values.

Description

Translated fromChinese
一种图像色深转换的方法、电子设备Method and electronic device for image color depth conversion

技术领域technical field

本发明涉及显示领域,尤其是涉及一种图像色深转换的方法、电子设备。The invention relates to the field of display, in particular to a method for image color depth conversion and electronic equipment.

背景技术Background technique

现有Memory in Pixel(MIP)技术的LCD显示屏,每个像素(Pixel)的RGB三个通道(也可以称之为子像素)只能实现各1bit的色深,而主控Android系统中RGB三个通道通常是各8bit色深。因此,在使用MIP LCD显示屏显示图片时,需要将待显示的色深位数高的图像转换为色深位数低的图像后,再发送到MIP LCD显示屏上解码显示。In the existing LCD display with Memory in Pixel (MIP) technology, the three RGB channels (also called sub-pixels) of each pixel (Pixel) can only achieve a color depth of 1 bit, while the RGB channel in the main control Android system The three channels are usually 8bit color depth each. Therefore, when using the MIP LCD display to display pictures, it is necessary to convert the image with a high number of color depth bits to be displayed into an image with a low number of color depth bits, and then send it to the MIP LCD display for decoding and display.

在现有技术中,将8bit色深图像转换为1bit色深图像时,先提取8bit色深图像中每个子像素的R、G、B各颜色的8位灰阶值二进制数据中的最高1位,作为1bit色深图像中对应像素的R、G、B各颜色的灰阶值,其它二进制数据位丢弃。In the prior art, when converting an 8-bit color-depth image into a 1-bit color-depth image, first extract the highest bit of the 8-bit grayscale value binary data of each sub-pixel of R, G, and B in the 8-bit color depth image , as the grayscale values of the R, G, and B colors of the corresponding pixel in the 1-bit color depth image, and the other binary data bits are discarded.

由于上述方案是通过提取8bit色深图像的R、G、B子像素最高位作为1bit色深图像对应的R、G、B子像素的灰阶值的,在将8bit色深图像转换为1bit色深图像时,当1bit色深图像中R、G、B各子像素的灰阶值均为1时,显示白画面,或者1bit色深图像中R、G、B各子像素的灰阶值均为0时,显示黑画面,而原图像(8bit色深图像)并非白色或者黑色时,则会造成1bit色深图像中对应像素的颜色丢失,造成显示的图像观感不佳,影响具有MIP LCD显示屏的电子设备的推广效果。Since the above solution extracts the highest bits of the R, G, and B sub-pixels of the 8-bit color-depth image as the grayscale values of the R, G, and B sub-pixels corresponding to the 1-bit color-depth image, the conversion of the 8-bit color-depth image into 1-bit color For deep images, when the grayscale values of R, G, and B subpixels in the 1bit color depth image are all 1, a white picture is displayed, or the grayscale values of the R, G, and B subpixels in the 1bit color depth image are all 1. When it is 0, a black screen is displayed, and when the original image (8bit color depth image) is not white or black, the color of the corresponding pixel in the 1bit color depth image will be lost, resulting in a poor look and feel of the displayed image, which will affect the MIP LCD display. The promotion effect of screen electronic equipment.

鉴于此,如何减少高色深的图像转换为低色深的图像时,出现颜色丢失的现象,成为一个亟待解决的技术问题。In view of this, how to reduce the phenomenon of color loss when an image with high color depth is converted to an image with low color depth has become an urgent technical problem to be solved.

发明内容Contents of the invention

本发明提供一种图像色深转换的方法、电子设备,用以解决现有技术中存在的高色深的图像转换为低色深的图像时,易出现颜色丢失的技术问题。The invention provides a method and electronic equipment for image color depth conversion, which are used to solve the technical problem that color loss is prone to occur when an image with high color depth is converted into an image with low color depth in the prior art.

第一方面,为解决上述技术问题,本发明实施例提供的一种图像色深转换的方法的技术方案如下:In the first aspect, in order to solve the above technical problems, the technical solution of a method for image color depth conversion provided by the embodiment of the present invention is as follows:

获取原始图像中的每个像素的原始灰阶数据;Obtain the original grayscale data of each pixel in the original image;

将所述原始图像的原始灰阶范围等分为多个连续的灰阶区间,使所述多个灰阶区间与目标图像的目标灰阶范围中的灰阶值一一对应;将所述原始灰阶数据中各子像素对应的原始灰阶值所在灰阶区间对应的灰阶值,映射为对应像素在所述目标图像中的目标灰阶值;其中,所述原始图像的色深大于所述目标图像的色深,所述色深用于确定图像的灰阶范围;dividing the original grayscale range of the original image into a plurality of continuous grayscale intervals, so that the grayscale intervals correspond to the grayscale values in the target grayscale range of the target image; The gray-scale value corresponding to the gray-scale interval corresponding to the original gray-scale value of each sub-pixel in the gray-scale data is mapped to the target gray-scale value of the corresponding pixel in the target image; wherein, the color depth of the original image is greater than the specified The color depth of the target image, the color depth is used to determine the grayscale range of the image;

在映射的过程中,当所述原始灰阶数据中每个子像素对应的原始灰阶值均位于同一灰阶区间时,若所述原始灰阶数据中任意两个子像素对应原始灰阶值的灰阶差异大于设定阈值,则将所述任意两个子像素在所述目标图像中对应的目标灰阶值调整为不同灰阶值;其中,所述设定阈值用于界定两个子像素的灰阶差异较大的临界值。During the mapping process, when the original gray-scale values corresponding to each sub-pixel in the original gray-scale data are in the same gray-scale interval, if any two sub-pixels in the original gray-scale data correspond to the original gray-scale values If the level difference is greater than the set threshold, then adjust the target gray scale values corresponding to any two sub-pixels in the target image to different gray scale values; wherein, the set threshold is used to define the gray scales of the two sub-pixels Critical value with large difference.

一种可能的实施方式,将所述原始图像的原始灰阶范围等分为多个连续的灰阶区间,使所述多个灰阶区间与目标图像的目标灰阶范围中的灰阶值一一对应,包括:In a possible implementation manner, the original gray scale range of the original image is equally divided into a plurality of continuous gray scale intervals, so that the gray scale intervals of the multiple gray scale intervals are equal to the gray scale values in the target gray scale range of the target image. One-to-one correspondence, including:

当所述原始图像中不同子像素对应的原始灰阶范围不同时,按所述目标灰阶范围包含的灰阶值的总数,将每个子像素对应的原始灰阶范围划分为多个连续的灰阶区间,并与所述目标灰阶范围中的灰阶值一一对应。When the original grayscale ranges corresponding to different subpixels in the original image are different, the original grayscale range corresponding to each subpixel is divided into a plurality of continuous grayscales according to the total number of grayscale values contained in the target grayscale range scale range, and correspond one-to-one to gray scale values in the target gray scale range.

一种可能的实施方式,若不同子像素的原始灰阶值所在原始灰阶区间对应在所述目标灰阶范围中的灰阶值相同,则确定所述不同子像素对应的原始灰阶值位于同一个灰阶区间。In a possible implementation manner, if the original gray-scale intervals where the original gray-scale values of different sub-pixels are located correspond to the same gray-scale value in the target gray-scale range, it is determined that the original gray-scale values corresponding to the different sub-pixels are located in the same gray scale range.

一种可能的实施方式,若所述原始灰阶数据中任意两个子像素对应原始灰阶值的灰阶差异大于设定阈值,则将所述任意两个子像素在所述目标图像中对应的目标灰阶值调整为不同灰阶值,包括:In a possible implementation manner, if the gray scale difference between any two sub-pixels in the original gray scale data corresponding to the original gray scale value is greater than a set threshold, the target corresponding to the any two sub pixels in the target image Grayscale values are adjusted to different grayscale values, including:

计算所述原始灰阶数据中任意两个子像素的原始灰阶值的差值;calculating the difference between the original grayscale values of any two sub-pixels in the original grayscale data;

若所述差值的绝对值大于所述设定阈值,则将对应的两个子像素中原始灰阶值较大者对应的目标灰阶值设置为大于较小者对应的目标灰阶值;其中,所述较大者和所述较小者的目标灰阶值为相邻的灰阶值,且其中一个的目标灰阶值为所述同一灰阶区间对应的灰阶值。If the absolute value of the difference is greater than the set threshold, then set the target gray-scale value corresponding to the larger original gray-scale value of the corresponding two sub-pixels to be greater than the target gray-scale value corresponding to the smaller one; wherein , the target grayscale values of the larger one and the smaller one are adjacent grayscale values, and the target grayscale value of one of them is the grayscale value corresponding to the same grayscale interval.

一种可能的实施方式,将对应的两个子像素中原始灰阶值较大者对应的目标灰阶值设置为大于较小者对应的目标灰阶值,包括:A possible implementation manner, setting the target gray-scale value corresponding to the larger original gray-scale value of the corresponding two sub-pixels to be greater than the target gray-scale value corresponding to the smaller one, includes:

当所述较大者的目标灰阶值为所述同一灰阶区间在所述目标灰阶范围内对应的灰阶值,则所述较小者的目标灰阶值为低于所述同一灰阶区间一级的灰阶区间对应的灰阶值。When the target grayscale value of the larger one is the grayscale value corresponding to the same grayscale interval within the target grayscale range, the target grayscale value of the smaller one is lower than the same grayscale value The gray scale value corresponding to the gray scale interval of the first level of the scale interval.

一种可能的实施方式,将对应的两个子像素中原始灰阶值较大者对应的目标灰阶值设置为大于较小者对应的目标灰阶值,包括:A possible implementation manner, setting the target gray-scale value corresponding to the larger original gray-scale value of the corresponding two sub-pixels to be greater than the target gray-scale value corresponding to the smaller one, includes:

当所述较小者的目标灰阶值为所述同一灰阶区间在所述目标灰阶范围内对应的灰阶值,则所述较大者的目标灰阶值为高于所述同一灰阶区间一级的灰阶区间对应的灰阶值。When the target grayscale value of the smaller one is the grayscale value corresponding to the same grayscale interval within the target grayscale range, the target grayscale value of the larger one is higher than the same grayscale value The gray scale value corresponding to the gray scale interval of the first level of the scale interval.

一种可能的实施方式,所述设定阈值为所述灰阶区间的大小与设定系数的积。In a possible implementation manner, the set threshold is a product of the size of the gray scale interval and a set coefficient.

一种可能的实施方式,所述设定系数为1/4。A possible implementation manner, the setting coefficient is 1/4.

第二方面,本发明实施例提供了一种电子设备,包括:In a second aspect, an embodiment of the present invention provides an electronic device, including:

主控系统,用于获取高色深的原始图像,并采用如第一方面所述的方法将所述原始图像转换为低色深的目标图像。The main control system is configured to acquire an original image with high color depth, and convert the original image into a target image with low color depth by using the method described in the first aspect.

一种可能的实施方式,所述电子设备,还包括:A possible implementation manner, the electronic device further includes:

低色深显示屏,用于显示从所述主控系统获取的所述目标图像。A low color depth display screen is used to display the target image acquired from the main control system.

一种可能的实施方式,所述低色深显示屏包括MIP LCD显示屏。In a possible implementation manner, the low color depth display screen includes a MIP LCD display screen.

附图说明Description of drawings

图1为本发明实施例提供的一种图像色深转换方法的流程图;FIG. 1 is a flowchart of an image color depth conversion method provided by an embodiment of the present invention;

图2为本发明实施例提供的原始灰阶范围的灰阶区间与目标灰阶范围中的灰阶值的对应关系示意图;FIG. 2 is a schematic diagram of the corresponding relationship between grayscale intervals in the original grayscale range and grayscale values in the target grayscale range provided by an embodiment of the present invention;

图3本发明实施例提供的另一种原始灰阶范围的灰阶区间与目标灰阶范围中的灰阶值的对应关系示意图;Fig. 3 is a schematic diagram of the corresponding relationship between grayscale intervals of another original grayscale range and grayscale values in the target grayscale range provided by an embodiment of the present invention;

图4为本发明实施例提供的另一种原始灰阶范围的灰阶区间与目标灰阶范围中灰阶值的对应关系示意图;FIG. 4 is a schematic diagram of the corresponding relationship between grayscale intervals of another original grayscale range and grayscale values in the target grayscale range provided by an embodiment of the present invention;

图5为本发明实施例提供的不同图像色深转换方法的效果对比图;FIG. 5 is a comparison diagram of effects of different image color depth conversion methods provided by an embodiment of the present invention;

图6为本发明实施例提供的另一种不同图像色深转换方法的效果对比图;Fig. 6 is an effect comparison diagram of another different image color depth conversion method provided by the embodiment of the present invention;

图7为本发明实施例提供的一种电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.

具体实施方式detailed description

本发明实施列提供一种图像色深转换的方法、电子设备,用以解决现有技术中存在的高色深的图像转换为低色深的图像时,易出现颜色丢失的技术问题。色深,即为色彩的深度,在RGB三通道图像中,每一个像素都由R、G、B三个通道组成,其中每个通道又由若干个二进制位来表示,如RGB均为8bit色深,在计算机中表示一个像素对应的色深数据共需要占用24bit的二进制位,例如:111111110000000000000000,前8个二进制位存放的是R的8个二进制数值(均为1),中间8个二进制位存放的是G的8个二进制数值(均为0),后8个二进制位存放的是B的8个二进制数值(均为0),对应像素显示纯红色。Embodiments of the present invention provide a method and electronic equipment for image color depth conversion, which are used to solve the technical problem in the prior art that color loss is prone to occur when an image with high color depth is converted to an image with low color depth. Color depth is the depth of color. In an RGB three-channel image, each pixel is composed of R, G, and B channels, and each channel is represented by several binary bits. For example, RGB is an 8-bit color Deep, the color depth data corresponding to one pixel needs to occupy 24 bits in total in the computer, for example: 111111110000000000000000, the first 8 binary bits store the 8 binary values of R (all 1), and the middle 8 binary bits It stores 8 binary values of G (all 0), and the last 8 binary bits store 8 binary values of B (all 0), and the corresponding pixel displays pure red.

灰阶是将最亮与最暗之间的亮度变化划分为若干层级,中间的层级越多,子像素所能够显示的亮度值越多,相应的图像显示的颜色也越多。例如:一个像素中各子像素均为8bit色深,一个子像素有28=256个灰阶,对应的像素能显示28×28×28=16777216种颜色;若一个像素中各子像素均为1bit色深,则一个子像素只有21=2个灰阶,对应像素能显示21×21×21=8种颜色。Grayscale is to divide the brightness change between the brightest and the darkest into several levels. The more levels in the middle, the more brightness values the sub-pixels can display, and the more colors the corresponding image displays. For example: each sub-pixel in a pixel has an 8bit color depth, and a sub-pixel has 28 =256 gray levels, and the corresponding pixel can display 28 ×28 ×28 =16777216 colors; if each sub-pixel in a pixel All pixels have a 1-bit color depth, so one sub-pixel has only 21 =2 gray levels, and the corresponding pixel can display 21 ×21 ×21 =8 colors.

为了更好的理解上述技术方案,下面通过附图以及具体实施例对本发明技术方案做详细的说明,应当理解本发明实施例以及实施例中的具体特征是对本发明技术方案的详细的说明,而不是对本发明技术方案的限定,在不冲突的情况下,本发明实施例以及实施例中的技术特征可以相互组合。In order to better understand the above technical solutions, the technical solutions of the present invention will be described in detail below through the accompanying drawings and specific examples. It should be understood that the embodiments of the present invention and the specific features in the examples are detailed descriptions of the technical solutions of the present invention, and It is not a limitation to the technical solutions of the present invention, and the embodiments of the present invention and the technical features in the embodiments can be combined with each other under the condition of no conflict.

请参考图1,本发明实施例提供一种图像色深转换的方法,该方法的处理过程如下。Referring to FIG. 1 , an embodiment of the present invention provides a method for image color depth conversion, and the processing process of the method is as follows.

步骤101:获取原始图像中的每个像素的原始灰阶数据;Step 101: Acquire the original grayscale data of each pixel in the original image;

步骤102:将原始图像的原始灰阶范围等分为多个连续的灰阶区间,使多个灰阶区间与目标图像的目标灰阶范围中的灰阶值一一对应;将原始灰阶数据中各子像素对应的原始灰阶值所在灰阶区间对应的灰阶值,映射为对应像素在目标图像中的目标灰阶值;其中,原始图像的色深大于目标图像的色深,色深用于确定图像的灰阶范围。Step 102: Divide the original grayscale range of the original image into a plurality of continuous grayscale intervals, so that the grayscale intervals correspond to the grayscale values in the target grayscale range of the target image; the original grayscale data The gray-scale value corresponding to the gray-scale interval corresponding to the original gray-scale value of each sub-pixel in is mapped to the target gray-scale value of the corresponding pixel in the target image; wherein, the color depth of the original image is greater than the color depth of the target image, and the color depth Used to determine the gray scale range of the image.

例如,以原始图像中的每个像素包括R、G、B三个子像素为例,该图像的色深为RGB8,8,8-bit,即表示原始图像中R、G、B三个子像素的色深均为8bit,8bit色深能表示的灰阶范围为0~(28-1)(即原始灰阶范围为0~255),目标图像中R、G、B三个子像素的色深均为2bit,2bit色深能表示的灰阶范围为0~(22-1)(即目标灰阶范围为0~3)。For example, taking each pixel in the original image includes three sub-pixels R, G, and B as an example, the color depth of the image is RGB8,8,8-bit, which means that the three sub-pixels of R, G, and B in the original image The color depth is 8bit, and the grayscale range that can be represented by 8bit color depth is 0~(28 -1) (that is, the original grayscale range is 0~255), and the color depth of the three sub-pixels R, G, and B in the target image Both are 2bit, and the grayscale range that can be represented by 2bit color depth is 0~(22 -1) (that is, the target grayscale range is 0~3).

按目标灰阶范围中包含灰阶值的总数量(4),将原始灰阶范围(0~255)划分为4个连续的灰阶区间(0~63、64~127、128~191、192~255),并让这4个灰阶区间与目标灰阶范围中的4个灰阶值一一对应,如图2所示,图2为本发明实施例提供的原始灰阶范围的灰阶区间与目标灰阶范围中的灰阶值的对应关系示意图。According to the total number of gray-scale values contained in the target gray-scale range (4), the original gray-scale range (0-255) is divided into 4 continuous gray-scale intervals (0-63, 64-127, 128-191, 192 ~255), and let these 4 grayscale intervals correspond to the 4 grayscale values in the target grayscale range one by one, as shown in Figure 2, Figure 2 is the grayscale of the original grayscale range provided by the embodiment of the present invention Schematic diagram of the corresponding relationship between intervals and grayscale values in the target grayscale range.

由于原始图像中每个像素是由R、G、B三个子像素组成的,因此每个像素的原始灰阶数据包括这三个子像素各自对应的原始灰阶值。如一个像素中R、G、B三个子像素对应的原始灰阶值依次为31、121、195,它们在原始灰阶范围内所在的灰阶区间依次为0~63、64~127、192~255,根据图2中的对应关系,将上述像素中R、G、B三个子像素对应原始灰阶值所在灰阶区间对应在目标灰阶范围中的灰阶值,映射为在目标图像中的目标灰阶值(依次为0、1、3),同样的方式可以将原始图像中的各个像素的原始灰阶数据转换为目标图像中对应像素的目标灰阶数据(由各子像素的目标灰阶值组成),从而实现将高色深图像转换为低色深图像,满足显示屏的色深需求。Since each pixel in the original image is composed of three sub-pixels R, G, and B, the original grayscale data of each pixel includes the original grayscale values corresponding to the three subpixels. For example, the original grayscale values corresponding to the three sub-pixels of R, G, and B in a pixel are 31, 121, and 195 in turn, and the grayscale intervals they are in in the original grayscale range are 0~63, 64~127, 192~ 255. According to the corresponding relationship in FIG. 2, the gray-scale interval corresponding to the gray-scale value of the original gray-scale value of the three sub-pixels of R, G, and B in the pixel corresponds to the gray-scale value in the target gray-scale range, and maps it to the gray-scale value in the target image The target grayscale value (0, 1, 3 in turn), in the same way, the original grayscale data of each pixel in the original image can be converted into the target grayscale data of the corresponding pixel in the target image (by the target grayscale data of each sub-pixel Step value composition), so as to realize the conversion of high color depth images into low color depth images, and meet the color depth requirements of the display screen.

一种可能的实施方式,将原始图像的原始灰阶范围等分为多个连续的灰阶区间,使多个灰阶区间与目标图像的目标灰阶范围中的灰阶值一一对应,还可以通过下列方式实现:In a possible implementation manner, the original grayscale range of the original image is equally divided into multiple continuous grayscale intervals, so that the multiple grayscale intervals correspond to the grayscale values in the target grayscale range of the target image one by one, and This can be achieved by:

当原始图像中不同子像素对应的原始灰阶范围不同时,按目标灰阶范围包含的灰阶值的总数,将每个子像素对应的原始灰阶范围划分为多个连续的灰阶区间,并与目标灰阶范围中的灰阶值一一对应。When the original grayscale ranges corresponding to different subpixels in the original image are different, according to the total number of grayscale values contained in the target grayscale range, the original grayscale range corresponding to each subpixel is divided into a plurality of continuous grayscale intervals, and One-to-one correspondence with grayscale values in the target grayscale range.

例如,仍以原始图像中的每个像素包括R、G、B三个子像素为例,该图像的色深为RGB5,6,5-bit,即表示原始图像中R、B两个子像素的色深均为5bit,对应的原始灰阶范围为0~31,原始图像中G子像素的色深均为6bit,对应的原始灰阶范围为0~63。假设目标图像中三个子像素的色深均为1bit,对应的目标灰阶范围为0~1(包含2个灰阶值)。此时,将原始灰阶范围(0~31)划分为2个灰阶区间(0~15,16~31)、以及将原始灰阶范围(0~63)划分为2个灰阶区间(0~31,32~63),并与目标灰阶范围中的灰阶值一一对应,如图3所示为本发明实施例提供的另一种原始灰阶范围的灰阶区间与目标灰阶范围中的灰阶值的对应关系示意图。For example, still taking each pixel in the original image including three sub-pixels R, G, and B as an example, the color depth of the image is RGB5,6,5-bit, which means that the color depth of the two sub-pixels R and B in the original image The depth is 5bit, and the corresponding original grayscale range is 0-31. The color depth of the G sub-pixel in the original image is 6bit, and the corresponding original grayscale range is 0-63. Assume that the color depth of the three sub-pixels in the target image is 1 bit, and the corresponding target grayscale range is 0 to 1 (including 2 grayscale values). At this time, the original gray scale range (0~31) is divided into 2 gray scale intervals (0~15, 16~31), and the original gray scale range (0~63) is divided into 2 gray scale intervals (0~15, 16~31). ~31, 32~63), and correspond one-to-one with the grayscale values in the target grayscale range, as shown in FIG. Schematic diagram of the corresponding relationship between the grayscale values in the range.

若在原始图像中,一个像素中R、G、B三个子像素对应的原始灰阶值依次为5、31、28,它们在各自对应的原始灰阶范围内所在的灰阶区间依次为0~15、0~31、16~31,根据图3中的对应关系,将上述像素中R、G、B三个子像素对应原始灰阶值所在灰阶区间对应目标灰阶范围中的灰阶值,映射为在目标图像中的目标灰阶值(依次为0、0、1),同样的方式可以将原始图像中的各个像素的原始灰阶数据转换为目标图像中对应像素的目标灰阶数据。If in the original image, the original grayscale values corresponding to the three sub-pixels R, G, and B in a pixel are 5, 31, and 28 in turn, the grayscale intervals of their respective original grayscale ranges are 0~ 15, 0~31, 16~31, according to the corresponding relationship in Figure 3, the gray-scale interval corresponding to the original gray-scale value of the three sub-pixels of R, G, and B in the above pixel corresponds to the gray-scale value in the target gray-scale range, Mapped to the target grayscale value (0, 0, 1 in sequence) in the target image, the original grayscale data of each pixel in the original image can be converted into the target grayscale data of the corresponding pixel in the target image in the same way.

步骤103:在映射的过程中,当原始灰阶数据中每个子像素对应的原始灰阶值均位于同一灰阶区间时,若原始灰阶数据中任意两个子像素对应原始灰阶值的灰阶差异大于设定阈值,则将任意两个子像素在目标图像中对应的目标灰阶值调整为不同灰阶值;其中,设定阈值用于界定两个子像素的灰阶差异较大的临界值。Step 103: During the mapping process, when the original grayscale values corresponding to each sub-pixel in the original grayscale data are in the same grayscale range, if any two subpixels in the original grayscale data correspond to the grayscale values of the original grayscale values If the difference is greater than the set threshold, adjust the corresponding target gray scale values of any two sub-pixels in the target image to different gray scale values; wherein, the set threshold is used to define a critical value where the difference between the gray scales of the two sub-pixels is large.

例如,原始图像中一个像素包括R、G、B三个子像素,色深均为8bit,它们的原始灰阶值依次为63、32、28,设定阈值为16,目标图像中各子像素的色深为2bit,则根据图2中所示的对应关系,可以确定原始灰阶值63、32、28均位于同一灰阶区间(0~63),这使得它们对应的目标灰阶值相同(均为0)。For example, a pixel in the original image includes three sub-pixels R, G, and B, and the color depth is 8 bits. Their original grayscale values are 63, 32, and 28 in turn. The threshold is set to 16. The sub-pixels in the target image If the color depth is 2bit, then according to the corresponding relationship shown in Figure 2, it can be determined that the original grayscale values 63, 32, and 28 are all located in the same grayscale interval (0-63), which makes their corresponding target grayscale values the same ( are all 0).

为了减少颜色丢失,需要进一步判断该像素中的R、G、B三个子像素中任意两个子像素对应的原始灰阶值的灰阶差异是否较大,若较大就需要将它们的灰阶值调整为不同,如判断R、G对应的原始灰阶值(63、32)的灰阶差异(为31)是否大于设定阈值(16),判断结果为是,确定R、G原始灰阶值差异较大,将R、G的目标灰阶值调整为不同(如G的目标灰阶值为0,将R的目标灰阶值调整为1);接着判断R、B对应的原始灰阶值(63、28),R、B对应的灰阶差异为35(大于设定阈值16),将R、B的灰阶值调整为不同(如R的目标灰阶值在上次比较中已调整为1,B则应设置为0);继续判断G、B对应的原始灰阶值(32、28),G、B对应的灰阶差异为4(小于设定阈值16),不调整,至此,上述三个子像素都做了两两灰阶差异判断。因此,可以最终确定R、G、B的原始灰阶值(63、32、28)对应在目标图像中的目标灰阶值依次为1、0、0。同理,原始图像中,其它像素的原始灰阶数据转换为目标图像中目标灰阶数据的方式,与此类似不再赘述。In order to reduce color loss, it is necessary to further judge whether the gray scale difference of the original gray scale values corresponding to any two sub-pixels of the three sub-pixels R, G, and B in this pixel is large, and if it is large, it is necessary to change their gray scale values to Adjust to be different, such as judging whether the gray scale difference (31) of the original gray scale values (63, 32) corresponding to R and G is greater than the set threshold (16), if the judgment result is yes, determine the original gray scale values of R and G If the difference is large, adjust the target grayscale values of R and G to be different (for example, if the target grayscale value of G is 0, adjust the target grayscale value of R to 1); then judge the original grayscale values corresponding to R and B (63, 28), the grayscale difference corresponding to R and B is 35 (greater than the set threshold 16), adjust the grayscale values of R and B to be different (for example, the target grayscale value of R has been adjusted in the last comparison is 1, B should be set to 0); continue to judge the original grayscale values corresponding to G and B (32, 28), the grayscale difference corresponding to G and B is 4 (less than the set threshold 16), do not adjust, so far , the above-mentioned three sub-pixels have made pairwise gray scale difference judgments. Therefore, it can be finally determined that the original grayscale values (63, 32, 28) of R, G, and B correspond to the target grayscale values in the target image as 1, 0, and 0 in sequence. Similarly, the manner in which the original grayscale data of other pixels in the original image is converted into the target grayscale data in the target image is similar to this and will not be repeated here.

在本发明提供的实施例中,在将高色深的原始图像转换为低色深的目标图像的过程中,当原始灰阶数据中每个子像素对应的原始灰阶值均位于同一灰阶区间时,将原始灰阶数据中任意两个子像素对应原始灰阶值的灰阶差异大于设定阈值的子像素,在目标图像中对应的目标灰阶值调整为不同,可以使原始灰阶数据中灰阶差异较大的两个子像素在目标图像的目标灰阶值形成差异,从而降低色彩丢失。In the embodiment provided by the present invention, in the process of converting an original image with high color depth into a target image with low color depth, when the original grayscale values corresponding to each sub-pixel in the original grayscale data are located in the same grayscale interval When the gray scale difference between any two sub-pixels in the original gray scale data corresponding to the original gray scale value is greater than the set threshold, the corresponding target gray scale value in the target image is adjusted to be different, which can make the original gray scale data The two sub-pixels with large grayscale difference form a difference in the target grayscale value of the target image, thereby reducing color loss.

一种可能的实施方式,若不同子像素的原始灰阶值所在原始灰阶区间对应在目标灰阶范围中的灰阶值相同,则确定不同子像素对应的原始灰阶值位于同一个灰阶区间。In a possible implementation manner, if the original gray-scale intervals where the original gray-scale values of different sub-pixels are located correspond to the same gray-scale values in the target gray-scale range, then it is determined that the original gray-scale values corresponding to different sub-pixels are located in the same gray scale interval.

对于原始图像中像素包含子像素的色深均相同的情况,可以直接通过各子像素对应的灰阶区间是否相同,确定它们的原始灰阶值是否在同一目标灰阶范围;而对于原始图像中像素包含子像素的色深不同的情况,则需要根据不同子像素的原始灰阶值所在原始灰阶区间对应在目标灰阶范围中的灰阶值是否相同,确定它们的原始灰阶值是否在同一目标灰阶范围。For the case that the pixels in the original image contain the same color depth of sub-pixels, you can directly determine whether their original gray-scale values are in the same target gray-scale range by checking whether the gray-scale intervals corresponding to each sub-pixel are the same; and for the original image If the pixel contains sub-pixels with different color depths, it is necessary to determine whether their original gray-scale values are within Same target grayscale range.

例如,仍以原始图像中的每个像素包括R、G、B三个子像素为例,该图像的色深为RGB5,6,5-bit,目标图像的色深为1bit,假设设定阈值为4,该原始图像中一个像素中R、G、B三个子像素的原始灰阶值依次为13、28、5,则根据图3中的对应关系,可以确定此像素中R、G、B三个子像素的原始灰阶值所在的灰阶区间依次为0~15、0~31、0~15,对应的目标灰阶值均为0,因此可以确定此像素中R、G、B三个子像素的原始灰阶值均位于同一个灰阶区间。For example, still taking each pixel in the original image including three sub-pixels of R, G, and B as an example, the color depth of the image is RGB5, 6, 5-bit, and the color depth of the target image is 1 bit, assuming that the threshold is set to 4. The original grayscale values of the R, G, and B sub-pixels in one pixel in the original image are 13, 28, and 5 in sequence. Then, according to the corresponding relationship in Figure 3, it can be determined that the three sub-pixels of R, G, and B in this pixel are The gray-scale intervals of the original gray-scale values of sub-pixels are 0-15, 0-31, 0-15, and the corresponding target gray-scale values are all 0, so it can be determined that the three sub-pixels of R, G, and B in this pixel The original grayscale values of are all in the same grayscale interval.

确定R(13)与G(28)、R与B(5)、G与B的灰阶差异依次为5、8、23,灰阶差异均大于设定阈值(4),对于R(13)与G(28),第一次调整:将R与G的目标灰阶值调整为不同(G调整为1,R保持为0);对于R(13)与B(5),第二次调整:将R与B的目标灰阶值调整为不同(R调整为1,B保持为0);对于G(28)与B(5),第三次调整:将G与B的目标灰阶值调整为不同(G为1,B为0),因此,最后定R(13)、G(28)、B(5)对应的目标灰阶值依次为1、1、0。It is determined that the grayscale differences between R(13) and G(28), R and B(5), and G and B are 5, 8, and 23 in sequence, and the grayscale differences are all greater than the set threshold (4). For R(13) and G(28), the first adjustment: adjust the target grayscale values of R and G to be different (G is adjusted to 1, R remains at 0); for R(13) and B(5), the second adjustment : Adjust the target grayscale values of R and B to be different (R is adjusted to 1, B remains at 0); for G(28) and B(5), the third adjustment: the target grayscale values of G and B Adjust to be different (G is 1, B is 0), therefore, the target grayscale values corresponding to R(13), G(28), and B(5) are finally set to be 1, 1, and 0 in sequence.

需要理解的是,在本发明提供的实施例中,原始图像的像素中包含子像素的原始灰阶值的比较顺序可以是任意的,如原始图像的像素中包含R、G、B子项像素时,可以按照R与G、R与B、G与B的顺序依次比较,也可以按照G与B、R与B、R与G的顺序比较,就实际显示效果而言,按照R与G、R与B、G与B的顺序依次比较更好。It should be understood that, in the embodiments provided by the present invention, the comparison order of the original grayscale values of the sub-pixels contained in the pixels of the original image can be arbitrary, such as the pixels of the original image containing R, G, B sub-item pixels , can be compared in the order of R and G, R and B, G and B, or can be compared in the order of G and B, R and B, R and G. As far as the actual display effect is concerned, in accordance with R and G, The order of R and B, G and B is better in turn.

一种可能的实施方式,若原始灰阶数据中任意两个子像素对应原始灰阶值的灰阶差异大于设定阈值,则将任意两个子像素在目标图像中对应的目标灰阶值调整为不同灰阶值,还可以通过下列方式实现:In a possible implementation, if the grayscale difference between any two subpixels corresponding to the original grayscale value in the original grayscale data is greater than the set threshold, adjust the target grayscale values corresponding to any two subpixels in the target image to be different. Grayscale values can also be achieved in the following ways:

计算原始灰阶数据中任意两个子像素的原始灰阶值的差值;若差值的绝对值大于设定阈值,则将对应的两个子像素中原始灰阶值较大者对应的目标灰阶值设置为大于较小者对应的目标灰阶值;其中,较大者和较小者的目标灰阶值为相邻的灰阶值,且其中一个的目标灰阶值为同一灰阶区间对应的灰阶值。Calculate the difference between the original grayscale values of any two sub-pixels in the original grayscale data; if the absolute value of the difference is greater than the set threshold, the target grayscale corresponding to the larger original grayscale value of the corresponding two subpixels The value is set to be greater than the target grayscale value corresponding to the smaller one; among them, the target grayscale value of the larger one and the smaller one are adjacent grayscale values, and one of the target grayscale values corresponds to the same grayscale interval grayscale value.

例如,以原始图像中的每个像素包括R、G、B三个子像素为例,该图像中每个像素包含子像素的色深为8bit,目标图像中每个像素包含的子像素的色深为1bit,设定阈值为32,上述原始图像的原始灰阶范围的灰阶区间与目标图像的目标灰阶范围的灰阶值的对应关系如图4所示,图4为本发明实施例提供的另一种原始灰阶范围的灰阶区间与目标灰阶范围中灰阶值的对应关系示意图。For example, taking each pixel in the original image includes three sub-pixels of R, G, and B as an example, the color depth of each pixel in this image is 8bit, and the color depth of each pixel in the target image is is 1 bit, and the threshold is set to 32, the corresponding relationship between the grayscale range of the original grayscale range of the original image and the grayscale value of the target grayscale range of the target image is shown in Figure 4, which is provided by the embodiment of the present invention A schematic diagram of the corresponding relationship between the gray-scale intervals of another original gray-scale range and the gray-scale values in the target gray-scale range.

原始图像中一个像素包含的R、G、B的原始灰阶值依次为20、15、100,第一次:计算R与G的差值为20-15=-5,该差值(-5)的绝对值为5(小于设定阈值32),因此,不需对R和G对应的目标灰阶值进行调整;第二次:计算R与B的差值为20-100=-80,该差值(-80)的绝对值为80(大于设定阈值32),将R、B的目标灰阶值调整为不同,由于R的原始灰阶值(20)小于B的原始灰阶值(100),因此R与B中R的原始灰阶值为较小者、B的原始灰阶值为较大者,将R的目标灰阶值保持为0、B的目标灰阶值调整为1;第三次:计算G与B的差值为15-100=-85,此差值(-85)的绝对值为85(大于设定阈值32),将G与B的目标灰阶值设置为不同,由于G的原始灰阶值(15)小于B的原始灰阶值(100),因此,G与B中G的原始灰阶值为较小者、B的原始灰阶值为较大者,将G的目标灰阶值保持为0、B的目标灰阶值调整为1。最终得到R、G、B的目标灰阶值依次为0、0、1。The original grayscale values of R, G, and B included in one pixel in the original image are 20, 15, and 100 in turn. For the first time: calculate the difference between R and G as 20-15=-5, and the difference (-5 ) has an absolute value of 5 (less than the set threshold 32), therefore, there is no need to adjust the target grayscale values corresponding to R and G; the second time: calculate the difference between R and B as 20-100=-80, The absolute value of the difference (-80) is 80 (greater than the set threshold 32), and the target grayscale values of R and B are adjusted to be different, because the original grayscale value of R (20) is smaller than the original grayscale value of B (100), therefore, among R and B, the original grayscale value of R is smaller, and the original grayscale value of B is larger, and the target grayscale value of R is kept at 0, and the target grayscale value of B is adjusted to 1; the third time: Calculate the difference between G and B as 15-100=-85, the absolute value of this difference (-85) is 85 (greater than the set threshold 32), and set the target grayscale value of G and B Set to be different, because the original grayscale value of G (15) is smaller than the original grayscale value of B (100), therefore, the original grayscale value of G is smaller among G and B, and the original grayscale value of B is smaller. If it is larger, keep the target grayscale value of G as 0, and adjust the target grayscale value of B as 1. Finally, the target grayscale values of R, G, and B are 0, 0, and 1 in sequence.

将对应的两个子像素中原始灰阶值较大者对应的目标灰阶值设置为大于较小者对应的目标灰阶值,还可以通过下列方式实现:Setting the target grayscale value corresponding to the larger original grayscale value of the two corresponding sub-pixels to be greater than the target grayscale value corresponding to the smaller one can also be achieved in the following ways:

当较大者的目标灰阶值为同一灰阶区间在目标灰阶范围内对应的灰阶值,则较小者的目标灰阶值为低于同一灰阶区间一级的灰阶区间对应的灰阶值。When the target grayscale value of the larger one is the grayscale value corresponding to the same grayscale interval within the target grayscale range, the target grayscale value of the smaller one is corresponding to the grayscale interval one level lower than the same grayscale interval. grayscale value.

例如,以原始图像中的每个像素包括R、G、B三个子像素为例,该图像中每个像素包含子像素的色深为8bit,目标图像中每个像素包含的子像素的色深为2bit,设定阈值为16。For example, taking each pixel in the original image includes three sub-pixels of R, G, and B as an example, the color depth of each pixel in this image is 8bit, and the color depth of each pixel in the target image is It is 2bit, and the threshold is set to 16.

在原始图像中,一个像素的R、G、B三个子像素的原始灰阶值依次为120、85、95,它们均位于原始灰阶范围内的64~127这一个灰阶区间(对应目标灰阶范围内的灰阶值1),R与G、R与B、G与B的灰阶差异依次为35(大于设定阈值16)、25(大于设定阈值16)、10(小于设定阈值16),需要对R与G、R与B一次进行调整,首先将R与G的目标灰阶值调整为不同,具体在调整时,若将较大者的目标灰阶值调整为所在灰阶区间在目标灰阶范围内对应的灰阶值(即R的目标灰阶值调整为1),则较小者的目标灰阶值应设置为低于其所在灰阶区间一级的灰阶区间(0~63)在目标灰阶范围对应的灰阶值(即G的目标灰阶值调整为0);其次,将R与B的目标灰阶值调整为不同,具体在调整时,若将较大者的目标灰阶值调整为所在灰阶区间在目标灰阶范围内对应的灰阶值(即R的目标灰阶值调整为1),则较小者的目标灰阶值应设置为低于其所在灰阶区间一级的灰阶区间(0~63)在目标灰阶范围对应的灰阶值(即B的目标灰阶值调整为0),最终可以确定R、G、B对应的目标灰阶值依次为1、0、0。In the original image, the original grayscale values of the R, G, and B sub-pixels of a pixel are 120, 85, and 95 in turn, and they are all located in the grayscale range of 64-127 within the original grayscale range (corresponding to the target grayscale Gray scale value within the scale range 1), the gray scale differences between R and G, R and B, and G and B are 35 (greater than the set threshold 16), 25 (greater than the set threshold 16), 10 (less than the set threshold Threshold 16), it is necessary to adjust R and G, R and B once. First, adjust the target gray scale values of R and G to be different. Specifically, when adjusting, if the target gray scale value of the larger one is adjusted to the If the grayscale value corresponding to the grayscale interval is within the target grayscale range (that is, the target grayscale value of R is adjusted to 1), the target grayscale value of the smaller one should be set to a grayscale level one level lower than the grayscale interval in which it is located The grayscale value corresponding to the interval (0~63) in the target grayscale range (that is, the target grayscale value of G is adjusted to 0); secondly, the target grayscale value of R and B is adjusted to be different. Specifically, when adjusting, if Adjust the target grayscale value of the larger one to the grayscale value corresponding to the grayscale interval in the target grayscale range (that is, adjust the target grayscale value of R to 1), then the target grayscale value of the smaller one should be set to For the grayscale value corresponding to the grayscale interval (0-63) one level lower than its grayscale interval in the target grayscale range (that is, the target grayscale value of B is adjusted to 0), finally R, G, and B can be determined. The corresponding target grayscale values are 1, 0, and 0 in sequence.

一种可能的实施方式,将对应的两个子像素中原始灰阶值较大者对应的目标灰阶值设置为大于较小者对应的目标灰阶值,还可以通过下列方式实现:In a possible implementation manner, setting the target gray-scale value corresponding to the larger original gray-scale value of the corresponding two sub-pixels to be greater than the target gray-scale value corresponding to the smaller one can also be achieved in the following manner:

当较小者的目标灰阶值为同一灰阶区间在目标灰阶范围内对应的灰阶值,则较大者的目标灰阶值为高于同一灰阶区间一级的灰阶区间对应的灰阶值。When the target grayscale value of the smaller one is the grayscale value corresponding to the same grayscale interval within the target grayscale range, the target grayscale value of the larger one is corresponding to the grayscale interval one level higher than the same grayscale interval. grayscale value.

例如,以原始图像中的每个像素包括R、G、B三个子像素为例,该图像中每个像素包含子像素的色深为8bit,目标图像中每个像素包含的子像素的色深为2bit,设定阈值为16。For example, taking each pixel in the original image includes three sub-pixels of R, G, and B as an example, the color depth of each pixel in this image is 8bit, and the color depth of each pixel in the target image is It is 2bit, and the threshold is set to 16.

在原始图像中,一个像素的R、G、B三个子像素的原始灰阶值依次为120、85、95,它们均位于原始灰阶范围内的64~127这一个灰阶区间(对应目标灰阶范围内的灰阶值1),R与G、R与B、G与B的灰阶差异依次为35、25、10,需要对R与G、R与B一次进行调整,首先将R与G的目标灰阶值调整为不同,具体在调整时,若将较小者的目标灰阶值调整为所在灰阶区间在目标灰阶范围内对应的灰阶值(即G的目标灰阶值调整为1),则较大者的目标灰阶值应设置为高于其所在灰阶区间一级的灰阶区间(128~191)在目标灰阶范围对应的灰阶值(即R的目标灰阶值调整为2);其次,将R与B的目标灰阶值调整为不同,具体在调整时,若将较小者的目标灰阶值调整为所在灰阶区间在目标灰阶范围内对应的灰阶值(即B的目标灰阶值调整为1),则较大者的目标灰阶值应设置为高于其所在灰阶区间一级的灰阶区间(128~191)在目标灰阶范围对应的灰阶值(即R的目标灰阶值调整为2)。因此,最终确定R、G、B对应的目标灰阶值依次为2、1、1。In the original image, the original grayscale values of the R, G, and B sub-pixels of a pixel are 120, 85, and 95 in turn, and they are all located in the grayscale range of 64-127 within the original grayscale range (corresponding to the target grayscale The gray scale value within the scale range 1), the gray scale differences between R and G, R and B, and G and B are 35, 25, and 10 in turn. It is necessary to adjust R and G, R and B once. The target gray-scale value of G is adjusted to be different. Specifically, when adjusting, if the target gray-scale value of the smaller one is adjusted to the gray-scale value corresponding to the gray-scale interval within the target gray-scale range (that is, the target gray-scale value of G Adjusted to 1), the target grayscale value of the larger one should be set to the grayscale value corresponding to the grayscale interval (128-191) one level higher than the grayscale interval in which it is located (that is, the target grayscale value of R Adjust the grayscale value to 2); secondly, adjust the target grayscale value of R and B to be different, specifically, when adjusting, if the smaller target grayscale value is adjusted so that the grayscale interval is within the target grayscale range The corresponding grayscale value (that is, the target grayscale value of B is adjusted to 1), then the target grayscale value of the larger one should be set to a grayscale interval (128-191) one level higher than the grayscale interval where it is located. The grayscale value corresponding to the grayscale range (that is, the target grayscale value of R is adjusted to 2). Therefore, it is finally determined that the target grayscale values corresponding to R, G, and B are 2, 1, and 1 in sequence.

当子像素的原始灰阶值所在的灰阶区间为原始灰阶范围内的最高灰阶区间时,只能将较大者的目标灰阶值调整为同一灰阶区间在目标灰阶范围内对应的灰阶值,则较小者的目标灰阶值为低于同一灰阶区间一级的灰阶区间对应的灰阶值。When the grayscale interval where the original grayscale value of the sub-pixel is located is the highest grayscale interval within the original grayscale range, only the larger target grayscale value can be adjusted so that the same grayscale interval corresponds to the target grayscale range grayscale value, the smaller target grayscale value is the grayscale value corresponding to the grayscale interval one level lower than the same grayscale interval.

当子像素的原始灰阶值所在的灰阶区间为原始灰阶范围内的最低灰阶区间时,只能将较小者的目标灰阶值调整为同一灰阶区间在目标灰阶范围内对应的灰阶值,则较大者的目标灰阶值为高于同一灰阶区间一级的灰阶区间对应的灰阶值。When the grayscale interval where the original grayscale value of the sub-pixel is located is the lowest grayscale interval within the original grayscale range, only the smaller target grayscale value can be adjusted so that the same grayscale interval corresponds to the target grayscale range The grayscale value of the larger target grayscale value is the grayscale value corresponding to the grayscale interval one level higher than the same grayscale interval.

在本发明提供的实施例中,设定阈值为灰阶区间的大小与设定系数的积。In the embodiment provided by the present invention, the set threshold is the product of the size of the gray scale interval and the set coefficient.

例如,以图2中的例子为例,灰阶区间0~63的大小为64(其余三个灰阶区间同样大小,因此可以任取其一),设定系数为k,则设定阈值为64×k。k为小数。For example, taking the example in Figure 2 as an example, the size of the gray-scale interval 0 to 63 is 64 (the other three gray-scale intervals have the same size, so you can choose one of them), and the coefficient is set to k, then the threshold is set to 64×k. k is a decimal.

优选的,设定系数为1/4。Preferably, the coefficient is set to 1/4.

如:设定阈值为64×k,k为设定系数,则设定阈值为64×0.25=16。For example, if the threshold is set to 64×k, and k is the setting coefficient, then the threshold is set to 64×0.25=16.

如图3所示,原始灰阶范围0~31对应的设定阈值为16×0.25=4,另一原始灰阶范围0~64对应的设定阈值为32×0.25=8,最终使用的设定阈值为多个设定阈值中的最小者(4)。即,对于像素中不同子像素对应的原始灰阶范围不同,最终使用的设定阈值为确定出的多个设定阈值中的最小者。As shown in Figure 3, the set threshold value corresponding to the original gray scale range 0-31 is 16×0.25=4, and the set threshold value corresponding to the other original gray scale range 0-64 is 32×0.25=8. The fixed threshold value is the minimum among multiple set threshold values (4). That is, for different original grayscale ranges corresponding to different sub-pixels in a pixel, the finally used set threshold value is the smallest one among the determined multiple set threshold values.

请参见图5和图6,图5为本发明实施例提供的不同图像色深转换方法的效果对比图,图6为本发明实施例提供的另一种不同图像色深转换方法的效果对比图。Please refer to Figure 5 and Figure 6, Figure 5 is a comparison diagram of the effects of different image color depth conversion methods provided by the embodiment of the present invention, and Figure 6 is a comparison diagram of the effects of another different image color depth conversion methods provided by the embodiment of the present invention .

从图5中可以看出,原始图像中小猪的脸部非白色,用现有技术将高色深的原始图像转换为低色深的目标图像后,小猪的脸部为白色,而使用本申请的方法将原始图像转为低色深的目标图像后,小猪的脸部为非白色,即用本发明的方法可以减少颜色丢失,尤其是对应1bit色深的目标图像,能防止原始图像中有色彩的区域在转换为低色深的图像后显示为黑色或白色。It can be seen from Figure 5 that the face of the piglet in the original image is not white. After converting the original image with high color depth to the target image with low color depth using the existing technology, the face of the piglet is white. After the method of the application converts the original image into a low-color-depth target image, the face of the piglet is non-white, that is, using the method of the present invention can reduce color loss, especially for the target image corresponding to 1bit color depth, which can prevent the original image from Medium-colored areas appear black or white when converted to a low-color-depth image.

请继续参见图6,在原始图像中,小狗的眼底(图中虚线内区域)非白色,用现有技术的方法将高色深的原始图像转换为低色深的目标图像后,小狗的眼底为白色,而使用本申请的方法将原始图像转为低色深的目标图像后,小狗的眼底为非白色,即用本发明的方法可以减少颜色丢失。Please continue to refer to Fig. 6, in the original image, the fundus of the puppy (the area inside the dotted line in the figure) is non-white, after the original image with high color depth is converted into the target image with low color depth by the method of the prior art, the puppy The fundus of the dog is white, and after using the method of the present application to convert the original image into a target image with low color depth, the fundus of the puppy is non-white, that is, the method of the present invention can reduce color loss.

需要理解的是,本发明实施例中的原始图像、目标图像实际为彩色图像,只是限于附图中不能用彩色图像,而使用的灰阶图像,在实际显示时,彩色图像的显示效果。差异会更加明显。此外,在图5和图6中目标图像显示在低色深显示屏的效果。It should be understood that the original image and the target image in the embodiment of the present invention are actually color images, but only limited to the fact that color images cannot be used in the drawings, and the grayscale images used, in actual display, have the display effect of color images. The difference will be more obvious. In addition, in Fig. 5 and Fig. 6 the target image is shown on the low color depth display.

在本发明提供的实施例中,由于设定阈值对图片转化效果具有较大的影响。若设定阈值较大将难以区分灰阶差异大的原始灰阶值,不能起到保留图片信息的作用;若设定阈值较小则会使灰阶差异小(相近)的部分颜色的差异增大,使图片显示失真。而将设定阈值设定在原始灰阶范围内单个灰阶区间较大的1/4,既能保留较多的图片信息,也能使灰阶相近的部分正常显示、不失真。In the embodiment provided by the present invention, the setting of the threshold has a great influence on the image conversion effect. If the threshold value is set larger, it will be difficult to distinguish the original grayscale values with large grayscale differences, and cannot play the role of retaining image information; if the threshold value is set smaller, the difference between some colors with small (similar) grayscale differences will increase. , distorting the image display. However, setting the threshold value at 1/4 of the larger single gray-scale interval within the original gray-scale range can not only retain more image information, but also enable normal display of parts with similar gray scales without distortion.

在本发明提供的实施例中,当目标图像的色深为1bit时,若原始图像的像素中各个子像素的原始灰阶值均位于同一灰阶区间,将像素中任意两个子像素的原始灰阶值的灰阶差异大于设定阈值的两个像素的目标灰阶值设置为不同,将原始灰阶值相对低的一个对应的目标灰阶值调整为0,而将原始灰阶值相对高的一个的目标灰阶值调整为1,从而解决同在原始灰阶范围内的一个灰阶区间内的子像素的目标灰阶值设置为相同的值,而显示白色或黑色,出现颜色丢失的问题。In the embodiment provided by the present invention, when the color depth of the target image is 1 bit, if the original grayscale values of each subpixel in the pixel of the original image are all in the same grayscale interval, the original grayscale values of any two subpixels in the pixel The target grayscale value of the two pixels whose grayscale difference is greater than the set threshold is set to be different, and the corresponding target grayscale value of the one whose original grayscale value is relatively low is adjusted to 0, while the original grayscale value is relatively high The target grayscale value of one of them is adjusted to 1, so as to solve the problem that the target grayscale value of the sub-pixels in a grayscale interval within the original grayscale range is set to the same value, while displaying white or black, color loss occurs question.

基于同一发明构思,本发明一实施例中提供一种电子设备,请参图7,该电子设备,包括:Based on the same inventive concept, an electronic device is provided in an embodiment of the present invention, please refer to FIG. 7, the electronic device includes:

主控系统701,用于获取高色深的原始图像,并采用如上所述的图像色深转换方法将所述原始图像转换为低色深的目标图像。该图像色深转换方法的具体实施方式可参见方法实施例部分的描述,重复之处不再赘述。Themain control system 701 is configured to acquire an original image with high color depth, and convert the original image into a target image with low color depth by using the image color depth conversion method as described above. For the specific implementation of the image color depth conversion method, please refer to the description of the method embodiment, and the repeated parts will not be repeated.

一种可能的实施方式,所述电子设备,还包括:A possible implementation manner, the electronic device further includes:

低色深显示屏702,用于显示从所述主控系统获取的所述目标图像。The low colordepth display screen 702 is used to display the target image acquired from the main control system.

一种可能的实施方式,所述低色深显示屏包括MIP LCD显示屏。In a possible implementation manner, the low color depth display screen includes a MIP LCD display screen.

上述电子设备可以是电视机、显示器、手持设备等,具体不做限定。The foregoing electronic device may be a television, a monitor, a handheld device, etc., and is not specifically limited.

显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and equivalent technologies thereof, the present invention also intends to include these modifications and variations.

Claims (11)

Translated fromChinese
1.一种图像色深转换的方法,其特征在于,包括:1. A method for image color depth conversion, comprising:获取原始图像中的每个像素的原始灰阶数据;Obtain the original grayscale data of each pixel in the original image;将所述原始图像的原始灰阶范围等分为多个连续的灰阶区间,使所述多个灰阶区间与目标图像的目标灰阶范围中的灰阶值一一对应;将所述原始灰阶数据中各子像素对应的原始灰阶值所在灰阶区间对应的灰阶值,映射为对应像素在所述目标图像中的目标灰阶值;其中,所述原始图像的色深大于所述目标图像的色深,所述色深用于确定图像的灰阶范围;dividing the original grayscale range of the original image into a plurality of continuous grayscale intervals, so that the grayscale intervals correspond to the grayscale values in the target grayscale range of the target image; The gray-scale value corresponding to the gray-scale interval corresponding to the original gray-scale value of each sub-pixel in the gray-scale data is mapped to the target gray-scale value of the corresponding pixel in the target image; wherein, the color depth of the original image is greater than the specified The color depth of the target image, the color depth is used to determine the grayscale range of the image;在映射的过程中,当所述原始灰阶数据中每个子像素对应的原始灰阶值均位于同一灰阶区间时,若所述原始灰阶数据中任意两个子像素对应原始灰阶值的灰阶差异大于设定阈值,则将所述任意两个子像素在所述目标图像中对应的目标灰阶值调整为不同灰阶值;其中,所述设定阈值用于界定两个子像素的灰阶差异较大的临界值。During the mapping process, when the original gray-scale values corresponding to each sub-pixel in the original gray-scale data are in the same gray-scale interval, if any two sub-pixels in the original gray-scale data correspond to the original gray-scale values If the level difference is greater than the set threshold, then adjust the target gray scale values corresponding to any two sub-pixels in the target image to different gray scale values; wherein, the set threshold is used to define the gray scales of the two sub-pixels Critical value with large difference.2.如权利要求1所述的方法,其特征在于,将所述原始图像的原始灰阶范围等分为多个连续的灰阶区间,使所述多个灰阶区间与目标图像的目标灰阶范围中的灰阶值一一对应,包括:2. The method according to claim 1, wherein the original grayscale range of the original image is equally divided into a plurality of continuous grayscale intervals, so that the plurality of grayscale intervals are consistent with the target grayscale of the target image. The grayscale values in the scale range correspond one-to-one, including:当所述原始图像中不同子像素对应的原始灰阶范围不同时,按所述目标灰阶范围包含的灰阶值的总数,将每个子像素对应的原始灰阶范围划分为多个连续的灰阶区间,并与所述目标灰阶范围中的灰阶值一一对应。When the original gray-scale ranges corresponding to different sub-pixels in the original image are different, divide the original gray-scale range corresponding to each sub-pixel into a plurality of consecutive gray-scale ranges according to the total number of gray-scale values contained in the target gray-scale range scale range, and correspond one-to-one to gray scale values in the target gray scale range.3.如权利要求2所述的方法,其特征在于,若不同子像素的原始灰阶值所在原始灰阶区间对应在所述目标灰阶范围中的灰阶值相同,则确定所述不同子像素对应的原始灰阶值位于同一个灰阶区间。3. The method according to claim 2, wherein if the original gray-scale intervals where the original gray-scale values of different sub-pixels are located correspond to the same gray-scale values in the target gray-scale range, then determine the different sub-pixels The original grayscale values corresponding to the pixels are in the same grayscale interval.4.如权利要求1-3任一项所述的方法,其特征在于,若所述原始灰阶数据中任意两个子像素对应原始灰阶值的灰阶差异大于设定阈值,则将所述任意两个子像素在所述目标图像中对应的目标灰阶值调整为不同灰阶值,包括:4. The method according to any one of claims 1-3, wherein if the gray-scale difference between any two sub-pixels in the original gray-scale data corresponding to the original gray-scale value is greater than a set threshold, the The target grayscale values corresponding to any two sub-pixels in the target image are adjusted to different grayscale values, including:计算所述原始灰阶数据中任意两个子像素的原始灰阶值的差值;calculating the difference between the original grayscale values of any two sub-pixels in the original grayscale data;若所述差值的绝对值大于所述设定阈值,则将对应的两个子像素中原始灰阶值较大者对应的目标灰阶值设置为大于较小者对应的目标灰阶值;其中,所述较大者和所述较小者的目标灰阶值为相邻的灰阶值,且其中一个的目标灰阶值为所述同一灰阶区间对应的灰阶值。If the absolute value of the difference is greater than the set threshold, then set the target gray-scale value corresponding to the larger original gray-scale value of the corresponding two sub-pixels to be greater than the target gray-scale value corresponding to the smaller one; wherein , the target grayscale values of the larger one and the smaller one are adjacent grayscale values, and the target grayscale value of one of them is the grayscale value corresponding to the same grayscale interval.5.如权利要求4所述的方法,其特征在于,将对应的两个子像素中原始灰阶值较大者对应的目标灰阶值设置为大于较小者对应的目标灰阶值,包括:5. The method according to claim 4, wherein setting the target gray-scale value corresponding to the larger original gray-scale value of the corresponding two sub-pixels to be greater than the target gray-scale value corresponding to the smaller one, comprising:当所述较大者的目标灰阶值为所述同一灰阶区间在所述目标灰阶范围内对应的灰阶值,则所述较小者的目标灰阶值为低于所述同一灰阶区间一级的灰阶区间对应的灰阶值。When the target grayscale value of the larger one is the grayscale value corresponding to the same grayscale interval within the target grayscale range, the target grayscale value of the smaller one is lower than the same grayscale value The gray scale value corresponding to the gray scale interval of the first level of the scale interval.6.如权利要求4所述的方法,其特征在于,将对应的两个子像素中原始灰阶值较大者对应的目标灰阶值设置为大于较小者对应的目标灰阶值,包括:6. The method according to claim 4, wherein setting the target gray-scale value corresponding to the larger original gray-scale value of the corresponding two sub-pixels to be greater than the target gray-scale value corresponding to the smaller one, comprising:当所述较小者的目标灰阶值为所述同一灰阶区间在所述目标灰阶范围内对应的灰阶值,则所述较大者的目标灰阶值为高于所述同一灰阶区间一级的灰阶区间对应的灰阶值。When the target grayscale value of the smaller one is the grayscale value corresponding to the same grayscale interval within the target grayscale range, the target grayscale value of the larger one is higher than the same grayscale value The gray scale value corresponding to the gray scale interval of the first level of the scale interval.7.如权利要求4所述的方法,其特征在于,所述设定阈值为所述灰阶区间的大小与设定系数的积。7. The method according to claim 4, wherein the set threshold is a product of the size of the gray scale interval and a set coefficient.8.如权利要求7所述的方法,其特征在于,所述设定系数为1/4。8. The method according to claim 7, wherein the setting coefficient is 1/4.9.一种电子设备,其特征在于,包括:9. An electronic device, characterized in that it comprises:主控系统,用于获取高色深的原始图像,并采用如权利要求1-8任一项所述的方法将所述原始图像转换为低色深的目标图像。The main control system is used to obtain an original image with high color depth, and convert the original image into a target image with low color depth by using the method according to any one of claims 1-8.10.如权利要求9所述的电子设备,其特征在于,所述电子设备,还包括:10. The electronic device according to claim 9, further comprising:低色深显示屏,用于显示从所述主控系统获取的所述目标图像。A low color depth display screen is used to display the target image acquired from the main control system.11.如权利要求10所述的电子设备,其特征在于,所述低色深显示屏包括MIP LCD显示屏。11. The electronic device according to claim 10, wherein the low color depth display screen comprises a MIP LCD display screen.
CN202111002687.9A2021-08-302021-08-30Image color depth conversion method and electronic equipmentExpired - Fee RelatedCN113658564B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202111002687.9ACN113658564B (en)2021-08-302021-08-30Image color depth conversion method and electronic equipment

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202111002687.9ACN113658564B (en)2021-08-302021-08-30Image color depth conversion method and electronic equipment

Publications (2)

Publication NumberPublication Date
CN113658564A CN113658564A (en)2021-11-16
CN113658564Btrue CN113658564B (en)2022-12-13

Family

ID=78482386

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202111002687.9AExpired - Fee RelatedCN113658564B (en)2021-08-302021-08-30Image color depth conversion method and electronic equipment

Country Status (1)

CountryLink
CN (1)CN113658564B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114268704B (en)*2021-12-202024-09-06北京镁伽科技有限公司Image data conversion method, conversion device, signal generator, and storage medium
CN114244968B (en)*2021-12-202024-01-09北京镁伽科技有限公司Image conversion method, image conversion device and image signal generator
CN114820823A (en)*2022-04-272022-07-29深圳市掌阅科技有限公司Picture loading method of ink screen equipment, electronic equipment and storage medium
CN118115410A (en)*2024-03-062024-05-31硅谷数模(上海)半导体有限公司Data mapping method based on three-dimensional lookup table

Citations (12)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US5410617A (en)*1991-04-251995-04-25Unisys CorporationMethod for adaptively thresholding grayscale image data
JP2002156951A (en)*2000-08-142002-05-31Canon IncDisplay device
TW200601249A (en)*2004-06-172006-01-01Matsushita Electric Tw Co LtdLuminance compensation and frame quality correction method to increase frame contrast and LCD used the method
CN101256751A (en)*2008-04-032008-09-03上海广电光电子有限公司Method for improving color depth of LCD device
CN101668107A (en)*2008-09-042010-03-10中国移动通信集团公司Method, system and device for transforming color depth and transmitting image after color depth transformation
JP2013141123A (en)*2012-01-042013-07-18Fujifilm CorpCorrection method of pixel data, image processing apparatus, program and image formation apparatus
CN103530896A (en)*2013-09-252014-01-22电子科技大学Image compression and detail enhancement method for infrared image
CN103843058A (en)*2011-09-272014-06-04皇家飞利浦有限公司 Apparatus and method for dynamic range transformation of images
CN104732952A (en)*2013-12-232015-06-24昆山国显光电有限公司Color display processing method and system
CN106652955A (en)*2017-01-042017-05-10京东方科技集团股份有限公司Drive circuit of display screen, display method and display device
CN109801240A (en)*2019-01-152019-05-24武汉鸿瑞达信息技术有限公司A kind of image enchancing method and image intensifier device
CN111563851A (en)*2020-03-272020-08-21中国科学院西安光学精密机械研究所 An Image Mapping Method Based on Dynamic Gaussian Parameters

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US9251732B2 (en)*2013-02-202016-02-02Spreadtrum Communications (Shanghai) Co., Ltd.Method and system for image dithering

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US5410617A (en)*1991-04-251995-04-25Unisys CorporationMethod for adaptively thresholding grayscale image data
JP2002156951A (en)*2000-08-142002-05-31Canon IncDisplay device
TW200601249A (en)*2004-06-172006-01-01Matsushita Electric Tw Co LtdLuminance compensation and frame quality correction method to increase frame contrast and LCD used the method
CN101256751A (en)*2008-04-032008-09-03上海广电光电子有限公司Method for improving color depth of LCD device
CN101668107A (en)*2008-09-042010-03-10中国移动通信集团公司Method, system and device for transforming color depth and transmitting image after color depth transformation
CN103843058A (en)*2011-09-272014-06-04皇家飞利浦有限公司 Apparatus and method for dynamic range transformation of images
JP2013141123A (en)*2012-01-042013-07-18Fujifilm CorpCorrection method of pixel data, image processing apparatus, program and image formation apparatus
CN103530896A (en)*2013-09-252014-01-22电子科技大学Image compression and detail enhancement method for infrared image
CN104732952A (en)*2013-12-232015-06-24昆山国显光电有限公司Color display processing method and system
CN106652955A (en)*2017-01-042017-05-10京东方科技集团股份有限公司Drive circuit of display screen, display method and display device
CN109801240A (en)*2019-01-152019-05-24武汉鸿瑞达信息技术有限公司A kind of image enchancing method and image intensifier device
CN111563851A (en)*2020-03-272020-08-21中国科学院西安光学精密机械研究所 An Image Mapping Method Based on Dynamic Gaussian Parameters

Also Published As

Publication numberPublication date
CN113658564A (en)2021-11-16

Similar Documents

PublicationPublication DateTitle
CN113658564B (en)Image color depth conversion method and electronic equipment
CN105096755B (en)A kind of display device and its sub-pixel rendering intent using sub-pixel rendering intent
CN112614457B (en)Display control method, device and system
KR102344334B1 (en)Display apparatus and method for processing image
WO2019119791A1 (en)Driving method and driving apparatus for display apparatus
WO2022032919A1 (en)Grayscale-adaptive correction data control method and apparatus, and led display screen
WO2019119794A1 (en)Driving method and driving apparatus for display apparatus
CN114267291A (en)Gray scale data determination method, device and equipment and screen driving board
KR101094674B1 (en) Pixel Overdrive for LCD Panels with Slow Response Pixels
CN109472874B (en)Display method, display device, VR display device and storage medium
CN101471063A (en)Color signal generating device
CN115713920A (en)Method and system for establishing overdrive lookup table and display
TW202217788A (en)Brightness compensation method, brightness compensation circuit and display device
CN104464684B (en)Method for rendering picture of display
CN114067724A (en)Gray scale data processing method, device and system and display device
CN104952383B (en)Circuit for driving color display to display black-white gray scale image and data conversion circuit
KR102301925B1 (en)Tone mapping method and display device using the same
CN104505053B (en)Show signal conversion method and device
CN105261324B (en)Display method and display panel using the same
EP3296957B1 (en)Method and apparatus for judging image brightness background, and display apparatus
US11715441B2 (en)Virtual reality display device, host device, system and data processing method
CN115050306A (en)Image correction method, preprocessing method thereof and image correction circuit
CN101364401A (en) Color management system and its driving method
CN111312166B (en)Display panel compensation method, display panel and display device
CN115346475A (en) LED display control method, control device, electronic equipment and storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
CF01Termination of patent right due to non-payment of annual fee

Granted publication date:20221213


[8]ページ先頭

©2009-2025 Movatter.jp