#217787
how to achieve this ?

let's say i have a 100x75 px, some of the pixels are colored.

if i wanted to loop through x and y pixels and create a vector array of the image's rgb values of each pixel... how would i do that in MEL ?

* * *

thanks for any ideas...
User avatar
By deadalvs
#217799
thanks for the tip !

i am currently trying the colorAtPoint command...

it's not yet working... takes some time, as always... :)
User avatar
By deadalvs
#217803
ah, this is good:

this samples not directly the pixel's value but the uv-position (firstly calculated by the pixel-ratio)...

5: 5th pixel
15: total of 15 pixels

* * *

float $X = (5/15);
float $Y = 1-(5/15);
print("U = " + $X + " and V = " + $Y);
vector $imgColor = `colorAtPoint -o RGB -u $X -v $Y file1`

* * *

found here:
http://store.digital-tutors.com/chit_ch ... hp?p=13266
User avatar
By deadalvs
#223296
this is better:

this samples each pixel in the middle of the pixel, and not at the edge as the other script does.

* * *

int $pxU = 2;
int $pxV = 2;
int $resU = 15;
int $resV = 15;


float $FloatpxU = $pxU + 0.00001;
float $FloatpxV = $pxV + 0.00001;
float $FloatresU = $resU + 0.00001;
float $FloatresV = $resV + 0.00001;


float $X = ( ($FloatpxU/$FloatresU) + (($FloatpxU-1.0)/$FloatresU) ) / 2.0;
float $Y = 1-(( ($FloatpxV/$FloatresV) + (($FloatpxV-1.0)/$FloatresV) )/2.0);
print("U = " + $X + " and V = " + $Y);
vector $imgColor = `colorAtPoint -o RGB -u $X -v $Y file1`;
Help with swimming pool water

Hi Andreas " I would say the above "fake[…]

render engines and Maxwell

Other rendering engines are evolving day by day, m[…]