Latest Articles

These are my recent articles. A full list of articles is here.

Adaptive Thresholding for Document Image Binarization

Binarization is the process of converting a colour or grayscale image into a binary (i.e. black and white) image. It’s typically the first step performed by software that does any sort of document analysis and recognition, optical character recognition (OCR) being the most common application. When a document is scanned with a flatbed scanner, well established algorithms do a very good job. Nowadays, however, many document images come from the cameras in our mobile devices, and these are subject to variable lighting conditions that make binarization quite difficult. The problem is exacerbated

Perpendicular Distance Least-Squares Fitting for Arbitrary Lines

(updated )

I’m not a mathematician, but I understand the mathematician’s delight. When terms cancel, substitutions simplify, and something that was previously hidden is revealed and exposed to the mind for the first time, the intellect is entertained.

I can still recall one of my earlier moments of “mathematician’s delight.” I was sitting in Mr. Pontifex’s grade 12 physics class as he derived the formulas for obtaining the best-fit line for a set of points. We had already used the equations often to find the answer our lab experiments

Displaying Touches On-screen in iOS with Touchposé

The iPad 2 and iPhone 4S support display mirroring out-of-the-box. When connected to an external display (via cable or wirelessly with AirPlay), iOS will mirror the device’s display on the external display. This is a great feature when you need to demonstrate your iOS app to an audience of more than a few people. However, with the audience looking at an external display, and not you, there’s a major problem: they have no idea how you’re interacting with the app.

I wrote Touchposé to solve this problem. Touchposé adds a