HTML to Markdown Converter

July 12, 2014 Leave a comment

I am moving my blog post formatting code over to Markdown and found an incredibly useful HTML to Markdown converter by Dom Christie. It allows me to take HTML, for example:

<code><h2>A great list of websites:</h2>
<ul>
<li><a href = "http://www.semifluid.com">Semifluid.com</a></li>
<li><a href = "https://uni-giessen.academia.edu/StevenACholewiak">Steven Cholewiak's Academia.edu profile</a></li>
<li><a href = "https://www.researchgate.net/profile/Steven_Cholewiak">Steven Cholewiak's ResearchGate.com profile</a></li>
</ul></code>

And easily convert it to markdown:

## A great list of websites:

*   [Semifluid.com](http://www.semifluid.com)
*   [Steven Cholewiak's Academia.edu profile](https://uni-giessen.academia.edu/StevenACholewiak)
*   [Steven Cholewiak's ResearchGate.com profile](https://www.researchgate.net/profile/Steven_Cholewiak)

The code can be found on GitHub at to-markdown and Dom has a live demo available too.

FoodieTV adds Johannisbeeren Pastries to this week’s episode

June 20, 2014 Leave a comment

Since my Johannisbeeren (red currant) Pastries video on Vimeo is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike license (CC BY-NC-SA 3.0), anyone is free to share, modify, and adapt it, as long as they make sure to note that I created it (and as long as it is not used for commercial purposes).

The FoodieTV app, from Glam Media, took advantage of the open nature of the licensing and just included my video in their latest episode (S2E12):

Cool! FoodieTV is a free app on the Apple iTunes Store (unsolicited shout-out and thank you for the free exposure).

2 Degrees of Academic Separation using Google Scholar v1

June 19, 2014 1 comment

Another post, another neat force-directed graph. This one illustrates the interconnections between professors and students who have been co-authors on some of my papers and presentations, as scrapped from Google Scholar citations.  It could be described as the first version of a rough illustration of my 2 degrees of separation in academia.

2-Degrees-of-Academic-Seperation-v1.1

The dark orange circle in the center is myself, light blue circles are papers/presentations, light orange circles are co-authors, and dark-blue circles are co-authors of my co-authors (i.e., have not necessarily directly worked with me on a project).

Unfortunately, as of today, not all of my co-authors have Google Scholar pages, so there are a number of co-authors whose connections and branches are under-represented.  In addition, Google Scholar does not necessarily accumulate all of a given author’s papers/presentations and often makes mistakes misattributing papers to profiles.  So, the veracity of the information represented here should be taken with a grain of salt unless I find a better service for generating these networks.

For some more information on how this was created, click-through to the post.

Read more…

VSS 2014 “DNA” v1

May 3, 2014 1 comment

Here’s an illustration I pulled together using Python, NetworkX, and D3.js to illustrate the interconnections between abstracts that will be presented at the Vision Sciences Society 2014 annual meeting in approximately 2 weeks. Orange dots represent abstracts, Light Blue dots represent authors with at least one first authorship, and Dark Blue dots represent other authors (second through last).

VSS DNA v1

As you can see, there are large numbers of abstracts that have few shared authors.  Those abstracts that share authors often join together to create “chains” of students, advisors, and colleagues.

This is a first version, hastily pulled together, so there are a few problems.  The nodes are assigned to authors by name, which can be a problem for authors sharing the same name (which creates more connections than appropriate for a given node) or who  have inconsistent reporting of their name (for example, omitting the middle initial or alternate spelling, which can create another erroneous node). I am thinking of addressing the duplicate node issue by using a string similarity metric (e.g., Levenshtein distance) to find strings that contain similar names to combine the connections, but this could be an issue if the names are truly different people. Alternatively, I could incorporate the authors’ affiliations, but this carries similar issues (e.g., I report my affiliation as “University of Giessen” while colleagues report it as “Justus-Liebig-Universität Gießen”).

Although there are lingering issues, it is still an interesting illustration of the connections between the different abstracts being presented at VSS 2014.

Here’s the code on GitHub: pyVSSRelationshipPlot

Equirectangular to Stereographic Projections (Little Planets) in MATLAB

April 20, 2014 Leave a comment

The camera included in Google’s Android mobile OS has a feature called “Photo Spheres” that allows you to take a series of photos and create a full spherical panorama. The Photo Sphere feature is included on Google Play Edition (GPE) phones –phones that incorporate Google’s version of unadulterated Android– including my Nexus 5. When you take a Photo Sphere, the camera seamlessly stitches the individual photos into an Equirectangular panorama. For example, here is a panorama I took of the rapeseed fields in central Germany:

Generated using Android's Photo Sphere function

There is a bit of distortion (see Tissot’s indicatrix), especially at the top and bottom of the image, but this is due to the problem of projecting a sphere onto a plane. On the Nexus 5 (and other GPE phones), the Gallery application includes a feature that allows you to either view the resulting Photo Spheres as spherical panoramas or to create “Little Planets”/”Tiny Planets”, which are actually Stereographic Projections of the spherical panorama. I found the effect really neat, so I wanted to see if I could recreate the projection in MATLAB.

As a teaser, here’s the output for my code:

MATLAB Little Planet of German Rapeseed Field

Click through to get more information on the MATLAB implementation.
Read more…

Batch Handbrake video file conversion with Python

April 11, 2014 Leave a comment

I needed a quick little piece of code that would go recursively iterate through a folder and its subfolders and convert all of the video files to H.264, so I took advantage of the Handbrake command line interface (CLI) and Python 2.7.x to do the work for me. This code snippet is not long or elaborate, but does the job, so hopefully it will be helpful to others.

Note that the Handbrake CLI options are defined in runstr. As-is, the script will convert videos with AVI, DIVX, FLV, M4V, MKV, MOV, MPG, MPEG, and WMV extensions to H.264 MP4s with the following options:

Here’s the code (available on GitHub):

import os
import time
import subprocess
import sys

fileList = []
rootdir = raw_input("Root Dir: ")
for root, subFolders, files in os.walk(rootdir):
    for file in files:
        theFile = os.path.join(root,file)
        fileName, fileExtension = os.path.splitext(theFile)
        if fileExtension.lower() in ('.avi', '.divx', '.flv', '.m4v', '.mkv', '.mov', '.mpg', '.mpeg', '.wmv'):
            print 'Adding',theFile
            fileList.append(theFile)

runstr = '"C:Program FilesHandbrakeHandBrakeCLI.exe" -i "{0}" -o "{1}" --preset="Normal" --two-pass --turbo'

print '=======--------======='

while fileList:
    inFile = fileList.pop()
    fileName, fileExtension = os.path.splitext(inFile)
    outFile = fileName+'.mp4'

    print 'Processing',inFile
    returncode  = subprocess.call(runstr.format(inFile,outFile))
    time.sleep(5)
    print 'Removing',inFile
    os.remove(inFile)

Read more…

GoPro SuperView-like adaptive aspect ratio

March 16, 2014 Leave a comment

For Christmas, my parents got me a fantastic gift for photographers and outdoors enthusiasts, a GoPro Hero3+ Silver Edition digital camera (Amazon). If you are not familiar with GoPros, they are small action cameras that have a very wide-angle lens and come with a water-resistant case. It’s a fantastic little camera that packs a lot of punch for such a compact package.

There are a number of GoPro editions, but the newest one are the Hero3+ Silver and Black. The Silver Edition is very similar to the GoPro Hero3+ Black Edition (Amazon), but omits a few features, including some very high-resolution video recording modes and a feature that GoPro calls “Superview”. This post talks about a way that I attempted to emulate their Superview mode in MATLAB and put together an adaptive aspect ratio function that allows one to change the image’s aspect ratio while maintaining “safe regions” with minimal distortion.

This function allowed me to resize 4:3 images and video, like this one:

To a wider aspect ratio, for example 16:9:

Click through for info on how I implemented the code.

Read more…

Cinnamon Buns

March 15, 2014 Leave a comment

Here’s a short video of some cinnamon buns I made. The video was set to music by Jill Zimmerman – Earthbound (CC BY-NC-SA 3.0).

Click through for the recipe.

Read more…