Hi Adrian, thank you for the awesome guide. I do not have any python/opencv experience, but seems that I finished all steps and got results ? You’ve earned +1 into your fanbase ?However I got few problems during process, that were not covered in your guide (POPCNT almost sent me into space):problem: `cmake: command not found`solution: `brew install cmake`problem: `error “POPCNT is not defined by compiler”` error in CMakeError.loginvestigation: happens only with `-D OPENCVEXTRAMODULESPATH`solution:1. Cmake via terminal w/o `-D OPENCVEXTRAMODULESPATH`2. Open build folder and add `-D OPENCVEXTRAMODULESPATH` via cmake GUI, configure, generatenote: no idea what the problemproblem: `error: (-215) npoints = 0 && (depth CV32F depth CV32S) in function contourArea` after `python scan.py –image images/receipt.jpg`solution:– `cnts = cnts0 if imutils.iscv2 else cnts1`+ `cnts = cnts0`.
![]()
Installing OpenCV on Mac. UPDATE: Mavericks users were likely frustrated for the last few weeks trying to install OpenCV. It appears the problem has been fixed, and these instructions should work without issue. My previous post on installing OpenCV for Mac users is one of the most popular on this site.
Tried to install OpenCV using Hombrew a few times and on this page:And commented that I couldn’t get it working. So I have now tried this update.Seems to all go OK until I try to sumlink.When I try and run:ls /usr/local/lib/python3.7/site-packages/cv2.cpython-37m-darwin.soI get:ls: /usr/local/lib/python3.7/site-packages/cv2.cpython-37m-darwin.so: No such file or directoryShould I be doing this inside the vitualenv or outside of it?Anyway when I look in:ls /usr/local/lib/python3.7/site-packages/There is no cv2.cpython-37m-darwin.so because on a previous attempt it was renamed to cv2.so, but I can’t understand as I have followed this guide to completely re-install it? Not sure if its still relevant, but this fixed the issue with tesseract.It was installed on my machine with ffmpeg, and even after uninstalling everything, it kept failing, until I found this:You need to re-install ffmpeg and tesseract, and while installing it will give you the location of the install in brew:brew uninstall ffmpegbrew install ffmpegIn one of the outputs you will see the location of the install:?
/usr/local/Cellar/tesseract/4.1.0: 65 files, 29.7MBThen you run your make command like this (add the “include” to the path):CPATH=/usr/local/Cellar/tesseract/4.1.0/include make -j6And now it seems to work.Hope it helps, good luck!.Adrian Rosebrock. Hi Adrian,Great tutorial! I completed it easily on my computer. Once I started the practical python book, I had trouble with Matplotlib on TkAgg, but thats another problem. I uninstalled homebrew and reinstalled to start the process over (all the simlinks were so messed up I didnt know what else to do) and now I get this error when trying to install python. Python contains a recursive dependency on itself:python depends on sphinx-docsphinx-doc depends on pythonIt seems like the issue has been documented here, but they have not made any moves to fix it.Any ideas?Python 3.7 installs perfectly fine with brew install python. Oh no, I’m sorry to hear about the error, Carlene.
Unfortunately I’ve never encountered that error before so I’m not sure what the exact error is. If your sym-links were messed up though then that’s likely the root cause. Unfortunately just about the only thing I can recommend is a fresh install of macOS to ensure you have a fresh slate. I know that’s not the answer you were hoping for but given the state of the machine I unfortunately don’t have many other recommendations. Sorry I couldn’t be of more help here!
Hi Adrian,I solved it in a different way:First of all I uninstalled the python 3.7 release I installed two days ago using “brew uninstall python”.Then I downloaded the python installer 3.6.8 from python web site and installed it using its installer.Because of this, python components have not been installed on /usr/local/Cellar/python/3.6.51/Frameworks but they are in /Library/Frameworks This is not a problem for virtualenv that recognize the correct directory.Up to now I did not found any problem related to this solution so I’d like to share it ?.Saksham. Adrian,Thanks for the tutorial. I got this working on Mojave with zero problems.It seems that you should emphasize to people new to OpenCV on Mac that setting up in the virtual environment is not just an optional way of doing this, but has real advantages in keeping a botched install from tangling up their machine and possibly making other programs and packages unusable.It seems that unless a user really knows what they are doing and how to un-do an action, they should work in the virtual environment. Adrian et all – I am just getting started and definitely motivated, I have one successful RPI project, including code modifications, Ive read a bunch of the “14 days” tutorials, and I have a recurring impediment maybe you / community could assist with:Version / configuration control of MAC OS, OpenCV, Python and ability to compile appropriate environment for each project.
Im trying to run the projects on my MAC OS instead of RPI which introduced one variable not yet overcome, and I see some of the projects reference different versions of Python and also different versions of Open CV. Getting through compile on the RPI took many trouble shooting sessions (nights) and I am looking for some kind of solution that may stream line my ability to execute each of the projects Some ideas I have but realistically, I don’t know what is feasible or realistic: a summary of config needed at top of each project, open source bash scripts for each combination of configuration, reference to a tutorial in this topic, other Adrian thanks ahead for all you do community too.
I noticed a potential problem with how PYTHON3LIBRARY is defined.The python-config executable that subprocess invokes might not belong to the python instance that was used to create the virtualenv.In my case python-config references the Apple-provided Python2.7 instance, even when I’m inside a Python3 virtualenv. The python-config executable isn’t part of the virtualenv, possibly because I didn’t use virtualenv/virtualenvwrapper (just python3 -m venv).Another way of figuring out the dylib path could be to use ctypes.util.findlibrary(“python3.7”). That gives what looks like the right path without shelling out.
Hey, Adrian here, author of the PyImageSearch blog. I’d love to hear from you, but before you submit a comment, please follow these guidelines:. If you have a question, read the comments first. You should also search this page (i.e., ctrl + f) for keywords related to your question.
It’s likely that I have already addressed your question in the comments. If you are copying and pasting code/terminal output, please don’t. Reviewing another programmers’ code is a very time consuming and tedious task, and due to the volume of emails and contact requests I receive, I simply cannot do it. Be respectful of the space.
I put a lot of my own personal time into creating these free weekly tutorials. On average, each tutorial takes me 15-20 hours to put together.
![]()
I love offering these guides to you and I take pride in the content I create. Therefore, I will not approve comments that include large code blocks/terminal output as it destroys the formatting of the page. Kindly be respectful of this space.
Be patient. I receive 200+ comments and emails per day. Due to spam, and my desire to personally answer as many questions as I can, I hand moderate all new comments (typically once per week). I try to answer as many questions as I can, but I’m only one person.
Please don’t be offended if I cannot get to your question. Do you need priority support?. I place customer questions and emails in a separate, special priority queue and answer them first. If you are a customer of mine you will receive a guaranteed response from me. If there’s any time left over, I focus on the community at large and attempt to answer as many of those questions as I possibly can.Thank you for keeping these guidelines in mind before submitting your comment.
opencv
Also known as: opencv@4
Formerly known as: opencv3
Open source computer vision library
Formula code on GitHub
Current versions:
Other versions:
Revision: 3
Depends on:
Depends on when building from source:
Analytics:
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |