Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
bffe254a
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bffe254a
编写于
11月 07, 2017
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10003 from sturkmen72:documentation_updates
上级
981009ac
63fb79b5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
43 addition
and
101 deletion
+43
-101
modules/core/include/opencv2/core/core_c.h
modules/core/include/opencv2/core/core_c.h
+2
-2
modules/core/include/opencv2/core/saturate.hpp
modules/core/include/opencv2/core/saturate.hpp
+2
-2
modules/imgproc/include/opencv2/imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+5
-5
samples/cpp/falsecolor.cpp
samples/cpp/falsecolor.cpp
+25
-70
samples/cpp/mask_tmpl.cpp
samples/cpp/mask_tmpl.cpp
+9
-22
未找到文件。
modules/core/include/opencv2/core/core_c.h
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录