get average pixel rgb value

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 12 December 2003   #1
get average pixel rgb value

hi all

i once wrote a script in maxscript to take an image and calculate the average of all the pixels' rgb values, and now i need the same thing in maya and my mel is basic to say the least.

i dare say i could work it out but i wondered if anyone has any tips or knows perhaps if there is such a script floating around somewhere.

what i want it for is a scene where i have a character watching tv in a dark room and i want to use a single area light to light him, with its colour derived from an image sequence playing on the tv.

any ideas?


mods - sorry, posted this in wrong forum before
feel free to delete thread in maya forum
Old 12 December 2003   #2
Mel doesn't expose any direct image manipulation functionality, although there are plugins or scripts available to get an iff image as an array of pixels. You can then loop over this array and take the average, could be quite slow depending on the resolution of your image.

A much better way of doing this would be to just scale you image sequence down to like 2 pixels square and plug this in to the light's colour

You can have your characters photoreal, fast or cheap. Pick two.
Old 12 December 2003   #3
thanks ch00ns
i'll see what it looks like doing it that way. perhaps a heavy heavy blur then resize would do pretty much the same
happy new year
Old 01 January 2004   #4
Ok sorry probably I don't really understand what you're trying to do..but why putting the sequence of image directly in the color of the light would't work ?..isn't what you're after ?

Old 01 January 2004   #5
thematt - i don't want the light to project the image sequence - i was just trying to get a dull single color light to illuminate the scene as if the light were coming from a tv in a dark room. a tv doesn't project an image of what its displaying as the light emitted from it is so diffused by the time it hits anything [unless of course the object is right up against the screen]

thanks anyway though for replying

Old 01 January 2004   #6
Yes sure I got it...sorry can't help you with that.

Old 01 January 2006   #7
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 10:37 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.