一、实验要求
1.文件分辨率256*256
2.yuv采样空间4:2:0
3.rgb按照像素BGR依次存放
4.YUV格式按照全部像素的Y数据块、U数据块、V数据块依次存放
二、RGB文件分量提取概率和熵的计算
int main()
{
unsigned char R[65536] = { 0 };
unsigned char G[65536] = { 0 };
unsigned char B[65536] = { 0 };
FILE* fdown;
fdown = fopen("C:\\vs\\shuzhi\\down.rgb", "rb");
unsigned char pix[196608];
fread(pix, 1, 196608, fdown);
for (int i = 0, j = 0;i < Width * Height * 3;i = i + 3)
{
R[j] = pix[i + 2];
G[j] = pix[i + 1];
B[j] = pix[i];
j++;
}
double fre_R[256] = { 0 };
double fre_G[256] = { 0 };
double fre_B[256] = { 0 };
for (int i = 0; i < 256; i++)
{
for (int j = 0; j < 65536; j++)
{
if (int(R[j] == i))
{
fre_R[i]++;
}
}
}
for (int i = 0; i < 256; i++)
{
for (int j = 0; j < 65536; j+