Как на гистограмме yuv файла очистить изображение на языке C - PullRequest
0 голосов
/ 07 апреля 2020

Я хочу размыть и очистить изображение, но я не знаю, как использовать математические формулы c, такие как гистограмма и усреднение в коде. Изображение уже преобразовано в yuv, поэтому единственная проблема - математические формулы для завершения работы. Кто-нибудь может мне помочь?

#include <stdio.h>

unsigned char yplane[240][416]; //array for the y component i.e. your greyscale image
unsigned char uplane[120][208]; //array for the u component. Needed to create the .yuv output file
unsigned char vplane[120][208]; //array for the v component. Needed to create the .yuv output file

int main()
{
FILE *fd;
FILE *fd2;

fd = fopen("PATH of file yuv", "rb");
fd2 = fopen("PATH of file yuv", "wb");

fread(yplane, 1, sizeof(yplane), fd);
fread(uplane, 1, sizeof(uplane), fd);
fread(vplane, 1, sizeof(vplane), fd);

/*
code to handle one or more of the components
For example the y component can be "seen" as a greyscale image with dimension 416X240
So, the data or the raw image are already stored in the yplane[240][416] array.
*/
fwrite(yplane, 1, sizeof(yplane), fd2);
fwrite(uplane, 1, sizeof(uplane), fd2);
fwrite(vplane, 1, sizeof(vplane), fd2);

fclose(fd2);
fclose(fd);

return 0;
}
...