ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Is there an Expression to find position of brightest pixel on a layer?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mike Potter
Is there an Expression to find position of brightest pixel on a layer?
on Apr 30, 2019 at 8:58:50 am

Is there an Expression to find position of brightest pixel on a dark layer from a cluster of 10-20 moving pixels ?
and then use this position data to move another layer ?


Return to posts index

Kalleheikki Kannisto
Re: Is there an Expression to find position of brightest pixel on a layer?
on May 1, 2019 at 5:41:59 am

You would combine two nested loops for x and y coordinate lookup and use sampleImage() for checking the color values and then store the coordinates of the lightest one in a two-dimensional array and apply that to position of the other layer.

To make life easier, convert the source image to grayscale so you can get the lightness value directly from any channel rather than having to calculate it from the RGB channels (if you have color, that is).

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Mike Potter
Re: Is there an Expression to find position of brightest pixel on a layer?
on May 2, 2019 at 7:40:22 am

I think the expression would be simpler
if by using effects I manage to have just
one single maximum brightness pixel (255,255,255) on a completely dark (0,0,0) background.

How would the expression "sound like" ☺ in this case please ?


Return to posts index


Kalleheikki Kannisto
Re: Is there an Expression to find position of brightest pixel on a layer?
on May 2, 2019 at 9:20:55 am

If you manage to do that the "expression" would sound like a point tracker :)

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

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