Monday, September 01, 2014

Set up OpenCV for Python in MacOS X

Install/update Xcode from App Store and launch it to pass through terms agreement prompts.

Install Xcode Command Line Tools for easing later processes.
xcode-select --install
c.f. Stack Overflow thread

Install OpenCV.
$ brew install gcc
$ brew install opencv3
Now install python modules for OpenCV.
$ pip install cv2

You have to provide a shared library for it.  This is the key step. 
$ pushed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
$ ln -s /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cv2.so
$ popd
Test if it works.
$ python
>>> import cv2
>>>  
It should finish without showing any error.

If this is for your virtualenv, do similarly in your venv directory.

1 comment:

for. said...

Image Processing Projects For Final Year offers innovative project ideas that focus on techniques such as image enhancement, object detection, segmentation, and pattern recognition. These projects help students gain practical experience in applying computer vision methods to real-world visual data.

Big Data Projects includes a variety of final-year topics centered on analyzing and processing large-scale datasets using tools like Hadoop, Spark, and NoSQL databases. These projects enable students to develop skills in scalable data processing, analytics, and visualization.