Showing posts with label average. Show all posts
Showing posts with label average. Show all posts

Average Book Covers and a New (official) GIMP Website (maybe)


A little while back I had a big streak of averaging anything I could get my hands on. I am still working on a couple of larger averaging projects (here's a small sneak peek - guess the movie?):








I'm trying out visualizing a movie by mean averaging all of the cuts. Turns out movies have way more than I thought - so it might be a while until I finish this one... :)

On the other hand, here's something neat that is recently finished...

JungleBook: Simple Kindle Ebook Cover Analysis


Jason van Gumster just posted this morning about a neat project he'd been toying with that is along similar lines of the Netflix Top 50 Covers by Genre, but takes it to a deeper level. He's written code to average the top 50 ebook covers on Amazon by genre:

Top 50 Kindle Covers by Jason van Gumster

By itself this is really pretty (to me - not sure if anyone else likes these things as much as I do) but Jason takes it further by providing some analysis and commentary on the resulting images in the context of ebook sales and popularity (visually) to people.

I highly recommend you visit Jason's post and read the whole post (it's not too long). It's really neat!


The GIMP Website


I had this note on my to-do list for ages to tinker with the GIMP website. I finally got off my butt and started a couple of weeks ago. I did a quick mockup to get a feel for the overall direction I wanted to head:


I've been hacking at it for a couple of weeks now and I kind of like how it's turning out. I'm still in the process of migrating old site content and making sure that legacy URI's aren't going to change. It may end up being a new site for GIMP. It also may not, so please don't hold your breath... :)

Here's where I am at the moment for a front page:


Yes, that image is a link. The link will lead you to the page as I build it: http://static.gimp.org. See? It's like a prize for people who bother to read to the end! Feel free to hit me up with ideas or if you want to donate any artwork for the new page while I build it. I can't promise that I'll use anything anyone sends me, but if I do I will be sure to properly attribute! (Please consider a permissive license if you decide to send me something).

Mean Averaged Music Videos [G’MIC/Blender]

So I can’t leave well enough alone, as seen in my last post about mean averaging stuff. In that last post I had averaged entire music videos to see what the resulting images would look like.


This time around I took a different path. I wanted to demonstrate what exactly was visually happening when creating these averaged images. For that I turned to the experts (by experts, I mean David TschumperlĂ©), and this time did all of the image averaging in G’MIC. (So a great big Thank You! to David for putting up with me while I tried to describe what I wanted).

The reason is that I wanted to show the videos turning into the final mean averaged images in realtime, as the video played. For this, David was kind enough to write me a quick G’MIC script that would do the mean average for every frame in the video, and dump the total average for each frame one by one.

Mean Averaging Music Videos [Imagemagick/GIMP]

Well, I apparently just can’t get enough of averaging things.


While playing around on the last post for averaging long exposure images, I stumbled across something interesting. Apparently Imagemagick can open video files. At that point I just had to have a go at averaging some music videos.

The results were … interesting to say the least.

These are really worth seeing large, just click the image to embiggen.
The links for each video name below will open the video in the page, in case you wanted to watch.

Some of them were really cool though. For instance here’s BeyoncĂ©’s “All the Single Ladies”:

Beyonce All the Single Ladies blend average mean
BeyoncĂ© - “All the Single Ladies” (5955 frames)


Or kicking it a little old school produces some greats.

Here's A-ha’s “Take On Me”:

A-Ha Take On Me blend average mean
A-Ha - “Take On Me” (6807 frames)


“Tonight, Tonight” from The Smashing Pumpkins:

Smashing Pumpkins Tonight Tonight blend average mean
The Smashing Pumpkins - “Tonight, Tonight” (6475 frames)


I couldn't help but mess around and try some more recent videos as well, of course.

Not surprisingly, Gotye’s “Somebody That I Used to Know’ looks exactly like you'd expect:

Gotye Somebody That I Used to Know mean average blend
Gotye - “Somebody That I Used to Know” (6099 frames)


Of course, I had to do Robin Thicke’s “Blurred Lines” video, for (ahem ) science:

Robin Thicke Blurred Lines mean average blend
Robin Thicke - “Blurred Lines” (6235 glorious NSFW frames)


Pink

Billboards Woman of the Year, Pink, yielded some interesting results:

Pink Blow Me mean average blend
Pink - “Blow Me (One Last Kiss)” (5535 frames)


Pink Try average mean blend
Pink - “Try” (5972 frames)


Pink Just Give Me a Reason blend average mean
Pink - “Just Give Me a Reason” (5814 frames)


