This is my first assignment about image processing. I'm assuming index of each pixel on output image are represented as matrix below:
00 01 02 03 04 05
10 11 12 13 14 15
20 21 22 23 24 25
At each index of output image I have different color to draw on. For ex, at index 00 I have redcolor available to put there and so on with other indexes. My question is how can I draw these color into the indexes to create the output image?
Update
This is what I have right now:
inputImgAvg //Image for processing
CGContextRef context = UIGraphicsGetCurrentContext();
float yy = groutW / 2; // skip over grout on edge
float stride =(int) (tileW + groutW +0.5);
for(int y=0; y<tilesY; y++) { //Number tile in Y direction
float xx = groutW / 2 ; // skip over grout on edge
for(int x=0; x<tilesX; x++) {
tileRGB = [inputImgAvg colorAtPixel:CGPointMake(x,y)];
//Right here I'm checking tileRGB with list of available color
//Find out the closest color
//Now i'm just checking with greenColor
// best matching tile is found in idx position in vector;
// scale and copy it into proper location in the output
CGContextSetFillColor(context, CGColorGetComponents( [[UIColor greenColor] CGColor]));
But I got this error. Can you point out what did I do wrong?
<Error>: CGContextSetFillColor: invalid context 0x0
<Error>: CGContextFillRects: invalid context 0x0