Computer Vision Basics in Microsoft Excel
Computer Vision is often seen by software developers and others as a hard field to get into. In this article, we'll learn Computer Vision from basics using sample algorithms implemented within Microsoft Excel, using a series of one-liner Excel formulas. We'll use a surprise trick that helps us implement and visualize algorithms like Face Detection, Hough Transform, etc., within Excel, with no dependence on any script or a third-party plugin.
Figure 1: Outline of the steps to visualize a spreadsheet as an image. The spreadsheet, and thereby the image, is then manipulated step by step using formulas.
Selected Feedback Quotes
“Its amazing to see an image show up on the Excel sheet as you zoom out and numbers appear as you zoom back in.”
“Very cool to see that with ‘simple’ Excel formulas you can do some real computer vision.”
“… never thought you can explain CV through simple Excel formulas and transformations. Hats-off :)”
“… used Excel to explain the core concepts and algorithms so clear that I feel I could start working with it right now! …”
“I've been wanting to learn how CV works for a while, and this was probably the best transition from data to visuals I've ever seen.”
“Just incredible build up from small to great one step at a time.”
Preview of what we will achieve
We will see how to detect a face using a toy example: (Below are screenshots of Excel shreadsheets.)
We will also see how to find edges and lines:
Expectations from the audience
No prior background in Computer Vision should be needed to follow the material. It is assumed that the audience knows Microsoft Excel basics and can read its documentation, or search online for interpreting the formulas used. Exceljet is a great resource for the latter.
Some mathematical understanding would be needed: Those who won't know what weighted average is won't be able to follow much. Understanding of partial derivatives would be helpful but not required. Most complex mathematical concept used is eigenvalues, but again the readers should be able to follow even if they do not know or remember the same.
The crux of the material is in the Excel files (*.xlsx) available below for downloading. These are self-explanatory with notes inserted within. Please follow the sheets step-by-step. You may need to change zoom levels as per your monitor resolution.
The work was created using Excel 2016 on Windows; it should however open in other versions of Excel (tested with Excel 2007 on Windows, and Excel for Mac).
While the files open in LibreOffice (tested in version 22.214.171.124 (x64)), it is slow to the level of being unusable. We have not tested in Apache OpenOffice.
Relevant Excel Formula Options
Before opening the Excel file(s), change Excel Formula Calculation to “Manual” since some calculations (Hough Transform specifically) are time-consuming (say an hour). Then trigger recalculation manually as per need.
Also, uncheck “Recalculate workbook before saving”, else Excel will recalculate all the formulas every time you save the files.
Note: Be sure to revert these settings once you are done.
Those familiar with R1C1 formula reference style in Excel, or those adventurous, should try switching to it by looking in Excel options and turning it on. See the screenshot below and check the box to enable it. This changes the formulas from “D5” type format to a relative style like “R[-1]C” (absolute references also allowed as “R4C5” for example), bringing it closer to programming languages and aiding understanding.
The full Excel file is more than 50 MB in size. The same content is also available in smaller parts.
The following can be downloaded by right-clicking. Alternatively, on left-clicking, Github will take you to preview page from where the raw *.xlsx files can be downloaded.
|The full Excel File||Computer-Vision-Basics-in-Excel.xlsx||The file is, unsurprisingly, heavy for Excel. Be patient with it. :-) Even if it goes busy for an hour, Excel usually does finish up and come back.|
|Part 0||Computer-Vision-Basics-in-Excel-0-Introduction-and-Outline.xlsx||Introduction and Outline:Start here if following the individual parts.|
|Part 1||Computer-Vision-Basics-in-Excel-1-Edges-and-Lines.xlsx||Edges and Lines:One of the sheets in this file, named “Hough”, is very compute-intensive.|
|Part 2||Computer-Vision-Basics-in-Excel-2-Keypoints-and-Descriptors.xlsx||Corners/Keypoints:We do not go into the details of these.|
|Part 3||Computer-Vision-Basics-in-Excel-3-Face-Detection.xlsx||Face Detection:Functional face detection demo on the specific input image using (simplified) Viola-Jones object detection framework.|
|Part 4||Computer-Vision-Basics-in-Excel-4-Text.xlsx||Character Recognition:A toy example that recognizes uppercase E's in the image.|