免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
Install OpenCV 3 With Python 3 (Mac OSX)

Install FFmpeg

  • FFmpeg is used to encode and decode multimedia data. It is very important to complete this step before moving on to step 8. You will be able to install OpenCV without FFmpeg, but some functions will not compile properly without it and trying to install FFmpeg post OpenCV installation is tricky.
  • Run the following line in your terminal shell.
$ brew install ffmpeg





###############################################################


It took me a while, but I did it. I want to migrate my final project to python 3, so I had to use Opencv 3.0.At the moment of writing, the opencv 3.0 is still alpha, but seems stable enough. So, we’ll be using python 3.4 + Opencv 3.0 alpha on OSX 10.9.4. Let’s start.

Installing python3.4

I have installed python3 using homebrew. I recommend using it. In this case, you should only install python3:

    brew install python3

If you already have python3, skip this step. You can also install openCV 2.4.9, but at the time of writing there is no option for openCV 3 with python3.You should also install numpy. For that you can use pip (already installed), a python packet manager:

    pip3 install numpy

Installing Cmake

You can also install Cmake with homebrew, but instead, I downloaded it directly from its homepage.This way you have cmake gui, a graphical user interface that makes it easier to manage.  So, download and installas any program (dmg): cmake download (look for the Mac OSX 64/32-bit Universal dmg).If you have problems opening, read this

Installing opencv 3.0

First download it from the opencv homepage: opencv3.0 download Select the OpenCV 3.0 (at the time of writing, alpha) for Linux/Mac. We should now unzip it. It’s time to use cmake. Open it from your applications. It asks you to select where the source code is. Navigate to your opencv3.0 folder, previously unzipped.You should also select the build directory (usually you can make a build folder inside the opencv3.0 folder)

This image shows my configuration. You can filter the configuration parameters so it is easier to find. The important ones are those with “python3” prefix.You should set yours depending on your system installation, but if you followed this guide you should set themas they are shown.

So remember to:

  • Set the BUILD_opencv_python3. If it is not present, you can add it with the Add Entry button. (這里設(shè)置成bool 的值即可, 記得check上)
  • In my case, the parameters I had to set manually were PYTHON3_INCLUDE_DIR and PYTHON3_LIBRARY. (這里自己也要設(shè)置,路徑同上圖。 同時(shí),要注意PYTHON3_NUMPY_INCLUDE_DIRS的路徑也是和圖里一樣的。如果不一樣,就看另一個(gè)帖子)
  • If the others parameters are not set automatically, it may help to run brew linkapps command before configuring. In any case, you can set them manually.
  • Your Current Generator is Unix Makefiles

Now, click configure. If everything goes fine, now you click generate. If any problem should happen, you can try to detect it by reading the output in the bottom of CMAKE. Look for problems related with Python. It would be easier if you copy the text into textedit so you can find words.

All right, time to open a terminal.In the terminal, navigate to the folder where you have your build folder, something like:

    cd /Users/[username]/Downloads/opencv-3.0.0-alpha/build

Now execute the make command (-jX where X is the number of cores of your CPU, to make compilation faster):

    make -j8

For the next command you need super user privileges:

    sudo make install

Checking it all works

If there were no errors, you should be able to import it. Execute this in the terminal:

    python3    import cv2

If there is no Error, congratulations, you have opencv3 with python 3.

Now go out for a beer, you earned it.

What? It didn’t work? No time for beer yet then…

UPDATE:If you got problems like import error, I recommend that you look careful at the outputs in every step. Actually, you should always do that for everything. Looking for words like ERROR. If you had made it to last step, you can try to uninstall and try configuring and installeing it all again.To uninstall your recently installed openCV you should go to the build directory from the terminal and run this command:

    sudo make uninstall

I usually do this for installing newer versions of OpenCV too (OpenCV 3.0 - beta is out now).

If you keep having problems, post them in the comments and I’ll try to help ;)

***************************安裝完畢后,可以在ipython3路徑中import cv2了。但是還不能在python3中導(dǎo)入cv2----------

經(jīng)過查詢后,發(fā)現(xiàn)cv2.so位置是:/usr/local/lib/python3.4/site-packages

因此,在~/.bash_profile中加入了語句

PYTHONPATH="${PYTHONPATH}:/usr/local/lib/python3.4/site-packages”
export PYTHONPATH

即可   --------上面的結(jié)果還是不行,結(jié)果是Python 3.4.2和 3.4.3沖突所致。

因此我們的解決方案是: 全部刪除Python3,然后再brew 安裝最新的Python,最終link之即可

----------------------------------------------------

要處理avi數(shù)據(jù),我們還需要brew install ffmpeg

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
[翻譯]Ubuntu 14.04, 13.10 下安裝 OpenCV 2.4.9
神級(jí)程序員把Python2和3當(dāng)中最常見的問題都收集了!很全面的總結(jié)
Opencv在Crotex
Centos7下安裝部署MXNET
centos安裝caffe
子豪兄教你在樹莓派上安裝OpenCV
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服