Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
bffe254a
Commit
bffe254a
authored
Nov 07, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10003 from sturkmen72:documentation_updates
parents
981009ac
63fb79b5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
100 deletions
+42
-100
core_c.h
modules/core/include/opencv2/core/core_c.h
+2
-2
saturate.hpp
modules/core/include/opencv2/core/saturate.hpp
+2
-2
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+5
-5
falsecolor.cpp
samples/cpp/falsecolor.cpp
+24
-69
mask_tmpl.cpp
samples/cpp/mask_tmpl.cpp
+9
-22
No files found.
modules/core/include/opencv2/core/core_c.h
View file @
bffe254a
...
...
@@ -359,7 +359,7 @@ CVAPI(CvMat*) cvGetSubRect( const CvArr* arr, CvMat* submat, CvRect rect );
/** @brief Returns array row or row span.
The function
s return
the header, corresponding to a specified row/row span of the input array.
The function
returns
the header, corresponding to a specified row/row span of the input array.
cvGetRow(arr, submat, row) is a shortcut for cvGetRows(arr, submat, row, row+1).
@param arr Input array
@param submat Pointer to the resulting sub-array header
...
...
@@ -385,7 +385,7 @@ CV_INLINE CvMat* cvGetRow( const CvArr* arr, CvMat* submat, int row )
/** @brief Returns one of more array columns.
The function
s return
the header, corresponding to a specified column span of the input array. That
The function
returns
the header, corresponding to a specified column span of the input array. That
is, no data is copied. Therefore, any modifications of the submatrix will affect the original array.
If you need to copy the columns, use cvCloneMat. cvGetCol(arr, submat, col) is a shortcut for
...
...
modules/core/include/opencv2/core/saturate.hpp
View file @
bffe254a
...
...
@@ -58,8 +58,8 @@ namespace cv
/** @brief Template function for accurate conversion from one primitive type to another.
The function
s saturate_cast resemble
the standard C++ cast operations, such as static_cast\<T\>()
and others.
They
perform an efficient and accurate conversion from one primitive type to another
The function
saturate_cast resembles
the standard C++ cast operations, such as static_cast\<T\>()
and others.
It
perform an efficient and accurate conversion from one primitive type to another
(see the introduction chapter). saturate in the name means that when the input value v is out of the
range of the target type, the result is not formed just by taking low bits of the input, but instead
the value is clipped. For example:
...
...
modules/imgproc/include/opencv2/imgproc.hpp
View file @
bffe254a
...
...
@@ -2623,7 +2623,7 @@ CV_EXPORTS_AS(integral3) void integral( InputArray src, OutputArray sum,
//! @addtogroup imgproc_motion
//! @{
/** @brief Adds an image to the accumulator.
/** @brief Adds an image to the accumulator
image
.
The function adds src or some of its elements to dst :
...
...
@@ -2631,7 +2631,7 @@ The function adds src or some of its elements to dst :
The function supports multi-channel images. Each channel is processed independently.
The function
s accumulate\*
can be used, for example, to collect statistics of a scene background
The function
cv::accumulate
can be used, for example, to collect statistics of a scene background
viewed by a still camera and for the further foreground-background segmentation.
@param src Input image of type CV_8UC(n), CV_16UC(n), CV_32FC(n) or CV_64FC(n), where n is a positive integer.
...
...
@@ -2643,7 +2643,7 @@ viewed by a still camera and for the further foreground-background segmentation.
CV_EXPORTS_W
void
accumulate
(
InputArray
src
,
InputOutputArray
dst
,
InputArray
mask
=
noArray
()
);
/** @brief Adds the square of a source image to the accumulator.
/** @brief Adds the square of a source image to the accumulator
image
.
The function adds the input image src or its selected region, raised to a power of 2, to the
accumulator dst :
...
...
@@ -2662,7 +2662,7 @@ floating-point.
CV_EXPORTS_W
void
accumulateSquare
(
InputArray
src
,
InputOutputArray
dst
,
InputArray
mask
=
noArray
()
);
/** @brief Adds the per-element product of two input images to the accumulator.
/** @brief Adds the per-element product of two input images to the accumulator
image
.
The function adds the product of two images or their selected regions to the accumulator dst :
...
...
@@ -2672,7 +2672,7 @@ The function supports multi-channel images. Each channel is processed independen
@param src1 First input image, 1- or 3-channel, 8-bit or 32-bit floating point.
@param src2 Second input image of the same type and the same size as src1 .
@param dst %Accumulator with the same number of channels as input images, 32-bit or 64-bit
@param dst %Accumulator
image
with the same number of channels as input images, 32-bit or 64-bit
floating-point.
@param mask Optional operation mask.
...
...
samples/cpp/falsecolor.cpp
View file @
bffe254a
#include <opencv2/opencv.hpp>
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using
namespace
cv
;
using
namespace
std
;
enum
MyShape
{
MyCIRCLE
=
0
,
MyRECTANGLE
,
MyELLIPSE
};
struct
ParamColorMa
r
{
struct
ParamColorMa
p
{
int
iColormap
;
Mat
img
;
};
Ptr
<
Mat
>
lutRND
;
String
winName
=
"False color"
;
static
const
String
ColorMaps
[]
=
{
"Autumn"
,
"Bone"
,
"Jet"
,
"Winter"
,
"Rainbow"
,
"Ocean"
,
"Summer"
,
"Spring"
,
"Cool"
,
"HSV"
,
"Pink"
,
"Hot"
,
"Parula"
,
"User defined (random)"
};
static
void
TrackColorMap
(
int
x
,
void
*
r
)
{
std
::
cout
<<
"selected: "
<<
x
<<
std
::
endl
;
ParamColorMar
*
p
=
(
ParamColorMar
*
)
r
;
ParamColorMap
*
p
=
(
ParamColorMap
*
)
r
;
Mat
dst
;
p
->
iColormap
=
x
;
if
(
x
==
cv
::
COLORMAP_PARULA
+
1
)
if
(
x
==
COLORMAP_PARULA
+
1
)
{
if
(
!
lutRND
)
{
RNG
ra
;
lutRND
=
makePtr
<
Mat
>
(
256
,
1
,
CV_8UC3
);
ra
.
fill
(
*
lutRND
,
RNG
::
UNIFORM
,
0
,
256
);
}
applyColorMap
(
p
->
img
,
dst
,
*
lutRND
.
get
());
Mat
lutRND
(
256
,
1
,
CV_8UC3
);
randu
(
lutRND
,
Scalar
(
0
,
0
,
0
),
Scalar
(
255
,
255
,
255
));
applyColorMap
(
p
->
img
,
dst
,
lutRND
);
}
else
applyColorMap
(
p
->
img
,
dst
,
p
->
iColormap
);
String
colorMapName
;
switch
(
p
->
iColormap
)
{
case
COLORMAP_AUTUMN
:
colorMapName
=
"Colormap : Autumn"
;
break
;
case
COLORMAP_BONE
:
colorMapName
=
"Colormap : Bone"
;
break
;
case
COLORMAP_JET
:
colorMapName
=
"Colormap : Jet"
;
break
;
case
COLORMAP_WINTER
:
colorMapName
=
"Colormap : Winter"
;
break
;
case
COLORMAP_RAINBOW
:
colorMapName
=
"Colormap : Rainbow"
;
break
;
case
COLORMAP_OCEAN
:
colorMapName
=
"Colormap : Ocean"
;
break
;
case
COLORMAP_SUMMER
:
colorMapName
=
"Colormap : Summer"
;
break
;
case
COLORMAP_SPRING
:
colorMapName
=
"Colormap : Spring"
;
break
;
case
COLORMAP_COOL
:
colorMapName
=
"Colormap : Cool"
;
break
;
case
COLORMAP_HSV
:
colorMapName
=
"Colormap : HSV"
;
break
;
case
COLORMAP_PINK
:
colorMapName
=
"Colormap : Pink"
;
break
;
case
COLORMAP_HOT
:
colorMapName
=
"Colormap : Hot"
;
break
;
case
COLORMAP_PARULA
:
colorMapName
=
"Colormap : Parula"
;
break
;
default:
colorMapName
=
"User colormap : random"
;
break
;
}
std
::
cout
<<
"> "
<<
colorMapName
<<
std
::
endl
;
putText
(
dst
,
colorMapName
,
Point
(
10
,
20
),
cv
::
FONT_HERSHEY_SIMPLEX
,
1
,
Scalar
(
255
,
255
,
255
));
putText
(
dst
,
"Colormap : "
+
ColorMaps
[
p
->
iColormap
],
Point
(
10
,
20
),
FONT_HERSHEY_SIMPLEX
,
0.8
,
Scalar
(
255
,
255
,
255
),
2
);
imshow
(
winName
,
dst
);
}
...
...
@@ -128,27 +81,29 @@ static Mat DrawMyImage(int thickness,int nbShape)
int
main
(
int
argc
,
char
**
argv
)
{
ParamColorMar
p
;
cout
<<
"This program demonstrates the use of applyColorMap function.
\n\n
"
;
ParamColorMap
p
;
Mat
img
;
if
(
argc
>
1
)
img
=
imread
(
argv
[
1
],
0
);
img
=
imread
(
argv
[
1
],
IMREAD_GRAYSCALE
);
else
img
=
DrawMyImage
(
2
,
256
);
p
.
img
=
img
;
p
.
iColormap
=
0
;
imshow
(
"Gray image"
,
img
);
namedWindow
(
winName
);
createTrackbar
(
"colormap"
,
winName
,
&
p
.
iColormap
,
1
,
TrackColorMap
,(
void
*
)
&
p
);
setTrackbarMin
(
"colormap"
,
winName
,
cv
::
COLORMAP_AUTUMN
);
setTrackbarMax
(
"colormap"
,
winName
,
cv
::
COLORMAP_PARULA
+
1
);
setTrackbarMin
(
"colormap"
,
winName
,
COLORMAP_AUTUMN
);
setTrackbarMax
(
"colormap"
,
winName
,
COLORMAP_PARULA
+
1
);
setTrackbarPos
(
"colormap"
,
winName
,
-
1
);
TrackColorMap
((
int
)
getTrackbarPos
(
"colormap"
,
winName
),(
void
*
)
&
p
);
while
(
waitKey
(
0
)
!=
27
)
{
std
::
cout
<<
"Press 'ESC' to exit"
<<
std
::
endl
;
}
TrackColorMap
(
0
,
(
void
*
)
&
p
);
cout
<<
"Press a key to exit"
<<
endl
;
waitKey
(
0
);
return
0
;
}
samples/cpp/mask_tmpl.cpp
View file @
bffe254a
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <cctype>
#include <iostream>
#include <iterator>
#include <stdio.h>
using
namespace
std
;
using
namespace
cv
;
static
void
help
()
{
cout
<<
"
\n
This program demonstrates template match with mask.
\n
"
"Usage:
\n
"
"./mask_tmpl -i=<image_name> -t=<template_name> -m=<mask_name>, Default is ../data/lena_tmpl.jpg
\n
"
<<
endl
;
}
int
main
(
int
argc
,
const
char
**
argv
)
{
help
();
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{ i | ../data/lena_tmpl.jpg | }"
"{ t | ../data/tmpl.png | }"
"{ m | ../data/mask.png | }"
);
CommandLineParser
parser
(
argc
,
argv
,
"{ i | ../data/lena_tmpl.jpg |image name }"
"{ t | ../data/tmpl.png |template name }"
"{ m | ../data/mask.png |mask name }"
"{ cm| 3 |comparison method }"
);
cout
<<
"This program demonstrates the use of template matching with mask.
\n\n
"
;
parser
.
printMessage
();
string
filename
=
parser
.
get
<
string
>
(
"i"
);
string
tmplname
=
parser
.
get
<
string
>
(
"t"
);
...
...
@@ -35,27 +26,23 @@ int main( int argc, const char** argv )
if
(
img
.
empty
())
{
help
();
cout
<<
"can not open "
<<
filename
<<
endl
;
return
-
1
;
}
if
(
tmpl
.
empty
())
{
help
();
cout
<<
"can not open "
<<
tmplname
<<
endl
;
return
-
1
;
}
if
(
mask
.
empty
())
{
help
();
cout
<<
"can not open "
<<
maskname
<<
endl
;
return
-
1
;
}
//int method = CV_TM_SQDIFF;
int
method
=
CV_TM_CCORR_NORMED
;
int
method
=
parser
.
get
<
int
>
(
"cm"
);
// default 3 (CV_TM_CCORR_NORMED)
matchTemplate
(
img
,
tmpl
,
res
,
method
,
mask
);
double
minVal
,
maxVal
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment