Tag: Graphics

ImageMagick Thumbnails and Contact Sheets

March 30, 2009 » Geek

Update (2010-06-14)
Thanks to Glenn Turnbull I’ve fixed a bug where the last contact sheet would not be created when the number of photos is evenly divisible by the contact sheet size.

Additionally, this script and others will now be kept updated at http://github.com/jmhobbs/helper-scripts

Update (2012-04-10)
Phillip Vuchetich wrote a neat script for making composite 4×6 out of wallet sized images, which he has allowed me to post about here.

Wow, long time no post. Darcy and I got a digital camera about a week ago, a Nikon D90. We haven’t really had a chance to put it through it’s paces, but we’ve taken a few pictures around the house to play with it.

At about 3mb each (JPEG’s) the images are really slow to preview in Konqueror. I decided it would be better to be able to download all the photos from the card, then run a script to make my thumbnails. That way I wouldn’t have to wait around while I was viewing photos, instead I could just wait once at the beginning of the process.

My resulting script may have some holes, but it works well for me on Sidux. It takes all of the images in the current directory and makes 600×600 base thumbnails into a directory called “thumb” then uses those to make 12 image contact sheets into a directory called “contact”.

real user sys
resize 0m43.478s 0m40.625s 0m2.525s
scale 0m25.449s 0m22.975s 0m2.236s
sample 0m18.362s 0m15.983s 0m2.211s
Script times for 16 JPEG images at 3Mb each
To 600×600 thumbnails and 200×200 contact sheet frames.

Your results will vary, but I ran it with three different scaling types (resize, scale, sample). I’m fine with the output from the fastest one (sample) but you can do as you please. I didn’t add command line options because I wanted to have consistent sizes and qualities every time I use it.


Side By Side Resize Method Comparison
Click For Fullsize

Sample Contact Sheet
Click For Full Size

It keeps you updated so you know it hasn’t stalled, here is a sample run.

And here it is. Feel free to comment your changes!

libcvfx

March 10, 2008 » Geek

I’ve been playing with OpenCV recently and was having troubles with creating effects. That’s all over now thanks to the OpenCV mailing list, you can see the fix in the comments of this post. Since I can now manipulate colors and pixels with ease I’ve been writing a few more neat effects. And yes, I know that this is not what OpenCV is for, but it’s a really handy library and I like it.

I decided to pull them out of my test program and make them into a little library. Having never made a library before I[m sure I did some things wrong, but it works and that’s what I care about right now.

I doubt my manipulation method is the fastest, but I’ve tried to be economical and share resources between effects. I also included a test program so you can try out the filters. These are all written by me so far, with inspiration but no code from other sources. I’m hoping to port over some of effectv’s super cool filters as time goes on. You can click through on any of the pictures below for a 640×480 version.

Baseline
This is my normal image I get from my cheap labtec webcam.
And yes, I am that good looking.

Green
Probably the simplest effect, it just involves turning off the blue and red channels.

Mirror
Copies and flips the left side onto the right.

Monochrome
Simple like green, just sums the three channels into one value.

Corners
This one swaps the top left and bottom right corners. I’m going to swap top right and bottom left later.

Horizontal Flip

Vertical Flip

Memory
This is one of the harder ones. It stores three frames in memory and then combines them with the current frame for a ghosting type of effect.

Oompa Loompa
For lack of a better name.

Invert

Pixelize
This is the only one with parameters, and one of my favorites.
The parameter is the “pixel size”.
From top down it is set at 2, 6 and 10.


You can grab the 0.01 source here (doesn’t have the invert filter) or browse the svn repo at http://svn.velvetcache.org/libcvfx/ for more current stuff.

Screwy OpenCV Manipulations

March 2, 2008 » Geek

I’ve been playing more with OpenCV and I think I’m missing something. I can’t do any manipulations on the image data without really screwing it up. The only thing that doesn’t seem to wash out the data out is moving pixels around without changing them. Not sure what I’m missing. Here’s the few different manipulations and what they look like when they wash out.

Monochrome


Memory
This one just keeps five frames and then adds them in to create a faded composite, should be simple.

I just can’t figure out what I’m doing wrong here.

Class Photoshop Project

March 2, 2008 » Geek

I’m taking a GUI design class right now and for slightly odd reasons he is having us do mini-projects in Photoshop and Flash. For the last bit of the Photoshop one we were supposed to cut Lance Armstrong out of a picture and put him in any background we wanted. I choose the gates to Mordor and I’m quite proud of the results.

Click through for the full size, it’s worth it I think.

Playing with OpenCV

February 26, 2008 » Geek

OpenCV is a cross platform video library I’ve been playing with. Today I coded up a horizontal mirror effect, took about 30 minutes. I worked out all the byte manipulations on a piece of paper, that took the longest. Coding was a breeze with OpenCV, and I tried out some of the built in effects too, stacking them on top of each other.

Here’s my first version source for the mirror effect, it’s rough since I just translated what I had written down into code. “frame” is a captured IplImage.

Here is the reformed version, cleaner by far.

And here is what it looks like. The first one is without any other effects, the second is with the OpenCV effect “erode”.


You can get the full source of my fxTest.cpp here if you want it.

The Introduction to programming with OpenCV was a great resource for me.