PROCESSING MANY IMAGES AT ONCE: Order Images By Hue

Hello, Everyone.

I have a folder with high-resolution images and would like to sort them by hue. This means that I need to read all the images, calculate the average hue, sort/order them, and then save them back into another folder. After this, I can open the ordered folder in Touch Designer and visualize them sequentially.
I can easily calculate the Average Hue with a GLSL node for one picture, but what about 100 or more? What is the best workflow for this task? Should I use a phyton extension?
Generalizing; I need to find a workflow that allows me to input many images, apply some calculations to all of them, and output the same number of images processed so that I can make a video out of them.
I am unfamiliar with phyton, so any input or guidelines is appreciated.
Sincerely,

Claudia M.

Hi @PreSerie,

am I right that this does not need to be a realtime task?
If so, you could think about it like this:

  • read an image
  • analyze the hue (here you could also use a RGB to HSV TOP and a Analyze TOP)
  • write the path of the image and the hue value to a table
  • sort the table using the Sort DAT
  • load each image from the sorted table and save it out as a movie

To facilitate this, make use of 2 Timer CHOPs, the first one cycling through all images and in the onCycle callback saving the path and hue into a table. You can fetch the hue via the TOP’s sample method and just using the first returned channel.
The second Timer CHOP would be responsible for loading the images in the new order and saving out the final movie.

There is not much python required here except references to channels and tables. A really nice introduction to these things can be found in our curriculum here:

Hope this helps a bit
cheers
Markus

Hello Markus, yes, it doesn’t have to be in real-time. Thank you so much for your reply. I will watch the linked videos and hopefully understand what you are suggesting.
I need to figure out how a timer CHOP works (I have never used it) and which parameters must be customized with Python code to fetch the hue and path from my Analyze TOP.
Implementation on the same topic: What if I want to calculate the gradient of the color temperature in each image/frame in my folder with GLSL_TOP and save the processed images into a folder (like the example pic)? So, basically, what if I want to process all my images with GLSL code
SAMPLE GRAD PIC
and then save them back into another folder? Thank you in advance. I am trying to work out a pipeline that works for image manipulation. Claudia M.