Thursday, August 22, 2013

Photo Formatting Program (Updated)

As I mentioned previously, I wanted a program that would automatically format my photos to be used on my digital frames. I'm pretty sure this would be trivial for an actual programmer, but I'll post it anyway.  I have two frames, one is a standard 7" digital frame with 800x600 resolution and the second is a converted 19" LCD monitor operating at 1920×1080 (i.e. 1080p). I don't like the black borders around photos with the wrong resolution so I would like to resize and crop the photos for their intended frame. In this program, portrait photos are resized and cropped for the 800x600 frame and landscape photos are resized and cropped for the 1920x1080 frame. The program finds the faces in the photo, determines the mid point between them, and uses that as the center of the cropped region.

I tested the program in Matlab 2012b (32bit) in Windows. It requires the fdlibmex library for face detection, which should go in the same directory as the Matlab *.m file. As written the program looks for jpg photo files in the Input subdirectory and writes the output files to the Output subdirectory.

Update (8/28/13):
Fixed several bugs and tested on a larger sample size.
  • Images without faces detected are processed, the code crops the middle section of the image.
  • The code now checks that cropped region won't exceed the size of the image, resulting in a cropped image that is too small. There is also an option to disable face detection altogether.

Wednesday, August 7, 2013

Work In Progress: Photo Formatting Program

Because I don't have enough things I'm concurrently working on (and none of this stuff obviously has a deadline), I thought I would work on a program that would prepare my digital photos for my two digital frames. I have a little programming experience, I took some classes in college and have done a little over the years though grad school and work, but I'm so out of practice and do it so infrequently, I might as well be a beginner. Hopefully if I give myself software projects I can improve my skills a little, as well as automate some of the digital grunt work in my life.

I have two frames, one is a standard 7" digital frame with 800x600 resolution and the second is a converted 19" LCD monitor operating at 1920×1080 (i.e. 1080p). I don't like it when portrait photographs are displayed on the frames leaving dark margins on the edges. I tried using the smaller frame in portrait mode, but I don't like how it looks. If I were to use it this way, it still wouldn't be labor free since the as far as I can tell the frame doesn't have a setting to automatically rotate each image. I would have to manually rotate them. Digital camera photos tend to have a 1.33 aspect ratio while my converted monitor has a 1.78 aspect ratio. Previously I prepared photos for this frame by resizing the photos to a width of 1920 pixels then cropping out a section1080 pixels high. For a few photos I cropped out a 1920x1080 section without resizing, but this tends to look too big. My plan is to take the landscape photos and resize and crop them for the larger frame and take the portrait photos and resize and crop out a 800x600 portrait section for the smaller frame.

Here's what I would like the program to do:
  • Decide if a photo is portrait or landscape, and sort them into different directory
  • Resize the images to the appropriate size
  • Find the faces in the images
  • Find the centroid of the faces and put it in the top 1/3 line of the crop region, making sure that nobody is cut off.
  • crop and save the images.
We'll see how my automated cropping plan works.  If it doesn't work out I'll have it pop open a selection window to manually choose a crop region with the defined size. As a feasibility exercise, I was able to get this face detection function working in Matlab. Ideally, I'd ultimately like to have a standalone program rather than Matlab, but that may take considerably longer.

Tuesday, August 6, 2013

Ideas?

Here are some things that I have around that I would like to find a use for. I'm open to suggestions.

Monday, August 5, 2013

To Do List

Last Updated: August 5, 2013

Theater HTPC

Get Blu Ray disc playback working
Set up external programs (Netflix, Hulu, etc)
Choose a remote control setup and configure Eventghost
Get better front speakers
Move noisy AV equipment into the garage (Xbox, HTPC)
Fix screen velvet border
New decor design (curtains, carpet, sofa covers, wall paint)

Den HTPC
Finish setting up external programs (Netflix, Skype, etc)
Find way to return to XBMC easily from external programs
Configure Xbox controller
Install and configure game emulators
AV cabinet for Den

Whole House Audio
Add screen controls for volume
Configure kitchen PC for optional "headless" operation with a "headless" mode button
Add IR control to kitchen PC 
Add more standalone audio nodes
Improve audio node speakers/amplifiers
Configure Airfoil Speakers on HTPCs
Add scanner to kitchen PC

Other Projects
Add bluetooth input to the other car
Garage door open/closed notifier
Rec Room open/closed notifier or motion detector


Friday, August 2, 2013

Kitchen PC: Software Configuration

If there is one thing I've learned about my family computing projects over the years is the software makes or breaks the whole project. It can't take more than a few actions for PC to perform it's task, otherwise it isn't going to be used. My goal for the kitchen PC is for me or my wife to wake the thing up and have it playing music in one click. I don't think I'm there yet, but I'm on my way.

The Guts

