mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
Merge pull request #25042 from mshabunin:doc-upgrade
Documentation transition to fresh Doxygen #25042 * current Doxygen version is 1.10, but we will use 1.9.8 for now due to issue with snippets (https://github.com/doxygen/doxygen/pull/10584) * Doxyfile adapted to new version * MathJax updated to 3.x * `@relates` instructions removed temporarily due to issue in Doxygen (to avoid warnings) * refactored matx.hpp - extracted matx.inl.hpp * opencv_contrib - https://github.com/opencv/opencv_contrib/pull/3638
This commit is contained in:
@@ -16,6 +16,10 @@ endif()
|
||||
|
||||
find_package(Doxygen)
|
||||
if(DOXYGEN_FOUND)
|
||||
if (DOXYGEN_VERSION VERSION_LESS 1.9.8)
|
||||
message(WARNING "Found doxygen ${DOXYGEN_VERSION}, version 1.9.8 is used for testing, there is
|
||||
a chance your documentation will look different or have some limitations.")
|
||||
endif()
|
||||
add_custom_target(doxygen)
|
||||
|
||||
# not documented modules list
|
||||
@@ -191,6 +195,8 @@ if(DOXYGEN_FOUND)
|
||||
list(APPEND CMAKE_DOXYGEN_HTML_FILES "${CMAKE_CURRENT_SOURCE_DIR}/tutorial-utils.js")
|
||||
string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_HTML_FILES "${CMAKE_DOXYGEN_HTML_FILES}")
|
||||
|
||||
set(OPENCV_MATHJAX_RELPATH "https://cdn.jsdelivr.net/npm/mathjax@3.0.1" CACHE STRING "URI to a MathJax installation")
|
||||
|
||||
set(OPENCV_DOCS_DOT_PATH "" CACHE PATH "Doxygen/DOT_PATH value")
|
||||
set(CMAKECONFIG_DOT_PATH "${OPENCV_DOCS_DOT_PATH}")
|
||||
|
||||
|
||||
+59
-14
@@ -3,8 +3,11 @@ PROJECT_NAME = OpenCV
|
||||
PROJECT_NUMBER = @OPENCV_VERSION@
|
||||
PROJECT_BRIEF = "Open Source Computer Vision"
|
||||
PROJECT_LOGO = @CMAKE_CURRENT_SOURCE_DIR@/opencv-logo-small.png
|
||||
#PROJECT_ICON =
|
||||
OUTPUT_DIRECTORY = @CMAKE_DOXYGEN_OUTPUT_PATH@
|
||||
CREATE_SUBDIRS = YES
|
||||
CREATE_SUBDIRS_LEVEL = 8
|
||||
ALLOW_UNICODE_NAMES = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
@@ -26,8 +29,10 @@ STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@/modules @CMAKE_DOXYGEN_INCLUDE_ROOTS
|
||||
STRIP_FROM_INC_PATH = @CMAKE_DOXYGEN_INCLUDE_ROOTS@
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
JAVADOC_BANNER = NO
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
PYTHON_DOCSTRING = YES
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 4
|
||||
@@ -43,26 +48,34 @@ OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
OPTIMIZE_FOR_FORTRAN = NO
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
OPTIMIZE_OUTPUT_SLICE = NO
|
||||
EXTENSION_MAPPING =
|
||||
MARKDOWN_SUPPORT = YES
|
||||
TOC_INCLUDE_HEADINGS = 5
|
||||
MARKDOWN_ID_STYLE = DOXYGEN
|
||||
AUTOLINK_SUPPORT = YES
|
||||
BUILTIN_STL_SUPPORT = YES
|
||||
CPP_CLI_SUPPORT = NO
|
||||
SIP_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
GROUP_NESTED_COMPOUNDS = NO
|
||||
SUBGROUPING = YES
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
INLINE_SIMPLE_STRUCTS = NO
|
||||
TYPEDEF_HIDES_STRUCT = YES
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
NUM_PROC_THREADS = 1
|
||||
TIMESTAMP = YES
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_PRIV_VIRTUAL = NO
|
||||
EXTRACT_PACKAGE = NO
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = NO
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
RESOLVE_UNNAMED_PARAMS = YES
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
@@ -70,6 +83,8 @@ HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
HIDE_COMPOUND_REFERENCE= NO
|
||||
SHOW_HEADERFILE = YES
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
SHOW_GROUPED_MEMB_INC = YES
|
||||
FORCE_LOCAL_INCLUDES = NO
|
||||
@@ -96,11 +111,16 @@ QUIET = YES
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_IF_INCOMPLETE_DOC = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_IF_UNDOC_ENUM_VAL = NO
|
||||
WARN_AS_ERROR = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LINE_FORMAT = "at line $line of file $file"
|
||||
WARN_LOGFILE =
|
||||
INPUT = @CMAKE_DOXYGEN_INPUT_LIST@
|
||||
INPUT_ENCODING = UTF-8
|
||||
INPUT_FILE_ENCODING =
|
||||
FILE_PATTERNS =
|
||||
RECURSIVE = YES
|
||||
EXCLUDE = @CMAKE_DOXYGEN_EXCLUDE_LIST@
|
||||
@@ -125,8 +145,11 @@ REFERENCES_LINK_SOURCE = YES
|
||||
SOURCE_TOOLTIPS = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = NO
|
||||
CLANG_ASSISTED_PARSING = NO
|
||||
CLANG_ADD_INC_PATHS = YES
|
||||
CLANG_OPTIONS =
|
||||
CLANG_DATABASE_PATH =
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
@@ -136,14 +159,19 @@ HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/footer.html
|
||||
HTML_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/stylesheet.css
|
||||
HTML_EXTRA_FILES = @CMAKE_DOXYGEN_HTML_FILES@
|
||||
HTML_COLORSTYLE = LIGHT
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = YES
|
||||
HTML_DYNAMIC_MENUS = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
HTML_CODE_FOLDING = YES
|
||||
#HTML_COPY_CLIPBOARD = YES
|
||||
#HTML_PROJECT_COOKIE =
|
||||
HTML_INDEX_NUM_ENTRIES = 100
|
||||
GENERATE_DOCSET = NO
|
||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||
DOCSET_FEEDURL =
|
||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
||||
DOCSET_PUBLISHER_NAME = Publisher
|
||||
@@ -154,6 +182,7 @@ GENERATE_CHI = NO
|
||||
CHM_INDEX_ENCODING =
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
SITEMAP_URL =
|
||||
GENERATE_QHP = @CMAKE_DOXYGEN_GENERATE_QHP@
|
||||
QCH_FILE = ../opencv-@OPENCV_VERSION@.qch
|
||||
QHP_NAMESPACE = org.opencv.@OPENCV_VERSION@
|
||||
@@ -166,15 +195,19 @@ GENERATE_ECLIPSEHELP = NO
|
||||
ECLIPSE_DOC_ID = org.doxygen.Project
|
||||
DISABLE_INDEX = NO
|
||||
GENERATE_TREEVIEW = NO
|
||||
FULL_SIDEBAR = NO
|
||||
ENUM_VALUES_PER_LINE = 1
|
||||
TREEVIEW_WIDTH = 250
|
||||
EXT_LINKS_IN_WINDOW = YES
|
||||
OBFUSCATE_EMAILS = YES
|
||||
HTML_FORMULA_FORMAT = svg
|
||||
FORMULA_FONTSIZE = 14
|
||||
FORMULA_TRANSPARENT = YES
|
||||
FORMULA_MACROFILE =
|
||||
USE_MATHJAX = YES
|
||||
MATHJAX_FORMAT = HTML-CSS
|
||||
MATHJAX_VERSION = MathJax_3
|
||||
MATHJAX_FORMAT = chtml
|
||||
MATHJAX_RELPATH = @OPENCV_MATHJAX_RELPATH@
|
||||
MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
|
||||
MATHJAX_EXTENSIONS = ams
|
||||
MATHJAX_CODEFILE = @CMAKE_CURRENT_SOURCE_DIR@/mymath.js
|
||||
SEARCHENGINE = YES
|
||||
SERVER_BASED_SEARCH = NO
|
||||
@@ -187,18 +220,20 @@ GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
LATEX_MAKEINDEX_CMD = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4
|
||||
EXTRA_PACKAGES = mymath
|
||||
LATEX_HEADER =
|
||||
LATEX_FOOTER =
|
||||
LATEX_EXTRA_STYLESHEET =
|
||||
LATEX_EXTRA_FILES =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
LATEX_SOURCE_CODE = NO
|
||||
LATEX_BIB_STYLE = plain
|
||||
LATEX_EMOJI_DIRECTORY =
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
@@ -208,13 +243,18 @@ RTF_EXTENSIONS_FILE =
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_SUBDIR =
|
||||
MAN_LINKS = NO
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_PROGRAMLISTING = YES
|
||||
XML_NS_MEMB_FILE_SCOPE = NO
|
||||
GENERATE_DOCBOOK = NO
|
||||
DOCBOOK_OUTPUT = docbook
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
GENERATE_SQLITE3 = NO
|
||||
SQLITE3_OUTPUT = sqlite3
|
||||
SQLITE3_RECREATE_DB = YES
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
@@ -272,19 +312,20 @@ GENERATE_TAGFILE = @CMAKE_DOXYGEN_OUTPUT_PATH@/html/opencv.tag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
EXTERNAL_PAGES = YES
|
||||
CLASS_DIAGRAMS = YES
|
||||
DIA_PATH =
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
HAVE_DOT = @CMAKECONFIG_HAVE_DOT@
|
||||
DOT_NUM_THREADS = 0
|
||||
DOT_FONTNAME = Helvetica
|
||||
DOT_FONTSIZE = 10
|
||||
DOT_FONTPATH =
|
||||
DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10"
|
||||
DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10"
|
||||
DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4"
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
GROUP_GRAPHS = NO
|
||||
UML_LOOK = YES
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
DOT_UML_DETAILS = NO
|
||||
DOT_WRAP_THRESHOLD = 17
|
||||
TEMPLATE_RELATIONS = YES
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
@@ -292,15 +333,19 @@ CALL_GRAPH = YES
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DIR_GRAPH_MAX_DEPTH = 1
|
||||
DOT_IMAGE_FORMAT = @CMAKECONFIG_DOT_IMAGE_FORMAT@
|
||||
INTERACTIVE_SVG = @CMAKECONFIG_INTERACTIVE_SVG@
|
||||
DOT_PATH = @CMAKECONFIG_DOT_PATH@
|
||||
DOTFILE_DIRS =
|
||||
MSCFILE_DIRS =
|
||||
DIAFILE_DIRS =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
PLANTUML_JAR_PATH =
|
||||
PLANTUML_CFG_FILE =
|
||||
PLANTUML_INCLUDE_PATH =
|
||||
DOT_GRAPH_MAX_NODES = 250
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
MSCGEN_TOOL =
|
||||
MSCFILE_DIRS =
|
||||
|
||||
@@ -336,7 +336,7 @@ function installDOM(){
|
||||
- Make sure the files `aarcascade_frontalface_default.xml` and `haarcascade_eye.xml` are present in project's directory. They can be obtained from [OpenCV sources](https://github.com/opencv/opencv/tree/4.x/data/haarcascades).
|
||||
- Make sure a sample image file `lena.jpg` exists in project's directory. It should display people's faces for this example to make sense. The following image is known to work:
|
||||
|
||||

|
||||

|
||||
|
||||
The following command should generate the file `output3.jpg`:
|
||||
|
||||
|
||||
+18
-20
@@ -1,22 +1,20 @@
|
||||
//<![CDATA[
|
||||
MathJax.Hub.Config(
|
||||
{
|
||||
TeX: {
|
||||
Macros: {
|
||||
matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
|
||||
fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
|
||||
forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
|
||||
forkfour: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ #7 & \\mbox{#8}\\\\ \\end{array} \\right.", 8],
|
||||
vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
|
||||
vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
|
||||
cameramatrix: ["#1 = \\begin{bmatrix} f_x & 0 & c_x\\\\ 0 & f_y & c_y\\\\ 0 & 0 & 1 \\end{bmatrix}", 1],
|
||||
distcoeffs: ["(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \\tau_x, \\tau_y]]]]) \\text{ of 4, 5, 8, 12 or 14 elements}"],
|
||||
distcoeffsfisheye: ["(k_1, k_2, k_3, k_4)"],
|
||||
hdotsfor: ["\\dots", 1],
|
||||
mathbbm: ["\\mathbb{#1}", 1],
|
||||
bordermatrix: ["\\matrix{#1}", 1]
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
macros: {
|
||||
matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
|
||||
fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
|
||||
forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
|
||||
forkfour: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ #7 & \\mbox{#8}\\\\ \\end{array} \\right.", 8],
|
||||
vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
|
||||
vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
|
||||
cameramatrix: ["#1 = \\begin{bmatrix} f_x & 0 & c_x\\\\ 0 & f_y & c_y\\\\ 0 & 0 & 1 \\end{bmatrix}", 1],
|
||||
distcoeffs: ["(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \\tau_x, \\tau_y]]]]) \\text{ of 4, 5, 8, 12 or 14 elements}"],
|
||||
distcoeffsfisheye: ["(k_1, k_2, k_3, k_4)"],
|
||||
hdotsfor: ["\\dots", 1],
|
||||
mathbbm: ["\\mathbb{#1}", 1],
|
||||
bordermatrix: ["\\matrix{#1}", 1]
|
||||
}
|
||||
}
|
||||
};
|
||||
//]]>
|
||||
|
||||
@@ -79,62 +79,38 @@ Building OpenCV from source
|
||||
-# Extract it to a folder, opencv and create a new folder build in it.
|
||||
-# Open CMake-gui (*Start \> All Programs \> CMake-gui*)
|
||||
-# Fill the fields as follows (see the image below):
|
||||
|
||||
-# Click on **Browse Source...** and locate the opencv folder.
|
||||
|
||||
-# Click on **Browse Build...** and locate the build folder we created.
|
||||
|
||||
-# Click on **Configure**.
|
||||
|
||||

|
||||
|
||||
-# It will open a new window to select the compiler. Choose appropriate compiler (here,
|
||||
Visual Studio 11) and click **Finish**.
|
||||
|
||||

|
||||
|
||||
-# Wait until analysis is finished.
|
||||
|
||||
-# You will see all the fields are marked in red. Click on the **WITH** field to expand it. It
|
||||
decides what extra features you need. So mark appropriate fields. See the below image:
|
||||
|
||||

|
||||
|
||||
-# Now click on **BUILD** field to expand it. First few fields configure the build method. See the
|
||||
below image:
|
||||
|
||||

|
||||
|
||||
-# Remaining fields specify what modules are to be built. Since GPU modules are not yet supported
|
||||
by OpenCV-Python, you can completely avoid it to save time (But if you work with them, keep it
|
||||
there). See the image below:
|
||||
|
||||

|
||||
|
||||
-# Now click on **ENABLE** field to expand it. Make sure **ENABLE_SOLUTION_FOLDERS** is unchecked
|
||||
(Solution folders are not supported by Visual Studio Express edition). See the image below:
|
||||
|
||||

|
||||
|
||||
-# Also make sure that in the **PYTHON** field, everything is filled. (Ignore
|
||||
PYTHON_DEBUG_LIBRARY). See image below:
|
||||
|
||||

|
||||
|
||||
-# Finally click the **Generate** button.
|
||||
|
||||
-# Now go to our **opencv/build** folder. There you will find **OpenCV.sln** file. Open it with
|
||||
Visual Studio.
|
||||
|
||||
-# Check build mode as **Release** instead of **Debug**.
|
||||
|
||||
-# In the solution explorer, right-click on the **Solution** (or **ALL_BUILD**) and build it. It
|
||||
will take some time to finish.
|
||||
|
||||
-# Again, right-click on **INSTALL** and build it. Now OpenCV-Python will be installed.
|
||||
|
||||

|
||||
|
||||
-# Open Python IDLE and enter 'import cv2 as cv'. If no error, it is installed correctly.
|
||||
|
||||
@note We have installed with no other support like TBB, Eigen, Qt, Documentation etc. It would be
|
||||
|
||||
@@ -87,7 +87,7 @@ Fourier Transform too needs to be of a discrete type resulting in a Discrete Fou
|
||||
(*DFT*). You'll want to use this whenever you need to determine the structure of an image from a
|
||||
geometrical point of view. Here are the steps to follow (in case of a gray scale input image *I*):
|
||||
|
||||
#### Expand the image to an optimal size
|
||||
### Expand the image to an optimal size
|
||||
|
||||
The performance of a DFT is dependent of the image
|
||||
size. It tends to be the fastest for image sizes that are multiple of the numbers two, three and
|
||||
@@ -108,7 +108,7 @@ image (the appended pixels are initialized with zero):
|
||||
@snippet python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py expand
|
||||
@end_toggle
|
||||
|
||||
#### Make place for both the complex and the real values
|
||||
### Make place for both the complex and the real values
|
||||
|
||||
The result of a Fourier Transform is
|
||||
complex. This implies that for each image value the result is two image values (one per
|
||||
@@ -128,7 +128,7 @@ input image to this type and expand it with another channel to hold the complex
|
||||
@snippet python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py complex_and_real
|
||||
@end_toggle
|
||||
|
||||
#### Make the Discrete Fourier Transform
|
||||
### Make the Discrete Fourier Transform
|
||||
It's possible an in-place calculation (same input as
|
||||
output):
|
||||
|
||||
@@ -144,7 +144,7 @@ output):
|
||||
@snippet python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py dft
|
||||
@end_toggle
|
||||
|
||||
#### Transform the real and complex values to magnitude
|
||||
### Transform the real and complex values to magnitude
|
||||
A complex number has a real (*Re*) and a
|
||||
complex (imaginary - *Im*) part. The results of a DFT are complex numbers. The magnitude of a
|
||||
DFT is:
|
||||
@@ -165,7 +165,7 @@ Translated to OpenCV code:
|
||||
@snippet python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py magnitude
|
||||
@end_toggle
|
||||
|
||||
#### Switch to a logarithmic scale
|
||||
### Switch to a logarithmic scale
|
||||
It turns out that the dynamic range of the Fourier
|
||||
coefficients is too large to be displayed on the screen. We have some small and some high
|
||||
changing values that we can't observe like this. Therefore the high values will all turn out as
|
||||
@@ -188,7 +188,7 @@ Translated to OpenCV code:
|
||||
@snippet python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py log
|
||||
@end_toggle
|
||||
|
||||
#### Crop and rearrange
|
||||
### Crop and rearrange
|
||||
Remember, that at the first step, we expanded the image? Well, it's time
|
||||
to throw away the newly introduced values. For visualization purposes we may also rearrange the
|
||||
quadrants of the result, so that the origin (zero, zero) corresponds with the image center.
|
||||
@@ -205,7 +205,7 @@ quadrants of the result, so that the origin (zero, zero) corresponds with the im
|
||||
@snippet python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py crop_rearrange
|
||||
@end_toggle
|
||||
|
||||
#### Normalize
|
||||
### Normalize
|
||||
This is done again for visualization purposes. We now have the magnitudes,
|
||||
however this are still out of our image display range of zero to one. We normalize our values to
|
||||
this range using the @ref cv::normalize() function.
|
||||
|
||||
@@ -73,7 +73,7 @@ Here's a function that will do this:
|
||||
@snippet samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp basic_method
|
||||
|
||||
At first we make sure that the input images data is in unsigned char format. For this we use the
|
||||
@ref cv::CV_Assert function that throws an error when the expression inside it is false.
|
||||
@ref CV_Assert function (macro) that throws an error when the expression inside it is false.
|
||||
@snippet samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp 8_bit
|
||||
@end_toggle
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ In this tutorial, we first introduce how to obtain the custom OCR model, then ho
|
||||
|
||||
After completing the model training, please use [transform_to_onnx.py](https://github.com/zihaomu/deep-text-recognition-benchmark/blob/master/transform_to_onnx.py) to convert the model into onnx format.
|
||||
|
||||
#### Execute in webcam
|
||||
### Execute in webcam
|
||||
The Python version example code can be found at [here](https://github.com/opencv/opencv/blob/4.x/samples/dnn/text_detection.py).
|
||||
|
||||
Example:
|
||||
@@ -44,9 +44,10 @@ Their performance at different text recognition datasets is shown in the table b
|
||||
| CRNN_VGG-BiLSTM-CTC | 82.63 | 82.07 | 92.96 | 88.867 | 66.28 | 71.01 | 62.37 | 78.03 | 8.45 |
|
||||
| ResNet-CTC | 84.00 | 84.08 | 92.39 | 88.96 | 67.74 | 74.73 | 67.60 | 79.93 | 44.28 |
|
||||
|
||||
The performance of the text recognition model were tesred on OpenCV DNN, and does not include the text detection model.
|
||||
The performance of the text recognition model were tested on OpenCV DNN, and does not include the text detection model.
|
||||
|
||||
### Model selection suggestion
|
||||
|
||||
#### Model selection suggestion:
|
||||
The input of text recognition model is the output of the text detection model, which causes the performance of text detection to greatly affect the performance of text recognition.
|
||||
|
||||
DenseNet_CTC has the smallest parameters and best FPS, and it is suitable for edge devices, which are very sensitive to the cost of calculation. If you have limited computing resources and want to achieve better accuracy, VGG_CTC is a good choice.
|
||||
|
||||
@@ -17,7 +17,7 @@ In this tutorial you will learn how to use opencv_dnn module for image classific
|
||||
GoogLeNet trained network from [Caffe model zoo](http://caffe.berkeleyvision.org/model_zoo.html).
|
||||
|
||||
We will demonstrate results of this example on the following picture.
|
||||

|
||||

|
||||
|
||||
Source Code
|
||||
-----------
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
In this tutorial, we will introduce the APIs for TextRecognitionModel and TextDetectionModel in detail.
|
||||
|
||||
---
|
||||
#### TextRecognitionModel:
|
||||
### TextRecognitionModel
|
||||
|
||||
In the current version, @ref cv::dnn::TextRecognitionModel only supports CNN+RNN+CTC based algorithms,
|
||||
and the greedy decoding method for CTC is provided.
|
||||
@@ -38,7 +38,7 @@ Before recognition, you should `setVocabulary` and `setDecodeType`.
|
||||
|
||||
---
|
||||
|
||||
#### TextDetectionModel:
|
||||
### TextDetectionModel
|
||||
|
||||
@ref cv::dnn::TextDetectionModel API provides these methods for text detection:
|
||||
- cv::dnn::TextDetectionModel::detect() returns the results in std::vector<std::vector<Point>> (4-points quadrangles)
|
||||
@@ -60,7 +60,7 @@ We encourage you to add new algorithms to these APIs.
|
||||
|
||||
## Pretrained Models
|
||||
|
||||
#### TextRecognitionModel:
|
||||
### TextRecognitionModel
|
||||
|
||||
```
|
||||
crnn.onnx:
|
||||
@@ -92,7 +92,7 @@ More models can be found in [here](https://drive.google.com/drive/folders/1cTbQ3
|
||||
which are taken from [clovaai](https://github.com/clovaai/deep-text-recognition-benchmark).
|
||||
You can train more models by [CRNN](https://github.com/meijieru/crnn.pytorch), and convert models by `torch.onnx.export`.
|
||||
|
||||
#### TextDetectionModel:
|
||||
### TextDetectionModel
|
||||
|
||||
```
|
||||
- DB_IC15_resnet50.onnx:
|
||||
@@ -297,7 +297,7 @@ For more information, please refer to:
|
||||
- [samples/dnn/text_detection.cpp](https://github.com/opencv/opencv/blob/4.x/samples/dnn/text_detection.cpp)
|
||||
- [samples/dnn/scene_text_spotting.cpp](https://github.com/opencv/opencv/blob/4.x/samples/dnn/scene_text_spotting.cpp)
|
||||
|
||||
#### Test with an image
|
||||
### Test with an image
|
||||
Examples:
|
||||
```bash
|
||||
example_dnn_scene_text_recognition -mp=path/to/crnn_cs.onnx -i=path/to/an/image -rgb=1 -vp=/path/to/alphabet_94.txt
|
||||
@@ -306,7 +306,7 @@ example_dnn_scene_text_spotting -dmp=path/to/DB_IC15_resnet50.onnx -rmp=path/to/
|
||||
example_dnn_text_detection -dmp=path/to/EAST.pb -rmp=path/to/crnn_cs.onnx -i=path/to/an/image -rgb=1 -vp=path/to/alphabet_94.txt
|
||||
```
|
||||
|
||||
#### Test on public datasets
|
||||
### Test on public datasets
|
||||
Text Recognition:
|
||||
|
||||
The download link for testing images can be found in the **Images for Testing**
|
||||
|
||||
@@ -111,7 +111,7 @@ called and it will update the output image based on the current trackbar values.
|
||||
|
||||
Let's analyze these two functions:
|
||||
|
||||
#### The erosion function
|
||||
### The erosion function (CPP)
|
||||
|
||||
@snippet cpp/tutorial_code/ImgProc/Morphology_1.cpp erosion
|
||||
|
||||
@@ -135,7 +135,7 @@ receives three arguments:
|
||||
|
||||
That is all. We are ready to perform the erosion of our image.
|
||||
|
||||
#### The dilation function
|
||||
### The dilation function (CPP)
|
||||
|
||||
The code is below. As you can see, it is completely similar to the snippet of code for **erosion**.
|
||||
Here we also have the option of defining our kernel, its anchor point and the size of the operator
|
||||
@@ -175,7 +175,7 @@ In short we
|
||||
The action and state changed listeners added call at the end the `update` method which updates
|
||||
the image based on the current slider values. So every time we move any slider, the `update` method is triggered.
|
||||
|
||||
#### Updating the image
|
||||
### Updating the image (Java)
|
||||
|
||||
To update the image we used the following implementation:
|
||||
|
||||
@@ -190,7 +190,7 @@ In other words we
|
||||
|
||||
Let's analyze the `erode` and `dilate` methods:
|
||||
|
||||
#### The erosion method
|
||||
### The erosion method (Java)
|
||||
|
||||
@snippet java/tutorial_code/ImgProc/erosion_dilatation/MorphologyDemo1.java erosion
|
||||
|
||||
@@ -213,7 +213,7 @@ receives three arguments:
|
||||
|
||||
That is all. We are ready to perform the erosion of our image.
|
||||
|
||||
#### The dilation function
|
||||
### The dilation function (Java)
|
||||
|
||||
The code is below. As you can see, it is completely similar to the snippet of code for **erosion**.
|
||||
Here we also have the option of defining our kernel, its anchor point and the size of the operator
|
||||
@@ -240,7 +240,7 @@ called and it will update the output image based on the current trackbar values.
|
||||
|
||||
Let's analyze these two functions:
|
||||
|
||||
#### The erosion function
|
||||
### The erosion function (Python)
|
||||
|
||||
@snippet python/tutorial_code/imgProc/erosion_dilatation/morphology_1.py erosion
|
||||
|
||||
@@ -262,7 +262,7 @@ specified, it is assumed to be in the center.
|
||||
|
||||
That is all. We are ready to perform the erosion of our image.
|
||||
|
||||
#### The dilation function
|
||||
### The dilation function (Python)
|
||||
|
||||
The code is below. As you can see, it is completely similar to the snippet of code for **erosion**.
|
||||
Here we also have the option of defining our kernel, its anchor point and the size of the operator
|
||||
|
||||
+4
-4
@@ -133,7 +133,7 @@ Explanation
|
||||
Let's check the OpenCV functions that involve only the smoothing procedure, since the rest is
|
||||
already known by now.
|
||||
|
||||
#### Normalized Block Filter:
|
||||
### Normalized Block Filter:
|
||||
|
||||
- OpenCV offers the function **blur()** to perform smoothing with this filter.
|
||||
We specify 4 arguments (more details, check the Reference):
|
||||
@@ -157,7 +157,7 @@ already known by now.
|
||||
@snippet samples/python/tutorial_code/imgProc/Smoothing/smoothing.py blur
|
||||
@end_toggle
|
||||
|
||||
#### Gaussian Filter:
|
||||
### Gaussian Filter:
|
||||
|
||||
- It is performed by the function **GaussianBlur()** :
|
||||
Here we use 4 arguments (more details, check the OpenCV reference):
|
||||
@@ -183,7 +183,7 @@ already known by now.
|
||||
@snippet samples/python/tutorial_code/imgProc/Smoothing/smoothing.py gaussianblur
|
||||
@end_toggle
|
||||
|
||||
#### Median Filter:
|
||||
### Median Filter:
|
||||
|
||||
- This filter is provided by the **medianBlur()** function:
|
||||
We use three arguments:
|
||||
@@ -203,7 +203,7 @@ already known by now.
|
||||
@snippet samples/python/tutorial_code/imgProc/Smoothing/smoothing.py medianblur
|
||||
@end_toggle
|
||||
|
||||
#### Bilateral Filter
|
||||
### Bilateral Filter
|
||||
|
||||
- Provided by OpenCV function **bilateralFilter()**
|
||||
We use 5 arguments:
|
||||
|
||||
@@ -78,7 +78,7 @@ You can also download it from
|
||||
Explanation
|
||||
-----------
|
||||
|
||||
#### Declare the variables
|
||||
### Declare the variables
|
||||
|
||||
First we declare the variables we are going to use:
|
||||
|
||||
@@ -97,7 +97,7 @@ First we declare the variables we are going to use:
|
||||
Especial attention deserves the variable *rng* which is a random number generator. We use it to
|
||||
generate the random border color, as we will see soon.
|
||||
|
||||
#### Load an image
|
||||
### Load an image
|
||||
|
||||
As usual we load our source image *src*:
|
||||
|
||||
@@ -113,7 +113,7 @@ As usual we load our source image *src*:
|
||||
@snippet python/tutorial_code/ImgTrans/MakeBorder/copy_make_border.py load
|
||||
@end_toggle
|
||||
|
||||
#### Create a window
|
||||
### Create a window
|
||||
|
||||
After giving a short intro of how to use the program, we create a window:
|
||||
|
||||
@@ -129,7 +129,7 @@ After giving a short intro of how to use the program, we create a window:
|
||||
@snippet python/tutorial_code/ImgTrans/MakeBorder/copy_make_border.py create_window
|
||||
@end_toggle
|
||||
|
||||
#### Initialize arguments
|
||||
### Initialize arguments
|
||||
|
||||
Now we initialize the argument that defines the size of the borders (*top*, *bottom*, *left* and
|
||||
*right*). We give them a value of 5% the size of *src*.
|
||||
@@ -146,7 +146,7 @@ Now we initialize the argument that defines the size of the borders (*top*, *bot
|
||||
@snippet python/tutorial_code/ImgTrans/MakeBorder/copy_make_border.py init_arguments
|
||||
@end_toggle
|
||||
|
||||
#### Loop
|
||||
### Loop
|
||||
|
||||
The program runs in an infinite loop while the key **ESC** isn't pressed.
|
||||
If the user presses '**c**' or '**r**', the *borderType* variable
|
||||
@@ -164,7 +164,7 @@ takes the value of *BORDER_CONSTANT* or *BORDER_REPLICATE* respectively:
|
||||
@snippet python/tutorial_code/ImgTrans/MakeBorder/copy_make_border.py check_keypress
|
||||
@end_toggle
|
||||
|
||||
#### Random color
|
||||
### Random color
|
||||
|
||||
In each iteration (after 0.5 seconds), the random border color (*value*) is updated...
|
||||
|
||||
@@ -182,7 +182,7 @@ In each iteration (after 0.5 seconds), the random border color (*value*) is upda
|
||||
|
||||
This value is a set of three numbers picked randomly in the range \f$[0,255]\f$.
|
||||
|
||||
#### Form a border around the image
|
||||
### Form a border around the image
|
||||
|
||||
Finally, we call the function **copyMakeBorder()** to apply the respective padding:
|
||||
|
||||
@@ -209,7 +209,7 @@ Finally, we call the function **copyMakeBorder()** to apply the respective paddi
|
||||
-# *value*: If *borderType* is *BORDER_CONSTANT*, this is the value used to fill the border
|
||||
pixels.
|
||||
|
||||
#### Display the results
|
||||
### Display the results
|
||||
|
||||
We display our output image in the image created previously
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ You can also download it from
|
||||
Explanation
|
||||
-----------
|
||||
|
||||
#### Load an image
|
||||
### Load an image
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/ImgTrans/filter2D_demo.cpp load
|
||||
@@ -108,7 +108,7 @@ Explanation
|
||||
@snippet python/tutorial_code/ImgTrans/Filter2D/filter2D.py load
|
||||
@end_toggle
|
||||
|
||||
#### Initialize the arguments
|
||||
### Initialize the arguments
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/ImgTrans/filter2D_demo.cpp init_arguments
|
||||
@@ -122,7 +122,7 @@ Explanation
|
||||
@snippet python/tutorial_code/ImgTrans/Filter2D/filter2D.py init_arguments
|
||||
@end_toggle
|
||||
|
||||
##### Loop
|
||||
### Loop
|
||||
|
||||
Perform an infinite loop updating the kernel size and applying our linear filter to the input
|
||||
image. Let's analyze that more in detail:
|
||||
|
||||
@@ -74,7 +74,7 @@ Explanation
|
||||
|
||||
The image we used can be found [here](https://raw.githubusercontent.com/opencv/opencv/4.x/samples/data/smarties.png)
|
||||
|
||||
#### Load an image:
|
||||
### Load an image:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp load
|
||||
@@ -88,7 +88,7 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o
|
||||
@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py load
|
||||
@end_toggle
|
||||
|
||||
#### Convert it to grayscale:
|
||||
### Convert it to grayscale:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp convert_to_gray
|
||||
@@ -102,7 +102,7 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o
|
||||
@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py convert_to_gray
|
||||
@end_toggle
|
||||
|
||||
#### Apply a Median blur to reduce noise and avoid false circle detection:
|
||||
### Apply a Median blur to reduce noise and avoid false circle detection:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp reduce_noise
|
||||
@@ -116,7 +116,7 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o
|
||||
@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py reduce_noise
|
||||
@end_toggle
|
||||
|
||||
#### Proceed to apply Hough Circle Transform:
|
||||
### Proceed to apply Hough Circle Transform:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp houghcircles
|
||||
@@ -144,7 +144,7 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o
|
||||
- *min_radius = 0*: Minimum radius to be detected. If unknown, put zero as default.
|
||||
- *max_radius = 0*: Maximum radius to be detected. If unknown, put zero as default.
|
||||
|
||||
#### Draw the detected circles:
|
||||
### Draw the detected circles:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp draw
|
||||
@@ -160,7 +160,7 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o
|
||||
|
||||
You can see that we will draw the circle(s) on red and the center(s) with a small green dot
|
||||
|
||||
#### Display the detected circle(s) and wait for the user to exit the program:
|
||||
### Display the detected circle(s) and wait for the user to exit the program:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp display
|
||||
|
||||
@@ -129,7 +129,7 @@ The sample code that we will explain can be downloaded from
|
||||
Explanation
|
||||
-----------
|
||||
|
||||
#### Load an image:
|
||||
### Load an image:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/houghlines.cpp load
|
||||
@@ -143,7 +143,7 @@ Explanation
|
||||
@snippet samples/python/tutorial_code/ImgTrans/HoughLine/hough_lines.py load
|
||||
@end_toggle
|
||||
|
||||
#### Detect the edges of the image by using a Canny detector:
|
||||
### Detect the edges of the image by using a Canny detector:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/houghlines.cpp edge_detection
|
||||
@@ -160,7 +160,7 @@ Explanation
|
||||
Now we will apply the Hough Line Transform. We will explain how to use both OpenCV functions
|
||||
available for this purpose.
|
||||
|
||||
#### Standard Hough Line Transform:
|
||||
### Standard Hough Line Transform:
|
||||
First, you apply the Transform:
|
||||
|
||||
@add_toggle_cpp
|
||||
@@ -199,7 +199,7 @@ And then you display the result by drawing the lines.
|
||||
@snippet samples/python/tutorial_code/ImgTrans/HoughLine/hough_lines.py draw_lines
|
||||
@end_toggle
|
||||
|
||||
#### Probabilistic Hough Line Transform
|
||||
### Probabilistic Hough Line Transform
|
||||
First you apply the transform:
|
||||
|
||||
@add_toggle_cpp
|
||||
@@ -242,7 +242,7 @@ And then you display the result by drawing the lines.
|
||||
@snippet samples/python/tutorial_code/ImgTrans/HoughLine/hough_lines.py draw_lines_p
|
||||
@end_toggle
|
||||
|
||||
#### Display the original image and the detected lines:
|
||||
### Display the original image and the detected lines:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/houghlines.cpp imshow
|
||||
@@ -256,7 +256,7 @@ And then you display the result by drawing the lines.
|
||||
@snippet samples/python/tutorial_code/ImgTrans/HoughLine/hough_lines.py imshow
|
||||
@end_toggle
|
||||
|
||||
#### Wait until the user exits the program
|
||||
### Wait until the user exits the program
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgTrans/houghlines.cpp exit
|
||||
|
||||
@@ -81,7 +81,7 @@ Code
|
||||
Explanation
|
||||
-----------
|
||||
|
||||
#### Declare variables
|
||||
### Declare variables
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp variables
|
||||
@@ -95,7 +95,7 @@ Explanation
|
||||
@snippet samples/python/tutorial_code/ImgTrans/LaPlace/laplace_demo.py variables
|
||||
@end_toggle
|
||||
|
||||
#### Load source image
|
||||
### Load source image
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp load
|
||||
@@ -109,7 +109,7 @@ Explanation
|
||||
@snippet samples/python/tutorial_code/ImgTrans/LaPlace/laplace_demo.py load
|
||||
@end_toggle
|
||||
|
||||
#### Reduce noise
|
||||
### Reduce noise
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp reduce_noise
|
||||
@@ -123,7 +123,7 @@ Explanation
|
||||
@snippet samples/python/tutorial_code/ImgTrans/LaPlace/laplace_demo.py reduce_noise
|
||||
@end_toggle
|
||||
|
||||
#### Grayscale
|
||||
### Grayscale
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp convert_to_gray
|
||||
@@ -137,7 +137,7 @@ Explanation
|
||||
@snippet samples/python/tutorial_code/ImgTrans/LaPlace/laplace_demo.py convert_to_gray
|
||||
@end_toggle
|
||||
|
||||
#### Laplacian operator
|
||||
### Laplacian operator
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp laplacian
|
||||
@@ -160,7 +160,7 @@ Explanation
|
||||
this example.
|
||||
- *scale*, *delta* and *BORDER_DEFAULT*: We leave them as default values.
|
||||
|
||||
#### Convert output to a *CV_8U* image
|
||||
### Convert output to a *CV_8U* image
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp convert
|
||||
@@ -174,7 +174,7 @@ Explanation
|
||||
@snippet samples/python/tutorial_code/ImgTrans/LaPlace/laplace_demo.py convert
|
||||
@end_toggle
|
||||
|
||||
#### Display the result
|
||||
### Display the result
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp display
|
||||
|
||||
@@ -58,7 +58,7 @@ Theory
|
||||
gradient of an image intensity function.
|
||||
-# The Sobel Operator combines Gaussian smoothing and differentiation.
|
||||
|
||||
#### Formulation
|
||||
### Formulation
|
||||
|
||||
Assuming that the image to be operated is \f$I\f$:
|
||||
|
||||
@@ -140,23 +140,23 @@ You can also download it from
|
||||
Explanation
|
||||
-----------
|
||||
|
||||
#### Declare variables
|
||||
### Declare variables
|
||||
|
||||
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp variables
|
||||
|
||||
#### Load source image
|
||||
### Load source image
|
||||
|
||||
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp load
|
||||
|
||||
#### Reduce noise
|
||||
### Reduce noise
|
||||
|
||||
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp reduce_noise
|
||||
|
||||
#### Grayscale
|
||||
### Grayscale
|
||||
|
||||
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp convert_to_gray
|
||||
|
||||
#### Sobel Operator
|
||||
### Sobel Operator
|
||||
|
||||
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp sobel
|
||||
|
||||
@@ -174,18 +174,18 @@ Explanation
|
||||
Notice that to calculate the gradient in *x* direction we use: \f$x_{order}= 1\f$ and
|
||||
\f$y_{order} = 0\f$. We do analogously for the *y* direction.
|
||||
|
||||
#### Convert output to a CV_8U image
|
||||
### Convert output to a CV_8U image
|
||||
|
||||
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp convert
|
||||
|
||||
#### Gradient
|
||||
### Gradient
|
||||
|
||||
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp blend
|
||||
|
||||
We try to approximate the *gradient* by adding both directional gradients (note that
|
||||
this is not an exact calculation at all! but it is good for our purposes).
|
||||
|
||||
#### Show results
|
||||
### Show results
|
||||
|
||||
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp display
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ Explanation / Result
|
||||
|
||||
Get image from [here](https://raw.githubusercontent.com/opencv/opencv/4.x/doc/tutorials/imgproc/morph_lines_detection/images/src.png) .
|
||||
|
||||
#### Load Image
|
||||
### Load Image
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/morph_lines_detection/Morphology_3.cpp load_image
|
||||
@@ -96,7 +96,7 @@ Get image from [here](https://raw.githubusercontent.com/opencv/opencv/4.x/doc/tu
|
||||
|
||||

|
||||
|
||||
#### Grayscale
|
||||
### Grayscale
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/morph_lines_detection/Morphology_3.cpp gray
|
||||
@@ -112,7 +112,7 @@ Get image from [here](https://raw.githubusercontent.com/opencv/opencv/4.x/doc/tu
|
||||
|
||||

|
||||
|
||||
#### Grayscale to Binary image
|
||||
### Grayscale to Binary image
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet samples/cpp/tutorial_code/ImgProc/morph_lines_detection/Morphology_3.cpp bin
|
||||
@@ -128,7 +128,7 @@ Get image from [here](https://raw.githubusercontent.com/opencv/opencv/4.x/doc/tu
|
||||
|
||||

|
||||
|
||||
#### Output images
|
||||
### Output images
|
||||
|
||||
Now we are ready to apply morphological operations in order to extract the horizontal and vertical lines and as a consequence to separate the music notes from the music sheet, but first let's initialize the output images that we will use for that reason:
|
||||
|
||||
@@ -144,7 +144,7 @@ Now we are ready to apply morphological operations in order to extract the horiz
|
||||
@snippet samples/python/tutorial_code/imgProc/morph_lines_detection/morph_lines_detection.py init
|
||||
@end_toggle
|
||||
|
||||
#### Structure elements
|
||||
### Structure elements
|
||||
|
||||
As we specified in the theory in order to extract the object that we desire, we need to create the corresponding structure element. Since we want to extract the horizontal lines, a corresponding structure element for that purpose will have the following shape:
|
||||

|
||||
@@ -182,7 +182,7 @@ and again this is represented as follows:
|
||||
|
||||

|
||||
|
||||
#### Refine edges / Result
|
||||
### Refine edges / Result
|
||||
|
||||
As you can see we are almost there. However, at that point you will notice that the edges of the notes are a bit rough. For that reason we need to refine the edges in order to obtain a smoother result:
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ Theory
|
||||
pyramid (with less resolution)
|
||||
- In this tutorial we'll use the *Gaussian pyramid*.
|
||||
|
||||
#### Gaussian Pyramid
|
||||
### Gaussian Pyramid
|
||||
|
||||
- Imagine the pyramid as a set of layers in which the higher the layer, the smaller the size.
|
||||
|
||||
@@ -100,7 +100,7 @@ Explanation
|
||||
|
||||
Let's check the general structure of the program:
|
||||
|
||||
#### Load an image
|
||||
### Load an image
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/ImgProc/Pyramids/Pyramids.cpp load
|
||||
@@ -114,7 +114,7 @@ Let's check the general structure of the program:
|
||||
@snippet python/tutorial_code/imgProc/Pyramids/pyramids.py load
|
||||
@end_toggle
|
||||
|
||||
#### Create window
|
||||
### Create window
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/ImgProc/Pyramids/Pyramids.cpp show_image
|
||||
@@ -128,7 +128,7 @@ Let's check the general structure of the program:
|
||||
@snippet python/tutorial_code/imgProc/Pyramids/pyramids.py show_image
|
||||
@end_toggle
|
||||
|
||||
#### Loop
|
||||
### Loop
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/tutorial_code/ImgProc/Pyramids/Pyramids.cpp loop
|
||||
|
||||
@@ -85,7 +85,7 @@ Setup Device for Testing and Debugging
|
||||
Usually the recipe above works as expected, but in some cases there are additional actions that must
|
||||
be performed. In this section we'll cover some cases.
|
||||
|
||||
#### Windows host computer
|
||||
### Windows host computer
|
||||
|
||||
If you have Windows 10 or higher then you don't have to do additional actions to connect
|
||||
a phone and run samples on it. However, earlier Windows versions require a longer procedure:
|
||||
@@ -163,7 +163,7 @@ a phone and run samples on it. However, earlier Windows versions require a longe
|
||||
-# Now, in Eclipse go Run -\> Run/Debug to run your application in regular or debugging mode.
|
||||
Device Chooser will let you choose among the devices.
|
||||
|
||||
#### Linux host computer
|
||||
### Linux host computer
|
||||
|
||||
While the latest Ubuntu versions work well with connected Android devices, there can be issues on older versions.
|
||||
However, most of them can be fixed easily. You have to create a new **/etc/udev/rules.d/51-android.rules** configuration file that contains
|
||||
@@ -184,7 +184,7 @@ R58MB40Q3VP device
|
||||
savuor@rostislav-laptop:~/Android/Sdk/platform-tools$
|
||||
```
|
||||
|
||||
#### Mac OS host computer
|
||||
### Mac OS host computer
|
||||
|
||||
No actions are required, just connect your device via USB and run adb devices to check connection.
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ This tutorial is deprecated.
|
||||
@tableofcontents
|
||||
|
||||
OpenCV with CUDA for Tegra
|
||||
==========================
|
||||
--------------------------
|
||||
|
||||
This document is a basic guide to building the OpenCV libraries with CUDA support for use in the Tegra environment. It covers the basic elements of building the version 3.1.0 libraries from source code for three (3) different types of platforms:
|
||||
|
||||
@@ -36,7 +36,7 @@ The OpenCV build system supports native compilation for all the supported platfo
|
||||
At the present time, this document focuses only on native compilation.
|
||||
|
||||
Getting the Source Code {#tutorial_building_tegra_cuda_getting_the_code}
|
||||
=======================
|
||||
-----------------------
|
||||
|
||||
There are two (2) ways to get the OpenCV source code:
|
||||
|
||||
@@ -45,8 +45,7 @@ There are two (2) ways to get the OpenCV source code:
|
||||
|
||||
For this guide, the focus is on using the git repositories. This is because the 3.1.0 version of OpenCV will not build with CUDA 8.0 without applying a few small upstream changes from the git repository.
|
||||
|
||||
OpenCV
|
||||
------
|
||||
### OpenCV
|
||||
|
||||
Start with the `opencv` repository:
|
||||
|
||||
@@ -93,8 +92,7 @@ You should see output similar to:
|
||||
|
||||
At this point, the `opencv` repository is ready for building.
|
||||
|
||||
OpenCV Extra
|
||||
------------
|
||||
### OpenCV Extra
|
||||
|
||||
The `opencv_extra` repository contains extra data for the OpenCV library, including the data files used by the tests and demos. It must be cloned separately:
|
||||
|
||||
@@ -111,12 +109,11 @@ You may opt to not fetch this repository if you do not plan on running the tests
|
||||
__Note:__ If you plan to run the tests, some tests expect the data to be present and will fail without it.
|
||||
|
||||
Preparation and Prerequisites {#tutorial_building_tegra_cuda_preparation}
|
||||
=============================
|
||||
-----------------------------
|
||||
|
||||
To build OpenCV, you need a directory to create the configuration and build the libraries. You also need a number of 3rd-party libraries upon which OpenCV depends.
|
||||
|
||||
Prerequisites for Ubuntu Linux
|
||||
------------------------------
|
||||
### Prerequisites for Ubuntu Linux
|
||||
|
||||
These are the basic requirements for building OpenCV for Tegra on Linux:
|
||||
|
||||
@@ -186,8 +183,7 @@ The commands that will do this:
|
||||
|
||||
Once all the necessary packages are installed, you can configure the build.
|
||||
|
||||
Preparing the Build Area
|
||||
------------------------
|
||||
### Preparing the Build Area
|
||||
|
||||
Software projects that use the CMake system for configuring their builds expect the actual builds to be done outside of the source tree itself. For configuring and building OpenCV, create a directory called "build" in the same base directory into which you cloned the git repositories:
|
||||
|
||||
@@ -197,7 +193,7 @@ Software projects that use the CMake system for configuring their builds expect
|
||||
You are now ready to configure and build OpenCV.
|
||||
|
||||
Configuring OpenCV for Building {#tutorial_building_tegra_cuda_configuring}
|
||||
===============================
|
||||
-------------------------------
|
||||
|
||||
The CMake configuration options given below for the different platforms are targeted towards the functionality needed for Tegra. They are based on the original configuration options used for building OpenCV 2.4.13.
|
||||
|
||||
@@ -209,8 +205,7 @@ For the Linux-based platforms, the shown value for the `CMAKE_INSTALL_PREFIX` pa
|
||||
|
||||
In each of the `cmake` invocations below, the last parameter, `OPENCV_TEST_DATA_PATH`, tells the build system where to find the test-data that is provided by the `opencv_extra` repository. When this is included, a `make install` installs this test-data alongside the libraries and example code, and a `make test` automatically provides this path to the tests that have to load data from it. If you did not clone the `opencv_extra` repository, do not include this parameter.
|
||||
|
||||
Vibrante V4L Configuration
|
||||
--------------------------
|
||||
### Vibrante V4L Configuration
|
||||
|
||||
Supported platform: Drive PX 2
|
||||
|
||||
@@ -251,8 +246,7 @@ The configuration provided above builds the Python bindings for Python 2 (but no
|
||||
|
||||
-DBUILD_opencv_python2=OFF
|
||||
|
||||
Jetson L4T Configuration
|
||||
------------------------
|
||||
### Jetson L4T Configuration
|
||||
|
||||
Supported platforms:
|
||||
|
||||
@@ -261,7 +255,7 @@ Supported platforms:
|
||||
|
||||
Configuration is slightly different for the Jetson TK1 and the Jetson TX1 systems.
|
||||
|
||||
### Jetson TK1
|
||||
#### Jetson TK1
|
||||
|
||||
$ cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
@@ -299,7 +293,7 @@ Configuration is slightly different for the Jetson TK1 and the Jetson TX1 system
|
||||
|
||||
__Note:__ This uses CUDA 6.5, not 8.0.
|
||||
|
||||
### Jetson TX1
|
||||
#### Jetson TX1
|
||||
|
||||
$ cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
@@ -336,8 +330,7 @@ __Note:__ This uses CUDA 6.5, not 8.0.
|
||||
|
||||
__Note:__ This configuration does not set the `ENABLE_NEON` parameter.
|
||||
|
||||
Ubuntu Desktop Linux Configuration
|
||||
----------------------------------
|
||||
### Ubuntu Desktop Linux Configuration
|
||||
|
||||
Supported platforms:
|
||||
|
||||
@@ -383,12 +376,11 @@ This configuration is nearly identical to that for V4L and L4T, except that the
|
||||
As with previous examples, the configuration given above builds the Python bindings for Python 2 (but not Python 3) as part of the build process.
|
||||
|
||||
Building OpenCV {#tutorial_building_tegra_cuda_building}
|
||||
===============
|
||||
---------------
|
||||
|
||||
Once `cmake` finishes configuring OpenCV, building is done using the standard `make` utility.
|
||||
|
||||
Building with `make`
|
||||
--------------------
|
||||
### Building with `make`
|
||||
|
||||
The only parameter that is needed for the invocation of `make` is the `-j` parameter for specifying how many parallel threads to use. This varies depending on the system and how much memory is available, other running processes, etc. The following table offers suggested values for this parameter:
|
||||
|
||||
@@ -408,12 +400,11 @@ By default, CMake hides the details of the build steps. If you need to see more
|
||||
$ make -j6 VERBOSE=1
|
||||
|
||||
Testing OpenCV {#tutorial_building_tegra_cuda_testing}
|
||||
==============
|
||||
--------------
|
||||
|
||||
Once the build completes successfully, you have the option of running the extensive set of tests that OpenCV provides. If you did not clone the `opencv_extra` repository and specify the path to `testdata` in the `cmake` invocation, then testing is not recommended.
|
||||
|
||||
Testing under Linux
|
||||
-------------------
|
||||
### Testing under Linux
|
||||
|
||||
To run the basic tests under Linux, execute:
|
||||
|
||||
@@ -425,7 +416,7 @@ This executes `ctest` to carry out the tests, as specified in CTest syntax withi
|
||||
|
||||
In this example, there are two (2) arguments passed to `ctest`: `--verbose` and `--parallel 3`. The first argument causes the output from `ctest` to be more detailed, and the second causes `ctest` to run as many as three (3) tests in parallel. As with choosing a thread count for building, base any choice for testing on the available number of processor cores, physical memory, etc. Some of the tests do attempt to allocate significant amounts of memory.
|
||||
|
||||
### Known Issues with Tests
|
||||
#### Known Issues with Tests
|
||||
|
||||
At present, not all of the tests in the OpenCV test suite pass. There are tests that fail whether or not CUDA is compiled, and there are tests that are only specific to CUDA that also do not currently pass.
|
||||
|
||||
@@ -434,7 +425,7 @@ __Note:__ There are no tests that pass without CUDA but fail only when CUDA is i
|
||||
As the full lists of failing tests vary based on platform, it is impractical to list them here.
|
||||
|
||||
Installing OpenCV {#tutorial_building_tegra_cuda_installing}
|
||||
=================
|
||||
-----------------
|
||||
|
||||
Installing OpenCV is very straightforward. For the Linux-based platforms, the command is:
|
||||
|
||||
@@ -443,14 +434,13 @@ Installing OpenCV is very straightforward. For the Linux-based platforms, the co
|
||||
Depending on the chosen installation location, you may need root privilege to install.
|
||||
|
||||
Building OpenCV 2.4.X {#tutorial_building_tegra_cuda_opencv_24X}
|
||||
=====================
|
||||
---------------------
|
||||
|
||||
If you wish to build your own version of the 2.4 version of OpenCV, there are only a few adjustments that must be made. At the time of this writing, the latest version on the 2.4 tree is 2.4.13. These instructions may work for later versions of 2.4, though they have not been tested for any earlier versions.
|
||||
|
||||
__Note:__ The 2.4.X OpenCV source does not have the extra modules and code for Tegra that was upstreamed into the 3.X versions of OpenCV. This part of the guide is only for cases where you want to build a vanilla version of OpenCV 2.4.
|
||||
|
||||
Selecting the 2.4 Source
|
||||
------------------------
|
||||
### Selecting the 2.4 Source
|
||||
|
||||
First you must select the correct source branch or tag. If you want a specific version such as 2.4.13, you want to make a local branch based on the tag, as was done with the 3.1.0 tag above:
|
||||
|
||||
@@ -466,14 +456,13 @@ If you simply want the newest code from the 2.4 line of OpenCV, there is a `2.4`
|
||||
|
||||
There is no need for the `git cherry-pick` commands used with 3.1.0 when building the 2.4.13 source.
|
||||
|
||||
Configuring
|
||||
-----------
|
||||
### Configuring
|
||||
|
||||
Configuring is done with CMake as before. The primary difference is that OpenCV 2.4 only provides Python bindings for Python 2, and thus does not distinguish between Python 2 and Python 3 in the CMake parameters. There is only one parameter, `BUILD_opencv_python`. In addition, there is a build-related parameter that controls features in 2.4 that are not in 3.1.0. This parameter is `BUILD_opencv_nonfree`.
|
||||
|
||||
Configuration still takes place in a separate directory that must be a sibling to the `opencv` and `opencv_extra` directories.
|
||||
|
||||
### Configuring Vibrante V4L
|
||||
#### Configuring Vibrante V4L
|
||||
|
||||
For DRIVE PX 2:
|
||||
|
||||
@@ -510,7 +499,7 @@ For DRIVE PX 2:
|
||||
-DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
|
||||
../opencv
|
||||
|
||||
### Configuring Jetson L4T
|
||||
#### Configuring Jetson L4T
|
||||
|
||||
For Jetson TK1:
|
||||
|
||||
@@ -582,7 +571,7 @@ For Jetson TX1:
|
||||
-DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
|
||||
../opencv
|
||||
|
||||
### Configuring Desktop Ubuntu Linux
|
||||
#### Configuring Desktop Ubuntu Linux
|
||||
|
||||
For both 14.04 LTS and 16.04 LTS:
|
||||
|
||||
@@ -618,13 +607,12 @@ For both 14.04 LTS and 16.04 LTS:
|
||||
-DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
|
||||
../opencv
|
||||
|
||||
Building, Testing and Installing
|
||||
--------------------------------
|
||||
### Building, Testing and Installing
|
||||
|
||||
Once configured, the steps of building, testing, and installing are the same as above for the 3.1.0 source.
|
||||
|
||||
CMake Parameter Reference {#tutorial_building_tegra_cuda_parameter_reference}
|
||||
=========================
|
||||
-------------------------
|
||||
|
||||
The following is a table of all the parameters passed to CMake in the recommended invocations above. Some of these are parameters from CMake itself, while most are specific to OpenCV.
|
||||
|
||||
|
||||
@@ -35,11 +35,11 @@ issue the following command to run the sample from the command line.
|
||||
cd path/to/samples/java/clojure/simple-sample
|
||||
lein run
|
||||
@endcode
|
||||
|
||||
Preamble
|
||||
--------
|
||||
|
||||
For detailed instruction on installing OpenCV with desktop Java support refer to the @ref tutorial_java_dev_intro "corresponding
|
||||
tutorial".
|
||||
For detailed instruction on installing OpenCV with desktop Java support refer to the @ref tutorial_java_dev_intro "corresponding tutorial".
|
||||
|
||||
If you are in hurry, here is a minimum quick start guide to install OpenCV on Mac OS X:
|
||||
|
||||
@@ -63,6 +63,7 @@ make -j8
|
||||
# optional
|
||||
# make install
|
||||
@endcode
|
||||
|
||||
Install Leiningen
|
||||
-----------------
|
||||
|
||||
@@ -170,6 +171,7 @@ i386 -> x86
|
||||
arm -> arm
|
||||
sparc -> sparc
|
||||
@endcode
|
||||
|
||||
### Package the native lib as a jar
|
||||
|
||||
Next you need to package the native lib in a jar file by using the jar command to create a new jar
|
||||
@@ -193,6 +195,7 @@ tree
|
||||
|
||||
3 directories, 3 files
|
||||
@endcode
|
||||
|
||||
### Locally install the jars
|
||||
|
||||
We are now ready to add the two jars as artifacts to the local maven repository with the help of the
|
||||
@@ -402,6 +405,7 @@ Let's now try to port to Clojure the @ref tutorial_java_dev_intro "OpenCV Java t
|
||||
Instead of writing it in a source file we're going to evaluate it at the REPL.
|
||||
|
||||
Following is the original Java source code of the cited sample.
|
||||
|
||||
@code{.java}
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.CvType;
|
||||
@@ -430,20 +434,25 @@ Before start coding, we'd like to eliminate the boring need of interactively loa
|
||||
opencv lib any time we start a new REPL to interact with it.
|
||||
|
||||
First, stop the REPL by evaluating the (exit) expression at the REPL prompt.
|
||||
|
||||
@code{.clojure}
|
||||
user=> (exit)
|
||||
Bye for now!
|
||||
@endcode
|
||||
|
||||
Then open your project.clj file and edit it as follows:
|
||||
|
||||
@code{.clojure}
|
||||
(defproject simple-sample "0.1.0-SNAPSHOT"
|
||||
...
|
||||
injections [(clojure.lang.RT/loadLibrary org.opencv.core.Core/NATIVE_LIBRARY_NAME)])
|
||||
@endcode
|
||||
|
||||
Here we're saying to load the opencv native lib anytime we run the REPL in such a way that we have
|
||||
not anymore to remember to manually do it.
|
||||
|
||||
Rerun the lein repl task
|
||||
|
||||
@code{.bash}
|
||||
lein repl
|
||||
nREPL server started on port 51645 on host 127.0.0.1
|
||||
@@ -458,11 +467,14 @@ Clojure 1.5.1
|
||||
|
||||
user=>
|
||||
@endcode
|
||||
|
||||
Import the interested OpenCV java interfaces.
|
||||
|
||||
@code{.clojure}
|
||||
user=> (import '[org.opencv.core Mat CvType Scalar])
|
||||
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 initialized to 0
|
||||
|
||||
@@ -6,7 +6,7 @@ OpenCV environment variables reference {#tutorial_env_reference}
|
||||
|
||||
@tableofcontents
|
||||
|
||||
### Introduction
|
||||
## Introduction
|
||||
|
||||
OpenCV can change its behavior depending on the runtime environment:
|
||||
- enable extra debugging output or performance tracing
|
||||
@@ -18,7 +18,7 @@ OpenCV can change its behavior depending on the runtime environment:
|
||||
- ⭐ marks most popular variables
|
||||
- variables with names like this `VAR_${NAME}` describes family of variables, where `${NAME}` should be changed to one of predefined values, e.g. `VAR_TBB`, `VAR_OPENMP`, ...
|
||||
|
||||
##### Setting environment variable in Windows
|
||||
### Setting environment variable in Windows
|
||||
In terminal or cmd-file (bat-file):
|
||||
```.bat
|
||||
set MY_ENV_VARIABLE=true
|
||||
@@ -30,7 +30,7 @@ In GUI:
|
||||
- In new window click on the "Environment variables" button
|
||||
- Add an entry to the "User variables" list
|
||||
|
||||
##### Setting environment variable in Linux
|
||||
### Setting environment variable in Linux
|
||||
|
||||
In terminal or shell script:
|
||||
```.sh
|
||||
@@ -42,7 +42,7 @@ or as a single command:
|
||||
MY_ENV_VARIABLE=true ./my_app
|
||||
```
|
||||
|
||||
##### Setting environment variable in Python
|
||||
### Setting environment variable in Python
|
||||
|
||||
```.py
|
||||
import os
|
||||
@@ -51,7 +51,7 @@ import cv2 # variables set after this may not have effect
|
||||
```
|
||||
|
||||
|
||||
### Types
|
||||
## Types
|
||||
|
||||
- _non-null_ - set to anything to enable feature, in some cases can be interpreted as other types (e.g. path)
|
||||
- _bool_ - `1`, `True`, `true`, `TRUE` / `0`, `False`, `false`, `FALSE`
|
||||
@@ -61,7 +61,7 @@ import cv2 # variables set after this may not have effect
|
||||
- _paths_ - `;`-separated on Windows, `:`-separated on others
|
||||
|
||||
|
||||
### General, core
|
||||
## General, core
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
| OPENCV_SKIP_CPU_BASELINE_CHECK | non-null | | do not check that current CPU supports all features used by the build (baseline) |
|
||||
@@ -84,14 +84,14 @@ Links:
|
||||
- https://github.com/opencv/opencv/wiki/CPU-optimizations-build-options
|
||||
|
||||
|
||||
### Logging
|
||||
## Logging
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
| ⭐ OPENCV_LOG_LEVEL | string | | logging level (see accepted values below) |
|
||||
| OPENCV_LOG_TIMESTAMP | bool | true | logging with timestamps |
|
||||
| OPENCV_LOG_TIMESTAMP_NS | bool | false | add nsec to logging timestamps |
|
||||
|
||||
##### Levels:
|
||||
### Levels
|
||||
- `0`, `O`, `OFF`, `S`, `SILENT`, `DISABLE`, `DISABLED`
|
||||
- `F`, `FATAL`
|
||||
- `E`, `ERROR`
|
||||
@@ -101,7 +101,7 @@ Links:
|
||||
- `V`, `VERBOSE`
|
||||
|
||||
|
||||
### core/parallel_for
|
||||
## core/parallel_for
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
| ⭐ OPENCV_FOR_THREADS_NUM | num | 0 | set number of threads |
|
||||
@@ -112,7 +112,7 @@ Links:
|
||||
| OPENCV_FOR_OPENMP_DYNAMIC_DISABLE | bool | false | use single OpenMP thread |
|
||||
|
||||
|
||||
### backends
|
||||
## backends
|
||||
OPENCV_LEGACY_WAITKEY
|
||||
Some modules have multiple available backends, following variables allow choosing specific backend or changing default priorities in which backends will be probed (e.g. when opening a video file).
|
||||
|
||||
@@ -128,7 +128,7 @@ Some modules have multiple available backends, following variables allow choosin
|
||||
| OPENCV_VIDEOIO_PRIORITY_LIST | string, `,`-separated | | list of videoio backends in priority order |
|
||||
|
||||
|
||||
### plugins
|
||||
## plugins
|
||||
Some external dependencies can be detached into a dynamic library, which will be loaded at runtime (plugin). Following variables allow changing default search locations and naming pattern for these plugins.
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
@@ -141,7 +141,7 @@ Some external dependencies can be detached into a dynamic library, which will be
|
||||
| OPENCV_VIDEOIO_PLUGIN_PATH | paths | | directories to search for _videoio_ plugins |
|
||||
| OPENCV_VIDEOIO_PLUGIN_${NAME} | string, glob | | _videoio_ plugin library name (glob) |
|
||||
|
||||
### OpenCL
|
||||
## OpenCL
|
||||
|
||||
**Note:** OpenCL device specification format is `<Platform>:<CPU|GPU|ACCELERATOR|nothing=GPU/CPU>:<deviceName>`, e.g. `AMD:GPU:`
|
||||
|
||||
@@ -170,7 +170,7 @@ Some external dependencies can be detached into a dynamic library, which will be
|
||||
| OPENCV_OPENCL_FORCE | bool | false | force running OpenCL kernel even if usual conditions are not met (e.g. dst.isUMat) |
|
||||
| OPENCV_OPENCL_PERF_CHECK_BYPASS | bool | false | force running OpenCL kernel even if usual performance-related conditions are not met (e.g. image is very small) |
|
||||
|
||||
##### SVM (Shared Virtual Memory) - disabled by default
|
||||
### SVM (Shared Virtual Memory) - disabled by default
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
| OPENCV_OPENCL_SVM_DISABLE | bool | false | disable SVM |
|
||||
@@ -179,11 +179,11 @@ Some external dependencies can be detached into a dynamic library, which will be
|
||||
| OPENCV_OPENCL_SVM_CAPABILITIES_MASK | num | | |
|
||||
| OPENCV_OPENCL_SVM_BUFFERPOOL_LIMIT | num | | same as OPENCV_OPENCL_BUFFERPOOL_LIMIT, but for SVM buffers |
|
||||
|
||||
##### Links:
|
||||
### Links:
|
||||
- https://github.com/opencv/opencv/wiki/OpenCL-optimizations
|
||||
|
||||
|
||||
### Tracing/Profiling
|
||||
## Tracing/Profiling
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
| ⭐ OPENCV_TRACE | bool | false | enable trace |
|
||||
@@ -196,11 +196,11 @@ Some external dependencies can be detached into a dynamic library, which will be
|
||||
| OPENCV_TRACE_ITT_PARENT | bool | false | set parentID for ITT task |
|
||||
| OPENCV_TRACE_ITT_SET_THREAD_NAME | bool | false | set name for OpenCV's threads "OpenCVThread-%03d" |
|
||||
|
||||
##### Links:
|
||||
### Links:
|
||||
- https://github.com/opencv/opencv/wiki/Profiling-OpenCV-Applications
|
||||
|
||||
|
||||
##### Cache
|
||||
## Cache
|
||||
**Note:** Default tmp location is `%TMPDIR%` (Windows); `$XDG_CACHE_HOME`, `$HOME/.cache`, `/var/tmp`, `/tmp` (others)
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
@@ -210,7 +210,7 @@ Some external dependencies can be detached into a dynamic library, which will be
|
||||
| OPENCV_OPENCL_CACHE_DIR | path | default tmp location | cache directory for OpenCL kernels cache (subdirectory `opencl_cache`) |
|
||||
|
||||
|
||||
### dnn
|
||||
## dnn
|
||||
**Note:** In the table below `dump_base_name` equals to `ocv_dnn_net_%05d_%02d` where first argument is internal network ID and the second - dump level.
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
@@ -240,7 +240,7 @@ Some external dependencies can be detached into a dynamic library, which will be
|
||||
| OPENCV_OCL4DNN_TUNING_RAISE_CHECK_ERROR | bool | false | raise exception on errors (auto-tuning) |
|
||||
|
||||
|
||||
### Tests
|
||||
## Tests
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
| ⭐ OPENCV_TEST_DATA_PATH | dir path | | set test data search location (e.g. `/home/user/opencv_extra/testdata`) |
|
||||
@@ -254,11 +254,11 @@ Some external dependencies can be detached into a dynamic library, which will be
|
||||
| OPENCV_PERF_VALIDATION_DIR | dir path | | location of files read/written by `--perf_read_validation_results`/`--perf_write_validation_results` |
|
||||
| ⭐ OPENCV_PYTEST_FILTER | string (glob) | | test filter for Python tests |
|
||||
|
||||
##### Links:
|
||||
### Links:
|
||||
* https://github.com/opencv/opencv/wiki/QA_in_OpenCV
|
||||
|
||||
|
||||
### videoio
|
||||
## videoio
|
||||
**Note:** extra FFmpeg options should be pased in form `key;value|key;value|key;value`, for example `hwaccel;cuvid|video_codec;h264_cuvid|vsync;0` or `vcodec;x264|vprofile;high|vlevel;4.0`
|
||||
|
||||
| name | type | default | description |
|
||||
@@ -288,7 +288,7 @@ Some external dependencies can be detached into a dynamic library, which will be
|
||||
| OPENCV_VIDEOWRITER_DEBUG | bool | false | enable debug messages for VideoWriter |
|
||||
| ⭐ OPENCV_VIDEOIO_DEBUG | bool | false | debug messages for both VideoCapture and VideoWriter |
|
||||
|
||||
##### videoio tests
|
||||
### videoio tests
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
| OPENCV_TEST_VIDEOIO_BACKEND_REQUIRE_FFMPEG | | | test app will exit if no FFmpeg backend is available |
|
||||
@@ -297,14 +297,14 @@ Some external dependencies can be detached into a dynamic library, which will be
|
||||
| OPENCV_TEST_CAMERA_%d_FPS | num | | fps to set for N-th camera (0-based index) (waitAny_V4L test) |
|
||||
|
||||
|
||||
### gapi
|
||||
## gapi
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
| ⭐ GRAPH_DUMP_PATH | file path | | dump graph (dot format) |
|
||||
| PIPELINE_MODELS_PATH | dir path | | pipeline_modeling_tool sample application uses this var |
|
||||
| OPENCV_GAPI_INFERENCE_ENGINE_CORE_LIFETIME_WORKAROUND | bool | true (Windows, Apple), false (others) | similar to OPENCV_DNN_INFERENCE_ENGINE_CORE_LIFETIME_WORKAROUND |
|
||||
|
||||
##### gapi tests/samples
|
||||
### gapi tests/samples
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
| PLAIDML_DEVICE | string | | specific to PlaidML backend test |
|
||||
@@ -312,12 +312,12 @@ Some external dependencies can be detached into a dynamic library, which will be
|
||||
| OPENCV_GAPI_ONNX_MODEL_PATH | dir path | | search location for ONNX models test |
|
||||
| OPENCV_TEST_FREETYPE_FONT_PATH | file path | | location of TrueType font for one of tests |
|
||||
|
||||
##### Links:
|
||||
### Links:
|
||||
* https://github.com/opencv/opencv/wiki/Using-G-API-with-OpenVINO-Toolkit
|
||||
* https://github.com/opencv/opencv/wiki/Using-G-API-with-MS-ONNX-Runtime
|
||||
|
||||
|
||||
### highgui
|
||||
## highgui
|
||||
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
@@ -325,14 +325,14 @@ Some external dependencies can be detached into a dynamic library, which will be
|
||||
| $XDG_RUNTIME_DIR | | | Wayland backend specific - create shared memory-mapped file for interprocess communication (named `opencv-shared-??????`) |
|
||||
|
||||
|
||||
### imgproc
|
||||
## imgproc
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
| OPENCV_OPENCL_IMGPROC_MORPH_SPECIAL_KERNEL | bool | true (Apple), false (others) | use special OpenCL kernel for small morph kernel (Intel devices) |
|
||||
| OPENCV_GAUSSIANBLUR_CHECK_BITEXACT_KERNELS | bool | false | validate Gaussian kernels before running (src is CV_16U, bit-exact version) |
|
||||
|
||||
|
||||
### imgcodecs
|
||||
## imgcodecs
|
||||
| name | type | default | description |
|
||||
|------|------|---------|-------------|
|
||||
| OPENCV_IMGCODECS_AVIF_MAX_FILE_SIZE | num | 64MB | limit input AVIF size |
|
||||
|
||||
@@ -22,8 +22,7 @@ best to help you out.
|
||||
with the latest Microsoft Visual Studio IDE and do not take advantage of the most advanced
|
||||
technologies we integrate into our library. .. _Windows_Install_Prebuild:
|
||||
|
||||
Installation by Using the Pre-built Libraries {#tutorial_windows_install_prebuilt}
|
||||
=============================================
|
||||
## Installation by Using the Pre-built Libraries {#tutorial_windows_install_prebuilt}
|
||||
|
||||
-# Launch a web browser of choice and go to our [page on
|
||||
Sourceforge](http://sourceforge.net/projects/opencvlibrary/files/).
|
||||
@@ -35,8 +34,7 @@ Installation by Using the Pre-built Libraries {#tutorial_windows_install_prebuil
|
||||
|
||||
-# To finalize the installation go to the @ref tutorial_windows_install_path section.
|
||||
|
||||
Installation by Using git-bash (version>=2.14.1) and cmake (version >=3.9.1){#tutorial_windows_gitbash_build}
|
||||
===============================================================
|
||||
## Installation by Using git-bash (version>=2.14.1) and cmake (version >=3.9.1){#tutorial_windows_gitbash_build}
|
||||
|
||||
-# You must download [cmake (version >=3.9.1)](https://cmake.org) and install it. You must add cmake to PATH variable during installation
|
||||
|
||||
@@ -108,8 +106,7 @@ CMAKE_OPTIONS=(-DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:B
|
||||
-# Next time you run this script, opencv and opencv_contrib will be updated and rebuild
|
||||
|
||||
|
||||
Installation by Making Your Own Libraries from the Source Files {#tutorial_windows_install_build}
|
||||
===============================================================
|
||||
## Installation by Making Your Own Libraries from the Source Files {#tutorial_windows_install_build}
|
||||
|
||||
You may find the content of this tutorial also inside the following videos:
|
||||
[Part 1](https://www.youtube.com/watch?v=NnovZ1cTlMs) and [Part 2](https://www.youtube.com/watch?v=qGNWMcfWwPU), hosted on YouTube.
|
||||
@@ -364,8 +361,7 @@ libraries). If you do not need the support for some of these, you can just freel
|
||||
caused mostly by old video card drivers. For testing the GPU (if built) run the
|
||||
*performance_gpu.exe* sample application.
|
||||
|
||||
Set the OpenCV environment variable and add it to the systems path {#tutorial_windows_install_path}
|
||||
=================================================================
|
||||
## Set the OpenCV environment variable and add it to the systems path {#tutorial_windows_install_path}
|
||||
|
||||
First, we set an environment variable to make our work easier. This will hold the build directory of
|
||||
our OpenCV library that we use in our projects. Start up a command window and enter:
|
||||
|
||||
Reference in New Issue
Block a user