Sample files for image scanning, basic Mat, file I/O. Added Victors removed tutorials back in the system. Some typo fixing.Expanded conf.py with new global links.
This commit is contained in:
@@ -349,7 +349,8 @@ extlinks = {'cvt_color': ('http://opencv.willowgarage.com/documentation/cpp/imgp
|
||||
'basicstructures' : ('http://opencv.itseez.com/modules/core/doc/basic_structures.html#%s', None),
|
||||
'readwriteimagevideo' : ('http://opencv.itseez.com/modules/highgui/doc/reading_and_writing_images_and_video.html#%s', None),
|
||||
'operationsonarrays' : ('http://opencv.itseez.com/modules/core/doc/operations_on_arrays.html#%s', None),
|
||||
'utilitysystemfunctions':('http://opencv.itseez.com/modules/core/doc/utility_and_system_functions_and_macros.html%s', None),
|
||||
'utilitysystemfunctions':('http://opencv.itseez.com/modules/core/doc/utility_and_system_functions_and_macros.html#%s', None),
|
||||
'imgprocfilter':('http://opencv.itseez.com/modules/imgproc/doc/filtering.html#%s', None),
|
||||
'point_polygon_test' : ('http://opencv.willowgarage.com/documentation/cpp/imgproc_structural_analysis_and_shape_descriptors.html#cv-pointpolygontest%s', None)
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,62 @@
|
||||
.. _CameraCalibrationSquareChessBoardTutorial:
|
||||
|
||||
Camera calibration with square chessboard
|
||||
*****************************************
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
The goal of this tutorial is to learn how to calibrate a camera given a set of chessboard images.
|
||||
|
||||
*Test data*: use images in your data/chess folder.
|
||||
|
||||
#.
|
||||
Compile opencv with samples by setting ``BUILD_EXAMPLES`` to ``ON`` in cmake configuration.
|
||||
|
||||
#.
|
||||
Go to ``bin`` folder and use ``imagelist_creator`` to create an ``XML/YAML`` list of your images.
|
||||
|
||||
#.
|
||||
Then, run ``calibration`` sample to get camera parameters. Use square size equal to 3cm.
|
||||
|
||||
Pose estimation
|
||||
===============
|
||||
|
||||
Now, let us write a code that detects a chessboard in a new image and finds its distance from the camera. You can apply the same method to any object with known 3D geometry that you can detect in an image.
|
||||
|
||||
*Test data*: use chess_test*.jpg images from your data folder.
|
||||
|
||||
#.
|
||||
Create an empty console project. Load a test image: ::
|
||||
|
||||
Mat img = imread(argv[1], CV_LOAD_IMAGE_GRAYSCALE);
|
||||
|
||||
#.
|
||||
Detect a chessboard in this image using findChessboard function. ::
|
||||
|
||||
bool found = findChessboardCorners( img, boardSize, ptvec, CV_CALIB_CB_ADAPTIVE_THRESH );
|
||||
|
||||
#.
|
||||
Now, write a function that generates a ``vector<Point3f>`` array of 3d coordinates of a chessboard in any coordinate system. For simplicity, let us choose a system such that one of the chessboard corners is in the origin and the board is in the plane *z = 0*.
|
||||
|
||||
#.
|
||||
Read camera parameters from XML/YAML file: ::
|
||||
|
||||
FileStorage fs(filename, FileStorage::READ);
|
||||
Mat intrinsics, distortion;
|
||||
fs["camera_matrix"] >> intrinsics;
|
||||
fs["distortion_coefficients"] >> distortion;
|
||||
|
||||
#.
|
||||
Now we are ready to find chessboard pose by running ``solvePnP``: ::
|
||||
|
||||
vector<Point3f> boardPoints;
|
||||
// fill the array
|
||||
...
|
||||
|
||||
solvePnP(Mat(boardPoints), Mat(foundBoardCorners), cameraMatrix,
|
||||
distCoeffs, rvec, tvec, false);
|
||||
|
||||
#.
|
||||
Calculate reprojection error like it is done in ``calibration`` sample (see ``opencv/samples/cpp/calibration.cpp``, function ``computeReprojectionErrors``).
|
||||
|
||||
Question: how to calculate the distance from the camera origin to any of the corners?
|
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
@@ -5,8 +5,32 @@
|
||||
|
||||
Although we got most of our images in a 2D format they do come from a 3D world. Here you will learn how to find out from the 2D images information about the 3D world.
|
||||
|
||||
.. include:: ../../definitions/noContent.rst
|
||||
.. include:: ../../definitions/tocDefinitions.rst
|
||||
|
||||
+
|
||||
.. tabularcolumns:: m{100pt} m{300pt}
|
||||
.. cssclass:: toctableopencv
|
||||
|
||||
===================== ==============================================
|
||||
|CameraCalSqChess| **Title:** :ref:`CameraCalibrationSquareChessBoardTutorial`
|
||||
|
||||
*Compatibility:* > OpenCV 2.0
|
||||
|
||||
*Author:* |Author_VictorE|
|
||||
|
||||
You will use some chessboard images to calibrate your camera.
|
||||
|
||||
===================== ==============================================
|
||||
|
||||
.. |CameraCalSqChess| image:: images/camera_calibration_square_chess.jpg
|
||||
:height: 90pt
|
||||
:width: 90pt
|
||||
|
||||
.. raw:: latex
|
||||
|
||||
\pagebreak
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
../camera_calibration_square_chess/camera_calibration_square_chess
|
||||
|
@@ -0,0 +1,15 @@
|
||||
.. _discretFourierTransform:
|
||||
|
||||
Discrete Fourier Transform
|
||||
**************************
|
||||
|
||||
Goal
|
||||
====
|
||||
|
||||
We'll seek answers for the following questions:
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
+ What is a Fourier transform and why use it?
|
||||
+ How to do it in OpenCV?
|
||||
+ Usage of functions such as: :imgprocfilter:`copyMakeBorder() <copymakeborder>`, :operationsonarrays:`merge() <merge>`, :operationsonarrays:`dft() <dft>`, :operationsonarrays:`getOptimalDFTSize() <getoptimaldftsize>`, :operationsonarrays:`log() <log>` and :operationsonarrays:`normalize() <normalize>` .
|
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
@@ -124,6 +124,25 @@ Here you will learn the about the basic building blocks of the library. A must r
|
||||
:height: 90pt
|
||||
:width: 90pt
|
||||
|
||||
+
|
||||
.. tabularcolumns:: m{100pt} m{300pt}
|
||||
.. cssclass:: toctableopencv
|
||||
|
||||
=============== ======================================================
|
||||
|DiscFourTr| **Title:** * :ref:`discretFourierTransform`
|
||||
|
||||
*Compatibility:* > OpenCV 2.0
|
||||
|
||||
*Author:* |Author_BernatG|
|
||||
|
||||
You will see how and why use the Discrete Fourier transformation with OpenCV.
|
||||
|
||||
=============== ======================================================
|
||||
|
||||
.. |DiscFourTr| image:: images/discrete_fourier_transform.png
|
||||
:height: 90pt
|
||||
:width: 90pt
|
||||
|
||||
.. raw:: latex
|
||||
|
||||
\pagebreak
|
||||
@@ -137,4 +156,5 @@ Here you will learn the about the basic building blocks of the library. A must r
|
||||
../basic_linear_transform/basic_linear_transform
|
||||
../basic_geometric_drawing/basic_geometric_drawing
|
||||
../random_generator_and_text/random_generator_and_text
|
||||
../mat-mask-operations/mat-mask-operations.rst
|
||||
../mat-mask-operations/mat-mask-operations
|
||||
../discrete_fourier_transform/discrete_fourier_transform
|
@@ -1,7 +1,7 @@
|
||||
.. |Author_AnaH| unicode:: Ana U+0020 Huam U+00E1 n
|
||||
.. |Author_BernatG| unicode:: Bern U+00E1 t U+0020 G U+00E1 bor
|
||||
.. |Author_AndreyK| unicode:: Andrey U+0020 Kamaev
|
||||
|
||||
.. |Author_VictorE| unicode:: Victor Eruhimov
|
||||
|
||||
|
||||
|
||||
|
@@ -0,0 +1,72 @@
|
||||
.. _detectionOfPlanarObjects:
|
||||
|
||||
Detection of planar objects
|
||||
***************************
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
The goal of this tutorial is to learn how to use *features2d* and *calib3d* modules for detecting known planar objects in scenes.
|
||||
|
||||
*Test data*: use images in your data folder, for instance, ``box.png`` and ``box_in_scene.png``.
|
||||
|
||||
#.
|
||||
Create a new console project. Read two input images. ::
|
||||
|
||||
Mat img1 = imread(argv[1], CV_LOAD_IMAGE_GRAYSCALE);
|
||||
Mat img2 = imread(argv[2], CV_LOAD_IMAGE_GRAYSCALE);
|
||||
|
||||
#.
|
||||
Detect keypoints in both images. ::
|
||||
|
||||
// detecting keypoints
|
||||
FastFeatureDetector detector(15);
|
||||
vector<KeyPoint> keypoints1;
|
||||
detector.detect(img1, keypoints1);
|
||||
|
||||
... // do the same for the second image
|
||||
|
||||
#.
|
||||
Compute descriptors for each of the keypoints. ::
|
||||
|
||||
// computing descriptors
|
||||
SurfDescriptorExtractor extractor;
|
||||
Mat descriptors1;
|
||||
extractor.compute(img1, keypoints1, descriptors1);
|
||||
|
||||
... // process keypoints from the second image as well
|
||||
|
||||
#.
|
||||
Now, find the closest matches between descriptors from the first image to the second: ::
|
||||
|
||||
// matching descriptors
|
||||
BruteForceMatcher<L2<float> > matcher;
|
||||
vector<DMatch> matches;
|
||||
matcher.match(descriptors1, descriptors2, matches);
|
||||
|
||||
#.
|
||||
Visualize the results: ::
|
||||
|
||||
// drawing the results
|
||||
namedWindow("matches", 1);
|
||||
Mat img_matches;
|
||||
drawMatches(img1, keypoints1, img2, keypoints2, matches, img_matches);
|
||||
imshow("matches", img_matches);
|
||||
waitKey(0);
|
||||
|
||||
#.
|
||||
Find the homography transformation between two sets of points: ::
|
||||
|
||||
vector<Point2f> points1, points2;
|
||||
// fill the arrays with the points
|
||||
....
|
||||
Mat H = findHomography(Mat(points1), Mat(points2), CV_RANSAC, ransacReprojThreshold);
|
||||
|
||||
|
||||
#.
|
||||
Create a set of inlier matches and draw them. Use perspectiveTransform function to map points with homography:
|
||||
|
||||
Mat points1Projected;
|
||||
perspectiveTransform(Mat(points1), points1Projected, H);
|
||||
|
||||
#.
|
||||
Use ``drawMatches`` for drawing inliers.
|
Binary file not shown.
After Width: | Height: | Size: 7.6 KiB |
@@ -86,6 +86,25 @@ Learn about how to use the feature points detectors, descriptors and matching f
|
||||
:height: 90pt
|
||||
:width: 90pt
|
||||
|
||||
+
|
||||
.. tabularcolumns:: m{100pt} m{300pt}
|
||||
.. cssclass:: toctableopencv
|
||||
|
||||
===================== ==============================================
|
||||
|DetectPlanar| **Title:** :ref:`detectionOfPlanarObjects`
|
||||
|
||||
*Compatibility:* > OpenCV 2.0
|
||||
|
||||
*Author:* |Author_VictorE|
|
||||
|
||||
You will use *features2d* and *calib3d* modules for detecting known planar objects in scenes.
|
||||
|
||||
===================== ==============================================
|
||||
|
||||
.. |DetectPlanar| image:: images/detection_of_planar_objects.png
|
||||
:height: 90pt
|
||||
:width: 90pt
|
||||
|
||||
.. raw:: latex
|
||||
|
||||
\pagebreak
|
||||
@@ -97,3 +116,4 @@ Learn about how to use the feature points detectors, descriptors and matching f
|
||||
../trackingmotion/good_features_to_track/good_features_to_track.rst
|
||||
../trackingmotion/generic_corner_detector/generic_corner_detector
|
||||
../trackingmotion/corner_subpixeles/corner_subpixeles
|
||||
../detection_of_planar_objects/detection_of_planar_objects
|
@@ -207,6 +207,7 @@ Say you have or create a new file, *helloworld.cpp* in a directory called *foo*:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
||||
#include <cv.h>
|
||||
#include <highgui.h>
|
||||
int main ( int argc, char **argv )
|
||||
@@ -243,9 +244,9 @@ Say you have or create a new file, *helloworld.cpp* in a directory called *foo*:
|
||||
|
||||
#. Run ``make -j4`` *(the ``-j4`` is optional, it just tells the compiler to build in 4 threads)*. Make sure it builds.
|
||||
|
||||
#. Start ``eclipse``. Put the workspace in some directory but **not** in ``foo`` or ``foo\\build``
|
||||
#. Start ``eclipse`` . Put the workspace in some directory but **not** in ``foo`` or ``foo\\build``
|
||||
|
||||
#. Right click in the ``Project Explorer`` section. Select ``Import`` And then open the ``C/C++`` filter. Choose *Existing Code as a Makefile Project``
|
||||
#. Right click in the ``Project Explorer`` section. Select ``Import`` And then open the ``C/C++`` filter. Choose *Existing Code* as a Makefile Project``
|
||||
|
||||
#. Name your project, say *helloworld*. Browse to the Existing Code location ``foo\\build`` (where you ran your cmake-gui from). Select *Linux GCC* in the *"Toolchain for Indexer Settings"* and press *Finish*.
|
||||
|
||||
|
@@ -19,7 +19,7 @@ Required packages
|
||||
* pkgconfig
|
||||
* libpng, zlib, libjpeg, libtiff, libjasper with development files (e.g. libpjeg-dev)
|
||||
* Python 2.3 or later with developer packages (e.g. python-dev)
|
||||
* SWIG 1.3.30 or later
|
||||
* SWIG 1.3.30 or later (only for versions prior to OpenCV 2.3)
|
||||
* libavcodec
|
||||
* libdc1394 2.x
|
||||
|
||||
|
@@ -60,7 +60,7 @@ If you are building your own libraries you can take either the source files from
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
+ stable and tested build - https://code.ros.org/svn/opencv/branches/
|
||||
+ stable and tested build - https://code.ros.org/svn/opencv/branches/2.3 (this will change with every new realease)
|
||||
+ development build - https://code.ros.org/svn/opencv/trunk/
|
||||
|
||||
While the later one may contain a couple of new and experimental algorithms, performance increases and interface improvements, be aware, that it may also contain many-many bugs. Using the first one is recommended in most of the cases. That is unless you are extending the OpenCV library itself or really need to most up to date version of it.
|
||||
@@ -285,11 +285,11 @@ Building the library
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
+ *BUILD_DOCS* -> Build the documentation of OpenCV (there will be a separate project for building the HTML and the PDF files).
|
||||
+ *BUILD_DOCS* -> It creates two projects for building the documentation of OpenCV (there will be a separate project for building the HTML and the PDF files). Note that these aren't built together with the solution. You need to make an explicit build project command on these to do so.
|
||||
+ *BUILD_EXAMPLES* -> OpenCV comes with many example applications from which you may learn most of the libraries capabilities. This will also come handy to easily try out if OpenCV is fully functional on your computer.
|
||||
+ *BUILD_JAVA_SUPPORT* -> This is a fresh addition to OpenCV, which slowly start to support the java language.
|
||||
+ *BUILD_JAVA_SUPPORT* -> At the moment this has no real meaning on the Windows platform. Ignore it.
|
||||
+ *BUILD_NEW_PYTHON_SUPPORT* -> Self-explanatory. Create the binaries to use OpenCV from the Python language.
|
||||
+ *BUILD_PACKAGE* -> Build a project that will build an OpenCV installer. With this you can easily install your OpenCV flavor on other systems.
|
||||
+ *BUILD_PACKAGE* -> Prior to version 2.3 with this you could build a project that will build an OpenCV installer. With this you can easily install your OpenCV flavor on other systems. For the latest source files of OpenCV it generates a new project that simply creates zip archive with OpenCV sources.
|
||||
+ *BUILD_SHARED_LIBS* -> With this you can control to build DLL files (when turned on) or static library files (\*.lib) otherwise.
|
||||
+ *BUILD_TESTS* -> Each module of OpenCV has a test project assigned to it. Building these test projects is also a good way to try out, that the modules work just as expected on your system too.
|
||||
|
||||
|
Reference in New Issue
Block a user