Converting Between cv::Mat and QImage or QPixmap

In a previous article, I outlined how to compile OpenCV for Mac OS X and to build and run a small example. In that post I used OpenCV‘s High-Level GUI (highgui) module to display a simple interface using the Qt framework. This is great if you’re writing a one-off program or are just experimenting with OpenCV, but how do you interface with your own Qt-based project if you don’t want to (or can’t) use the highgui module?

OpenCV Library

OpenCV Library

+

Qt Library

Qt Library

The first hurdle is converting between data formats so you can work with images in both OpenCV and Qt. So how do you move an image’s data between a cv::Mat and a QImage or QPixmap so you can display it in a widget?

In this article, I present some functions to handle these conversions and explain how to use them.

Continue reading

Packaging a Mac OS X Application Using a DMG

I learned early on in my software career that packaging up a release of an application can be a real pain. Not only is it time consuming, but it is quite easy to forget a file or miss something when there are so many steps involved and you have to do it frequently. The solution to this is to automate the process. Putting together scripts to package up a release helps avoid missing steps and speeds up development and deployment of releases and updates.

One of the challenges of automating this on Mac OS X is figuring out how to script the creation of Apple disk image (DMG) files. Getting the arguments to hdiutil correct can be quite a challenge! In this post, I’ll give an example of a script I use to do the following:

  • Copy all the necessary files to a staging area
  • Strip and compress the executable files and libraries
  • Create a DMG of the correct size for the release
  • Add a link to /Applications to the DMG
  • Add a background to the DMG so when it opens up your company logo or application graphic appears
  • Check the background image’s DPI to ensure it is 72. Fix it if it’s not.
  • Resize the window and icons, and position items in the DMG so when it opens everything is in the right place
  • Create a final, compressed DMG

Packaging An Application Using a DMG

Packaging An Application Using a DMG

Let’s take a look… Continue reading

Clean Up Your LinkedIn Page

Over the years, LinkedIn has been adding “content” to the data feed and to the right-hand side of the home page which cannot be turned off in the preferences – things like Jobs You May Be Interested In (I’m not) and Companies You May Want To Follow (I don’t). The worst of these is the LinkedIn Today blob at the top of the updates.

LinkedIn Today Blob

LinkedIn Today Blob

When it initially showed up, I put in a ticket asking how to turn it off and was told that they were working on it. Six months later I hadn’t heard back, so I asked again (and again) and they have now informed me that it’s permanent.

Well I’ve decided to make it unpermanent by hiding all these spammy bits with Adblock Plus. (If you are not surfing with an ad blocker, you should. Adblock Plus is simple to install and it will enhance your browsing experience and your life in general.)

LinkedIn Today - Kill It With Fire!

Here’s how to do it…

Update 07 May 2012: Added instructions to remove Sponsored Content
Update 18 July 2014: Added instructions to remove LinkedIn Pulse

Continue reading

Compiling OpenCV On Mac OS X 10.6

A couple of years ago I needed to do some basic image processing and found OpenCV. OpenCV is a BSD-licensed library for digital image processing which implements several hundred computer vision algorithms. Unfortunately compiling it on the Mac was not straightforward—requiring Fink or MacPorts—and the one existing Mac framework was out of date and no longer maintained.

OpenCV Library

OpenCV Library

Fast forward to last week. I had another requirement for some image processing magic and I thought I’d check out OpenCV again. What a difference! It’s now really easy to compile and use on the Mac. I didn’t find a writeup online on how to compile on the Mac—the one on the OpenCV site is out of date—so I thought I’d write up a short summary for future reference and any Googlers out there in internet land.

Here’s how I did it…

Continue reading