Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am trying to do some Face Recognition (not detection) stuff using OpenCV. I found this article with some code:
http://www.cognotics.com/opencv/servo_2007_series/index.html
However, this code is written using the older C-style OpenCV API. Does someone have a C++ API version of this using a more recent version like OpenCV 2.3.1?
Update: OpenCV 2.4.2 now comes with the very new cv::FaceRecognizer. Please see the very detailed documentation at:
http://docs.opencv.org/trunk/modules/contrib/doc/facerec/index.html
I have released libfacerec, a modern face recognition library for the OpenCV C++ API (BSD license). libfacerec has no additional dependencies and implements the Eigenfaces method, Fisherfaces method and Local Binary Patterns Histograms. Parts of the library are going to be included in OpenCV 2.4.
The latest revision of the libfacerec is available at:
https://github.com/bytefish/libfacerec
The library was written for OpenCV 2.3.1 with the upcoming OpenCV 2.4 in mind, so I don't support OpenCV versions earlier than 2.3.1. This project comes as a CMake project with a well-documented API, there's also a tutorial on gender classification. You can see a HTML version of the documentation at:
http://www.bytefish.de/dev/libfacerec/
If you want to understand how those algorithms work, you might want to read my Guide To Face Recognition (includes Python and GNU Octave/MATLAB examples):
http://www.bytefish.de/blog/face_recognition_with_opencv2
The relevant publications are:
Turk, M., and Pentland, A. Eigenfaces for recognition.. Journal of Cognitive Neuroscience 3 (1991), 71–86.
Belhumeur, P. N., Hespanha, J., and Kriegman, D. Eigenfaces vs. Fisherfaces: Recognition using class specific linear projection.. IEEE Transactions on Pattern Analysis and Machine Intelligence 19, 7 (1997), 711–720.
Ahonen, T., Hadid, A., and Pietikainen, M. Face Recognition with Local Binary Patterns.. Computer Vision - ECCV 2004 (2004), 469–481.
I'm doing a face recognition project for my engineer's degree, using c++ api. I think that everything regarding face recognition in c++ is fairly straightforward, even simpler than in C (less pointers). To use PCA you have a class named PCA described here. Just use the proper methods and read documentation with understanding. To build the matrix with input data I've created a matrix of proper size, then pasted pictures as rows (use method reshape) into it (there is a method in cv::Mat that lets you to get easily a row of a matrix). You just need to keep sure that base data and tested data have the same parameters (channels, size,etc.)
EDIT:
using namespace cv; //somewhere near top
inserting data to data matrix:
62 Mat reshaped=img.reshape(1,1);
63 Mat dataRow=_data.row(y++);
64 resize(reshaped,dataRow,dataRow.size(),0,0,CV_INTER_LINEAR);
computing pca:
251 _pca(_data,Mat(),CV_PCA_DATA_AS_ROW); //compute pca
252 _pca.project(_data,_vectors); // project original data to new coordinates
As opencv's documentation isn't the best out there, it doesn't hurt to spend some time reading it. Most of the c api functions have their equivalents in c++ api, You only need to do some "write into search window and hit enter" searching. And, there are also tutorials in c++ to get a grip of the c++ api.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I have already built a deep neural network image classifier program in Matlab (gives 1 output for each example, such as is it a car or not), using gradient descent and back propagation algorithms. It is a simple feed forward network, with 1 or 2 hidden layers. I'm using the obtained weights in a nvcc C++ for real time object detection.
NN training results have quite a good accuracy (more than %99.9, but not enough), and can process more than 100,000 image files of size 32x32. But only problem with the Matlab code is: it ends up in local minimums in each training, so requires many different trainings but its training speed is quite slow.
Other than my slowly working Matlab NN training code, I have tried:
1) OpenCV 3.0.0, it "probably" has a bug in virtual float cv::ml::StatModel::predict function at the moment. So I weren't able to use it properly.
2) Tried OpenNN with gui, but it even gets stuck during loading and training. I'm still working on to fix that.
3) Checked FANN, but could only find "one" tutorial code written in C++. May take quite a time for me to master it with out examples.
4) I had tried Theano in Python a few months ago, it was quite customizable, and has quite many tutorials. But had never tried training image files with it.
5) I can also transfer my Matlab code to nvcc C++, and try conjugate gradients method to speed up further. But didn't try this yet, it is the last choice for me.
Mastering in each path may take quite a big time, and I have many more different works to do too. Which path should I take, or do you have another suggestion? Thank you
If you have experience with Matlab, the easiest path is to go through the "VGG Convolutional Neural Networks Practical" and use their open source MatConvNet toolbox for Matlab: http://www.vlfeat.org/matconvnet/.
I am trying to make an OCR library using Haar classifier of opencv.But its not working well.So can you tell me what are the steps for making an OCR? and will it be possible by using Haar classifier?
There are lots of books, tutorials etc available on googling.
But there are two books which would be useful for you.
1) Handbook of Character Recognition and Document Image Analysis by H. Bunke and P. S. P. Wang
2) Optical Character Recognition: An Illustrated Guide to the Frontier (The Springer International Series in Engineering and Computer Science) by Stephen V. Rice, George Nagy and Thomas A. Nartker
They have got some good deep theory in it.
And you can see a simple digit OCR using kNN in C++ here: Basic OCR in OpenCV
And you can see a simple Python implementation of OCR using kNN in this SOF: Simple Digit Recognition OCR in OpenCV-Python
In the OpenCV svn, you can see a new Python sample for hand-written recognition using ANN : ...svn\opencv\samples\python2\digits.py . The code is in Python, but all OpenCV functions would be available in C++ too.
Hope this would be sufficient for a start up.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am looking to build a new Interactive 3D planning software similar to this one http://www.materialise.com/materialise/view/en/131410-SimPlant.html
I was looking for some expert advise about the best technologies to use to build the different components of the software (ie: UI, Image processing, visualization, 3D, etc.. )
The software need to be able to process the images very quickly and in the same time I need to be able to deliver the software to the market fast, so the technologies used should allow for both rapid application development, and high performance. Any advise would be appreciated
Take a look at VTK (vtk.org) for an general purpose visualization toolkit and the ITK (itk.org)
which is an image analysis toolkit built on top of vtk. Both are BSD licensed.
The Python Imaging Library, PIL, is a good compromise between speed-to-market and good performance (and you can always use scipy and its core part, numpy, to enrich it for more advanced image-processing needs, if you pick Python as your pivot language!-). Similarly, visualization (including 3D) are excellently covered in third-party Python extensions -- check out EPD, the Enthought Python Distribution, for a good idea of what libraries might best help you in such tasks (you can always build your own versions if you don't want to partner with Enthought for commercial distribution... but it might be worth checking them out, as they have excellent commercial contacts as well as tech skills;-).
When and if you want to dip down into C++ for some specific component, Boost.Python, SIP, or Cython will make it child's play to integrate the component into your Python mainstream. For UI &c, PyQt is great...
In other words, while I'm obviously biased, in your shoes I'd unhesitatingly go for Python as the "core" and investigate the various options I've mentioned for visualization, UI, etc, etc. One caveat: for quick time-to-market, stick with Python 2.6: the newest 3.1, while great in many respects, is likely to still miss compatible versions of many third party extensions that will make your life way easier and sweeter with Python 2.6!
ITK is not built on top of VTK, although they are related. One can easily process data with ITK and then switch to a VTK pipeline for the visualization and interaction functionality.
We have built fairly large and complex medical image processing and visualization applications (experimental, surgical planning) in Python using a combination of VTK, ITK and wxPython. The licensing of all these components is such that you can use them in commercial applications.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am really intrigued by the field of computer vision and the potential it has. Are there any examples (preferably implemented in .NET) which I can study along with a reference book?
Sample Vision Code
Vision Source Code - Carnegie Mellon University
Open Source Computer Vision Library - Sourceforge
Computer Vision Test Images
libsift - Scale-Invariant Feature Transform implementation
C# wrapper for OpenCV
Resources
Computer Vision Online - Computer Vision Online
Computer Vision "Home" - Carnegie Mellon University
Lecture on Vision Systems - Cardiff School of Computer Science
Lectures on Computer Vision Systems - The University of Nottingham Computer Science Department
Feature Detection - Wikipedia Article
Scale-Invariant Feature Transform - Wikipedia Article
Stack Overflow Questions
Where do I learn about Image Processing and Object Recognition?
Image Processing Textbooks?
Computer Vision References
OpenCV (Open Computer Vision) is the most popular library, and it has been wrapped for C#:
http://www.codeproject.com/KB/cs/Intel_OpenCV.aspx
Some discussion about this wrapper and the library in general is here:
http://coolthingoftheday.blogspot.com/2008/08/opencv-open-source-computer-vision-for.html
-Adam
While the OpenCV library is interesting to use, it doesn't offer a lot of transparency as you learn. If you're interested in actually learning about the field, I would recommend looking into low-level image processing libraries and implementing your own Computer Vision applications. Once you've coded your own basic CV applications, using the OpenCV library becomes a lot easier. I would suggest the following topics to advance quickly through the basics:
sobel operators for edge detection
trying your hand at color segmentation
reconstructing 3d information from stereo images using disparity maps
Here's a site with some good test images (http://www.cs.cmu.edu/~cil/v-images.html).
I also found a good resource of course slides that cover the majority of these topics at (http://www.cs.nott.ac.uk/~tpp/G5BVIS/lectures.html)
Happy hacking =)
Here's a large collection of code, toolkits, and apps you might find useful
http://www.cs.cmu.edu/~cil/v-source.html
You could start by looking at some of the similar questions on this site:
where-do-i-start-learning-about-image-processing-and-object-recognition
image-processing-textbook
computer-vision-reference
I can also look at these two sites:
http://www.cs.cmu.edu/afs/cs/project/cil/ftp/html/vision.html
http://www.cs.cf.ac.uk/Dave/Vision_lecture/Vision_lecture_caller.html
The sites provide information, tutorials and code examples, even though they are not actively maintained anymore.
There is the OpenCV project on sourceforge with a book that you can get as well. You can see it here. However, that is not a .NET solution it is C
I recommend Open Computer Vision Library. It's much spoken of and looks promising. It even has an O'Reilly accompanying book :)
The Open Computer Vision Library has >
500 algorithms, documentation and
sample code for real time computer
vision. Tutorial documentation is in
O'Reilly Book
I've done a bit of work with SIFT in the recent past and it seems to be a rather interesting modern algorithm for feature detection, which is one of the major (and perhaps more advanced) topics within machine vision. Someone has written a C# library for SIFT with a pretty nice example that can automatically stitch together separate photographs of the same scene. Admittedly, this isn't a very complete answer, and I can't recommend a reference book, but hopefully it should be of some use to you anyway...
The AForge.NET library is pretty good and is written in C#, with the source available here.
Supported features are:
AForge.Imaging - library with image processing routines and filters;
AForge.Vision - computer vision library;
AForge.Neuro - neural networks computation library;
AForge.Genetic - evolution programming library;
AForge.Fuzzy - fuzzy computations library;
AForge.MachineLearning - machine learning library;
AForge.Robotics - library providing support of some robotics kits;
AForge.Video - set of libraries for video processing etc.
The algorithms are maybe not as cutting edge/academic as some of the other answers but a lot of the engineering problems taken care of (getting video into your application, etc).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
What is the best way to graph scatter plots in C++?
Do you write data to a file and use another tool? Is there a library like matplotlib in Python?
I always write out data and then using gnuplot to create my graphs. It is by far the best way I have found of producing graphs in a variety of formats: eps, png, jpeg, xpm, you name it.
gnuplot will do scatter plot very easily. Provided the x and y values are in 2 space-separated columnss, then
plot "data.txt" using 1:2
Will give you a quick scatter plot. Then you can adjust it and what not using other gnuplot commands.
If you are involved in sciences, then learning gnuplot will be very valuable to you. It kicks the crap out of doing excel plots for sure and it eases the task of making plots to include in papers.
If you are looking for a C++ library rather than I independent plotting tool like gnuplot, I would consider the following:
Koolplot
dislin (Wikipedia article on dislin)
dislin seems to be the more interesting of the two. Here is a description extracted from the wikipedia article:
DISLIN is a high-level and easy to use plotting library developed by Helmut Michels at the Max Planck Institute in Katlenburg-Lindau, Germany. Helmut Michels currently works as a mathematician and Unix system manager at the computer center of the institute.
The DISLIN library contains routines and functions for displaying data as curves, bar graphs, pie charts, 3D-colour plots, surfaces, contours and maps. Several output formats are supported such as X11, VGA, PostScript, PDF, CGM, HPGL, SVG, PNG, BMP, PPM, GIF and TIFF.
DISLIN is available for the programming languages Fortran 77, Fortran 90/95 and C. Plotting extensions for the languages Perl, Python and Java are also supported for most operating systems. The current version of DISLIN is 9.4, released in October 2008. The first version 1.0 was released in December 1986.
The DISLIN software is free for non-commercial use.
Very heavy solution: you could link against ROOT, which will do just about anything you want:
runs on Mac, Windows and Linux
runs compiled or using the cint interperter
output to a file in encapsulated postscript, PDF, gif, png...
display to the screen using several different technologies
serialize the data in an internal format that can be manipulated later
Sure, its a bit much for most people, but it does do exactly what you asked for. I use it because I know it and it is already on my machines becase I'm that kind of physicist.
Good old GNU, they have everything...
http://directory.fsf.org/project/plotutils/
This is certainly not the best way but I usually write output files that can be read by R and use this, along with an appropriate script, to plot the graphs.
The problem here is that C++, unlike Java for example, does not have built-in GUI or graphics. If you want to generate graphs with C++ you would need to use a GUI library available for your OS. There are free GUI libraries, many cross-plaform such as Qt or GTK.
However, as other people have pointed out, the easiest thing for you to do would be to save the data into a text file, and use another program to generate the graph. gnuplot is definitely a good choice. It comes standard with most linux distros, and you get for Windows under cygwin.
Regards plotting in C++ for anyone who didn't do it yet. I will say what I did to plot Graphs in C++
Download the zipped file "gp443win32.zip" from http://sourceforge.jp/projects/sfnet_gnuplot/downloads/gnuplot/4.4.3/gp443win32.zip/
Extract it in "C:\Gnuplot"
then I read "C:\Gnuplot\gnuplot\README.Windows"
and I got these information:
I used Windows 7 ==> so you need to download "winhlp32.exe"... just search for it "winhlp32.exe Windows 7" in a search engine and go through the first link.
Append to the "Path" Environment variable the path for binary folder which is "C:\Gnuplot\gnuplot\binary"
then I shutdown my computer and open it again. After I found that it didn't sense the change in the environment variables :D
you need now to write a sample code to test your plotting ability :)
so you can visit this link
http://code.google.com/p/gnuplot-cpp/source/browse/#svn%2Ftrunk
to see the header file "gnuplot_i.hpp" and source file "example.cc".
You will get many and many graphs, choose your appropriate graph, customize your core, and enjoy :)
If you're familiar with matplotlib, you can embed python in C/C++ applications. Depending on what you want it for, this might be a quick solution.
Chart Director has bindings for C++. I've used their .Net libraries, and I've been pretty happy with them. It's a pretty cheap library, and gives you the power to do all sorts of different charts.