Computer Vision Basics in Microsoft Excel (using just formulas)

Feb 18, 2020 • edited Feb 19, 2020

Computer Vision Basics in Microsoft Excel (using just formulas)

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.

Microsoft Excel Trick for Spreadsheet Images

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.)

Face Detection in Microsoft Excel

We will also see how to find edges and lines:

Edge Detection in Microsoft Excel

Lines in Microsoft Excel

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.

Instructions

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.

Screenshot of an Excel file

Software requirements

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 6.4.0.3 (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.

Excel Formulas, Change to Manual

Also, uncheck “Recalculate workbook before saving”, else Excel will recalculate all the formulas every time you save the files.

Don't Recalculate Workbook before Saving

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[2]” (absolute references also allowed as “R4C5” for example), bringing it closer to programming languages and aiding understanding.

Excel R1C1 Formula Reference Style

Downloads

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.

ContentsFileDescription
The full Excel FileComputer-Vision-Basics-in-Excel.xlsxThe 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 0Computer-Vision-Basics-in-Excel-0-Introduction-and-Outline.xlsxIntroduction and Outline:Start here if following the individual parts.
Part 1Computer-Vision-Basics-in-Excel-1-Edges-and-Lines.xlsxEdges and Lines:One of the sheets in this file, named “Hough”, is very compute-intensive.
Part 2Computer-Vision-Basics-in-Excel-2-Keypoints-and-Descriptors.xlsxCorners/Keypoints:We do not go into the details of these.
Part 3Computer-Vision-Basics-in-Excel-3-Face-Detection.xlsxFace Detection:Functional face detection demo on the specific input image using (simplified) Viola-Jones object detection framework.
Part 4Computer-Vision-Basics-in-Excel-4-Text.xlsxCharacter Recognition:A toy example that recognizes uppercase E's in the image.
#Tutorial#Formulas

How to Get Data using MS Query in Excel

How To import Data from Access database into excel