Hi. This is my first code in C I wrote ... it is supposed to create a grayscale image histogram. How do I save the histogram to a png file?
(I'm not sure the code is correct but there are no compile time errors)
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
unsigned char buffer[10];
init disp;
FILE *img;
img = fopen("name.bin", "rb");
disp = fread(buffer, sizeof(buffer), 1, img);
int hist[256] = { 0 };
int col = 1200;
int row = 1500;
int i;
int j;
int J;
for (j = 0; j < row; j++);
{
for (i = 0; i < col; i++);
{
J = (disp + i + j*col);
hist[J] = hist[J] + 1;
}
}