As I mentioned in the hardware post for the kitchen PC, with an iOS device you can stream to a single Airport Express, the advantage to using a PC (or a Mac, for that matter) is it is possible to stream to multiple Airport Expresses simultaneously. The most straightforward way to do this is to use iTunes. Of course, using iTunes isn't exactly the most well regarded music software, and using it to stream will limit you to only music you can import or get from iTunes. My preferred technique is to run Rogue Amoeba's Airfoil, which allows you to stream audio from any program to multiple Airport Express units. It largely runs in the background, although you need to open it up if you want to change which Airport Expresses you want to broadcast to, or which application you're broadcasting from. I recommend enabling Airfoil's Instant On feature which can eliminate having to restart the applications to capture the audio in Airfoil.

The weak point with Airfoil, in my opinion, is you need to open it up and switch sources. One way around this is to stick to a single source. I'm trying to only use Chrome-web apps to keep to a single source. Opening a page in app mode eliminates the toolbars and tab markers, so the page looks like a standalone app. So far it looks promising, but I'm not 100% sold on the Spotify web app. Also, I haven't decided what to do with my local music, but I will probably use Google Music once I get it all properly tagged, right now my Google Music is a mess.

To open a page in Chrome app mode create a shortcut with the following (using TuneIn as an example)
c:\Program Files\Google\Chrome\Application --app=http://tunein.com



 The User-Interface

Here's what I'm starting with

I imagine the user-interface for this project will evolve. To start off, I put the start menu at the top of the screen. It looks OSX-esque from an earlier attempt to see if I could make a mock-Macintosh and I can't remember how to undo it. There are also a few desktop icons. Once things are running smoothly I may hide the start menu and task bar and remove the icons. At the bottom of the screen I have Rocketdock running. I have the dock set to always be on top and to not autohide.  I also turned off, minimize to the dock. For icons, I got free Rocketdock compatible icons from Icon Database. I'm using the ICS Optics set by lostintortola.

In the middle of the dock I put the music apps, I think I will primarily use, on the left side I put video apps, I may occasionally use, and on the right side I put miscellaneous other apps. Here they are in order from left to right.
  • YouTube: I have this set to the YouTube Leanback TV-friendly interface.
  • Live-TV application: I have an old HD Homerun on my network, this starts the QuickTV application that will play broadcast TV via an antenna in my attic. It seems like the computer isn't quite fast enough to playback the mpeg2 video stream, but since other video files run decently, that could also be that I had bad reception at when I was testing it. I used CCCP to install an mpeg2 compatible codec.
  • Video Files: This opens a grid stack docklet that shows the contents of a video folder on my NAS.
  • Music: Currently this opens another stack docklet that points to my music folder, but the plan is to have this point to Google Music.
  • TuneIn: This site collects internet-broadcasting terrestrial radio stations. I set up favorites for the local stations we tend to listen to.
  • Spotify: The subscription music service. There is both a web app and desktop app, The desktop app seems to perform better, and gives you more options, but I am going to try the web app again, to see if I get used to it.
  • Skype: This opens the chat program in it's standard window. I don't foresee broadcasting this over the whole house. That might be a little quickly.
  • Chrome: Opens a standard Chrome browser window
  • Airfoil: Opens the Airfoil App
  • Recycling Bin: I'll probably get rid of this as soon as I figure out how to put it somewhere else.
Remote Control

Having the tablet screen is nice, but it's also nice to be able to control music playback remotely. I've installed Remoteless for Spotify on our iPhones to do that, at least with Spotify. Remoteless also has a version only for Airfoil, but so far I primarily use Spotify on this machine and Airfoil control is baked into that version as well.

Tidbits

A few odds and ends to make the system work better.
  • Autohotkey: This project is actually my first experience with this Windows scripting program. On startup, the screen is upside down relative to the user (it's actually right side up relative to the keyboard). I have a one line script that sends Ctrl + Alt + Up Arrow to rotate the screen. I believe this is particular to this tablet. Occasionally I'll do something that will cause the screen to rotate back (so it is upside down to me). I put a shortcut on the desktop and in the quickrun toolbar that will execute this hotkey. I am going to try Hybernate Trigger to try to run this script when the computer wakes up.
  • Standby at night: I set up a batch file (from this source) in the task scheduler so the computer will go into Standby mode at night.
  • TightVNC: It is much easier to configure things on another PC while I sit on my couch rather than trying to use the stylus and a mini-wireless keyboard in the kitchen.
  • Rainmeter: I'm playing around with the desktop customization program, Rainmeter. I'd like to put a clock, weather, and maybe a music player on the desktop. I haven't used Rainmeter before. Years ago I used Samurize, which is similar.
Upgrade Ideas

Software wise, I suspect it's going to take a while to converge on the right user interface. Ideally, I wouldn't have to open up Airfoil. Also, I'd like to set up the desktop to display useful information like the weather.

If you missed it, see my take on the kitchen PC hardware, here.