Setting up OpenCV 2.1 on Ubuntu 10.10 for python (2.6)

Originally I just tried the apt-get route, using this updated source (starting from the top of this doc). It didn’t work out so well - 404 errors missing maverick sources. Caveating by saying I didn’t need source, just the basics to get me up and running.

After looking at the opencv installation wiki, it looks like just two commands took care of it for me. I still get a wierd libc error when importing opencv but it doesn’t seem to affect basic samples.

  • Update: Found this article to help re-install FFMPEG from source on Ubuntu, this to help with the “wierd libc errors”

In short, first install the ffmpeg dependencies

$ sudo apt-get install libavformat-dev libswscale-dev

then finish by installing opencv’s python libraries

$ sudo apt-get install python-opencv

Setting up EC2 w/django, python, mysql, apache and a new user (draft in progress)

setup an image. i used ubuntu with AMI ID of ami-508c7839. after install i realized there’s a newer version. this is ok for now.

key pair - i made my own then downloaded the key (automatically). let’s call it “aws_admin.pem” for now.

security group - i created one and added https (443), http (80), and ssh (22) privs for “All Internet”. for now, assume i called it “public_internet”

secure the local key, firstly i manually copied from downloads into ~/.ssh/. then run

$ chmod 600 aws_admin.pem

then login via ssh, note the “ubuntu@” instead of “root@” as the Ubuntu AMI won’t have a root user you can use.

$ ssh -i aws_admin.pem ubuntu@ec2-184-73-127-59.compute-1.amazonaws.com

then update apt-get (the ‘-y’ just defaults to yes for all prompts)

$ sudo apt-get -y update && sudo apt-get -y upgrade

awesome guide for the rest of it - especially the setup of a new user: http://www.philroche.net/archives/simple-django-install-on-amazon-ec2/

additional info:

to start apache once you’ve installed it, use the following comment (note: and NOT simply “$ apache2 -k start”)

sudo /etc/init.d/apache2 restart

Next I wanted to setup TextMate to access remote files for editing to make life easier and found this howto using MacFUSE: http://minimaldesign.net/articles/read/remote-textmate-projects

NTS: ffmpeg to encode & save a mjpeg stream

<url/> = fully qualified url to a mjpeg file starting with http and ending with .mjpg (or .mjpeg). <numseconds/> = total number of seconds to record for tmp.mpg = the filename, replace as needed.

$ ffmpeg -f mjpeg -i <url/> -t <numseconds> tmp.mpg

If you want to get your output into BGR24 for processing w/out HW acceleration (thanks to jpsxdec):

$ ffmpeg -i inYCbCr.avi -vcodec rawvideo -pix_fmt bgr24 outRgb.avi

django-nonrel on appengine & setup for file transfers for django newbs (like me)

I read the django-nonrel article recently posted up on code.google and wanted to give django a whirl more officially - beyond the basic views & templates support in GAE out of the box. I had a little hobby app that was small and simple enough to be my test case for making the cutover.

One of the features I needed to get working quickly was a file uploads feature, and I realized after looking through the docs that the django-filetransfers package was just the ticket, and I looked at the example source the team posted. (Kudos to the django-nonrel team, the docs were easy to navigate).

I realized as I went through the build there were a couple steps in the process where I needed to google around so I figured I’d take notes here in case it might help if you’re trying similar might save you some time.

On python2.5 (same as my AppEngine SDK), assuming you already have django-nonrel installed.

  1. Download django-filetransfers
  2. $ sudo python2.5 setup.py install (note: did as a matter of course, step 5 is what mattered for me
  3. copy subdirectory “filetransfers” into my project directory (note: not the app directory)
  4. update the settings.py file for my project to include ‘filetransfers’ inside INSTALLED_APPS
  5. get the rest of your files in place (e.g., upload.html, views etc), some random notes around package imports..
    1. from filetransfers.api import prepare_upload, serve_file
    2. from django.shortcuts import get_object_or_404
    3. from django.core.urlresolvers import reverse (note: important to get the view handlers right for the sample!)
    4. update the view_url’s reverse() parameter to point at your app’s handler (e.g., myApp.views.upload_handler where myApp’s your app’s name)
  6. patch your local SDK as explained here, note: in v1.4 for GaE it was on line 302.

That should do it.

sudo port install git-core

If your macports install of git-core is failing with a cryptic checksum error, try this out: http://evanculver.com/2010/04/13/curl-ca-bundle-macports-checksum-woes/. Worked wonders for me.

NTS: A good laptop running Windows 7+?

It’s ridiculous that there aren’t any on the market. The coolest Win 7 laptops are made by the big OEMs and they all pale next to an Apple equivalent. Why.. WHY! Microsoft Windows 7 is fantastic and lots of people use it. There is a great opportunity to launch a beautifully designed laptop on the mid-high end.. really thin, minimalist on the extra ports, brushed aluminum and great bundled services.

NTS: An automated VC blog bot?

I love reading VC blogs. A techmeme.com style way of having a VC news would be a great site.