液晶屏的Dithering功能

看液晶屏手册,发现有一个引脚控制Dithering功能:

Dithering功能简单的说就是用有限的颜色经过处理呈现出更多“显示颜色”的技术。

比如只用黑白两种颜色(0和255),表示下面的灰度图(0到255之间):

如果只是简单的二值化,大于128显示白色(255),小于128显示黑色(0),那么效果为:

这样显示效果惨不忍睹。那怎么使用黑白两色表示出0-255的灰度值呢?控制一个区域内黑白两种点数目的比例就可以了。在一个区域内用很小的白点和黑点填充,如果白点和黑点的数目各占一半,这个区域看起来就是灰度值128,其他灰度值也一样。这就是Dithering技术,也叫图像抖动技术。用Dithering技术处理后,效果为:

还有一个例子:

把经过Dithering处理的图像放大后,可以看到图像中只有黑白两种颜色。

彩色图像也是同样的道理,把有限的颜色经过Dithering处理,可以呈现出更多的颜色:

如果上面的用红色和蓝色,组合出紫色。

上图中,最左边是原图,中间是用液晶屏仅有的颜色显示的图片效果,最右边是用Dithering技术把仅有的颜色组合出更丰富的颜色,优化了图像显示效果。

 

参考:https://www.cnblogs.com/hwl1023/p/3593553.html

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
CT image compression (a) Implement the simplified DCT compression process above for n = 2, 4, and 8 and apply it to the attached image. Show the reconstructed images for these three different cases. [3 images] Compute the PSNR values of the three reconstructed images and discuss what the PSNR value means here. (b) Use the same process in (a) with image transformed to YIQ color model and show the reconstructed image in RGB space. [3 images] Compute the PSNR values of the three reconstructed images and discuss what the PSNR value means here. Dithering 2. Dithering (30%) Convert the image cat2_gray.png to binary (black and white) image with different methods of dithering, show the results, and make some comparison with the results. (a) Apply noise (random) dithering on the provided image and show the result. [1 image] (b) Apply average dithering on the provided image and show the result. [1 image] (c) Apply error diffusion dithering (Floyd-Steinberg algorithm) on the provided image and show the result. [1 image] Image Interpolation Implement the image interpolation function to upsample an image to four times the original width and height. Implement the following two different interpolation methods and show the 4× upsampled images. (a) Apply nearest-neighbor interpolation on the low resolution image, cat3_LR.png, and compute the PSNR with the original high resolution image, cat3_HR.png. [1 image] (b) Apply bilinear interpolation on the low resolution image and compute the PSNR with the high resolution image. [1 image] (c) Apply bicubic interpolation on the low resolution image and compute the PSNR with the high resolution image. [1 image]
以下是Somogyi Stucki抖动算法的MATLAB代码: ``` function output_img = dither_somogyi_stucki(input_img) % Somogyi Stucki dithering algorithm % input_img: grayscale input image (double, range 0-1) % output_img: dithered image (binary) % Define the dithering matrix dither_mat = [0 0 0 8 4; 2 4 8 4 2; 1 2 4 2 1]/42; % Define the dimensions of the input image [height, width] = size(input_img); % Initialize the output image output_img = zeros(height, width); % Iterate over each pixel for y = 1:height for x = 1:width % Calculate the current pixel's value old_pixel = input_img(y,x); % Calculate the new pixel's value new_pixel = old_pixel + dither_mat(mod(y-1,3)+1,mod(x-1,5)+1); % Threshold the new pixel's value if new_pixel >= 0.5 output_img(y,x) = 1; else output_img(y,x) = 0; end % Calculate the quantization error quant_error = old_pixel - output_img(y,x); % Distribute the quantization error to neighboring pixels if x < width input_img(y,x+1) = input_img(y,x+1) + quant_error * 8/42; end if x < width-1 input_img(y,x+2) = input_img(y,x+2) + quant_error * 4/42; end if x > 1 && y < height input_img(y+1,x-1) = input_img(y+1,x-1) + quant_error * 2/42; end if y < height input_img(y+1,x) = input_img(y+1,x) + quant_error * 4/42; end if y < height-1 input_img(y+2,x) = input_img(y+2,x) + quant_error * 2/42; end if x < width && y < height input_img(y+1,x+1) = input_img(y+1,x+1) + quant_error * 8/42; end if x < width && y < height-1 input_img(y+2,x+1) = input_img(y+2,x+1) + quant_error * 4/42; end if x < width-1 && y < height-1 input_img(y+2,x+2) = input_img(y+2,x+2) + quant_error * 2/42; end end end % Convert the output image to binary output_img = logical(output_img); end ``` 请注意,该代码假定输入图像是灰度图像,并且其值范围为0到1。如果你的输入图像不是灰度图像或其值范围不是0到1,你需要先进行适当的处理。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

【ql君】qlexcel

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值