2

I am trying to take pixels from an image and plot them ontop of a Blue Marble map. I have figured out how to project them on to the map. I have just not been able to figure out how to color each individual pixel when they are projected onto the map.
I have been using the plot() method, when I do them individually the terminal automatically kills my process because it has to plot ~65000 times. Is there another method I could use? Is there a way to use an array of pixel colors in any of these methods? Is this possible with PIL?

rgb is the color array with a 3-tuple ie. (14,0,0) etc. full_x and full_y are a 2 dimensional array where it is # of pixels x 5 different x,y points (to make the pixel shape on the blue marble image)

This is where I tried to do an array of colors:

for i in range(len(rgb)):
    hexV = struct.pack('BBB',*rgb[i]).encode('hex')
    hexA.append('#' + hexV)

m.plot(full_x, full_y, color=hexA)

I have also tried:

for i in range(len(rgb)):
    hexV = struct.pack('BBB',*rgb[i]).encode('hex')
    #hexA.append('#' + hexV)
    hexA = '#' + hexV
    m.plot(full_x[i], full_y[i], color=hexA[i])

これは、各ピクセルを個別に実行しようとしたところ、プロセスが自動的に強制終了されました。

どんな助けでも大歓迎です。前もって感謝します。

4

1 に答える 1

1

これを見て同じ問題を抱えている人のために:

どうやら、使用する必要があるのはスキャッターだけです。ピクセル/その他のポイントを複数の色でマッピングするには、x 配列、y 配列、およびピクセル カラー配列でスキャッターを使用します。

于 2012-06-27T21:51:52.610 に答える