I'm using the Python bindings of OpenCV and it's really great. However, there are functions in the C++ version that are missing from the Python bindings, BackgroundSubstractorMOG2, and a lots of feature detection algorithms for example. What would be the easiest way to call them from Python?
I hope this helps people looking for a fast and easy way.
Here is the github repo with the open C++ code I wrote for exposing code using OpenCV's Mat class with as little pain as possible. It was originally inspired by Yati Sagade's example.
[Update] This code now works for OpenCV 2.X and OpenCV 3.X. CMake and experimental support for Python 3.X are now also available.
I also found that a few months after my original utility was written, Sudeep Pillai also wrote a similar thing for C++/CMake. There seems to be OpenCV 2 and OpenCV 3 support as well. May be worth a try.
Have a look to SimpleCV. It Python base and it a warping OpenCV. Maybe you can found something there.
Related
I am doing a simple demo project on iOS using swift and Dlib. Let's say I already have modified code for extracting facial landmarks using dlib C++ Lib, and I have tested my code in Xcode, which is pretty good(Although the capture is a little slow).
Now, I want to use iPhone front camera to do the device test. I only know C++ and Swift at this time. How to bring them together? What's the recommended method? Do I need to put all functions I need in *.mm files, and invoke them in the Swift code?
Expect to great answers and thanks a lot!
I would like to create results similar to the video found at this link. I tried the Object Detection and Localization toolkit made for the work done by Dalal and Triggs found here, and I tried trainHOG(https://github.com/DaHoC/trainHOG), a program that uses OpenCV that can be trained to detect people.
For the ODL toolkit, I had problems compiling because its requirements are now dated. The Ubuntu packages that provide the requirements for ODL (ImLib, Boost, and Blitz) are not compatible with the versions of the packages required by ODL. I actually went through a lot of effort building older versions of the required packages but hit a dead end of an error saying:
error: no matching function for call to ‘boost::program_options::validation_error::validation_error(std::basic_string)’ + argument.desc.find(*ai, false).format_name());
For trainHOG I was able to detect people but only if they were very small in the image. I also got a lot of false positives. I trained it with 1133 positive images and ~8500 negative image, all of which were 64x128 in size.
OpenCV has a API for HOG Descriptor which you can use easily.
However, HOG is very very simple to implement and it should take whole deal of time for you to implement. You can refer to this tutorial which I found to be very helpful when for understanding HOG.
If you still find problem than let me know so I can help you code it.
Is there any bindings to execute functions in OpenFrameworks (C++ toolkit) using Python 2.7? Or any alternative for this available?
Experiments on python 2.6 has been made, see #Babu answer. But not updates..
I don't know a lot about it but you can try to have a look at SIP (even i think it is an hard task to let it work completely):
SIP is a tool for quickly writing Python modules that interface with
C++ and C libraries. Its home page is at
http://riverbankcomputing.co.uk/software/sip/intro. It was written by
Phil Thompson who is still actively maintaining it.
I don't think there is a binding available for Python 2.7. For 2.6, it's available here,
For Windows: http://forum.openframeworks.cc/index.php/topic,3031.0.html
For OSX: http://forum.openframeworks.cc/index.php/topic,2763.0.html
I am also very interested by Python bindings, but it seems quite hard to implement...
That's why things like cppyy could be really handy! I didn't have a close look yet, but it's definitely on my todo list.
Interesting thing to checkout when working with OpenFrameWorks + Python is using BeautifulSoup to parse HTML and use that in OPenFrameworks to visualize the informations.
i am looking into facial recognitions using Local Binary Pattern Histogram have came across OpenCV. Within OpenCV, the Local Binary Pattern Histogram has a function which compares histograms "compareHist". How can i perform this function on a web server?. Is it possible to run OpenCV on a web server? (i am thinking about writing the whole function myself however it is based on multiple custom created classes and its rather troublesome - what language should i use? - this would be my last resort).
OpenCV comes with cv::FaceRecognizer, which includes Eigenfaces, Fisherfaces and Local Binary Patterns Histograms. It comes with a very detailed documentation, please see:
http://docs.opencv.org/trunk/modules/contrib/doc/facerec/index.html
No need to implement it yourself. If you want to do this in another language, then you can easily look up the implementation in the contrib module of OpenCV. I am sure you can get some impression there.
As for the webserver. If you have a real server, then sure you could put OpenCV up there and interface with it. If you want to get something going real quick, have a look at the OpenCV Python bindings for cv::FaceRecognizer. I did a post on the OpenCV QA page just yesterday:
http://answers.opencv.org/question/253/broken-python-bindings-with/?answer=255#post-id-255
However, it's a bit complicated due to an error on my side. There was a bug in the official OpenCV 2.4.2 release, so for the Python bindings to work you'll need the trunk version. Note, that the source code is now hosted with git, so you can get it with:
git clone git://code.opencv.org/opencv.git
for example. Then if you are in Linux, you can follow this tutorial on how to install OpenCV:
http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html
or if you are in Windows, then:
http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html
might help. Make sure you have python-dev and python-numpy installed, so the Python bindings are compiled. If you are in Windows, simply install Python2.7 and NumPy (http://www.numpy.org).
You might be interested in my Guide to Face Recognition with Python also, which is available at:
https://github.com/bytefish/facerecognition_guide
That shows a really lightweight implementation of two algorithms.
Disclaimer I am a founder.
Algorithmia provides OpenCV as a service through our API.
http://algorithmia.com/users/opencv
Hey!! I'm looking for python bindings for opensg 1.8.. I haven't been able to find it. I have read somethin about pyopengs. Is it still available? I am working on linux platform (ubuntu). If anyone could direct me to it I would be grateful.
The homepage and source code is on google code: pyOpenSG Project
As one of the creators of pyOpenSG, I can tell you that it is definitely still alive and kicking. We use it in production software all the time. It has become so stable for us though that we don't often update the code base. The python binding generator that we use (py++) just keeps everything working between revisions.