FORUMS: list search recent posts

Sampleimage measurement of many pixels

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Paul Roper
Sampleimage measurement of many pixels
on Jun 23, 2011 at 12:06:09 am

Hello

I need to create a 10x10 matrix of numbers, each one representing the brightness of a greyscale pixel underneath it. The 10x10 pixels appear in the comp massively enlarged (in fact it's a 900x900 pixel photoshop image made by enlarging a 10x10 image with nearest neighbour).

I can easily create a text layer with a sampleimage expression and a point control to display the red value of the underlying layer (as I mentioned, it's a greyscale image underneath so I'm only interested in one of the RGB values). But the tricky bit is how can I replicate this easily to do all 100 pixels? Has anyone had experience of maybe using particle playground's grid/text functions plus an expression?

I suspect I may just end up with 100 layers made manually. Not elegant, but I'd probably spend more time figuring out how to do it using expressions. Unless somebody out there has a magic suggestion?!

Thanks,
Paul

red=thisComp.layer("big greyscale image").sampleImage(effect("Point Control")("Point"),[.5, .5])[0];

Math.round(red*255)


Return to posts index

Dan Ebberts
Re: Sampleimage measurement of many pixels
on Jun 23, 2011 at 5:31:23 am

You could sample the 10x10 grid and create a 10x10 grid of numbers, all with a single text layer, but I'm not sure how you'd get the two grids to line up. Maybe you could use a monospaced font so the expression could calculate where each character is located in comp space.


Dan



Return to posts index

Paul Roper
Re: Sampleimage measurement of many pixels
on Jun 23, 2011 at 4:07:40 pm

Thanks Dan, but I went for the manual, tedious method in the end, but put an expression on the position of each text layer to automatically position it correctly. Strangely, some of the 'sampleimage' results were completely wrong, for no apparent reason - for example some points were very dark grey, but the sampleimage gave me a result of around 1. Odd.

Look at all those lovely, boring layers:


...and here's the position expression to space the 100 text layers automatically (in a 10x10 grid layout):

[thisComp.layer(index-10).transform.position[0],thisComp.layer(index-10).transform.position[1]+90]


Return to posts index


Dan Ebberts
Re: Sampleimage measurement of many pixels
on Jun 23, 2011 at 4:45:47 pm

>Strangely, some of the 'sampleimage' results were completely wrong

What does your sampleImage() expression look like?

Dan



Return to posts index

Paul Roper
Re: Sampleimage measurement of many pixels
on Jul 13, 2011 at 8:48:38 pm

Dan - some of the sampleimage results were wrong because I had the text layer parented to a null and shifted out of position, so the pixel it was actually over was not the pixel it "thought" it was over. That was an easy fix...

but...

Now I need to do the same thing, but with a grid of 40 x 45 numbers. That's 1800 numbers = 1800 layers. I tried making a comp of a row of 40 numbers, with each number sampling the picture in the parent comp. This worked perfectly for the first row, so I duplicated it, but obviously it's only one comp, so the expressions only get calculated once, producing a nice row of numbers, which is then duplicated.

So...any further thoughts, anyone?


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]