Pink True Love mean average blend
Pink - “True Love” (5803 frames)


I find it interesting that if you’re familiar at all with these videos, the blends immediately evoke the sense of what you’ll see watching them.

Die Antwoord

Almost completely on the other side of the musical spectrum, we have Die Antwoord. I want to send a special “Thank You!” to Boing Boinger Xeni Jardin for turning me onto these guys (I consider it telling that I’ve lost count of the cool things that Boing Boing has led me to over the years).

If you haven’t had a chance to give them a listen, do it.

die antwoord enter the ninja mean average blend
Die Antwoord - “Enter the Ninja” (7805 frames)


mean average blend die antwoord rich bitch
Die Antwoord - “Rich Bitch” (4402 frames)


mean average blend die antwoord evil boy
Die Antwoord - “Evil Boy” (6961 frames)


mean average blend die antwoord i fink you freeky
Die Antwoord - “I Fink You Freeky” (5865 frames)


mean average blend die antwoord fatty boom boom
Die Antwoord - “Fatty Boom Boom” (8554 frames)


I like “Fatty Boom Boom” because it really looks like the video sounds. Hectic.

mean average blend die antwoord cookie thumper
Die Antwoord - “Cookie Thumper” (8459 frames)


Creating These

I did mention back at the beginning that it was cool I could load video files directly into Imagemagick. Just one problem: IM likes to load up the entire set of files before doing further operations against them. So trying to load up a full HD video in memory didn't work so well. SD videos loaded, but took forever to process.

To speed it up I just dumped the videos to files first, then operated on them in batches.

You'll need FFmpeg and Imagemagick, of course. I also happen to be using Cygwin, because I'm more comfortable doing things in a bash shell vs. windows command line.

Dumping the Video

I dumped the video using ffmpeg:

ffmpeg -i INFILE -y -f image2 output_%05d.png

This is fairly self-explanatory. The %05d tells ffmpeg to name each file with 5 digits sequentially.

So now I have a directory of files called output_00001.png, output_00002.png, etc.

Batch Averaging

As I said, IM will choke up if you try to load it with too much data (thousands of 1080p frames for instance). So I did a first pass of averaging by only generating the averages for 100 files at a time:

ls output_*.png | xargs -n 100 sh -c 'convert "$0" "$@" -evaluate-sequence mean outdir/"$0" '

Don't worry, it's not so as it looks. Let's break it down:

ls output_*.png | …
Generate a list of files in the directory name output_*.png. Then pipe that list into...

xargs -n 100 sh -c
xargs is used to build a command up. The -n 100 switch tells it to use 100 items from the piped list (all the filenames from the ls command) at a time.

Spawn a shell, and run this command:

convert "$0" "$@" -evaluate-sequence mean outdir/"$0"
This just runs the previous imagemagick command to mean average the images. $0 is the first in the list, $@ are the rest.

Then output the results into the directory “outdir”, with the file named the first in the list.

In my “outdir” directory, there are now a bunch of files with names like “output_00000.png, output_00100.png, output_00200.png” etc. These are averages of 100 frames from my video at a time.

In that directory, it's now trivial to get the final average:
convert output_*.png -evaluate-sequence mean -channel RGB -normalize final.png

This will generate the final mean average from all of the images we output previously. The inclusion of “-channel RGB -normalize” is to automatically normalize the results on a per-channel basis.

Batch Averaging (Windows Command Line)

Reader Belzecue has noted below a means for doing the first run batch averaging with just the windows command line:

FOR /L %i in (0,1,8) DO convert c:\inputpath\output_0%i*.png -evaluate-sequence mean -channel RGB -normalize c:\outputpath\final_0%i.png

The magic part is the options in the FOR command (0,1,8). Basically it means, start counting at 0, increment by 1, and stop at 8. Couple that with the globbing for filename “output_0%i*.png”, and that command will batch up 9 images, averaged across 1000 items at a time.

(The result to the command line will be output_00*.png, output_01*.png, output_02*.png, etc…)

Thanks for the tip!

Conclusion

Of course, I had to leave you all with one last video. The question is, can you guess which video it is?


Guess the video. Here’s a little hint:
“You wouldn't get this from any other guy”

The $30,429,899 Photograph

So, here is a view of the most expensive image ever (that doesn't really exist - except for now because I made it):


This is an amalgam of 16 (out of 18) of the most expensive photographs ever sold, all at once (based on the list at Wikipedia).

I averaged all of the images in Imagemagick, and brought them into GIMP for some level adjustments and minor processing.