我們正在嘗試從已上傳的位圖圖像讀取像素,但行 aBrightness =(0.2126 * aPixel [1] .red)+(0.7152 * aPixel [1]。綠色)+(0.0722 * aPixel [1] .blue)總是給出一個錯誤,說明未知屬性:「未定義」中的紅色。3Ds MAx腳本用於從圖像中讀取像素
我們當前的腳本是:
aBitmap = selectBitMap caption:"Select a Bitmap"
Print(aBitmap.height)
Print(aBitmap.width)
aLength = aBitmap.height
aWidth = aBitmap.width
for i = 0 to (aLength - 10) by 10 do
(
for j = 0 to (aWidth - 10) by 10 do
(
Print(i)
Print(j)
aPixel = getPixels aBitmap [i,j] 1
aBrightness = (0.2126*aPixel[1].red) + (0.7152*aPixel[1].green) + (0.0722*aPixel[1].blue)
aBox = box pos:[i,j,0] width:0.1 length:0.1 height:aBrightness
)
)
我們會很感激,關於這個腳本任何幫助。