mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 11:10:21 +08:00
Merge pull request #10814 from luzpaz:opencv-misc-apps-docs-platforms-typos
This commit is contained in:
commit
d56b2b56fb
@ -43,7 +43,7 @@
|
||||
|
||||
/*****************************************************************************************************
|
||||
USAGE:
|
||||
./opencv_annotation -images <folder location> -annotations <ouput file>
|
||||
./opencv_annotation -images <folder location> -annotations <output file>
|
||||
|
||||
Created by: Puttemans Steven - February 2015
|
||||
Adapted by: Puttemans Steven - April 2016 - Vectorize the process to enable better processing
|
||||
|
@ -89,7 +89,7 @@ bool calib::parametersController::loadFromParser(cv::CommandLineParser &parser)
|
||||
|
||||
if(!checkAssertion(mCapParams.squareSize > 0, "Distance between corners or circles must be positive"))
|
||||
return false;
|
||||
if(!checkAssertion(mCapParams.templDst > 0, "Distance betwen parts of dual template must be positive"))
|
||||
if(!checkAssertion(mCapParams.templDst > 0, "Distance between parts of dual template must be positive"))
|
||||
return false;
|
||||
|
||||
if (parser.has("v")) {
|
||||
|
@ -146,7 +146,7 @@ void CvHOGEvaluator::Feature::write(FileStorage &fs) const
|
||||
//}
|
||||
|
||||
//cell[0] and featComponent idx writing. By cell[0] it's possible to recover all block
|
||||
//All block is nessesary for block normalization
|
||||
//All block is necessary for block normalization
|
||||
void CvHOGEvaluator::Feature::write(FileStorage &fs, int featComponentIdx) const
|
||||
{
|
||||
fs << CC_RECT << "[:" << rect[0].x << rect[0].y <<
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include <iostream>
|
||||
|
||||
// Apple defines a check() macro somewhere in the debug headers
|
||||
// that interferes with a method definiton in this header
|
||||
// that interferes with a method definition in this header
|
||||
#undef check
|
||||
|
||||
/****************************************************************************************\
|
||||
@ -1243,9 +1243,9 @@ struct CvGBTreesParams : public CvDTreeParams
|
||||
// weak - array[0..(class_count-1)] of CvSeq
|
||||
// for storing tree ensembles
|
||||
// orig_response - original responses of the training set samples
|
||||
// sum_response - predicitons of the current model on the training dataset.
|
||||
// sum_response - predictions of the current model on the training dataset.
|
||||
// this matrix is updated on every iteration.
|
||||
// sum_response_tmp - predicitons of the model on the training set on the next
|
||||
// sum_response_tmp - predictions of the model on the training set on the next
|
||||
// step. On every iteration values of sum_responses_tmp are
|
||||
// computed via sum_responses values. When the current
|
||||
// step is complete sum_response values become equal to
|
||||
@ -1270,7 +1270,7 @@ struct CvGBTreesParams : public CvDTreeParams
|
||||
// matrix has the same size as train_data. 1 - missing
|
||||
// value, 0 - not a missing value.
|
||||
// class_labels - output class labels map.
|
||||
// rng - random number generator. Used for spliting the
|
||||
// rng - random number generator. Used for splitting the
|
||||
// training set.
|
||||
// class_count - count of output classes.
|
||||
// class_count == 1 in the case of regression,
|
||||
@ -1536,7 +1536,7 @@ public:
|
||||
// type - defines which error is to compute: train (CV_TRAIN_ERROR) or
|
||||
// test (CV_TEST_ERROR).
|
||||
// OUTPUT
|
||||
// resp - vector of predicitons
|
||||
// resp - vector of predictions
|
||||
// RESULT
|
||||
// Error value.
|
||||
*/
|
||||
|
@ -257,7 +257,7 @@ CvMat* icvGenerateRandomClusterCenters( int seed,
|
||||
/* Fills the <labels> using <probs> by choosing the maximal probability. Outliers are
|
||||
fixed by <oulier_tresh> and have cluster label (-1). Function also controls that there
|
||||
weren't "empty" clusters by filling empty clusters with the maximal probability vector.
|
||||
If probs_sums != NULL, filles it with the sums of probabilities for each sample (it is
|
||||
If probs_sums != NULL, fills it with the sums of probabilities for each sample (it is
|
||||
useful for normalizing probabilities' matrice of FCM) */
|
||||
void icvFindClusterLabels( const CvMat* probs, float outlier_thresh, float r,
|
||||
const CvMat* labels );
|
||||
|
@ -61,7 +61,7 @@ planes.push_back(plane0);
|
||||
planes.push_back(plane1);
|
||||
cv.merge(planes, complexI);
|
||||
|
||||
// in-place dft transfrom
|
||||
// in-place dft transform
|
||||
cv.dft(complexI, complexI);
|
||||
|
||||
// compute log(1 + sqrt(Re(DFT(img))**2 + Im(DFT(img))**2))
|
||||
|
@ -27,7 +27,7 @@ navigator.mediaDevices.getUserMedia({ video: true, audio: false })
|
||||
video.play();
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.log("An error occured! " + err);
|
||||
console.log("An error occurred! " + err);
|
||||
});
|
||||
@endcode
|
||||
|
||||
|
@ -10,15 +10,15 @@ Goal
|
||||
Theory
|
||||
------
|
||||
|
||||
Normally, we used to work with an image of constant size. But in some occassions, we need to work
|
||||
with images of different resolution of the same image. For example, while searching for something in
|
||||
an image, like face, we are not sure at what size the object will be present in the image. In that
|
||||
case, we will need to create a set of images with different resolution and search for object in all
|
||||
the images. These set of images with different resolution are called Image Pyramids (because when
|
||||
they are kept in a stack with biggest image at bottom and smallest image at top look like a
|
||||
pyramid).
|
||||
Normally, we used to work with an image of constant size. But on some occasions, we need to work
|
||||
with (the same) images in different resolution. For example, while searching for something in
|
||||
an image, like face, we are not sure at what size the object will be present in said image. In that
|
||||
case, we will need to create a set of the same image with different resolutions and search for object
|
||||
in all of them. These set of images with different resolutions are called **Image Pyramids** (because
|
||||
when they are kept in a stack with the highest resolution image at the bottom and the lowest resolution
|
||||
image at top, it looks like a pyramid).
|
||||
|
||||
There are two kinds of Image Pyramids. 1) Gaussian Pyramid and 2) Laplacian Pyramids
|
||||
There are two kinds of Image Pyramids. 1) **Gaussian Pyramid** and 2) **Laplacian Pyramids**
|
||||
|
||||
Higher level (Low resolution) in a Gaussian Pyramid is formed by removing consecutive rows and
|
||||
columns in Lower level (higher resolution) image. Then each pixel in higher level is formed by the
|
||||
|
@ -53,7 +53,7 @@ results for images with varying illumination.
|
||||
|
||||
We use the function: **cv.adaptiveThreshold (src, dst, maxValue, adaptiveMethod, thresholdType, blockSize, C)**
|
||||
@param src source 8-bit single-channel image.
|
||||
@param dst dstination image of the same size and the same type as src.
|
||||
@param dst destination image of the same size and the same type as src.
|
||||
@param maxValue non-zero value assigned to the pixels for which the condition is satisfied
|
||||
@param adaptiveMethod adaptive thresholding algorithm to use.
|
||||
@param thresholdType thresholding type that must be either cv.THRESH_BINARY or cv.THRESH_BINARY_INV.
|
||||
|
@ -28,7 +28,7 @@ BackgroundSubtractorMOG2
|
||||
------------------------
|
||||
|
||||
It is a Gaussian Mixture-based Background/Foreground Segmentation Algorithm. It is based on two
|
||||
papers by Z.Zivkovic, "Improved adaptive Gausian mixture model for background subtraction" in 2004
|
||||
papers by Z.Zivkovic, "Improved adaptive Gaussian mixture model for background subtraction" in 2004
|
||||
and "Efficient Adaptive Density Estimation per Image Pixel for the Task of Background Subtraction"
|
||||
in 2006. One important feature of this algorithm is that it selects the appropriate number of
|
||||
gaussian distribution for each pixel. It provides better adaptibility to varying scenes due illumination
|
||||
|
@ -1857,7 +1857,7 @@ class Poly:
|
||||
piecewise-linear segments joining the (x,y) points
|
||||
"bezier"/"B" d=[(x, y, c1x, c1y, c2x, c2y), ...]
|
||||
Bezier curve with two control points (control points
|
||||
preceed (x,y), as in SVG paths). If (c1x,c1y) and
|
||||
precede (x,y), as in SVG paths). If (c1x,c1y) and
|
||||
(c2x,c2y) both equal (x,y), you get a linear
|
||||
interpolation ("lines")
|
||||
"velocity"/"V" d=[(x, y, vx, vy), ...]
|
||||
|
@ -16,7 +16,7 @@ Apart from OpenCV, Python also provides a module **time** which is helpful in me
|
||||
execution. Another module **profile** helps to get detailed report on the code, like how much time
|
||||
each function in the code took, how many times the function was called etc. But, if you are using
|
||||
IPython, all these features are integrated in an user-friendly manner. We will see some important
|
||||
ones, and for more details, check links in **Additional Resouces** section.
|
||||
ones, and for more details, check links in **Additional Resources** section.
|
||||
|
||||
Measuring Performance with OpenCV
|
||||
---------------------------------
|
||||
|
@ -82,7 +82,7 @@ Non-maximum Suppression.
|
||||
|
||||
It is several times faster than other existing corner detectors.
|
||||
|
||||
But it is not robust to high levels of noise. It is dependant on a threshold.
|
||||
But it is not robust to high levels of noise. It is dependent on a threshold.
|
||||
|
||||
FAST Feature Detector in OpenCV
|
||||
-------------------------------
|
||||
|
@ -25,7 +25,7 @@ used.
|
||||
Second param is boolean variable, crossCheck which is false by default. If it is true, Matcher
|
||||
returns only those matches with value (i,j) such that i-th descriptor in set A has j-th descriptor
|
||||
in set B as the best match and vice-versa. That is, the two features in both sets should match each
|
||||
other. It provides consistant result, and is a good alternative to ratio test proposed by D.Lowe in
|
||||
other. It provides consistent result, and is a good alternative to ratio test proposed by D.Lowe in
|
||||
SIFT paper.
|
||||
|
||||
Once it is created, two important methods are *BFMatcher.match()* and *BFMatcher.knnMatch()*. First
|
||||
@ -164,7 +164,7 @@ Second dictionary is the SearchParams. It specifies the number of times the tree
|
||||
should be recursively traversed. Higher values gives better precision, but also takes more time. If
|
||||
you want to change the value, pass search_params = dict(checks=100).
|
||||
|
||||
With these informations, we are good to go.
|
||||
With this information, we are good to go.
|
||||
@code{.py}
|
||||
import numpy as np
|
||||
import cv2 as cv
|
||||
|
@ -39,7 +39,7 @@ grayscale image. Then you specify number of corners you want to find. Then you s
|
||||
level, which is a value between 0-1, which denotes the minimum quality of corner below which
|
||||
everyone is rejected. Then we provide the minimum euclidean distance between corners detected.
|
||||
|
||||
With all these informations, the function finds corners in the image. All corners below quality
|
||||
With all this information, the function finds corners in the image. All corners below quality
|
||||
level are rejected. Then it sorts the remaining corners based on quality in the descending order.
|
||||
Then function takes first strongest corner, throws away all the nearby corners in the range of
|
||||
minimum distance and returns N strongest corners.
|
||||
|
@ -35,7 +35,7 @@ different scale. It is OK with small corner. But to detect larger corners we nee
|
||||
For this, scale-space filtering is used. In it, Laplacian of Gaussian is found for the image with
|
||||
various \f$\sigma\f$ values. LoG acts as a blob detector which detects blobs in various sizes due to
|
||||
change in \f$\sigma\f$. In short, \f$\sigma\f$ acts as a scaling parameter. For eg, in the above image,
|
||||
gaussian kernel with low \f$\sigma\f$ gives high value for small corner while guassian kernel with high
|
||||
gaussian kernel with low \f$\sigma\f$ gives high value for small corner while gaussian kernel with high
|
||||
\f$\sigma\f$ fits well for larger corner. So, we can find the local maxima across the scale and space
|
||||
which gives us a list of \f$(x,y,\sigma)\f$ values which means there is a potential keypoint at (x,y) at
|
||||
\f$\sigma\f$ scale.
|
||||
@ -66,7 +66,7 @@ the intensity at this extrema is less than a threshold value (0.03 as per the pa
|
||||
rejected. This threshold is called **contrastThreshold** in OpenCV
|
||||
|
||||
DoG has higher response for edges, so edges also need to be removed. For this, a concept similar to
|
||||
Harris corner detector is used. They used a 2x2 Hessian matrix (H) to compute the pricipal
|
||||
Harris corner detector is used. They used a 2x2 Hessian matrix (H) to compute the principal
|
||||
curvature. We know from Harris corner detector that for edges, one eigen value is larger than the
|
||||
other. So here they used a simple function,
|
||||
|
||||
@ -79,7 +79,7 @@ points.
|
||||
### 3. Orientation Assignment
|
||||
|
||||
Now an orientation is assigned to each keypoint to achieve invariance to image rotation. A
|
||||
neigbourhood is taken around the keypoint location depending on the scale, and the gradient
|
||||
neighbourhood is taken around the keypoint location depending on the scale, and the gradient
|
||||
magnitude and direction is calculated in that region. An orientation histogram with 36 bins covering
|
||||
360 degrees is created. (It is weighted by gradient magnitude and gaussian-weighted circular window
|
||||
with \f$\sigma\f$ equal to 1.5 times the scale of keypoint. The highest peak in the histogram is taken
|
||||
@ -89,7 +89,7 @@ with same location and scale, but different directions. It contribute to stabili
|
||||
### 4. Keypoint Descriptor
|
||||
|
||||
Now keypoint descriptor is created. A 16x16 neighbourhood around the keypoint is taken. It is
|
||||
devided into 16 sub-blocks of 4x4 size. For each sub-block, 8 bin orientation histogram is created.
|
||||
divided into 16 sub-blocks of 4x4 size. For each sub-block, 8 bin orientation histogram is created.
|
||||
So a total of 128 bin values are available. It is represented as a vector to form keypoint
|
||||
descriptor. In addition to this, several measures are taken to achieve robustness against
|
||||
illumination changes, rotation etc.
|
||||
|
@ -26,7 +26,7 @@ and location.
|
||||
![image](images/surf_boxfilter.jpg)
|
||||
|
||||
For orientation assignment, SURF uses wavelet responses in horizontal and vertical direction for a
|
||||
neighbourhood of size 6s. Adequate guassian weights are also applied to it. Then they are plotted in
|
||||
neighbourhood of size 6s. Adequate gaussian weights are also applied to it. Then they are plotted in
|
||||
a space as given in below image. The dominant orientation is estimated by calculating the sum of all
|
||||
responses within a sliding orientation window of angle 60 degrees. Interesting thing is that,
|
||||
wavelet response can be found out using integral images very easily at any scale. For many
|
||||
|
@ -27,7 +27,7 @@ commands in your Python terminal :
|
||||
>>> print( flags )
|
||||
@endcode
|
||||
@note For HSV, Hue range is [0,179], Saturation range is [0,255] and Value range is [0,255].
|
||||
Different softwares use different scales. So if you are comparing OpenCV values with them, you need
|
||||
Different software use different scales. So if you are comparing OpenCV values with them, you need
|
||||
to normalize these ranges.
|
||||
|
||||
Object Tracking
|
||||
|
@ -124,8 +124,8 @@ got with corresponding values in newly added mask image. Check the code below:*
|
||||
# newmask is the mask image I manually labelled
|
||||
newmask = cv.imread('newmask.png',0)
|
||||
|
||||
# whereever it is marked white (sure foreground), change mask=1
|
||||
# whereever it is marked black (sure background), change mask=0
|
||||
# wherever it is marked white (sure foreground), change mask=1
|
||||
# wherever it is marked black (sure background), change mask=0
|
||||
mask[newmask == 0] = 0
|
||||
mask[newmask == 255] = 1
|
||||
|
||||
|
@ -12,15 +12,15 @@ In this chapter,
|
||||
Theory
|
||||
------
|
||||
|
||||
Normally, we used to work with an image of constant size. But in some occassions, we need to work
|
||||
with images of different resolution of the same image. For example, while searching for something in
|
||||
an image, like face, we are not sure at what size the object will be present in the image. In that
|
||||
case, we will need to create a set of images with different resolution and search for object in all
|
||||
the images. These set of images with different resolution are called Image Pyramids (because when
|
||||
they are kept in a stack with biggest image at bottom and smallest image at top look like a
|
||||
pyramid).
|
||||
Normally, we used to work with an image of constant size. But on some occasions, we need to work
|
||||
with (the same) images in different resolution. For example, while searching for something in
|
||||
an image, like face, we are not sure at what size the object will be present in said image. In that
|
||||
case, we will need to create a set of the same image with different resolutions and search for object
|
||||
in all of them. These set of images with different resolutions are called **Image Pyramids** (because
|
||||
when they are kept in a stack with the highest resolution image at the bottom and the lowest resolution
|
||||
image at top, it looks like a pyramid).
|
||||
|
||||
There are two kinds of Image Pyramids. 1) Gaussian Pyramid and 2) Laplacian Pyramids
|
||||
There are two kinds of Image Pyramids. 1) **Gaussian Pyramid** and 2) **Laplacian Pyramids**
|
||||
|
||||
Higher level (Low resolution) in a Gaussian Pyramid is formed by removing consecutive rows and
|
||||
columns in Lower level (higher resolution) image. Then each pixel in higher level is formed by the
|
||||
|
@ -104,7 +104,7 @@ Template Matching with Multiple Objects
|
||||
---------------------------------------
|
||||
|
||||
In the previous section, we searched image for Messi's face, which occurs only once in the image.
|
||||
Suppose you are searching for an object which has multiple occurances, **cv.minMaxLoc()** won't
|
||||
Suppose you are searching for an object which has multiple occurrences, **cv.minMaxLoc()** won't
|
||||
give you all the locations. In that case, we will use thresholding. So in this example, we will use
|
||||
a screenshot of the famous game **Mario** and we will find the coins in it.
|
||||
@code{.py}
|
||||
|
@ -239,7 +239,7 @@ from matplotlib import pyplot as plt
|
||||
# simple averaging filter without scaling parameter
|
||||
mean_filter = np.ones((3,3))
|
||||
|
||||
# creating a guassian filter
|
||||
# creating a gaussian filter
|
||||
x = cv.getGaussianKernel(5,10)
|
||||
gaussian = x*x.T
|
||||
|
||||
|
@ -139,7 +139,7 @@ some, they are not.
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
-# CMM page on [Watershed Tranformation](http://cmm.ensmp.fr/~beucher/wtshed.html)
|
||||
-# CMM page on [Watershed Transformation](http://cmm.ensmp.fr/~beucher/wtshed.html)
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
@ -16,7 +16,7 @@ Most of you will have some old degraded photos at your home with some black spot
|
||||
on it. Have you ever thought of restoring it back? We can't simply erase them in a paint tool
|
||||
because it is will simply replace black structures with white structures which is of no use. In
|
||||
these cases, a technique called image inpainting is used. The basic idea is simple: Replace those
|
||||
bad marks with its neighbouring pixels so that it looks like the neigbourhood. Consider the image
|
||||
bad marks with its neighbouring pixels so that it looks like the neighbourhood. Consider the image
|
||||
shown below (taken from [Wikipedia](http://en.wikipedia.org/wiki/Inpainting)):
|
||||
|
||||
![image](images/inpaint_basics.jpg)
|
||||
@ -28,8 +28,8 @@ First algorithm is based on the paper **"An Image Inpainting Technique Based on
|
||||
Method"** by Alexandru Telea in 2004. It is based on Fast Marching Method. Consider a region in the
|
||||
image to be inpainted. Algorithm starts from the boundary of this region and goes inside the region
|
||||
gradually filling everything in the boundary first. It takes a small neighbourhood around the pixel
|
||||
on the neigbourhood to be inpainted. This pixel is replaced by normalized weighted sum of all the
|
||||
known pixels in the neigbourhood. Selection of the weights is an important matter. More weightage is
|
||||
on the neighbourhood to be inpainted. This pixel is replaced by normalized weighted sum of all the
|
||||
known pixels in the neighbourhood. Selection of the weights is an important matter. More weightage is
|
||||
given to those pixels lying near to the point, near to the normal of the boundary and those lying on
|
||||
the boundary contours. Once a pixel is inpainted, it moves to next nearest pixel using Fast Marching
|
||||
Method. FMM ensures those pixels near the known pixels are inpainted first, so that it just works
|
||||
|
@ -33,7 +33,7 @@ one noisy image available.
|
||||
|
||||
So idea is simple, we need a set of similar images to average out the noise. Consider a small window
|
||||
(say 5x5 window) in the image. Chance is large that the same patch may be somewhere else in the
|
||||
image. Sometimes in a small neigbourhood around it. What about using these similar patches together
|
||||
image. Sometimes in a small neighbourhood around it. What about using these similar patches together
|
||||
and find their average? For that particular window, that is fine. See an example image below:
|
||||
|
||||
![image](images/nlm_patch.jpg)
|
||||
|
@ -68,7 +68,7 @@ cv.destroyAllWindows()
|
||||
### BackgroundSubtractorMOG2
|
||||
|
||||
It is also a Gaussian Mixture-based Background/Foreground Segmentation Algorithm. It is based on two
|
||||
papers by Z.Zivkovic, "Improved adaptive Gausian mixture model for background subtraction" in 2004
|
||||
papers by Z.Zivkovic, "Improved adaptive Gaussian mixture model for background subtraction" in 2004
|
||||
and "Efficient Adaptive Density Estimation per Image Pixel for the Task of Background Subtraction"
|
||||
in 2006. One important feature of this algorithm is that it selects the appropriate number of
|
||||
gaussian distribution for each pixel. (Remember, in last case, we took a K gaussian distributions
|
||||
|
@ -112,7 +112,7 @@ you may access it. For sequences you need to go through them to query a specific
|
||||
for (; it != it_end; ++it)
|
||||
cout << (string)*it << endl;
|
||||
@endcode
|
||||
For maps you can use the [] operator again to acces the given item (or the \>\> operator too):
|
||||
For maps you can use the [] operator again to access the given item (or the \>\> operator too):
|
||||
@code{.cpp}
|
||||
n = fs["Mapping"]; // Read mappings from a sequence
|
||||
cout << "Two " << (int)(n["Two"]) << "; ";
|
||||
|
@ -25,12 +25,12 @@ In OpenCV 3.2, the following parallel frameworks are available in that order:
|
||||
7. Pthreads (if available)
|
||||
|
||||
As you can see, several parallel frameworks can be used in the OpenCV library. Some parallel libraries
|
||||
are third party libraries and have to be explictly built and enabled in CMake (e.g. TBB, C=), others are
|
||||
are third party libraries and have to be explicitly built and enabled in CMake (e.g. TBB, C=), others are
|
||||
automatically available with the platform (e.g. APPLE GCD) but chances are that you should be enable to
|
||||
have access to a parallel framework either directly or by enabling the option in CMake and rebuild the library.
|
||||
|
||||
The second (weak) precondition is more related to the task you want to achieve as not all computations
|
||||
are suitable / can be adatapted to be run in a parallel way. To remain simple, tasks that can be splitted
|
||||
are suitable / can be adatapted to be run in a parallel way. To remain simple, tasks that can be split
|
||||
into multiple elementary operations with no memory dependency (no possible race condition) are easily
|
||||
parallelizable. Computer vision processing are often easily parallelizable as most of the time the processing of
|
||||
one pixel does not depend to the state of other pixels.
|
||||
@ -39,7 +39,7 @@ Simple example: drawing a Mandelbrot set
|
||||
----
|
||||
|
||||
We will use the example of drawing a Mandelbrot set to show how from a regular sequential code you can easily adapt
|
||||
the code to parallize the computation.
|
||||
the code to parallelize the computation.
|
||||
|
||||
Theory
|
||||
-----------
|
||||
|
@ -122,7 +122,7 @@ Selecting a region of interest:
|
||||
Rect r(10, 10, 100, 100);
|
||||
Mat smallImg = img(r);
|
||||
@endcode
|
||||
A convertion from Mat to C API data structures:
|
||||
A conversion from Mat to C API data structures:
|
||||
@code{.cpp}
|
||||
Mat img = imread("image.jpg");
|
||||
IplImage img1 = img;
|
||||
|
@ -84,7 +84,7 @@ int main( int argc, char** argv )
|
||||
printf("-- Min dist : %f \n", min_dist );
|
||||
|
||||
//-- Draw only "good" matches (i.e. whose distance is less than 2*min_dist,
|
||||
//-- or a small arbitary value ( 0.02 ) in the event that min_dist is very
|
||||
//-- or a small arbitrary value ( 0.02 ) in the event that min_dist is very
|
||||
//-- small)
|
||||
//-- PS.- radiusMatch can also be used here.
|
||||
std::vector< DMatch > good_matches;
|
||||
|
@ -34,7 +34,7 @@ Theory
|
||||
### How does it work?
|
||||
|
||||
- Equalization implies *mapping* one distribution (the given histogram) to another distribution (a
|
||||
wider and more uniform distribution of intensity values) so the intensity values are spreaded
|
||||
wider and more uniform distribution of intensity values) so the intensity values are spread
|
||||
over the whole range.
|
||||
- To accomplish the equalization effect, the remapping should be the *cumulative distribution
|
||||
function (cdf)* (more details, refer to *Learning OpenCV*). For the histogram \f$H(i)\f$, its
|
||||
|
@ -27,7 +27,7 @@ Explanation / Result
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/imageSegmentation.cpp load_image
|
||||
![](images/source.jpeg)
|
||||
|
||||
-# Then if we have an image with white background, it is good to tranform it black. This will help us to desciminate the foreground objects easier when we will apply the Distance Transform:
|
||||
-# Then if we have an image with a white background, it is good to transform it to black. This will help us to descriminate the foreground objects easier when we will apply the Distance Transform:
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/imageSegmentation.cpp black_bg
|
||||
![](images/black_bg.jpeg)
|
||||
|
||||
@ -36,11 +36,11 @@ Explanation / Result
|
||||
![](images/laplace.jpeg)
|
||||
![](images/sharp.jpeg)
|
||||
|
||||
-# Now we tranfrom our new sharped source image to a grayscale and a binary one, respectively:
|
||||
-# Now we transfrom our new sharped source image to a grayscale and a binary one, respectively:
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/imageSegmentation.cpp bin
|
||||
![](images/bin.jpeg)
|
||||
|
||||
-# We are ready now to apply the Distance Tranform on the binary image. Moreover, we normalize the output image in order to be able visualize and threshold the result:
|
||||
-# We are ready now to apply the Distance Transform on the binary image. Moreover, we normalize the output image in order to be able visualize and threshold the result:
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/imageSegmentation.cpp dist
|
||||
![](images/dist_transf.jpeg)
|
||||
|
||||
|
@ -87,7 +87,7 @@ Assuming that the image to be operated is \f$I\f$:
|
||||
When the size of the kernel is `3`, the Sobel kernel shown above may produce noticeable
|
||||
inaccuracies (after all, Sobel is only an approximation of the derivative). OpenCV addresses
|
||||
this inaccuracy for kernels of size 3 by using the **Scharr()** function. This is as fast
|
||||
but more accurate than the standar Sobel function. It implements the following kernels:
|
||||
but more accurate than the standard Sobel function. It implements the following kernels:
|
||||
\f[G_{x} = \begin{bmatrix}
|
||||
-3 & 0 & +3 \\
|
||||
-10 & 0 & +10 \\
|
||||
|
@ -36,7 +36,7 @@ discuss briefly 5 operations offered by OpenCV:
|
||||
foreground)
|
||||
- For instance, check out the example below. The image at the left is the original and the image
|
||||
at the right is the result after applying the opening transformation. We can observe that the
|
||||
small spaces in the corners of the letter tend to dissapear.
|
||||
small spaces in the corners of the letter tend to disappear.
|
||||
|
||||
![](images/Morphology_2_Tutorial_Theory_Opening.png)
|
||||
|
||||
|
@ -142,7 +142,7 @@ Results
|
||||
|
||||
![](images/Threshold_Tutorial_Original_Image.jpg)
|
||||
|
||||
-# First, we try to threshold our image with a *binary threhold inverted*. We expect that the
|
||||
-# First, we try to threshold our image with a *binary threshold inverted*. We expect that the
|
||||
pixels brighter than the \f$thresh\f$ will turn dark, which is what actually happens, as we can see
|
||||
in the snapshot below (notice from the original image, that the doggie's tongue and eyes are
|
||||
particularly bright in comparison with the image, this is reflected in the output image).
|
||||
|
@ -239,7 +239,7 @@ Well, running samples from Eclipse is very simple:
|
||||
@code{.sh}
|
||||
adb shell getprop ro.product.cpu.abi
|
||||
@endcode
|
||||
If you're using an AVD emulator, go Window \> AVD Manager to see the list of availible devices.
|
||||
If you're using an AVD emulator, go Window \> AVD Manager to see the list of available devices.
|
||||
Click Edit in the context menu of the selected device. In the window, which then pop-ups, find
|
||||
the CPU field.
|
||||
|
||||
|
@ -28,7 +28,7 @@ key topis:
|
||||
-# [Android
|
||||
Activity](http://developer.android.com/training/basics/activity-lifecycle/starting.html) and its
|
||||
lifecycle, that is an essential Android API class.
|
||||
-# OpenCV development will certainly require some knowlege of the [Android
|
||||
-# OpenCV development will certainly require some knowledge of the [Android
|
||||
Camera](http://developer.android.com/guide/topics/media/camera.html) specifics.
|
||||
|
||||
Quick environment setup for Android development
|
||||
@ -261,7 +261,7 @@ Here is the standard way to compile C++ part of an Android application:
|
||||
|
||||
**warning**
|
||||
|
||||
We strongly reccomend using cmd.exe (standard Windows console) instead of Cygwin on
|
||||
We strongly recommend using cmd.exe (standard Windows console) instead of Cygwin on
|
||||
**Windows**. Use the latter if only you're absolutely sure about, what you're doing. Cygwin is
|
||||
not really supported and we are unlikely to help you in case you encounter some problems with
|
||||
it. So, use it only if you're capable of handling the consequences yourself.
|
||||
@ -397,7 +397,7 @@ application, but sure the most uncomplicated one to configure.
|
||||
|
||||
![](images/AVD_create.png)
|
||||
|
||||
-# When you click the Create AVD button, your new AVD will be availible in AVD Manager.
|
||||
-# When you click the Create AVD button, your new AVD will be available in AVD Manager.
|
||||
-# Press Start to launch the device. Be aware that any AVD (a.k.a. Emulator) is usually much slower
|
||||
than a hardware Android device, so it may take up to several minutes to start.
|
||||
-# Go Run -\> Run/Debug in Eclipse IDE to run your application in regular or debugging mode.
|
||||
|
@ -307,7 +307,7 @@ application. It will be capable of accessing camera output, processing it and di
|
||||
@endcode
|
||||
-# Defines that your activity implements CvCameraViewListener2 interface and fix activity related
|
||||
errors by defining missed methods. For this activity define onCreate, onDestroy and onPause and
|
||||
implement them according code snippet bellow. Fix errors by adding required imports.
|
||||
implement them according to the code snippet below. Fix errors by adding required imports.
|
||||
@code{.java}
|
||||
private CameraBridgeViewBase mOpenCvCameraView;
|
||||
|
||||
|
@ -380,7 +380,7 @@ user=> (.area sq-100)
|
||||
100.0
|
||||
@endcode
|
||||
If you find yourself not remembering a OpenCV class behavior, the REPL gives you the opportunity to
|
||||
easily search the corresponding javadoc documention:
|
||||
easily search the corresponding javadoc documentation:
|
||||
@code{.clojure}
|
||||
user=> (javadoc Rect)
|
||||
"http://www.google.com/search?btnI=I%27m%20Feeling%20Lucky&q=allinurl:org/opencv/core/Rect.html"
|
||||
@ -455,7 +455,7 @@ org.opencv.core.Scalar
|
||||
@endcode
|
||||
We're going to mimic almost verbatim the original OpenCV java tutorial to:
|
||||
|
||||
- create a 5x10 matrix with all its elements intialized to 0
|
||||
- create a 5x10 matrix with all its elements initialized to 0
|
||||
- change the value of every element of the second row to 1
|
||||
- change the value of every element of the 6th column to 5
|
||||
- print the content of the obtained matrix
|
||||
|
@ -71,7 +71,7 @@ Explanation
|
||||
order in case of color images).
|
||||
|
||||
-# So now we have our new *gray_image* and want to save it on disk (otherwise it will get lost
|
||||
after the program ends). To save it, we will use a function analagous to @ref cv::imread : @ref
|
||||
after the program ends). To save it, we will use a function analogous to @ref cv::imread : @ref
|
||||
cv::imwrite
|
||||
@code{.cpp}
|
||||
imwrite( "../../images/Gray_Image.jpg", gray_image );
|
||||
|
@ -193,7 +193,7 @@ OpenCL {#tutorial_transition_hints_opencl}
|
||||
------
|
||||
All specialized `ocl` implemetations has been hidden behind general C++ algorithm interface. Now the function execution path can be selected dynamically at runtime: CPU or OpenCL; this mechanism is also called "Transparent API".
|
||||
|
||||
New class cv::UMat is intended to hide data exchange with OpenCL device in a convinient way.
|
||||
New class cv::UMat is intended to hide data exchange with OpenCL device in a convenient way.
|
||||
|
||||
Following example illustrate API modifications (from [OpenCV site](http://opencv.org/platforms/opencl.html)):
|
||||
|
||||
|
@ -51,7 +51,7 @@ Let's introduce the notation used to define formally a hyperplane:
|
||||
|
||||
where \f$\beta\f$ is known as the *weight vector* and \f$\beta_{0}\f$ as the *bias*.
|
||||
|
||||
@sa A more in depth description of this and hyperplanes you can find in the section 4.5 (*Seperating
|
||||
@sa A more in depth description of this and hyperplanes you can find in the section 4.5 (*Separating
|
||||
Hyperplanes*) of the book: *Elements of Statistical Learning* by T. Hastie, R. Tibshirani and J. H.
|
||||
Friedman (@cite HTF01).
|
||||
|
||||
|
@ -115,7 +115,7 @@ Explanation
|
||||
-# __Set up SVM's parameters__
|
||||
|
||||
@note In the previous tutorial @ref tutorial_introduction_to_svm there is an explanation of the
|
||||
atributes of the class @ref cv::ml::SVM that we configure here before training the SVM.
|
||||
attributes of the class @ref cv::ml::SVM that we configure here before training the SVM.
|
||||
|
||||
@snippet cpp/tutorial_code/ml/non_linear_svms/non_linear_svms.cpp init
|
||||
|
||||
|
@ -10,7 +10,7 @@ of data.
|
||||
|
||||
*Author:* Fernando Iglesias García
|
||||
|
||||
Learn what a Suport Vector Machine is.
|
||||
Learn what a Support Vector Machine is.
|
||||
|
||||
- @subpage tutorial_non_linear_svms
|
||||
|
||||
|
@ -10,7 +10,7 @@ To support this tutorial, several official OpenCV applications will be used: [op
|
||||
|
||||
### Important notes
|
||||
|
||||
- If you come accross any tutorial mentioning the old opencv_haartraining tool <i>(which is deprecated and still using the OpenCV1.x interface)</i>, then please ignore that tutorial and stick to the opencv_traincascade tool. This tool is a newer version, written in C++ in accordance to the OpenCV 2.x and OpenCV 3.x API. The opencv_traincascade supports both HAAR like wavelet features @cite Viola01 and LBP (Local Binary Patterns) @cite Liao2007 features. LBP features yield integer precision in contrast to HAAR features, yielding floating point precision, so both training and detection with LBP are several times faster then with HAAR features. Regarding the LBP and HAAR detection quality, it mainly depends on the training data used and the training parameters selected. It's possible to train a LBP-based classifier that will provide almost the same quality as HAAR-based one, within a percentage of the training time.
|
||||
- If you come across any tutorial mentioning the old opencv_haartraining tool <i>(which is deprecated and still using the OpenCV1.x interface)</i>, then please ignore that tutorial and stick to the opencv_traincascade tool. This tool is a newer version, written in C++ in accordance to the OpenCV 2.x and OpenCV 3.x API. The opencv_traincascade supports both HAAR like wavelet features @cite Viola01 and LBP (Local Binary Patterns) @cite Liao2007 features. LBP features yield integer precision in contrast to HAAR features, yielding floating point precision, so both training and detection with LBP are several times faster then with HAAR features. Regarding the LBP and HAAR detection quality, it mainly depends on the training data used and the training parameters selected. It's possible to train a LBP-based classifier that will provide almost the same quality as HAAR-based one, within a percentage of the training time.
|
||||
|
||||
- The newer cascade classifier detection interface from OpenCV 2.x and OpenCV 3.x (@ref cv::CascadeClassifier) supports working with both old and new model formats. opencv_traincascade can even save (export) a trained cascade in the older format if for some reason you are stuck using the old interface. At least training the model could then be done in the most stable interface.
|
||||
|
||||
@ -69,7 +69,7 @@ Command line arguments:
|
||||
|
||||
- `-num <number_of_samples>` : Number of positive samples to generate.
|
||||
|
||||
- `-bgcolor <background_color>` : Background color (currently grayscale images are assumed); the background color denotes the transparent color. Since there might be compression artifacts, the amount of color tolerance can be specified by -bgthresh. All pixels withing bgcolor-bgthresh and bgcolor+bgthresh range are interpreted as transparent.
|
||||
- `-bgcolor <background_color>` : Background color (currently grayscale images are assumed); the background color denotes the transparent color. Since there might be compression artifacts, the amount of color tolerance can be specified by -bgthresh. All pixels within bgcolor-bgthresh and bgcolor+bgthresh range are interpreted as transparent.
|
||||
|
||||
- `-bgthresh <background_color_threshold>`
|
||||
- `-inv` : If specified, colors will be inverted.
|
||||
@ -188,7 +188,7 @@ Training is finished and you can test your cascade classifier!
|
||||
Visualising Cascade Classifiers
|
||||
-------------------------------
|
||||
|
||||
From time to time it can be usefull to visualise the trained cascade, to see which features it selected and how complex its stages are. For this OpenCV supplies a opencv_visualisation application. This application has the following commands:
|
||||
From time to time it can be useful to visualise the trained cascade, to see which features it selected and how complex its stages are. For this OpenCV supplies a opencv_visualisation application. This application has the following commands:
|
||||
|
||||
- `--image` <b>(required)</b> : path to a reference image for your object model. This should be an annotation with dimensions [`-w`,`-h`] as passed to both opencv_createsamples and opencv_traincascade application.
|
||||
- `--model` <b>(required)</b> : path to the trained model, which should be in the folder supplied to the `-data` parameter of the opencv_traincascade application.
|
||||
|
@ -98,7 +98,7 @@ get CAP_OPENNI_IMAGE_GENERATOR_PRESENT property.
|
||||
@code{.cpp}
|
||||
bool isImageGeneratorPresent = capture.get( CAP_PROP_OPENNI_IMAGE_GENERATOR_PRESENT ) != 0; // or == 1
|
||||
@endcode
|
||||
Flags specifing the needed generator type must be used in combination with particular generator
|
||||
Flags specifying the needed generator type must be used in combination with particular generator
|
||||
property. The following properties of cameras available through OpenNI interfaces are supported:
|
||||
|
||||
- For image generator:
|
||||
|
@ -35,7 +35,7 @@ C++ class. This on itself builds on the FFmpeg open source library. This is a ba
|
||||
dependency of OpenCV so you shouldn't need to worry about this. A video is composed of a succession
|
||||
of images, we refer to these in the literature as frames. In case of a video file there is a *frame
|
||||
rate* specifying just how long is between two frames. While for the video cameras usually there is a
|
||||
limit of just how many frames they can digitalize per second, this property is less important as at
|
||||
limit of just how many frames they can digitize per second, this property is less important as at
|
||||
any time the camera sees the current snapshot of the world.
|
||||
|
||||
The first task you need to do is to assign to a @ref cv::VideoCapture class its source. You can do
|
||||
|
@ -298,7 +298,7 @@ if __name__ == "__main__":
|
||||
parser.add_argument('--ndk_path', help="Path to Android NDK to use for build")
|
||||
parser.add_argument('--sdk_path', help="Path to Android SDK to use for build")
|
||||
parser.add_argument("--extra_modules_path", help="Path to extra modules to use for build")
|
||||
parser.add_argument('--sign_with', help="Sertificate to sign the Manager apk")
|
||||
parser.add_argument('--sign_with', help="Certificate to sign the Manager apk")
|
||||
parser.add_argument('--build_doc', action="store_true", help="Build javadoc")
|
||||
parser.add_argument('--no_ccache', action="store_true", help="Do not use ccache during library build")
|
||||
parser.add_argument('--extra_pack', action='append', help="provide extra OpenCV libraries for Manager apk in form <version>:<path-to-native-libs>, for example '2.4.11:unpacked/sdk/native/libs'")
|
||||
|
@ -44,7 +44,7 @@ public class ManagerActivity extends Activity {
|
||||
public void onClick(View v) {
|
||||
if (!mMarket.InstallAppFromMarket(packageName)) {
|
||||
Toast toast = Toast.makeText(getApplicationContext(),
|
||||
"Google Play is not avaliable", Toast.LENGTH_SHORT);
|
||||
"Google Play is not available", Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
}
|
||||
}
|
||||
@ -70,7 +70,7 @@ public class ManagerActivity extends Activity {
|
||||
if (!bindService(new Intent(this, c),
|
||||
new OpenCVEngineServiceConnection(), Context.BIND_AUTO_CREATE)) {
|
||||
Log.e(TAG, "Failed to bind to service:" + c.getName());
|
||||
mVersionText.setText("not avaliable");
|
||||
mVersionText.setText("not available");
|
||||
} else {
|
||||
Log.d(TAG, "Successfully bound to service:" + c.getName());
|
||||
mVersionText.setText("available");
|
||||
|
@ -49,11 +49,11 @@ if(NOT DEFINED ARM_LINUX_SYSROOT AND DEFINED GNU_MACHINE)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_CXX_FLAGS)
|
||||
set(CMAKE_CXX_FLAGS "" CACHE INTERAL "")
|
||||
set(CMAKE_C_FLAGS "" CACHE INTERAL "")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "" CACHE INTERAL "")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "" CACHE INTERAL "")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "" CACHE INTERAL "")
|
||||
set(CMAKE_CXX_FLAGS "" CACHE INTERNAL "")
|
||||
set(CMAKE_C_FLAGS "" CACHE INTERNAL "")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "" CACHE INTERNAL "")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "" CACHE INTERNAL "")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "" CACHE INTERNAL "")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi")
|
||||
|
@ -59,11 +59,11 @@ if(NOT DEFINED AT_SYSROOT_PATH)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS)
|
||||
set(CMAKE_CXX_FLAGS "" CACHE INTERAL "")
|
||||
set(CMAKE_C_FLAGS "" CACHE INTERAL "")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "" CACHE INTERAL "")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "" CACHE INTERAL "")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "" CACHE INTERAL "")
|
||||
set(CMAKE_CXX_FLAGS "" CACHE INTERNAL "")
|
||||
set(CMAKE_C_FLAGS "" CACHE INTERNAL "")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "" CACHE INTERNAL "")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "" CACHE INTERNAL "")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "" CACHE INTERNAL "")
|
||||
|
||||
if(AT_RPATH)
|
||||
string(REPLACE "," ";" RPATH_LIST ${AT_RPATH})
|
||||
|
@ -57,7 +57,7 @@ Generally all that is required is the standard Maven command:
|
||||
|
||||
One of the first things the build will do is check the required native dependencies. The Maven build indicates the status of the required dependencies and will fail at this point if any are missing. Install using the package manager e.g. aptitude or apt-get, and restart the build with the above command.
|
||||
|
||||
Once the build succesfully completes the OSGi compatible artifacts are available as described above in 'Build Directory'.
|
||||
Once the build successfully completes the OSGi compatible artifacts are available as described above in 'Build Directory'.
|
||||
|
||||
#### 3.4 - ARM 32-bit Architecture - Raspbian Distribution
|
||||
Similar to the x86 architecture the native dependencies are first checked so install any that are missing, however at the time of writing there are no official `libtbb2` and `libtbb-dev` packages in Raspbian. Version 4.4.3 of Intel's Thread Building Blocks library are available [here](http://www.javatechnics.com/thread-building-blocks-tbb-4-4-3-for-raspbian) as a Raspbian-compatible Debian packages.
|
||||
|
@ -18,7 +18,7 @@
|
||||
#
|
||||
# Returns:
|
||||
# 0 - Successfully written the properties file.
|
||||
# 1 - Error occured such as build directory does not exist
|
||||
# 1 - Error occurred such as build directory does not exist
|
||||
# or OpenCV version could not be determined or an
|
||||
# unexpected error.
|
||||
#
|
||||
|
@ -317,7 +317,7 @@ Function Execute() {
|
||||
}
|
||||
|
||||
Function ShowHelp() {
|
||||
Write-Host "Configures OpenCV and generates projects for specified verion of Visual Studio/platforms/architectures."
|
||||
Write-Host "Configures OpenCV and generates projects for specified version of Visual Studio/platforms/architectures."
|
||||
Write-Host "Must be executed from the sources folder containing main CMakeLists configuration."
|
||||
Write-Host "Parameter keys can be shortened down to a single symbol (e.g. '-a') and are not case sensitive."
|
||||
Write-Host "Proper parameter sequencing is required when omitting keys."
|
||||
@ -348,7 +348,7 @@ Function ShowHelp() {
|
||||
Write-Host " setup_winrt -a x86 -g 'Visual Studio 15 2017' -pl WP "
|
||||
Write-Host " WHERE: "
|
||||
Write-Host " options - Options to call "
|
||||
Write-Host " -h: diplays command line help "
|
||||
Write-Host " -h: displays command line help "
|
||||
Write-Host " -b: builds BUILD_ALL and INSTALL projects for each generated configuration in both Debug and Release modes."
|
||||
Write-Host " platform - Array of target platforms. "
|
||||
Write-Host " Default: WP "
|
||||
|
Loading…
Reference in New Issue
Block a user