提交 bffe254a 编写于 作者: A Alexander Alekhin

Merge pull request #10003 from sturkmen72:documentation_updates

......@@ -359,7 +359,7 @@ CVAPI(CvMat*) cvGetSubRect( const CvArr* arr, CvMat* submat, CvRect rect );
/** @brief Returns array row or row span.
The functions 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 functions 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
......
......@@ -58,8 +58,8 @@ namespace cv
/** @brief Template function for accurate conversion from one primitive type to another.
The functions 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:
......
......@@ -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 functions 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.
......
#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 ParamColorMar {
struct ParamColorMap {
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;
}
#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 << "\nThis 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.
先完成此消息的编辑!
想要评论请 注册