Blog Navigation

OpenCV and ffmpeg are great tools especially if you're wanting to do any type of image/video analysis or manipulation. But installing these tools isn't exactly the easiest thing to do either. I went through the pain and here's what I discovered.

Installing ffmpeg

Since opening most video files require a codec in OpenCV installing ffmpeg was the first thing that I did.

After installing both OpenCV and ffmpeg you'll need to restart your computer to add the paths to the system path.

Installing OpenCV Python

Installing the binding for OpenCV in python simply requires copying over cv2.pyd from opencv/build/python/2.7/<OS Version> in to the site-packages folder. Note: that currently OpenCV is ONLY supported on Python 2.7.

OpenCV also requires that numpy be installed as well. matplolib is also recommended to be installed.

I've been contracted to create a simple application for a local school, that basically takes all of their social media feeds, and puts them in one central place (i.e. Twitter, facebook, youtube, etc,.). They wanted me to develop for all three major platforms (Android, iOS, and Windows Phone 8). I was planning on developing for each platform individually, even though I knew that the basic business logic behind all three were going to be pretty much the same. So I thought that I'd ask over at Stack Overflow if there was any way to keep the business logic between all three platforms:

This led me to the tool Xamarin. Apparently it allows you to develop Android, and iOS apps using C# libraries. Since Windows Phone 8 already uses C# this sounds like a win-win situation... til I saw the price $299 per platform for the "indie" which means you have to use their IDE, or $999 again per platform to use their add in for Visual Studio. I've decided to give it a shot, and since I'm still a student I was able to secure an Academic License (which thankfully includes the Visual Studio add-ins) that was a bit cheaper. (Thanks guys. Honestly.)

So here's the basic idea of what Xamarin is and does:

Shared backend business logic, custom UI generation

Each platform is unique in its development. There are things that are very unique to iOS that aren't found on Android, and vice versa. However, the backend logic or how the data is stored, retrieved, and manipulated can be the same all around. This graphic gives a good overview of what Xamarin achieves to accomplish seemless cross platform development:

Installation.

Installation was simple, until it came time to connect Xamarin to Visual Studio. As of right now, Xamarin doesn't support Visual Studio 2013 preview (understandable). After installing VS 2012 Ultimate, the Xamarin installer detected that the extensions needed to be installed. I tried, and tried, and tried, and tried, to no avail. Finally, I completely uninstalled Xamarin, and VS 2013 preview and then reinstalled Xamarin. Everthing worked fine from there.

If you're going to develop for iOS be warned, you still need a Mac running machine. You can still supposedly run the app from the Windows environment but, this appears to be done via connecting remotely to Xcode on the Mac. This also measn that you'll need to Xamarin on the Mac as well.

Summary

To summarize, if you're looking to develop mobile apps utilizing a single tool, Xamarin is your only option so far. But keep in mind there's a lot of upfront cost and setup time to get the ball rolling. Here's a quick summary of the steps that I've taken to get this all up and running:

Visual Studio is my favorite IDE by far, and when I heard that Python Tools for Visual Studio (PTVS) upgraded to v2.0 beta I was excited to test out the new features. However, I just started using Anaconda as my main Python distro which leads to problems with PTVS detecting any environments created using Anaconda.

Note that I'm not talking about virtualenvs, but rather Aanaconda's environments

I was able to get a Python 3.3 environment installed and running on Visual Studio, and here's what I did.

Installing a new Python Environment using Anaconda

To install a new env for Python, open up a command prompt and run the following:

conda create -n py3k python=3.3

You can change py3k to whatever you want to name the environment. The Python=3.3 specifies the version of python to install. Anaconda will take care of everything for you as far as downloading and installing packages.

Setting up PTVS for the new Anaconda Environment

PTVS will automatically pick up the root Anaconda environment, but any new ones created need to be specifically referenced. You can do this manually within Visual Studio:

Select:

Tools --> Options --> Python Tools --> Interpreter Options

Select:Add Interpreter

And then give it a new name. I simply named it Python 3.3. Assuming you installed Anaconda in the default path and name the environ, use the following for the Path and Windows Path:

Select the appropriate architechture and Language Version for your environment. Finally, you'll need to create a new Environment Variable for this installation. I simply used ANAPYTHONPATH. Whatever var you use, be sure to set the value of it to the following:

C:\Anaconda\envs\{env name};C:\Anaconda\envs\{env name}\Scripts

That's it! You should have full access to your new Anaconda Environment.

Welcome to the KronoSKoderS blog! I'll be sharing my random musings with the projects that I plan on working on. Right now I'm only working on a couple, but hope to start up a few more. Here's a quick list of the things that I'm working on: