gricode

grigory's place to post computer-related stuff.

Jul 27

Building OpenCV 2.3 on OSX 10.7 Lion

After upgrading to 10.7 (my 10.6 just refused to boot up one day, using odd looking kernel panic messages as a poor excuse for doing so), I decided to play with OpenCV.

First obvious step - compile it using CMake. First issue - “make” breaks around ~%50.

I got the following issue:

/Users/grisha/Downloads/OpenCV-2.3.0/modules/highgui/src/grfmt_png.cpp: In member function ‘virtual bool cv::PngEncoder::write(const cv::Mat&, const std::vector<int, std::allocator<int> >&)’:
/Users/grisha/Downloads/OpenCV-2.3.0/modules/highgui/src/grfmt_png.cpp:308: error: ‘MAX_MEM_LEVEL’ was not declared in this scope
/Users/grisha/Downloads/OpenCV-2.3.0/modules/highgui/src/grfmt_png.cpp:354: error: ‘Z_BEST_SPEED’ was not declared in this scope
/Users/grisha/Downloads/OpenCV-2.3.0/modules/highgui/src/grfmt_png.cpp:356: error: ‘Z_HUFFMAN_ONLY’ was not declared in this scope
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_png.o] Error 1
make[2]: *** Waiting for unfinished jobs….
Linking CXX shared library ../../lib/libopencv_video.dylib
[ 51%] Built target opencv_video
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2

After some googling, I found this discussion over at github: https://github.com/mxcl/homebrew/pull/6558. From reading that, it seems that the issue is with libpng not doing the right thing. Quick and dirty fix is to patch “grfmt_png.cpp” file with an explicit include statement for zlib.h, where the globals in question are declared.

So after adding “#include “zlib.h” to the top of OpenCV-2.3.0/modules/highgui/src/grfmt_png.cpp, OpenCV 2.3 compiled just fine on OSX 10.7.


Let’s do this again

I’ve been thinking lately - maybe I should get myself a tiny little blog to post tech stuff. I thought about using Google+ for that, but decided I wouldn’t feel comfortable using Google’s social network for that.

Thought process continued - let’s try tumblr, I’ve used it before and remember that it was pretty low effort. Upon logging into tumblr, I realized that I already have something I’ve created for this exact purpose some years ago - this blog!

So let’s try to do this tech blog stuff again. Right now I’m trying to figure out why I’m getting Grey Screen of Death in OSX Lion after trying to:

virtualenv —no-site-packages new_environment

and compiling OpenCV to have some fun with facial recognition.


Feb 4

Free/Open Source Mobile Development @ Waterloo, Canada

Today I attend this great event organized by fosslc.org and FOSSFactory.org. Videocast of it should be posted relatively soon, look for it at the event’s page.

It lasted for about 6 or so hours (we went over time for nearly an hour), and was great fun!

I won’t go into details at this time (mainly because it is very late…), but here are some highlights:

I’ve met personally with Jay Freeman aka saurik and had a chance to talk to him for some time after the end of the event. He is, among other awesome things, a creator of Cydia (iPhone APT frontend used on 1.5 million jailbroken devices).

saurik @ Waterloo

saurik giving a tutorial on objective-c

Also, I got a chance to talk to Dilpreet Singh from Life360.com (one of the winners of the Google Android Developers Challenge), and hopefully will be contacting him soon regarding jumping in into Android development, as it is pretty high up on my priority list at the moment.

There was also Jean-Michel Bouffard from openmokast. I didn’t know much about OpenMoko other that that it exists, so it was very interesting to listen to his presentation and watch a development workshop.

I’ll be posting some photos later on as well.

Overall, great event! Thanks to all great people at fosslc and FOSSFactory for organizing this!


Feb 3

Twitter + is.gd bookmarklet

Here is a new bookmarklet. It uses http://is.gd to create short urls, and “types” them into your twitter status box. Drag it onto your bookmarks tab & start clicking:

twitterLink

Initially I wanted my twitter bookmarklet to use is.gd for its shorturl purposes. However, my first Twitter bookmarklet used tinyurl due my inability to find a jsonp api wrapper for is.gd.

Since I didn’t yet wanted to go to sleep, I created my own “JSONP wrapper” for is.gd’s API and used it for my bookmarklet. Check it out with more information here: http://isgdp.wompires.com.

(note: is.gd imposes a 1000 requests per ip per day limitation. Even though I cache all is.gd requests, there might be a point at which this bookmarklet will fail to work. Sorry!)


Twitter + tinyURL bookmarklet

For those of you who are tired of copying and pasting links whenever you’d like to minify the link and post it on twitter, read on:

  • Simply drag the following link onto your bookmarks tab: twitterLink
  • Woot, you’re done!
  • Now, whenever you’re on a site that you would like to post on your twitter, simply click your newly created twitterLink button
  • You will be taken to twitter with a tiny url link already “pre-typed” for you :)

There, no more copy/paste nonsense! Tested to work with Firefox & Safari.

This is my first bookmarklet, so if there is something I did but absolutely shouldn’t have done - please let me know :)

P.S.: props to James Padolsey for the tinyurl jsonp code, I didn’t have to write it myself! :)