Feature Request: Qt Examples of openCV
-
Please add a submenu of examples using openCV to obtain and process pictures and video input. Maybe you can get the software book by Laganiere to work. Proceed to a full machine vision demo.
I would love to aim an N900 4G camera at a text and have it read and convert (OCR) to text, even off a curved book page, crumpled paper, or a sign in the background. I'd also like it to recognize objects including faces. Maybe it would be a security feature, if it's not my face it reports GPS location of my phone to another phone number.
-
Hi Kirk,
do you have any specific thing in mind? The ideas you describe seem more like general ideas, or too CV related.
Basically, Qt and OpenCV are not that related, they both aim at different problems to solve. So you can combine these toolkits easily.What I mean: Is there any specific interfacing where you have problems?
I've been using OpenCV and Qt for half a year now, and it works seamlessly together (with one exception: if you want to use OpenCV's GUI features, have a look at my patch: https://code.ros.org/trac/opencv/ticket/919 ).
I can see one thing that could be of interest for everybody: How to get a cv::mat into a QImage or QPixmap (and vice versa), or how to convert betweent cv::mat and OpenGL textures. For both things, there exist examples and blog entries on the web.
If you've got a specific problem, feel free to ask.
-
Hi LinusA,
I started Qt because of Laganiere's OpenCV...Cookbook but unfortunately the book's screen shots, instructions, and software download for hooking up Qt and OpenCV are obsolete. The professor kindly provided a new set which also failed. So my first question, as a newbie to both openCV and Qt, how do I combine these toolkits easily, as you wrote is possible?
The first problem I guess is running the book's software from http://www.packtpub.com/support selecting openCV 2 Computer Vision Application Programming Cookbook and downloading the software. All three .pro files for chapter 01 fail with the newer version of Qt. How do you suggest I get past that to get something in openCV to work?
Thanks much.
-
I'm currently using Windows XP Pro SP3, Qt Creator 2.2.1, and whatever C++ comes with Qt. I looked at Qt Quick too which looks interesting but I'm less sure it can work with openCV.
I hope to eventually use fresher stuff like Ubuntu or Susse and an N900 or better (hopefully).
-
Ok, well, I'm only using Visual Studio and Windows, so no idea about Qt Creator.
Anyway, the trick for me was to do everything Qt based. Create a Qt project, (I'm using VS Addon, which can import .pro files). Set everything up: Modules, libs, include paths, etc. Do a dry-run, does it compile and execute?
Treat everything else as "normal header or lib".
Get OpenCV, get CMake, compile OpenCV.Add the lib and the include dirs to the according paths, add the #includes to your headers, and go on.
I always #include Qt first, and then OpenCV.
OpenCV is not such much of "real programming framework". It's just "a collection of classes, functions, datatypes". So it doesn't cause a problem for Qt in any way (except the GUI thing I posted about, but that's not a common thing).
If you've got Visual Studio, I'd recommend you give it a try. Google around, there are many tutorials and guides how to compile and use OpenCV in VS. Use those guides, after you've created a VS soltution from inside VS with the Qt add on.
-
I don't understand. What is Visual Studio - it supports Qt.pro files? Why not just use Qt directly, as it downloads?
The problem for me is being a newbie, I need detailed instructions that work. A few general guidelines like "set everything up then compile and execute" aren't quite enough for me. What is treating anything like a "normal header or lib"? I'm mostly a newbie to C++ too. I had some exposure years ago but not enough to do much in today's environment.
Qt Creator has several examples that are all ready to go. That's why I asked for Qt to adopt openCV examples into its next release.
Right now it's kind of like, here's my toys and your toys and they ought to work great together but only a few people know how without losing lots of parts and failing in the joining.
-
[quote author="Kirk Fraser" date="1311882145"]I don't understand. What is Visual Studio - it supports Qt.pro files? Why not just use Qt directly, as it downloads?
[/quote]
VS = Visual Studio is a well known compiler and IDE for C++ (and other languages) for Windows. See Wikipedia / Google.Qt and VS are in relation like roads and cars. I asked "which car are you using", and you said "why use a car, why not use the road directly"?
Qt comes with its own compiler / IDE, Qt Creator. See tutorials etc. and beginners guides, for example: http://doc.qt.nokia.com/latest/tutorials.html
[quote author="Kirk Fraser" date="1311882145"]
The problem for me is being a newbie, I need detailed instructions that work. A few general guidelines like "set everything up then compile and execute" aren't quite enough for me.
[/quote]
Well, you know what a compilation is, and executing a program means running it. So I meant: First start with Qt, and make sure you get your first application running. If you can compile and start the examples, you've done that.[quote]
What is treating anything like a "normal header or lib"? I'm mostly a newbie to C++ too. I had some exposure years ago but not enough to do much in today's environment.
[/quote]
Headers and libs = libraries (I mean static libraries, usually .lib files) are very basic concepts of C(++). You need to understand them when working with Qt and OpenCV. You really do, there is no way around it. Look it up on Wikipedia or get a C++ book (e.g. B. Stroustrup, or more beginner friendly books).Qt Creator might include header files and libraries of Qt automatically for you, but you need to understand what's going on behind the scenes, especially for OpenCV. It will all be much clearer then!
[quote]
Right now it's kind of like, here's my toys and your toys and they ought to work great together but only a few people know how without losing lots of parts and failing in the joining. [/quote]Well yeah, it might be confusing at first, but you're asking to use two very big frameworks, so that's where you are.
If you want to avoid this whole header and library include stuff (I know I hated it), then you might want to switch to some other language? In Python, for example, you can use both OpenCV and Qt, and the "include" stuff is much simpler and less error-prone.Anyway, to get OpenCV into your .pro file, you have to specify some paths and header files there. To do this, understanding how qmake works is a good start. http://doc.qt.nokia.com/latest/qmake-tutorial.html
I personally went for Visual Studio, as I didn't want to manually play around with .pro files. Something advanced, which may make your life easier: There are certain files for qmake with the extension .prf. If you create them, you can sort of "package a dependency" for OpenCV, to be used by Qt. Thies makes creating new .pro files easier. But I don't know how exactly they are used, just some example file here for you (should you come accross it later):
@
OPENCV_PATH = D:/WhereYouInstalledOpenCV
OPENCV_VERSION = 211
OPENCV_MODULES = core imgproc video features2d objdetect calib3d ml highgui legacy contribINCLUDEPATH += $${OPENCV_PATH}/include
LIBS += -L$${OPENCV_PATH}/libfor(module, OPENCV_MODULES) {
INCLUDEPATH += $${OPENCV_PATH}/modules/$${module}/include
LIBS += -lopencv_$${module}$${OPENCV_VERSION}
}
@ -
With all due respect, while your enthusiasm for your project interests is very admirable, it may be that it's a little too ambitious for a "jump in and make it work while you learn things" kind of project. Especially if you're a newbie. I think some of the issues you've stated you need more guidance in (normal header or lib, building libs, etc.) are things that just kind of come from experience and getting your feet wet.
Perhaps a good path for you might be to work through some of the more basic examples of Qt, just to help you get reacclimated to some of the nuances of C++ and familiarized with the day-to-day mundane things that more experienced developers might tend to take for granted. Before long, you'll have picked those things up and will be taking them for granted too. It will also give you access to a lot more well-documented aspects of the ins and outs of things and allow an easier path for being able to ask questions and make the best use of the knowledge that everyone wants to share.
With a little patience and work to lay a good solid foundation, I think that you'll probably be better prepared to handle the complexities that are involved with more ambitious projects, especially those which are more in the realm of "uncharted waters."
I don't mean that as any kind of a slight or a putdown, by any means. We've all been the newbie before, and have had to go through the (sometimes tedious) process of learning the basics.
Anyway, just my thoughts...
-
How do I correctly ask for or propose this new feature, to add one or more openCV demos to Qt Creator so people will be able to use it in the next update?
I appreciate all the advice and hope to get it done for my own use but I'm thinking other Qt users may be interested in working with the camera whether on an N900 or a laptop or desktop PC. Likewise if such a proven link existed, it would draw more openCV users to Qt.
I'll look at the tutorials but I would like to know some of the real Qt developers have my back by being aware of this feature request and hopefully working on it. Thanks.