Commit 7f83ea1b authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

added OpenCV 1.x documentation

parent 30dcfe0c
if(BUILD_REFMAN AND PDFLATEX_COMPILER AND HAVE_SPHINX)
project(opencv_refman)
file(GLOB_RECURSE FILES_PICT ../modules/*.png ../modules/*.jpg)
file(GLOB_RECURSE FILES_RST *.rst ../modules/*.rst)
add_custom_target(refman ${SPHINX_BUILD} -b latex -c ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../modules .
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/doc/pics ${CMAKE_CURRENT_BINARY_DIR}/pics
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/latex2sphinx/mymath.sty ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${PDFLATEX_COMPILER} opencv
COMMAND ${PDFLATEX_COMPILER} opencv
DEPENDS conf.py ${FILES_RST} ${FILES_PICT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating the Reference Manual")
install(FILES ${CURRENT_BINARY_DIR}/opencv.pdf DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT main)
add_subdirectory(opencv1)
add_subdirectory(opencv2)
endif()
\ProvidesPackage{mymath}
\newcommand{\matTT}[9]{
\[
\left|\begin{array}{ccc}
#1 & #2 & #3\\
#4 & #5 & #6\\
#7 & #8 & #9
\end{array}\right|
\]
}
\newcommand{\fork}[4]{
\left\{
\begin{array}{l l}
#1 & \mbox{#2}\\
#3 & \mbox{#4}\\
\end{array} \right.}
\newcommand{\forkthree}[6]{
\left\{
\begin{array}{l l}
#1 & \mbox{#2}\\
#3 & \mbox{#4}\\
#5 & \mbox{#6}\\
\end{array} \right.}
\newcommand{\vecthree}[3]{
\begin{bmatrix}
#1\\
#2\\
#3
\end{bmatrix}
}
\newcommand{\vecthreethree}[9]{
\begin{bmatrix}
#1 & #2 & #3\\
#4 & #5 & #6\\
#7 & #8 & #9
\end{bmatrix}
}
project(opencv_refman1)
file(GLOB_RECURSE OPENCV1_FILES_PICT pics/*.png pics/*.jpg)
file(GLOB_RECURSE OPENCV1_FILES_RST *.rst)
add_custom_target(refman1
${SPHINX_BUILD}
-b latex -c ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR} .
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/pics ${CMAKE_CURRENT_BINARY_DIR}/pics
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/../mymath.sty ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${PDFLATEX_COMPILER} opencv1x
COMMAND ${PDFLATEX_COMPILER} opencv1x
DEPENDS conf.py ${OPENCV1_FILES_RST} ${OPENCV1_FILES_PICT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating the OpenCV 1.x Reference Manual")
install(FILES ${CURRENT_BINARY_DIR}/opencv1x.pdf DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT main)
############
Bibliography
############
.. [Agrawal08] Agrawal, M. and Konolige, K. and Blas, M.R. "CenSurE: Center Surround Extremas for Realtime Feature Detection and Matching", ECCV08, 2008
.. [BT96] Tomasi, C. and Birchfield, S.T. "Depth Discontinuities by Pixel-to-Pixel Stereo", STAN-CS, 1996
.. [Bay06] Bay, H. and Tuytelaars, T. and Van Gool, L. "SURF: Speeded Up Robust Features", 9th European Conference on Computer Vision, 2006
.. [Borgefors86] Borgefors, Gunilla, "Distance transformations in digital images". Comput. Vision Graph. Image Process. 34 3, pp 344--371 (1986)
.. [Bradski00] Davis, J.W. and Bradski, G.R. "Motion Segmentation and Pose Recognition with Motion History Gradients", WACV00, 2000
.. [Bradski98] Bradski, G.R. "Computer Vision Face Tracking for Use in a Perceptual User Interface", Intel, 1998
.. [Davis97] Davis, J.W. and Bobick, A.F. "The Representation and Recognition of Action Using Temporal Templates", CVPR97, 1997
.. [Felzenszwalb04] Felzenszwalb, Pedro F. and Huttenlocher, Daniel P. "Distance Transforms of Sampled Functions", TR2004-1963, TR2004-1963 (2004)
.. [Hartley99] Hartley, R.I., "Theory and Practice of Projective Rectification". IJCV 35 2, pp 115-127 (1999)
###########
C Reference
###########
.. highlight:: python
.. toctree::
:maxdepth: 2
core
imgproc
features2d
objdetect
video
highgui
calib3d
*******************************************************
calib3d. Camera Calibration, Pose Estimation and Stereo
*******************************************************
.. toctree::
:maxdepth: 2
calib3d_camera_calibration_and_3d_reconstruction
# -*- coding: utf-8 -*-
#
# opencv documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 4 21:06:43 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.pngmath', 'sphinx.ext.doctest'] # , 'sphinx.ext.intersphinx']
doctest_test_doctest_blocks = 'block'
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'opencv'
copyright = u'2010, authors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '2.2'
# The full version, including alpha/beta/rc tags.
release = '2.2'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
#unused_docs = []
# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'blue'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
"lang" : "%LANG%" # buildall substitutes this for c, cpp, py
}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ['../_themes']
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
html_logo = '../opencv-logo2.png'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['../_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_use_modindex = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''
# Output file base name for HTML help builder.
htmlhelp_basename = 'opencvdoc'
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'opencv.tex', u'opencv Documentation',
u'author', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_use_modindex = True
pngmath_latex_preamble = '\usepackage{mymath}\usepackage{amsmath}\usepackage{bbm}\usepackage[usenames]{color}'
# intersphinx_mapping = {
# 'http://docs.python.org/': None,
# }
intersphinx_mapping = {}
latex_elements = {'preamble': '\usepackage{mymath}\usepackage{amssymb}\usepackage{amsmath}\usepackage{bbm}'}
****************************
core. The Core Functionality
****************************
.. toctree::
:maxdepth: 2
core_basic_structures
core_operations_on_arrays
core_dynamic_structures
core_drawing_functions
core_xml_yaml_persistence
core_clustering
core_utility_and_system_functions_and_macros
This diff is collapsed.
Clustering
==========
.. highlight:: c
.. index:: KMeans2
.. _KMeans2:
KMeans2
-------
`id=0.323145542573 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/c/core/KMeans2>`__
.. cfunction:: int cvKMeans2(const CvArr* samples, int nclusters, CvArr* labels, CvTermCriteria termcrit, int attempts=1, CvRNG* rng=0, int flags=0, CvArr* centers=0, double* compactness=0)
Splits set of vectors by a given number of clusters.
:param samples: Floating-point matrix of input samples, one row per sample
:param nclusters: Number of clusters to split the set by
:param labels: Output integer vector storing cluster indices for every sample
:param termcrit: Specifies maximum number of iterations and/or accuracy (distance the centers can move by between subsequent iterations)
:param attempts: How many times the algorithm is executed using different initial labelings. The algorithm returns labels that yield the best compactness (see the last function parameter)
:param rng: Optional external random number generator; can be used to fully control the function behaviour
:param flags: Can be 0 or ``CV_KMEANS_USE_INITIAL_LABELS`` . The latter
value means that during the first (and possibly the only) attempt, the
function uses the user-supplied labels as the initial approximation
instead of generating random labels. For the second and further attempts,
the function will use randomly generated labels in any case
:param centers: The optional output array of the cluster centers
:param compactness: The optional output parameter, which is computed as :math:`\sum_i ||\texttt{samples}_i - \texttt{centers}_{\texttt{labels}_i}||^2`
after every attempt; the best (minimum) value is chosen and the
corresponding labels are returned by the function. Basically, the
user can use only the core of the function, set the number of
attempts to 1, initialize labels each time using a custom algorithm
( ``flags=CV_KMEAN_USE_INITIAL_LABELS`` ) and, based on the output compactness
or any other criteria, choose the best clustering.
The function
``cvKMeans2``
implements a k-means algorithm that finds the
centers of
``nclusters``
clusters and groups the input samples
around the clusters. On output,
:math:`\texttt{labels}_i`
contains a cluster index for
samples stored in the i-th row of the
``samples``
matrix.
::
#include "cxcore.h"
#include "highgui.h"
void main( int argc, char** argv )
{
#define MAX_CLUSTERS 5
CvScalar color_tab[MAX_CLUSTERS];
IplImage* img = cvCreateImage( cvSize( 500, 500 ), 8, 3 );
CvRNG rng = cvRNG(0xffffffff);
color_tab[0] = CV_RGB(255,0,0);
color_tab[1] = CV_RGB(0,255,0);
color_tab[2] = CV_RGB(100,100,255);
color_tab[3] = CV_RGB(255,0,255);
color_tab[4] = CV_RGB(255,255,0);
cvNamedWindow( "clusters", 1 );
for(;;)
{
int k, cluster_count = cvRandInt(&rng)
int i, sample_count = cvRandInt(&rng)
CvMat* points = cvCreateMat( sample_count, 1, CV_32FC2 );
CvMat* clusters = cvCreateMat( sample_count, 1, CV_32SC1 );
/* generate random sample from multigaussian distribution */
for( k = 0; k < cluster_count; k++ )
{
CvPoint center;
CvMat point_chunk;
center.x = cvRandInt(&rng)
center.y = cvRandInt(&rng)
cvGetRows( points,
&point_chunk,
k*sample_count/cluster_count,
(k == (cluster_count - 1)) ?
sample_count :
(k+1)*sample_count/cluster_count );
cvRandArr( &rng, &point_chunk, CV_RAND_NORMAL,
cvScalar(center.x,center.y,0,0),
cvScalar(img->width/6, img->height/6,0,0) );
}
/* shuffle samples */
for( i = 0; i < sample_count/2; i++ )
{
CvPoint2D32f* pt1 =
(CvPoint2D32f*)points->data.fl + cvRandInt(&rng)
CvPoint2D32f* pt2 =
(CvPoint2D32f*)points->data.fl + cvRandInt(&rng)
CvPoint2D32f temp;
CV_SWAP( *pt1, *pt2, temp );
}
cvKMeans2( points, cluster_count, clusters,
cvTermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 10, 1.0 ));
cvZero( img );
for( i = 0; i < sample_count; i++ )
{
CvPoint2D32f pt = ((CvPoint2D32f*)points->data.fl)[i];
int cluster_idx = clusters->data.i[i];
cvCircle( img,
cvPointFrom32f(pt),
2,
color_tab[cluster_idx],
CV_FILLED );
}
cvReleaseMat( &points );
cvReleaseMat( &clusters );
cvShowImage( "clusters", img );
int key = cvWaitKey(0);
if( key == 27 )
break;
}
}
..
.. index:: SeqPartition
.. _SeqPartition:
SeqPartition
------------
`id=0.684667795556 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/c/core/SeqPartition>`__
.. cfunction:: int cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels, CvCmpFunc is_equal, void* userdata )
Splits a sequence into equivalency classes.
:param seq: The sequence to partition
:param storage: The storage block to store the sequence of equivalency classes. If it is NULL, the function uses ``seq->storage`` for output labels
:param labels: Ouput parameter. Double pointer to the sequence of 0-based labels of input sequence elements
:param is_equal: The relation function that should return non-zero if the two particular sequence elements are from the same class, and zero otherwise. The partitioning algorithm uses transitive closure of the relation function as an equivalency critria
:param userdata: Pointer that is transparently passed to the ``is_equal`` function
::
typedef int (CV_CDECL* CvCmpFunc)(const void* a, const void* b, void* userdata);
..
The function
``cvSeqPartition``
implements a quadratic algorithm for
splitting a set into one or more equivalancy classes. The function
returns the number of equivalency classes.
::
#include "cxcore.h"
#include "highgui.h"
#include <stdio.h>
CvSeq* point_seq = 0;
IplImage* canvas = 0;
CvScalar* colors = 0;
int pos = 10;
int is_equal( const void* _a, const void* _b, void* userdata )
{
CvPoint a = *(const CvPoint*)_a;
CvPoint b = *(const CvPoint*)_b;
double threshold = *(double*)userdata;
return (double)((a.x - b.x)*(a.x - b.x) + (a.y - b.y)*(a.y - b.y)) <=
threshold;
}
void on_track( int pos )
{
CvSeq* labels = 0;
double threshold = pos*pos;
int i, class_count = cvSeqPartition( point_seq,
0,
&labels,
is_equal,
&threshold );
printf("
cvZero( canvas );
for( i = 0; i < labels->total; i++ )
{
CvPoint pt = *(CvPoint*)cvGetSeqElem( point_seq, i );
CvScalar color = colors[*(int*)cvGetSeqElem( labels, i )];
cvCircle( canvas, pt, 1, color, -1 );
}
cvShowImage( "points", canvas );
}
int main( int argc, char** argv )
{
CvMemStorage* storage = cvCreateMemStorage(0);
point_seq = cvCreateSeq( CV_32SC2,
sizeof(CvSeq),
sizeof(CvPoint),
storage );
CvRNG rng = cvRNG(0xffffffff);
int width = 500, height = 500;
int i, count = 1000;
canvas = cvCreateImage( cvSize(width,height), 8, 3 );
colors = (CvScalar*)cvAlloc( count*sizeof(colors[0]) );
for( i = 0; i < count; i++ )
{
CvPoint pt;
int icolor;
pt.x = cvRandInt( &rng )
pt.y = cvRandInt( &rng )
cvSeqPush( point_seq, &pt );
icolor = cvRandInt( &rng ) | 0x00404040;
colors[i] = CV_RGB(icolor & 255,
(icolor >> 8)&255,
(icolor >> 16)&255);
}
cvNamedWindow( "points", 1 );
cvCreateTrackbar( "threshold", "points", &pos, 50, on_track );
on_track(pos);
cvWaitKey(0);
return 0;
}
..
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
*******************************************************
features2d. Feature Detection and Descriptor Extraction
*******************************************************
.. toctree::
:maxdepth: 2
features2d_feature_detection_and_description
Feature detection and description
=================================
.. highlight:: c
* **image** The image. Keypoints (corners) will be detected on this.
* **keypoints** Keypoints detected on the image.
* **threshold** Threshold on difference between intensity of center pixel and
pixels on circle around this pixel. See description of the algorithm.
* **nonmaxSupression** If it is true then non-maximum supression will be applied to detected corners (keypoints).
.. index:: ExtractSURF
.. _ExtractSURF:
ExtractSURF
-----------
`id=0.726137466362 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/c/features2d/ExtractSURF>`__
.. cfunction:: void cvExtractSURF( const CvArr* image, const CvArr* mask, CvSeq** keypoints, CvSeq** descriptors, CvMemStorage* storage, CvSURFParams params )
Extracts Speeded Up Robust Features from an image.
:param image: The input 8-bit grayscale image
:param mask: The optional input 8-bit mask. The features are only found in the areas that contain more than 50 % of non-zero mask pixels
:param keypoints: The output parameter; double pointer to the sequence of keypoints. The sequence of CvSURFPoint structures is as follows:
::
typedef struct CvSURFPoint
{
CvPoint2D32f pt; // position of the feature within the image
int laplacian; // -1, 0 or +1. sign of the laplacian at the point.
// can be used to speedup feature comparison
// (normally features with laplacians of different
// signs can not match)
int size; // size of the feature
float dir; // orientation of the feature: 0..360 degrees
float hessian; // value of the hessian (can be used to
// approximately estimate the feature strengths;
// see also params.hessianThreshold)
}
CvSURFPoint;
..
:param descriptors: The optional output parameter; double pointer to the sequence of descriptors. Depending on the params.extended value, each element of the sequence will be either a 64-element or a 128-element floating-point ( ``CV_32F`` ) vector. If the parameter is NULL, the descriptors are not computed
:param storage: Memory storage where keypoints and descriptors will be stored
:param params: Various algorithm parameters put to the structure CvSURFParams:
::
typedef struct CvSURFParams
{
int extended; // 0 means basic descriptors (64 elements each),
// 1 means extended descriptors (128 elements each)
double hessianThreshold; // only features with keypoint.hessian
// larger than that are extracted.
// good default value is ~300-500 (can depend on the
// average local contrast and sharpness of the image).
// user can further filter out some features based on
// their hessian values and other characteristics.
int nOctaves; // the number of octaves to be used for extraction.
// With each next octave the feature size is doubled
// (3 by default)
int nOctaveLayers; // The number of layers within each octave
// (4 by default)
}
CvSURFParams;
CvSURFParams cvSURFParams(double hessianThreshold, int extended=0);
// returns default parameters
..
The function cvExtractSURF finds robust features in the image, as
described in
Bay06
. For each feature it returns its location, size,
orientation and optionally the descriptor, basic or extended. The function
can be used for object tracking and localization, image stitching etc.
See the
``find_obj.cpp``
demo in OpenCV samples directory.
.. index:: GetStarKeypoints
.. _GetStarKeypoints:
GetStarKeypoints
----------------
`id=0.460873667573 Comments from the Wiki <http://opencv.willowgarage.com/wiki/documentation/c/features2d/GetStarKeypoints>`__
.. cfunction:: CvSeq* cvGetStarKeypoints( const CvArr* image, CvMemStorage* storage, CvStarDetectorParams params=cvStarDetectorParams() )
Retrieves keypoints using the StarDetector algorithm.
:param image: The input 8-bit grayscale image
:param storage: Memory storage where the keypoints will be stored
:param params: Various algorithm parameters given to the structure CvStarDetectorParams:
::
typedef struct CvStarDetectorParams
{
int maxSize; // maximal size of the features detected. The following
// values of the parameter are supported:
// 4, 6, 8, 11, 12, 16, 22, 23, 32, 45, 46, 64, 90, 128
int responseThreshold; // threshold for the approximatd laplacian,
// used to eliminate weak features
int lineThresholdProjected; // another threshold for laplacian to
// eliminate edges
int lineThresholdBinarized; // another threshold for the feature
// scale to eliminate edges
int suppressNonmaxSize; // linear size of a pixel neighborhood
// for non-maxima suppression
}
CvStarDetectorParams;
..
The function GetStarKeypoints extracts keypoints that are local
scale-space extremas. The scale-space is constructed by computing
approximate values of laplacians with different sigma's at each
pixel. Instead of using pyramids, a popular approach to save computing
time, all of the laplacians are computed at each pixel of the original
high-resolution image. But each approximate laplacian value is computed
in O(1) time regardless of the sigma, thanks to the use of integral
images. The algorithm is based on the paper
Agrawal08
, but instead
of a square, hexagon or octagon it uses an 8-end star shape, hence the name,
consisting of overlapping upright and tilted squares.
Each computed feature is represented by the following structure:
::
typedef struct CvStarKeypoint
{
CvPoint pt; // coordinates of the feature
int size; // feature size, see CvStarDetectorParams::maxSize
float response; // the approximated laplacian value at that point.
}
CvStarKeypoint;
inline CvStarKeypoint cvStarKeypoint(CvPoint pt, int size, float response);
..
Below is the small usage sample:
::
#include "cv.h"
#include "highgui.h"
int main(int argc, char** argv)
{
const char* filename = argc > 1 ? argv[1] : "lena.jpg";
IplImage* img = cvLoadImage( filename, 0 ), *cimg;
CvMemStorage* storage = cvCreateMemStorage(0);
CvSeq* keypoints = 0;
int i;
if( !img )
return 0;
cvNamedWindow( "image", 1 );
cvShowImage( "image", img );
cvNamedWindow( "features", 1 );
cimg = cvCreateImage( cvGetSize(img), 8, 3 );
cvCvtColor( img, cimg, CV_GRAY2BGR );
keypoints = cvGetStarKeypoints( img, storage, cvStarDetectorParams(45) );
for( i = 0; i < (keypoints ? keypoints->total : 0); i++ )
{
CvStarKeypoint kpt = *(CvStarKeypoint*)cvGetSeqElem(keypoints, i);
int r = kpt.size/2;
cvCircle( cimg, kpt.pt, r, CV_RGB(0,255,0));
cvLine( cimg, cvPoint(kpt.pt.x + r, kpt.pt.y + r),
cvPoint(kpt.pt.x - r, kpt.pt.y - r), CV_RGB(0,255,0));
cvLine( cimg, cvPoint(kpt.pt.x - r, kpt.pt.y + r),
cvPoint(kpt.pt.x + r, kpt.pt.y - r), CV_RGB(0,255,0));
}
cvShowImage( "features", cimg );
cvWaitKey();
}
..
*************************************
highgui. High-level GUI and Media I/O
*************************************
While OpenCV was designed for use in full-scale
applications and can be used within functionally rich UI frameworks (such as Qt, WinForms or Cocoa) or without any UI at all, sometimes there is a need to try some functionality quickly and visualize the results. This is what the HighGUI module has been designed for.
It provides easy interface to:
*
create and manipulate windows that can display images and "remember" their content (no need to handle repaint events from OS)
*
add trackbars to the windows, handle simple mouse events as well as keyboard commmands
*
read and write images to/from disk or memory.
*
read video from camera or file and write video to a file.
.. toctree::
:maxdepth: 2
highgui_user_interface
highgui_reading_and_writing_images_and_video
highgui_qt_new_functions
This diff is collapsed.
This diff is collapsed.
*************************
imgproc. Image Processing
*************************
.. toctree::
:maxdepth: 2
imgproc_histograms
imgproc_image_filtering
imgproc_geometric_image_transformations
imgproc_miscellaneous_image_transformations
imgproc_structural_analysis_and_shape_descriptors
imgproc_planar_subdivisions
imgproc_motion_analysis_and_object_tracking
imgproc_feature_detection
imgproc_object_detection
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
***************************
objdetect. Object Detection
***************************
.. toctree::
:maxdepth: 2
objdetect_cascade_classification
This diff is collapsed.
*********************
video. Video Analysis
*********************
.. toctree::
:maxdepth: 2
video_motion_analysis_and_object_tracking
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment