これは、画像処理に関する私の最初の譲渡です。 Iは、出力画像の各画素のインデックスは以下の行列として表されると仮定している:出力画像の各インデックス位置にiphoneの画像にピクセル単位で色を追加する方法は?
00 01 02 03 04 05
10 11 12 13 14 15
20 21 22 23 24 25
私は上に描画するために異なる色を有します。たとえば、インデックス00では、そこに置くために使用可能な赤い色があり、他のインデックスと同様に配置されます。私の質問は、これらの色をインデックスに描画して出力イメージを作成する方法です。
更新
これは私が今持っているものです。
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]));
しかし、私はこのエラーを得ました。私は何が間違っているのか指摘できますか?
<Error>: CGContextSetFillColor: invalid context 0x0
<Error>: CGContextFillRects: invalid context 0x0
-1があるのはなぜ? – user1139699
あなたが実際にあなたの課題を試み、あなたが持っている特定の問題について質問をするならば、Stack Overflowから最良の反応を得るでしょう。 – theTRON
この質問はあなたが探しているかもしれないと思います: http://stackoverflow.com/questions/448125/how-to-get-pixel-data-from-a-uimage-cocoa-touchoror -cgimage-core-graphics –