Showing Up As Yourself

In a world filled with dating apps, swipe left or right, and fast paced relationship decision making, we often feel like we have to put on a show, or present some manicured, camera ready version of…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Installing OpenCV 3 from Source on macOS Catalina

OpenCV has become one of the most widely used open-sourced library used in the field of computer vision. Thanks to the volunteers who have contributed to this library. The journey from Willow Garage to opencv.org has been inspiring. However, setting up the environment to build OpenCV from source is always challenging. With every new release as well as with a new operating system release, configuring OpenCV will be cumbersome.

In this blog post, I am going to note down the OpenCV build process in baby steps on recently released macOS Catalina. Dropping the support for 32-bit applications has created an unpleasant situation amongst some users.

Download Xcode from App Store. It will take a while as the size of this file is nearly 7 to 8 GB. After the successful installation of Xcode, run the following command.

$ sudo xcodebuild -license

Use the space key to move to the bottom of the agreement page and type [accept] to agree with the license. Next, we need to install the command line tools, which will install the basic compilers (gcc, g++, etc.). Use the command given below.

$ sudo xcode-select --install

After installing homebrew, update the package definition.

Append the following lines to the file and save it.

Reload the ~/.zshrc file using source command.

After installing the downloaded python file, run the following command to check the path of python3.

Using the brew package manager, install the following dependencies for building OpenCV.

Configure the ~/.zshrc profile page again to set the environment variables.

After updating the ~/.zshrc file, reload it by using the source command.

Create a virtual environment with the name py3cv3. You can choose a suitable name for your needs.

The only python dependency required by OpenCV is NumPy (we will use 1.14.0), which we can install by using the following command.

We will rename the extracted folder so that the version information would be removed from the extracted folder name.

Check for the output of CMake. It should look as follows:

Check the interpreter and numpy library path. It should be selected from the virtual environment

Run the following code to make from the build files.

After a successful make, we can install it by using the following command.

To check the successful installation inside the system, you can search for the “opencv.pc” configuration file. Generally, it can be found in the following path.

Run the following command to check the installed version.

After the installation, we have to create a symbolic link of the cv2.so file into the virtual environment. Let’s first check whether the .so file exists inside the installation path or not.

If we want to install multiple versions of OpenCV, its better to rename it, to avoid any confusion with later installations. After renaming, we can create the symbolic link of the .so file into the virtual environment (e.g., py3cv3).

Finally, we can test the installation by running the following commands.

If you are able the see the version of OpenCV, the installation has been successful in your system, and you are ready to go. Congratulations!!

6. Tensorflow and Keras Installation on macOS Catalina

We are going to install TensorFlow and Keras inside the virtual environment py3cv3. To activate the virtual environment, just run the following code.

Using pip, we will install some of the famous computer vision, machine learning, and image processing packages.

Next, we will install matplotlib and update the rendering background.

Congratulations!! You have successfully installed OpenCV on the macOS Catalina.

Add a comment

Related posts:

My credit card score is 642. Is this good?

I am a college student and got my first ever credit cards in September (three months a go). My credit score is 642. It said the key factors that affected your credit score were: ‘Banking history…

Murni

Kali ini aku menulis dari laboratorium komputer di kampusku, meninggalkan ruangan studio yang panas dan ramai, mencari kesunyian. Aku tidak tahu akan menujukan keping ini kepada siapa, tapi aku…

Interview with a stranger

Small talk can be burdensome, or it can be a way to open ourselves up to others and to learn how to listen. Interviews are a version of small talk that rely on a person to ask more intimate questions…