The story of having a hard time introducing OpenCV with M1 MAC

Introduction

<!-Description the beginning and outline-> I bought an M1 MacBook Air and tried to play with OpenCV triumphantly, but I had a lot of trouble, so I will make a note. I think there is a better way, so for your reference. Qiita is also a beginner so I don't know

table of contents

<!-Edit title and anchor name->

  1. Environment
  2. Installation method
  3. References

<!-Each chapter->

environment

-Machine: MacBookAir 2020 M1 -Python: 3.8.2 (included from the beginning)

Installation procedure

① Install Xcode (may be unnecessary)

② Install Homebrew (maybe unnecessary)

④ Install Cmake (maybe unnecessary) Just in case, cmake gave an error when installing numpy. .. ..

brew install cmake

③ Install Anaconda See here

④ Install OpenCV See here

pip install opencv-python-headless :main module only

⑤ Execute! The test code looks like this

import cv2

img = cv2.imread('image.jpg')

cv2.imshow("image", img)
cv2.waitKey(0)
cv2.destroyAllWindows()

that's all!

Recommended Posts

The story of having a hard time introducing OpenCV with M1 MAC
The story of displaying images with OpenCV or PIL (only)
The story of making a question box bot with discord.py
Introducing OpenCV on Mac with homebrew
The story of writing a program
A story stuck with the installation of the machine learning library JAX
The story of making a standard driver for db with python.
The story of making a module that skips mail with python
A story that I had a hard time displaying graphs on top of each other with matplotlib
The story of blackjack A processing (python)
A story that visualizes the present of Qiita with Qiita API + Elasticsearch + Kibana
The story of a Parking Sensor in 10 minutes with GrovePi + Starter Kit
The story of making a university 100 yen breakfast LINE bot with Python
The story of making a sound camera with Touch Designer and ReSpeaker
The story of doing deep learning with TPU
[Python3] A story stuck with time zone conversion
The story of making a web application that records extensive reading with Django
The story of making a lie news generator
The story of making a mel icon generator
Predicting the goal time of a full marathon with machine learning-③: Visualizing data with Python-
The story of Airflow's webserver and DAG, which takes a long time to load
The story of introducing a multi-factor authentication function using a one-time password into a Java application
The story of launching a Minecraft server from Discord
A story that reduces the effort of operation / maintenance
The story of stopping the production service with the hostname command
Take a screenshot of the LCD with Python-LEGO Mindstorms
The story of making a music generation neural network
A story that struggled with the common set HTTP_PROXY = ~
Fill the background with a single color with OpenCV2 + Python
Visualize the characteristic vocabulary of a document with D3.js
A story about changing the master name of BlueZ
Zip 4 Gbyte problem is a story of the past
A story that analyzed the delivery of Nico Nama.
Visualize the appreciation status of art works with OpenCV
Calculate the product of matrices with a character expression?
The story of sys.path.append ()
A server that returns the number of people in front of the camera with bottle.py and OpenCV
The story of creating a "spirit and time chat room" exclusively for engineers in the company
Give the history command a date and time and collect the history files of all users with a script
A story that I had a hard time trying to create an "app that converts images like paintings" with the first web application
The story of creating a VIP channel for in-house chatwork
I tried "gamma correction" of the image with Python + OpenCV
Avoiding the pitfalls of using a Mac (for Linux users?)
A network diagram was created with the data of COVID-19.
The story of implementing the popular Facebook Messenger Bot with python
Measure the importance of features with a random forest tool
Get the id of a GPU with low memory usage
Get UNIXTIME at the beginning of today with a command
The story of introducing jedi (python auto-completion package) to emacs
Let's execute the command on time with the bot of discord
The story of a Django model field disappearing from a class
Introducing the potential of Plotly scatter plots with practical examples
Reformat the timeline of the pandas time series plot with matplotlib
The story of rubyist struggling with python :: Dict data with pycall
Display the signal strength RSSI of a specific SSID (mac)
A story about how to deal with the CORS problem
A story about clustering time series data of foreign exchange
Estimate the attitude of AR markers with Python + OpenCV + drone
Analyze the topic model of becoming a novelist with GensimPy3
The story of creating a database using the Google Analytics API
A story about predicting prefectures from the names of cities, wards, towns and villages with Jubatus