一個彩色圖像由R G B三個分量組成,一個RGB565的每一個像素點數據為2Byte,即16位,那么從名字上就可看出來這16位中,高5位為R分量,中間6位為G分量,低5位為B分量。
下面做了一個實驗,使用matlab讀取一個圖片,由RGB888轉化為RGB565並進行顯示。如下圖
圖 原始的RBG888圖像
圖 RGB565實驗結果
可以看出來,相對於RGB888,RGB565在圖片質量上還是損失了不少。
代碼:
clear; clc; image=imread('tu.jpg'); image_r=image(:,:,1)/8; image_g=image(:,:,2)/4; image_b=image(:,:,3)/8; RGB=cat(3,image_r,image_g,image_b); subplot(2,2,1),imshow(image_r),title('Red component'); subplot(2,2,2),imshow(image_g),title('green component'); subplot(2,2,3),imshow(image_g),title('blue component'); subplot(2,2,4),imshow(RGB),title('Rgb565');