Traditionally the quickest and easiest way to install OpenCV on your Mac was to do it using Homebrew. Unfortunately the formula for building OpenCV for Apple Silicon is currently broken.

We will still use Homebrew to install some of our dependencies, so you can download and install it from here.

Step 1: Installing XCode Command Line Tools

Usually this should be installed on your system, though it better to check it as it can cause error in the proceeding steps.

Open the Terminal and execute:

xcode-select --install

If it replies with error: command line tools are already installed then you can proceed with installing OpenCV. …


Introduction

In this article, we will be detecting faces from an image using OpenCV’s cascade classifiers. The two most popular cascade classifiers used are LBP Cascade classifier and Haar Cascade classifier.

LBP is faster but less accurate as compared to Haar Cascade. But most consumer devices nowadays (including Android devices) are usually powerful enough to run Haar Cascade in real-time without much performance loss.

One downside of Haar Cascade classifiers is that it takes longer to train them as compared to LBP.

For this article, we will be using a pre-trained Haar Cascade Classifier file which is available here.

Prerequisites

Installation of…


Update: The following method will not work with Apple Silicon Macs. Please follow this setup guide if your Mac is using Apple M1 Chip.

Step 1: Installing OpenCV

The quickest and easiest way to install OpenCV on your mac is to use Homebrew. If you don’t have homebrew on your system you can download and install it from here.

After installing Homebrew check if you have XCode Command Line Tools already installed on your system. Open the Terminal and execute:

xcode-select --install

If it replies with error: command line tools are already installed then you can proceed with installing OpenCV. …

Dexter Barretto

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store