Commit f82c04f4 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

removed obsolete docs

parent 12d98a7d
\chapter{FAQ}
\section{First Section}
\subsection{Initialization}
\subsubsection*{CreateImage}
\addcontentsline{toc}{subsubsection}{CreateImage}
Creates header and \textsf{allocates} data
\begin{shaded}
\begin{verbatim}
IplImage* cvCreateImage( CvSize size,
int depth,
int channels );
\end{verbatim}
\end{shaded}
\begin{description}
\item[\texttt{size}] Image width and height
\item[\texttt{depth}] Bit depth of image elements. Can be one of:
\begin{description}
\item[IPL\_DEPTH\_8U] unsigned 8-bit integers
\item[IPL\_DEPTH\_8S] signed 8-bit integers
\item[IPL\_DEPTH\_16U] unsigned 16-bit integers
\item[IPL\_DEPTH\_16S] signed 16-bit integers
\item[IPL\_DEPTH\_32S] signed 32-bit integers
\item[IPL\_DEPTH\_32F] single precision floating-point numbers
\item[IPL\_DEPTH\_64F] double precision floating-point numbers
\end{description}
\item[\texttt{channels}] Number of channels per element(pixel). Can be 1, 2, 3 or 4. The channels are interleaved, for example the usual data layout of a color image is:
\begin{lstlisting}
b0 g0 r0 b1 g1 r1 ...
\end{lstlisting}
Although in general IPL image format can store non-interleaved images as well and some of OpenCV can process it, this function can create interleaved images only.
\end{description}
The function cvCreateImage creates the header and allocates data as in the method of~\cite{author_conf_year}. This call is a shortened form of
\begin{lstlisting}
header = cvCreateImageHeader(size,depth,channels);
cvCreateData(header);
\end{lstlisting}
ifelse(TARGET_LANGUAGE, py, `define(ONLY_PYTHON, $1)', `define(ONLY_PYTHON, )')
ifelse(TARGET_LANGUAGE, c, `define(ONLY_C, $1)', `define(ONLY_C, )')
define(`RQ',`changequote(<,>)dnl`
'changequote`'')
This diff is collapsed.
(pdflatex '\newcommand{\genc}{true}\newcommand{\genpy}{true}\newcommand{\targetlang}{c}\input{opencv.tex}' &&
bibtex opencv &&
makeindex opencv &&
pdflatex '\newcommand{\genc}{true}\newcommand{\genpy}{true}\newcommand{\targetlang}{c}\input{opencv.tex}' > 1
) || exit 1
#gv -page=480 opencv.pdf
(pdflatex '\newcommand{\genc}{true}\newcommand{\genpy}{true}\newcommand{\targetlang}{c}\input{opencv_user.tex}' &&
# bibtex opencv_user &&
# makeindex opencv_user &&
pdflatex '\newcommand{\genc}{true}\newcommand{\genpy}{true}\newcommand{\targetlang}{c}\input{opencv_user.tex}' > 1
) || exit 1
#gv -page=480 opencv_user.pdf
%%
%% This is file `helvetica.sty', based on helvet.sty extended to include
%% definitions for rm and tt. This means commands such as \textbf, \textit,
%% etc. will appear in Helvetica.
%% Changes added by Harriet Borton on <1995/12/11>
%%
%% The original source files were:
%%
%% psfonts.dtx (with options: `helvet')
%%
%% Copyright (C) 1994 Sebastian Rahtz
%% All rights reserved.
%%
%% The original file is part of the PSNFSS2e package.
%% -----------------------------------------
%%
%% This is a generated file. Permission is granted to to customize the
%% declarations in this file to serve the needs of your installation.
%% However, no permission is granted to distribute a modified version of
%% this file under its original name.
\def\fileversion{4.2}
\def\filedate{94/11/11}
\def\docdate {94/11/06}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{helvetica}[\filedate\space\fileversion\space
Helvetica PSNFSS2e package]
\renewcommand{\sfdefault}{phv}
\renewcommand{\rmdefault}{phv}
\renewcommand{\ttdefault}{pcr}
\endinput
%%
%% End of file `helvetica.sty'.
#!/bin/bash
LANGUAGES="${LANGUAGES:=c cpp py}"
mkdir -p $LANGUAGES
tput clear
python latex.py ../online-opencv.tex $LANGUAGES || exit
for D in $LANGUAGES
do
echo $D
mkdir -p $D
sed "s/%LANG%/$D/" conf.py > $D/conf.py
TEXINPUTS=$PWD: sphinx-build -w $D/sphinx.errors -D "lang=$D" -b html -d _build/doctrees/$D $D _build/html/$D
#Insert javascript links to load the Wiki in a frame
for file in `ls _build/html/$D/*.html`
do
cat $file | sed "/Comments from the Wiki/s/href=\"\(.*\)\">id=0.\([0-9]*\) /href=\"javascript:void\(0\)\" onclick=\"insertIframe\('\2', '\1'\)\" id=\"\2\">/" > tmp.html
mv 'tmp.html' "$file"
done
done
#!/bin/bash
LANGUAGES="${LANGUAGES:=c cpp py}"
mkdir -p $LANGUAGES
tput clear
python latex.py ../online-opencv.tex $LANGUAGES || exit
for D in $LANGUAGES
do
echo $D
mkdir -p _build/latex/$D
cp conf.py $D
cp mymath.sty _build/latex/$D
TEXINPUTS=$PWD: sphinx-build -w $D/sphinx.errors -D "lang=$D" -b latex -d _build/doctrees/$D $D _build/latex/$D
(cd _build/latex/$D && rm *.aux *.toc *.log && pdflatex opencv.tex)
done
# -*- 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}'}
This diff is collapsed.
import sys
import hashlib
import cPickle as pickle
import os
from pyparsing import Word, CharsNotIn, Optional, OneOrMore, ZeroOrMore, Group, Forward, ParseException, Literal, Suppress, replaceWith, StringEnd, lineno, QuotedString, White, NotAny, ParserElement, MatchFirst
class Argument:
def __init__(self, s, loc, toks):
self.str = toks[1]
def __repr__(self):
return "[%s]" % self.str
def __str__(self):
return self.str
def argfun(s, loc, toks):
return Argument(s, loc, toks)
class Parameter:
def __init__(self, s, loc, toks):
self.str = toks[0].asList()
def __repr__(self):
return '{' + "".join([str(s) for s in self.str]) + '}'
return "{%s}" % self.str
def __str__(self):
return "".join([str(s) for s in self.str])
def paramfun(s, loc, toks):
return Parameter(s, loc, toks)
class TexCmd:
def __init__(self, s, loc, toks):
self.cmd = str(toks[0])[1:]
#print 'cmd', self.cmd
self.args = toks[1].asList()
self.params = toks[2].asList()
self.lineno = lineno(loc, s)
self.filename = None
def __repr__(self):
return '\\' + self.cmd + "".join([repr(a) for a in self.args]) + "".join([repr(p) for p in self.params])
class ZeroOrMoreAsList(ZeroOrMore):
def __init__(self, *args):
ZeroOrMore.__init__(self, *args)
def listify(s, loc, toks):
return [toks]
self.setParseAction(listify)
ParserElement.setDefaultWhitespaceChars("\n\t")
backslash = chr(92)
texcmd = Forward()
filler = CharsNotIn(backslash + '$')
filler2 = CharsNotIn(backslash + '$' + '{}')
arg = '[' + CharsNotIn("]") + ']'
arg.setParseAction(argfun)
dollarmath = QuotedString('$', multiline=True, unquoteResults=False)
param = Suppress(Literal('{')) + ZeroOrMoreAsList(dollarmath | filler2 | QuotedString('{', endQuoteChar='}', unquoteResults=False) | texcmd) + Suppress(Literal('}'))
param.setParseAction(paramfun)
def bs(c): return Literal("\\" + c)
singles = bs("[") | bs("]") | bs("{") | bs("}") | bs("\\") | bs("&") | bs("_") | bs(",") | bs("#") | bs("\n") | bs(";") | bs("|") | bs("%") | bs("*") | bs("~") | bs("^")
texcmd << (singles | Word("\\", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", min = 2)) + ZeroOrMoreAsList(arg) + ZeroOrMoreAsList(param)
def texcmdfun(s, loc, toks):
return TexCmd(s, loc, toks)
texcmd.setParseAction(texcmdfun)
#legal = "".join([chr(x) for x in set(range(32, 127)) - set(backslash)])
#filler = Word(legal)
document = ZeroOrMore(dollarmath | texcmd | filler) + StringEnd().suppress()
if 0:
s = "This is \\\\ test"
print s
for t in document.parseString(s):
if isinstance(t, TexCmd):
print '====> cmd=[%s]' % t.cmd, t
else:
print '====>', t
sys.exit(-1)
selfstr = open( __file__).read() # Own source as a string. Used as part of hash.
hashbase = hashlib.md5(selfstr)
def tokenize(filename):
f = open(filename, "rt")
def uncomment(s):
if '%' in s and not '\\%' in s:
return s[:s.index('%')] + '\n'
else:
return s
docstr = "".join([uncomment(l) for l in f])
hash = hashbase.copy()
hash.update(docstr)
cache_filename = os.path.join("parse-cache", hash.hexdigest())
try:
return pickle.load(open(cache_filename))
except IOError:
print "parsing"
try:
r = document.parseString(docstr)
for x in r:
if isinstance(x, TexCmd) and not x.filename:
x.filename = filename
pickle.dump(r, open(cache_filename, 'w'))
return r
except ParseException, pe:
print 'Fatal problem at %s line %d col %d' % (filename, pe.lineno, pe.col)
print pe.line
sys.exit(1)
def latexparser(filename):
tokens = tokenize(filename)
def expand(t):
if isinstance(t, TexCmd) and t.cmd == "input":
filename = "../" + str(t.params[0].str[0]) + ".tex"
print filename
return latexparser(filename)
else:
return [t]
return sum([expand(t) for t in tokens], [])
\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}
}
class Argument:
def __init__(self, fields):
self.ty = fields[0]
self.nm = fields[1]
self.flags = ""
self.init = None
if len(fields) > 2:
if fields[2][0] == '/':
self.flags = fields[2][1:].split(",")
else:
self.init = fields[2]
def reader(apifile):
api = []
for l in open(apifile):
if l[0] == '#':
continue
l = l.rstrip()
f = l.split()
if len(f) != 0:
if l[0] != ' ':
if len(f) > 1:
ty = f[1]
else:
ty = None
api.append((f[0], [], ty))
else:
api[-1][1].append(Argument(f))
return dict([(a, (ins, outs)) for (a, ins, outs) in api])
import StringIO
import os
class QOpen(StringIO.StringIO):
def __init__(self, *args):
self.__args = args
StringIO.StringIO.__init__(self)
def close(self):
import StringIO, os
fname = self.__args[0]
if not os.access(fname, os.R_OK) or self.getvalue() != open(fname).read():
open(*self.__args).write(self.getvalue())
StringIO.StringIO.close(self)
def __del__(self):
if not self.closed:
self.close()
\documentclass[11pt]{book}
\usepackage{cite}
\usepackage[pdftex]{graphicx}
\usepackage{titlesec}
\usepackage{listings}
\usepackage{fancyvrb}
\usepackage[svgnames]{xcolor}
\usepackage{framed}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bbm}
\usepackage{hyperref}
\usepackage{makeidx}
\usepackage{color}
\usepackage{verbatim}
\setcounter{secnumdepth}{1}
\definecolor{shadecolor}{gray}{0.95} % Background color of title bars
\lstset{
language=C,
basicstyle=\small\ttfamily,
backgroundcolor=\color{shadecolor}
}
\definecolor{cvlinkcolor}{rgb}{0.0 0.3 0.8}
% taken from http://en.wikibooks.org/wiki/LaTeX/Hyperlinks
\hypersetup{
bookmarks=true, % show bookmarks bar?
unicode=false, % non-Latin characters in Acrobat’s bookmarks
%pdftoolbar=true, % show Acrobat’s toolbar?
%pdfmenubar=true, % show Acrobat’s menu?
%pdffitwindow=false, % window fit to page when opened
%pdfstartview={FitH}, % fits the width of the page to the window
%pdftitle={My title}, % title
%pdfauthor={Author}, % author
%pdfsubject={Subject}, % subject of the document
%pdfcreator={Creator}, % creator of the document
%pdfproducer={Producer}, % producer of the document
%pdfkeywords={keywords}, % list of keywords
%pdfnewwindow=true, % links in new window
colorlinks=true, % false: boxed links; true: colored links
linkcolor=cvlinkcolor, % color of internal links
citecolor=cvlinkcolor, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=cyan % color of external links
}
\makeindex
\newcommand{\piRsquare}{\pi r^2} % This is my own macro !!!
\usepackage{helvetica}
\usepackage{ifthen}
\usepackage{alltt}
\usepackage{opencv}
%%% Margins %%%
\oddsidemargin 0.0in
\evensidemargin 0.0in
\textwidth 6.5in
%\headheight 1.0in
%\topmargin 0.5in
%\textheight 9.0in
%\footheight 1.0in
%%%%%%%%%%%%%%%
\title{OpenCV Reference Manual} % used by \maketitle
\author{v2.2} % used by \maketitle
\date{December, 2010} % used by \maketitle
\begin{document}
\maketitle % automatic title!
\setcounter{tocdepth}{8}
\tableofcontents
\titleformat{\subsection}
{\titlerule
\vspace{.8ex}%
\normalfont\bfseries\Large}
{\thesection.}{.5em}{}
%%% Define these to get rid of warnings
\def\genc{true}
\def\genpy{true}
\def\gencpp{true}
\newif\ifC
\newif\ifPy
\newif\ifCpp
\newif\ifCPy
\Ctrue
\Cppfalse
\Pyfalse
\CPytrue
\def\targetlang{c}
\part{C API Reference}
\input{opencvref_body}
\Cfalse
\Cpptrue
\Pyfalse
\CPyfalse
\def\targetlang{cpp}
\part{C++ API Reference}
\input{opencvref_body}
\Cfalse
\Cppfalse
\Pytrue
\CPytrue
\def\targetlang{python}
\part{Python API Reference}
\input{opencvref_body}
%\part{Common Information}
\addcontentsline{toc}{part}{Bibliography}
\bibliographystyle{plain}
{\small
\bibliography{opencv}
}
\addcontentsline{toc}{part}{Index}
\printindex
\end{document} % End of document.
\input{core_introduction}
\chapter{core. The Core Functionality}
\renewcommand{\curModule}{core}
\input{core_basic_structures}
\input{core_array_operations}
\input{core_dynamic_structures}
\input{core_drawing_functions}
\input{core_persistence}
\input{core_clustering_search}
\input{core_utilities_system_functions}
\chapter{imgproc. Image Processing}
\renewcommand{\curModule}{imgproc}
\input{imgproc_histograms}
\input{imgproc_image_filtering}
\input{imgproc_image_warping}
\input{imgproc_image_transform}
\input{imgproc_struct_shape_analysis}
\input{imgproc_planar_subdivisions}
\input{imgproc_motion_tracking}
\input{imgproc_feature_detection}
\input{imgproc_object_detection}
\chapter{features2d. Feature Detection and Descriptor Extraction}
\renewcommand{\curModule}{features2d}
\input{features2d_detection_description}
\input{features2d_common_detection_description}
\input{features2d_object_categorization}
\chapter{flann. Clustering and Search in Multi-Dimensional Spaces}
\renewcommand{\curModule}{flann}
\input{flann}
\chapter{objdetect. Object Detection}
\renewcommand{\curModule}{objdetect}
\input{objdetect}
\chapter{video. Video Analysis}
\renewcommand{\curModule}{video}
\input{video_motion_tracking}
\chapter{highgui. High-level GUI and Media I/O}
\renewcommand{\curModule}{highgui}
\input{highgui}
\ifPy %Qt is for C and Cpp, so do nothing
\else
\input{highgui_qt}
\fi
\chapter{calib3d. Camera Calibration, Pose Estimation and Stereo}
\renewcommand{\curModule}{calib3d}
\input{calib3d}
\chapter{ml. Machine Learning}
\renewcommand{\curModule}{ml}
\input{ml}
\ifCpp
\chapter{gpu. GPU-based Functionality}
\renewcommand{\curModule}{gpu}
\input{gpu_introduction}
\input{gpu_initialization}
\input{gpu_data_structures}
\input{gpu_matrix_operations}
\input{gpu_per_element_operations}
\input{gpu_image_processing}
\input{gpu_matrix_reductions}
\input{gpu_object_detection}
\input{gpu_features2d}
\input{gpu_image_filtering}
\input{gpu_calib3d}
\fi
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf _build/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) _build/dirhtml
@echo
@echo "Build finished. The HTML pages are in _build/dirhtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in _build/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) _build/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in _build/qthelp, like this:"
@echo "# qcollectiongenerator _build/qthelp/opencv.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile _build/qthelp/opencv.qhc"
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
@echo
@echo "Build finished; the LaTeX files are in _build/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes
@echo
@echo "The overview file is in _build/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in _build/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) _build/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in _build/doctest/output.txt."
* automatically put generated rst files in subdirectories
(e.g. cxcore/, cvreference/ etc.)
* fixup translation of function groups (e.g. cv*Dget)
* generate opencv_function_names on the fly during parsing of the tex source
* improve plastex
- allow pickling of dom tree --> only regenerate when necessary
{% extends "basic/layout.html" %}
{% block document %}
<div class="documentwrapper">
{%- if not embedded %}{% if not theme_nosidebar|tobool %}
<div class="bodywrapper">
{%- endif %}{% endif %}
<div class="body">
{% block body %} {% endblock %}
</div>
<div class="feedback">
<h2>Help and Feedback</h2>
You did not find what you were looking for?
<ul>
<li>Try the <a href="faq.html">FAQ</a>.</li>
<li>Ask a question in the <a href="http://tech.groups.yahoo.com/group/OpenCV/">user group/mailing list</a>.</li>
<li>If you think something is missing or wrong in the documentation,
please file a <a href="https://code.ros.org/trac/opencv/wiki">bug report</a>.</li>
</ul>
</div>
{%- if not embedded %}{% if not theme_nosidebar|tobool %}
</div>
{%- endif %}{% endif %}
</div>
{% endblock %}
[theme]
inherit = basic
stylesheet = default.css
pygments_style = sphinx
[options]
rightsidebar = false
stickysidebar = false
footerbgcolor = #004068
footertextcolor = #ffffff
sidebarbgcolor = #006090
sidebartextcolor = #ffffff
sidebarlinkcolor = #cceeff
relbarbgcolor = #003048
relbartextcolor = #ffffff
relbarlinkcolor = #ffffff
bgcolor = #ffffff
textcolor = #000000
headbgcolor = #f2f2f2
headtextcolor = #003048
headlinkcolor = #65a136
linkcolor = #0090d9
codebgcolor = #e0f5ff
codetextcolor = #333333
feedbackbgcolor = #004068
feedbacktextcolor = #ffffff
feedbacklinkcolor = #ffffff
bodyfont = sans-serif
headfont = 'Trebuchet MS', sans-serif
# -*- 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']
# 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'2009, 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.0'
# The full version, including alpha/beta/rc tags.
release = '2.0+ SVN'
# 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 = {}
# 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}'
highlight_language = 'c'
***
FAQ
***
.. toctree::
:maxdepth: 2
first_section
FAQ General
-----------
How can I get acquainted with OpenCV fast?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1. Look at samples.
2. Look at some web guides
* http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/index.html
* http://web.archive.org/web/20060715011915/http://www.cs.bham.ac.uk/resources/courses/robotics/doc/opencvdocs/ref/OpenCVRef_ImageProcessing.htm
* stavens_opencv_optical_flow.pdf
3. Using C/C++ interpreter Ch to run OpenCV
* http://www.softintegration.com/products/thirdparty/opencv/demos/
4. Within Visual Studio you may load OpenCV workspace:
* opencv.dsw for Microsoft Visual Studio 6.0
* opencv.sln for Miscrosoft Visual Studio .NET 2003
* cbuilderx/opencv.bpgr for Borland C++ BuilderX
* select cvsample project, build it and run. Look into the code and modify it as you wish.
5. Also, scan through reference manuals - they contain some example code as well.
6. Search OpenCV archives at http://groups.yahoo.com/group/OpenCV for the topic you are interesting in.
7. Create a new project from scratch or modify existing cvsample. There are
application wizards for Microsoft Visual Studio that create OpenCV-aware
projects; look for them at http://groups.yahoo.com/group/OpenCV (Files section
- you have to be registered OpenCV@yahoogroups.com user)
How do I join the OpenCV forum?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Send email to OpenCV-subscribe@yahoogroups.com , after you are a member and
select your logon, you can read the web group at
http://groups.yahoo.com/group/OpenCV. This mailing list is mirrored at gmane:
http://news.gmane.org/gmane.comp.lib.opencv so you can read it with a usenet
client.
FAQ Technical Questions on Library Use
--------------------------------------
How to access image pixels
^^^^^^^^^^^^^^^^^^^^^^^^^^
(The coordinates are 0-based and counted from image origin, either top-left (img->origin=IPL_ORIGIN_TL) or bottom-left (img->origin=IPL_ORIGIN_BL)
* Suppose, we have 8-bit 1-channel image I (IplImage* img)::
I(x,y) ~ ((uchar*)(img->imageData + img->widthStep*y))[x]
* Suppose, we have 8-bit 3-channel image I (IplImage* img)::
I(x,y)blue ~ ((uchar*)(img->imageData + img->widthStep*y))[x*3]
I(x,y)green ~ ((uchar*)(img->imageData + img->widthStep*y))[x*3+1]
I(x,y)red ~ ((uchar*)(img->imageData + img->widthStep*y))[x*3+2]
e.g. increasing brightness of point (100,100) by 30 can be done this way::
CvPoint pt = {100,100};
((uchar*)(img->imageData + img->widthStep*pt.y))[pt.x*3] += 30;
((uchar*)(img->imageData + img->widthStep*pt.y))[pt.x*3+1] += 30;
((uchar*)(img->imageData + img->widthStep*pt.y))[pt.x*3+2] += 30;
or more efficiently::
CvPoint pt = {100,100};
uchar* temp_ptr = &((uchar*)(img->imageData + img->widthStep*pt.y))[pt.x*3];
temp_ptr[0] += 30;
temp_ptr[1] += 30;
temp_ptr[2] += 30;
* Suppose, we have 32-bit floating point, 1-channel image I (IplImage* img)::
I(x,y) ~ ((float*)(img->imageData + img->widthStep*y))[x]
* Now, the general case: suppose, we have N-channel image of type T::
I(x,y)c ~ ((T*)(img->imageData + img->widthStep*y))[x*N + c]
or you may use macro CV_IMAGE_ELEM( image_header, elemtype, y, x_Nc )::
I(x,y)c ~ CV_IMAGE_ELEM( img, T, y, x*N + c )
There are functions that work with arbitrary (up to 4-channel) images and matrices (cvGet2D, cvSet2D), but they are pretty slow.
#!/bin/bash
grep ".. cfunction::" *.rst -h |
python -c "import sys
print \"opencv_function_names = [\"
for line in sys.stdin.readlines():
fname = line.split()[3].strip(' (')
bpos = fname.find('(')
if bpos >= 0:
fname = fname[:bpos]
print \"'%s',\" % fname
print \"]\"" > function_names.py
opencv_function_names = [
'cvProjectPoints2',
'cvFindHomography',
'cvCalibrateCamera2',
'cvFindExtrinsicCameraParams2',
'cvRodrigues2',
'cvUndistort2',
'cvInitUndistortMap',
'cvFindChessboardCorners',
'cvDrawChessboardCorners',
'cvRQDecomp3x3',
'cvDecomposeProjectionMatrix',
'cvCreatePOSITObject',
'cvPOSIT',
'cvReleasePOSITObject',
'cvCalcImageHomography',
'cvFindFundamentalMat',
'cvComputeCorrespondEpilines',
'cvConvertPointsHomogenious',
'cvOpenFileStorage',
'cvReleaseFileStorage',
'cvStartWriteStruct',
'cvEndWriteStruct',
'cvWriteInt',
'cvWriteReal',
'cvWriteString',
'cvWriteComment',
'cvStartNextStream',
'cvWrite',
'cvWriteRawData',
'cvWriteFileNode',
'cvGetRootFileNode',
'cvGetFileNodeByName',
'cvGetHashedKey',
'cvGetFileNode',
'char*',
'cvReadInt',
'cvReadIntByName',
'cvReadReal',
'cvReadRealByName',
'char*',
'char*',
'cvRead',
'cvReadByName',
'cvReadRawData',
'cvStartReadRawData',
'cvReadRawDataSlice',
'cvRegisterType',
'cvUnregisterType',
'cvFirstType',
'cvFindType',
'cvTypeOf',
'cvRelease',
'cvClone',
'cvSave',
'cvLoad',
'CV_RGB',
'cvLine',
'cvRectangle',
'cvCircle',
'cvEllipse',
'cvFillPoly',
'cvFillConvexPoly',
'cvPolyLine',
'cvInitFont',
'cvPutText',
'cvGetTextSize',
'cvDrawContours',
'cvInitLineIterator',
'cvClipLine',
'cvEllipse2Poly',
'cvCreateMemStorage',
'cvCreateChildMemStorage',
'cvReleaseMemStorage',
'cvClearMemStorage',
'cvMemStorageAlloc',
'cvMemStorageAllocString',
'cvSaveMemStoragePos',
'cvRestoreMemStoragePos',
'cvCreateSeq',
'cvSetSeqBlockSize',
'cvSeqPush',
'cvSeqPop',
'cvSeqPushFront',
'cvSeqPopFront',
'cvSeqPushMulti',
'cvSeqPopMulti',
'cvSeqInsert',
'cvSeqRemove',
'cvClearSeq',
'cvGetSeqElem',
'cvSeqElemIdx',
'cvCvtSeqToArray',
'cvMakeSeqHeaderForArray',
'cvSeqSlice',
'cvCloneSeq',
'cvSeqRemoveSlice',
'cvSeqInsertSlice',
'cvSeqInvert',
'cvSeqSort',
'cvStartAppendToSeq',
'cvStartWriteSeq',
'cvEndWriteSeq',
'cvFlushSeqWriter',
'cvStartReadSeq',
'cvGetSeqReaderPos',
'cvSetSeqReaderPos',
'cvCreateSet',
'cvSetAdd',
'cvSetRemove',
'cvSetNew',
'cvSetRemoveByPtr',
'cvGetSetElem',
'cvClearSet',
'cvCreateGraph',
'cvGraphAddVtx',
'cvGraphRemoveVtx',
'cvGraphRemoveVtxByPtr',
'cvGetGraphVtx',
'cvGraphVtxIdx',
'cvGraphAddEdge',
'cvGraphAddEdgeByPtr',
'cvGraphRemoveEdge',
'cvGraphRemoveEdgeByPtr',
'cvFindGraphEdge',
'cvFindGraphEdgeByPtr',
'cvGraphEdgeIdx',
'cvGraphVtxDegree',
'cvGraphVtxDegreeByPtr',
'cvClearGraph',
'cvCloneGraph',
'cvCreateGraphScanner',
'cvNextGraphItem',
'cvReleaseGraphScanner',
'cvInitTreeNodeIterator',
'cvNextTreeNode',
'cvPrevTreeNode',
'cvTreeToNodeSeq',
'cvInsertNodeIntoTree',
'cvRemoveNodeFromTree',
'cvGetErrStatus',
'cvSetErrStatus',
'cvGetErrMode',
'cvSetErrMode',
'cvError',
'char*',
'cvRedirectError',
'cvAlloc',
'cvFree',
'cvGetTickCount',
'cvGetTickFrequency',
'cvRegisterModule',
'cvGetModuleInfo',
'cvUseOptimized',
'cvSetMemoryManager',
'cvSetIPLAllocators',
'cvSobel',
'cvLaplace',
'cvCanny',
'cvPreCornerDetect',
'cvCornerEigenValsAndVecs',
'cvCornerMinEigenVal',
'cvCornerHarris',
'cvFindCornerSubPix',
'cvGoodFeaturesToTrack',
'cvExtractSURF',
'cvGetStarKeypoints',
'cvSampleLine',
'cvGetRectSubPix',
'cvGetQuadrangleSubPix',
'cvResize',
'cvWarpAffine',
'cvGetAffineTransform',
'cv2DRotationMatrix',
'cvWarpPerspective',
'cvGetPerspectiveTransform',
'cvRemap',
'cvLogPolar',
'cvCreateStructuringElementEx',
'cvReleaseStructuringElement',
'cvErode',
'cvDilate',
'cvMorphologyEx',
'cvSmooth',
'cvFilter2D',
'cvCopyMakeBorder',
'cvIntegral',
'cvCvtColor',
'cvThreshold',
'cvAdaptiveThreshold',
'cvPyrDown',
'cvPyrUp',
'cvPyrSegmentation',
'cvFloodFill',
'cvFindContours',
'cvStartFindContours',
'cvFindNextContour',
'cvSubstituteContour',
'cvEndFindContours',
'cvMoments',
'cvGetSpatialMoment',
'cvGetCentralMoment',
'cvGetNormalizedCentralMoment',
'cvGetHuMoments',
'cvHoughLines2',
'cvHoughCircles',
'cvDistTransform',
'cvCreateHist',
'cvSetHistBinRanges',
'cvReleaseHist',
'cvClearHist',
'cvMakeHistHeaderForArray',
'cvGetMinMaxHistValue',
'cvNormalizeHist',
'cvThreshHist',
'cvCompareHist',
'cvCopyHist',
'cvCalcHist',
'cvCalcBackProject',
'cvCalcBackProjectPatch',
'cvCalcProbDensity',
'cvEqualizeHist',
'cvMatchTemplate',
'cvMatchShapes',
'cvCalcEMD2',
'cvCheckArr',
'cvKMeans2',
'cvSeqPartition',
'cvAcc',
'cvSquareAcc',
'cvMultiplyAcc',
'cvRunningAvg',
'cvUpdateMotionHistory',
'cvCalcMotionGradient',
'cvCalcGlobalOrientation',
'cvSegmentMotion',
'cvMeanShift',
'cvCamShift',
'cvSnakeImage',
'cvCalcOpticalFlowHS',
'cvCalcOpticalFlowLK',
'cvCalcOpticalFlowBM',
'cvCalcOpticalFlowPyrLK',
'cvCreateKalman',
'cvReleaseKalman',
'CvMat*',
'CvMat*',
'cvCreateConDensation',
'cvReleaseConDensation',
'cvConDensInitSampleSet',
'cvConDensUpdateByTime',
'cvCreateImage',
'cvCreateImageHeader',
'cvReleaseImageHeader',
'cvReleaseImage',
'cvInitImageHeader',
'cvCloneImage',
'cvSetImageCOI',
'cvGetImageCOI',
'cvSetImageROI',
'cvResetImageROI',
'cvGetImageROI',
'cvCreateMat',
'cvCreateMatHeader',
'cvReleaseMat',
'cvInitMatHeader',
'cvMat',
'cvCloneMat',
'cvCreateMatND',
'cvCreateMatNDHeader',
'cvReleaseMatND',
'cvInitMatNDHeader',
'cvCloneMatND',
'cvDecRefData',
'cvIncRefData',
'cvCreateData',
'cvReleaseData',
'cvSetData',
'cvGetRawData',
'cvGetMat',
'cvGetImage',
'cvCreateSparseMat',
'cvReleaseSparseMat',
'cvCloneSparseMat',
'cvGetSubRect',
'cvGetRow',
'cvGetRows',
'cvGetCol',
'cvGetCols',
'cvGetDiag',
'cvGetSize',
'cvInitSparseMatIterator',
'cvGetNextSparseNode',
'cvGetElemType',
'cvGetDims',
'cvGetDimSize',
'cvmGet',
'cvmSet',
'cvClearND',
'cvCopy',
'cvSet',
'cvSetZero',
'cvReshape',
'cvReshapeMatND',
'cvRepeat',
'cvFlip',
'cvSplit',
'cvMerge',
'cvLUT',
'cvConvertScale',
'cvConvertScaleAbs',
'cvAdd',
'cvAddS',
'cvAddWeighted',
'cvSub',
'cvSubS',
'cvSubRS',
'cvMul',
'cvDiv',
'cvAnd',
'cvAndS',
'cvOr',
'cvOrS',
'cvXor',
'cvXorS',
'cvNot',
'cvCmp',
'cvCmpS',
'cvInRange',
'cvInRangeS',
'cvMax',
'cvMaxS',
'cvMin',
'cvMinS',
'cvAbsDiff',
'cvAbsDiffS',
'cvCountNonZero',
'cvSum',
'cvAvg',
'cvAvgSdv',
'cvMinMaxLoc',
'cvNorm',
'cvSetIdentity',
'cvDotProduct',
'cvCrossProduct',
'cvScaleAdd',
'cvGEMM',
'cvTransform',
'cvPerspectiveTransform',
'cvMulTransposed',
'cvTrace',
'cvTranspose',
'cvDet',
'cvInvert',
'cvSolve',
'cvSVD',
'cvSVBkSb',
'cvEigenVV',
'cvCalcCovarMatrix',
'cvMahalanobis',
'cvRound',
'cvSqrt',
'cvInvSqrt',
'cvCbrt',
'cvFastArctan',
'cvIsNaN',
'cvIsInf',
'cvCartToPolar',
'cvPolarToCart',
'cvPow',
'cvExp',
'cvLog',
'cvSolveCubic',
'cvRNG',
'cvRandArr',
'cvRandInt',
'cvRandReal',
'cvDFT',
'cvGetOptimalDFTSize',
'cvMulSpectrums',
'cvDCT',
'cvLoadHaarClassifierCascade',
'cvReleaseHaarClassifierCascade',
'cvHaarDetectObjects',
'cvSetImagesForHaarClassifierCascade',
'cvRunHaarClassifierCascade',
'cvApproxChains',
'cvStartReadChainPoints',
'cvReadChainPoint',
'cvApproxPoly',
'cvBoundingRect',
'cvContourArea',
'cvArcLength',
'cvCreateContourTree',
'cvContourFromContourTree',
'cvMatchContourTrees',
'cvMaxRect',
'cvPointSeqFromMat',
'cvBoxPoints',
'cvFitEllipse2',
'cvFitLine',
'cvConvexHull2',
'cvCheckContourConvexity',
'cvConvexityDefects',
'cvPointPolygonTest',
'cvMinAreaRect2',
'cvMinEnclosingCircle',
'cvCalcPGH',
'cvSubdiv2DGetEdge',
'cvSubdiv2DRotateEdge',
'cvSubdiv2DEdgeOrg',
'cvSubdiv2DEdgeDst',
'cvCreateSubdivDelaunay2D',
'cvSubdivDelaunay2DInsert',
'cvSubdiv2DLocate',
'cvFindNearestPoint2D',
'cvCalcSubdivVoronoi2D',
'cvClearSubdivVoronoi2D',
]
#!/bin/bash
#cd .. && make && cd -
mkdir -p _build/html/python
mkdir -p _build/html/cpp
if true
then
rm -f *.rst
svn up
TEXINPUTS=../: python renderer.py c > a || exit
TEXINPUTS=$PWD: sphinx-build -b html -D 'html_title=OpenCV 2.0 C Reference' -d _build/doctrees . _build/html
fi
if true
then
rm -f *.rst
svn up
cp python-introduction.rst introduction.rst
TEXINPUTS=../: python renderer.py py > a || exit
cp python-introduction.rst introduction.rst
TEXINPUTS=$PWD: sphinx-build -b html -D 'highlight_language=python' -D 'html_title=OpenCV 2.0 Python Reference' -d _build/doctrees . _build/html/python
fi
if true
then
rm -f *.rst
svn up
TEXINPUTS=../: python renderer.py cpp > a || exit
TEXINPUTS=$PWD: sphinx-build -b html -D 'html_title=OpenCV 2.0 C++ Reference' -d _build/doctrees . _build/html/cpp
fi
The OpenCV Wiki is here: http://opencv.willowgarage.com/
Contents:
.. toctree::
:maxdepth: 2
introduction
cxcore._the_core_functionality
cv._image_processing_and_computer_vision
cvaux._extra_computer_vision_functionality
highgui._high-level_gui_and_media_io
ml._machine_learning
Indices and tables
==================
* :ref:`genindex`
* :ref:`search`
import sys
from pyparsing import Word, CharsNotIn, Optional, OneOrMore, ZeroOrMore, Group, ParseException, Literal, replaceWith
import pyparsing
help(pyparsing)
class Argument:
def __init__(self, s, loc, toks):
self.str = toks[1]
def __repr__(self):
return "[%s]" % self.str
def argfun(s, loc, toks):
return Argument(s, loc, toks)
class Parameter:
def __init__(self, s, loc, toks):
self.str = toks[1]
def __repr__(self):
return "{%s}" % self.str
def paramfun(s, loc, toks):
return Parameter(s, loc, toks)
class TexCmd:
def __init__(self, s, loc, toks):
self.cmd = str(toks[0])[1:]
#print 'cmd', self.cmd
self.args = toks[1].asList()
self.params = toks[2].asList()
def __repr__(self):
return self.cmd + "".join([repr(a) for a in self.args]) + "".join([repr(p) for p in self.params])
class ZeroOrMoreAsList(ZeroOrMore):
def __init__(self, *args):
ZeroOrMore.__init__(self, *args)
def listify(s, loc, toks):
return [toks]
self.setParseAction(listify)
arg = '[' + CharsNotIn("]") + ']'
arg.setParseAction(argfun)
param = '{' + Optional(CharsNotIn("}")) + '}'
param.setParseAction(paramfun)
texcmd = Word("\\", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") + ZeroOrMoreAsList(arg) + ZeroOrMoreAsList(param)
def texcmdfun(s, loc, toks):
if str(toks[0])[1:] == 'input':
filename = toks[2].asList()[0].str + "-py.tex"
print 'Now parsing', filename
return parsefile(filename)
else:
return TexCmd(s, loc, toks)
texcmd.setParseAction(texcmdfun)
legal = "".join([chr(x) for x in set(range(32, 127)) - set("\\")])
document = ZeroOrMore(texcmd | Word(legal)) + Literal(chr(127)).suppress()
def parsefile(filename):
f = open(filename, "rt")
lines = list(f)
def uncomment(s):
if '%' in s:
return s[:s.index('%')] + '\n'
else:
return s
lines = [uncomment(l) for l in lines]
docstr = "".join(lines) + chr(127)
# document.setFailAction(None)
return document.parseString(docstr)
for x in parsefile(sys.argv[1]):
if isinstance(x, TexCmd):
if x.cmd == 'chapter':
print repr(x)
\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}
}
from plasTeX import Base
from plasTeX.Base.LaTeX.Verbatim import verbatim
from plasTeX.Base.LaTeX import Sectioning
import sys
class includegraphics(Base.Command):
args = '[size] file'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvclass(Sectioning.subsection):
def invoke(self, tex):
Sectioning.subsection.invoke(self, tex)
class cvfunc(Sectioning.subsection):
def invoke(self, tex):
Sectioning.subsection.invoke(self, tex)
class cvCPyFunc(Sectioning.subsection):
def invoke(self, tex):
Sectioning.subsection.invoke(self, tex)
class cvCppFunc(Sectioning.subsection):
def invoke(self, tex):
Sectioning.subsection.invoke(self, tex)
class cvFunc(Sectioning.subsection):
args = 'title alt'
def invoke(self, tex):
Sectioning.subsection.invoke(self, tex)
class cvstruct(Sectioning.subsection):
def invoke(self, tex):
Sectioning.subsection.invoke(self, tex)
class cvmacro(Sectioning.subsection):
def invoke(self, tex):
Sectioning.subsection.invoke(self, tex)
class cross(Base.Command):
args = 'name'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class label(Base.Command):
args = 'name'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class url(Base.Command):
args = 'loc'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvarg(Base.Command):
args = 'item def'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvCross(Base.Command):
args = 'name altname'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvCPyCross(Base.Command):
args = 'name'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvCppCross(Base.Command):
args = 'name'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvdefC(Base.Command):
args = 'a'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvcode(Base.Command):
args = 'a'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvdefPy(Base.Command):
args = 'a'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvdefCpp(Base.Command):
args = 'a'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvC(Base.Command):
args = 'a'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvCpp(Base.Command):
args = 'a'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvCPy(Base.Command):
args = 'a'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class cvPy(Base.Command):
args = 'a'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class xxindex(Base.Command):
args = 'entry'
def invoke(self, tex):
Base.Command.invoke(self, tex)
class lstlisting(verbatim):
def parse(self, tex):
verbatim.parse(self, tex)
return self.attributes
def section_filename(title):
"""Image Processing ==> image_processing.rst"""
lower_list = [word.lower() for word in title.split()]
return "_".join(lower_list) + ".rst"
class chapter(Sectioning.chapter):
@property
def filenameoverride(self):
if self.attributes['title'] is not None:
filename = section_filename(str(self.attributes['title']))
#assert filename in ['cxcore.rst', 'cvreference.rst']
return filename
raise AttributeError, 'This chapter does not generate a new file'
class section(Sectioning.section):
@property
def filenameoverride(self):
if self.attributes['title'] is not None:
filename = section_filename(str(self.attributes['title']))
print 'section:', filename
return filename
raise AttributeError, 'This section does not generate a new file'
class xifthenelse(Base.Command):
args = 'test then else'
class _not(Base.Command):
macroName = 'not'
class _and(Base.Command):
macroName = 'and'
class _or(Base.Command):
macroName = 'or'
class NOT(Base.Command):
pass
class AND(Base.Command):
pass
class OR(Base.Command):
pass
class openParen(Base.Command):
macroName = '('
class closeParen(Base.Command):
macroName = ')'
class isodd(Base.Command):
args = 'number:int'
class isundefined(Base.Command):
args = 'command:str'
class equal(Base.Command):
args = 'first second'
class lengthtest(Base.Command):
args = 'test'
class boolean(Base.Command):
args = 'name:str'
Introduction
============
Cookbook
--------
Here is a small collection of code fragments demonstrating some features
of the OpenCV Python bindings.
Convert an image from png to jpg
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
import cv
cv.SaveImage("foo.png", cv.LoadImage("foo.jpg"))
Compute the Laplacian
^^^^^^^^^^^^^^^^^^^^^
::
im = cv.LoadImage("foo.png", 1)
dst = cv.CreateImage(cv.GetSize(im), cv.IPL_DEPTH_16S, 3);
laplace = cv.Laplace(im, dst)
cv.SaveImage("foo-laplace.png", dst)
Using cvGoodFeaturesToTrack
^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
img = cv.LoadImage("foo.jpg")
eig_image = cv.CreateImage(cv.GetSize(img), cv.IPL_DEPTH_32F, 1)
temp_image = cv.CreateImage(cv.GetSize(img), cv.IPL_DEPTH_32F, 1)
# Find up to 300 corners using Harris
for (x,y) in cv.GoodFeaturesToTrack(img, eig_image, temp_image, 300, None, 1.0, use_harris = True):
print "good feature at", x,y
Using GetSubRect
^^^^^^^^^^^^^^^^
GetSubRect returns a rectangular part of another image. It does this without copying any data.
::
img = cv.LoadImage("foo.jpg")
sub = cv.GetSubRect(img, (0, 0, 32, 32)) # sub is 32x32 patch from img top-left
cv.SetZero(sub) # clear sub to zero, which also clears 32x32 pixels in img
Using CreateMat, and accessing an element
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
mat = cv.CreateMat(5, 5, cv.CV_32FC1)
mat[3,2] += 0.787
ROS image message to OpenCV
^^^^^^^^^^^^^^^^^^^^^^^^^^^
See this tutorial: http://www.ros.org/wiki/cv_bridge/Tutorials/UsingCvBridgeToConvertBetweenROSImagesAndOpenCVImages
PIL Image to OpenCV
^^^^^^^^^^^^^^^^^^^
(For details on PIL see the `PIL manual <http://www.pythonware.com/library/pil/handbook/image.htm>`_).
::
import Image
import cv
pi = Image.open('foo.png') # PIL image
cv_im = cv.CreateImageHeader(pi.size, cv.IPL_DEPTH_8U, 1)
cv.SetData(cv_im, pi.tostring())
OpenCV to PIL Image
^^^^^^^^^^^^^^^^^^^
::
cv_im = cv.CreateImage((320,200), cv.IPL_DEPTH_8U, 1)
pi = Image.fromstring("L", cv.GetSize(cv_im), cv_im.tostring())
NumPy and OpenCV
^^^^^^^^^^^^^^^^
Using the `array interface <http://docs.scipy.org/doc/numpy/reference/arrays.interface.html>`_, to use an OpenCV CvMat in NumPy::
import cv
import numpy
mat = cv.CreateMat(5, 5, cv.CV_32FC1)
a = numpy.asarray(mat)
and to use a NumPy array in OpenCV::
a = numpy.ones((640, 480))
mat = cv.fromarray(a)
even easier, most OpenCV functions can work on NumPy arrays directly, for example::
picture = numpy.ones((640, 480))
cv.Smooth(picture, picture, cv.CV_GAUSSIAN, 15, 15)
Given a 2D array,
the fromarray function (or the implicit version shown above)
returns a single-channel CvMat of the same size.
For a 3D array of size :math:`j \times k \times l`, it returns a
CvMat sized :math:`j \times k` with :math:`l` channels.
Alternatively, use fromarray with the allowND option to always return a cvMatND.
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