In RGB picture each pixel consists of 3 colours: Red, Green and Blue, and the value is between 0 and 255 for each colour. Say, I want a pixel with coordinate (50, 50) to be Red, so I will have
Post the definitions of RED, BLUE, and GREEN.
Are they placeholders for the 0-2 index range?
image[RED] = 255;
image[GREEN] = 0;
image[BLUE] = 0;
Thanks for the reply, I've modernized my code
What does "something is wrong when putting data in" mean?
The main problem is when I start the programm. It builds with no error, but when I try to debug it gives an error and points an arrow to the row image[Ycount][Xcount][RED] = 255;
int XSIZE, YSIZE;
int Xcount, Ycount;
printf("Array height: ");
image = malloc(YSIZE*sizeof(int**));
for (YSIZE=0; YSIZE<Ycount; YSIZE++)
image[YSIZE] = malloc(XSIZE*sizeof(int*));
for (XSIZE=0; XSIZE<Xcount; XSIZE++)
image[YSIZE][XSIZE] = malloc(3*sizeof(int));
for(y = 0; y < YSIZE; y++) //putting data into the array
for(x = 0; x < XSIZE; x++)
image[y][x][RED] = 255; // Value of red colour in the image
image[y][x][GREEN]= 100; // Value of green colour in the image
image[y][x][BLUE]= 100;// Value of blue colour