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
89480801
Commit
89480801
authored
Jul 26, 2017
by
Suleyman TURKMEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some improvements on tutorials
parent
8e6e05ed
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
260 additions
and
187 deletions
+260
-187
core.hpp
modules/core/include/opencv2/core.hpp
+6
-0
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+15
-0
objdetect.hpp
modules/objdetect/include/opencv2/objdetect.hpp
+4
-0
photo.hpp
modules/photo/include/opencv2/photo.hpp
+6
-0
shape_distance.hpp
modules/shape/include/opencv2/shape/shape_distance.hpp
+3
-0
tracking.hpp
modules/video/include/opencv2/video/tracking.hpp
+16
-14
videoio.hpp
modules/videoio/include/opencv2/videoio.hpp
+3
-3
create_mask.cpp
samples/cpp/create_mask.cpp
+15
-12
drawing.cpp
samples/cpp/drawing.cpp
+17
-15
edge.cpp
samples/cpp/edge.cpp
+2
-6
falsecolor.cpp
samples/cpp/falsecolor.cpp
+6
-2
grabcut.cpp
samples/cpp/grabcut.cpp
+3
-8
image_alignment.cpp
samples/cpp/image_alignment.cpp
+13
-20
image_sequence.cpp
samples/cpp/image_sequence.cpp
+2
-7
inpaint.cpp
samples/cpp/inpaint.cpp
+3
-6
laplace.cpp
samples/cpp/laplace.cpp
+3
-6
letter_recog.cpp
samples/cpp/letter_recog.cpp
+5
-9
lkdemo.cpp
samples/cpp/lkdemo.cpp
+4
-9
mask_tmpl.cpp
samples/cpp/mask_tmpl.cpp
+2
-6
npr_demo.cpp
samples/cpp/npr_demo.cpp
+1
-1
polar_transforms.cpp
samples/cpp/polar_transforms.cpp
+3
-4
shape_example.cpp
samples/cpp/shape_example.cpp
+1
-0
BasicLinearTransformsTrackbar.cpp
...p/tutorial_code/HighGUI/BasicLinearTransformsTrackbar.cpp
+9
-4
BasicLinearTransforms.cpp
samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp
+7
-2
Morphology_2.cpp
samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp
+7
-2
Threshold.cpp
samples/cpp/tutorial_code/ImgProc/Threshold.cpp
+7
-2
changing_contrast_brightness_image.cpp
...t_brightness_image/changing_contrast_brightness_image.cpp
+9
-2
HoughCircle_Demo.cpp
samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp
+6
-8
HoughLines_Demo.cpp
samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
+8
-3
Laplace_Demo.cpp
samples/cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp
+7
-2
Remap_Demo.cpp
samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp
+4
-2
Sobel_Demo.cpp
samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp
+7
-2
copyMakeBorder_demo.cpp
samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp
+7
-2
filter2D_demo.cpp
samples/cpp/tutorial_code/ImgTrans/filter2D_demo.cpp
+7
-2
imageSegmentation.cpp
samples/cpp/tutorial_code/ImgTrans/imageSegmentation.cpp
+2
-2
findContours_demo.cpp
.../cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp
+8
-2
SBM_Sample.cpp
samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp
+4
-5
AKAZE_match.cpp
samples/cpp/tutorial_code/features2D/AKAZE_match.cpp
+4
-1
planar_tracking.cpp
...torial_code/features2D/AKAZE_tracking/planar_tracking.cpp
+12
-12
introduction_to_pca.cpp
...orial_code/ml/introduction_to_pca/introduction_to_pca.cpp
+7
-3
LATCH_match.cpp
samples/cpp/tutorial_code/xfeatures2D/LATCH_match.cpp
+5
-1
No files found.
modules/core/include/opencv2/core.hpp
View file @
89480801
...
...
@@ -273,6 +273,9 @@ of p and len.
*/
CV_EXPORTS_W
int
borderInterpolate
(
int
p
,
int
len
,
int
borderType
);
/** @example copyMakeBorder_demo.cpp
An example using copyMakeBorder function
*/
/** @brief Forms a border around an image.
The function copies the source image into the middle of the destination image. The areas to the
...
...
@@ -471,6 +474,9 @@ The function can also be emulated with a matrix expression, for example:
*/
CV_EXPORTS_W
void
scaleAdd
(
InputArray
src1
,
double
alpha
,
InputArray
src2
,
OutputArray
dst
);
/** @example AddingImagesTrackbar.cpp
*/
/** @brief Calculates the weighted sum of two arrays.
The function addWeighted calculates the weighted sum of two arrays as follows:
...
...
modules/imgproc/include/opencv2/imgproc.hpp
View file @
89480801
...
...
@@ -2795,6 +2795,9 @@ CV_EXPORTS_W void adaptiveThreshold( InputArray src, OutputArray dst,
//! @addtogroup imgproc_filter
//! @{
/** @example Pyramids.cpp
An example using pyrDown and pyrUp functions
*/
/** @brief Blurs an image and downsamples it.
By default, size of the output image is computed as `Size((src.cols+1)/2, (src.rows+1)/2)`, but in
...
...
@@ -3669,6 +3672,9 @@ enum TemplateMatchModes {
TM_CCOEFF_NORMED
=
5
//!< \f[R(x,y)= \frac{ \sum_{x',y'} (T'(x',y') \cdot I'(x+x',y+y')) }{ \sqrt{\sum_{x',y'}T'(x',y')^2 \cdot \sum_{x',y'} I'(x+x',y+y')^2} }\f]
};
/** @example MatchTemplate_Demo.cpp
An example using Template Matching algorithm
*/
/** @brief Compares a template against overlapped image regions.
The function slides through image , compares the overlapped patches of size \f$w \times h\f$ against
...
...
@@ -4134,6 +4140,9 @@ enum ColormapTypes
COLORMAP_PARULA
=
12
//!< 
};
/** @example falsecolor.cpp
An example using applyColorMap function
*/
/** @brief Applies a GNU Octave/MATLAB equivalent colormap on a given image.
@param src The source image, grayscale or colored of type CV_8UC1 or CV_8UC3.
...
...
@@ -4216,6 +4225,9 @@ CV_EXPORTS void rectangle(CV_IN_OUT Mat& img, Rect rec,
const
Scalar
&
color
,
int
thickness
=
1
,
int
lineType
=
LINE_8
,
int
shift
=
0
);
/** @example Drawing_2.cpp
An example using drawing functions
*/
/** @brief Draws a circle.
The function circle draws a simple or filled circle with a given center and radius.
...
...
@@ -4339,6 +4351,9 @@ CV_EXPORTS void fillPoly(Mat& img, const Point** pts,
const
Scalar
&
color
,
int
lineType
=
LINE_8
,
int
shift
=
0
,
Point
offset
=
Point
()
);
/** @example Drawing_1.cpp
An example using drawing functions
*/
/** @brief Fills the area bounded by one or more polygons.
The function fillPoly fills an area bounded by several polygonal contours. The function can fill
...
...
modules/objdetect/include/opencv2/objdetect.hpp
View file @
89480801
...
...
@@ -215,6 +215,8 @@ public:
virtual
Ptr
<
MaskGenerator
>
getMaskGenerator
()
=
0
;
};
/** @example facedetect.cpp
*/
/** @brief Cascade classifier class for object detection.
*/
class
CV_EXPORTS_W
CascadeClassifier
...
...
@@ -348,6 +350,8 @@ struct DetectionROI
std
::
vector
<
double
>
confidences
;
};
/**@example peopledetect.cpp
*/
struct
CV_EXPORTS_W
HOGDescriptor
{
public
:
...
...
modules/photo/include/opencv2/photo.hpp
View file @
89480801
...
...
@@ -730,6 +730,9 @@ CV_EXPORTS_W void decolor( InputArray src, OutputArray grayscale, OutputArray co
//! @addtogroup photo_clone
//! @{
/** @example cloning_demo.cpp
An example using seamlessClone function
*/
/** @brief Image editing tasks concern either global changes (color/intensity corrections, filters,
deformations) or local changes concerned to a selection. Here we are interested in achieving local
changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless
...
...
@@ -833,6 +836,9 @@ CV_EXPORTS_W void edgePreservingFilter(InputArray src, OutputArray dst, int flag
CV_EXPORTS_W
void
detailEnhance
(
InputArray
src
,
OutputArray
dst
,
float
sigma_s
=
10
,
float
sigma_r
=
0.15
f
);
/** @example npr_demo.cpp
An example using non-photorealistic line drawing functions
*/
/** @brief Pencil-like non-photorealistic line drawing
@param src Input 8-bit 3-channel image.
...
...
modules/shape/include/opencv2/shape/shape_distance.hpp
View file @
89480801
...
...
@@ -53,6 +53,9 @@ namespace cv
//! @addtogroup shape
//! @{
/** @example shape_example.cpp
An example using shape distance algorithm
*/
/** @brief Abstract base class for shape distance algorithms.
*/
class
CV_EXPORTS_W
ShapeDistanceExtractor
:
public
Algorithm
...
...
modules/video/include/opencv2/video/tracking.hpp
View file @
89480801
...
...
@@ -78,7 +78,9 @@ See the OpenCV sample camshiftdemo.c that tracks colored objects.
*/
CV_EXPORTS_W
RotatedRect
CamShift
(
InputArray
probImage
,
CV_IN_OUT
Rect
&
window
,
TermCriteria
criteria
);
/** @example camshiftdemo.cpp
An example using the mean-shift tracking algorithm
*/
/** @brief Finds an object on a back projection image.
@param probImage Back projection of the object histogram. See calcBackProject for details.
...
...
@@ -97,8 +99,6 @@ projection and remove the noise. For example, you can do this by retrieving conn
with findContours , throwing away contours with small area ( contourArea ), and rendering the
remaining contours with drawContours.
@note
- A mean-shift tracking sample can be found at opencv_source_code/samples/cpp/camshiftdemo.cpp
*/
CV_EXPORTS_W
int
meanShift
(
InputArray
probImage
,
CV_IN_OUT
Rect
&
window
,
TermCriteria
criteria
);
...
...
@@ -123,6 +123,9 @@ CV_EXPORTS_W int buildOpticalFlowPyramid( InputArray img, OutputArrayOfArrays py
int
derivBorder
=
BORDER_CONSTANT
,
bool
tryReuseInputImage
=
true
);
/** @example lkdemo.cpp
An example using the Lucas-Kanade optical flow algorithm
*/
/** @brief Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with
pyramids.
...
...
@@ -258,6 +261,10 @@ enum
MOTION_HOMOGRAPHY
=
3
};
/** @example image_alignment.cpp
An example using the image alignment ECC algorithm
*/
/** @brief Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 .
@param templateImage single-channel template image; CV_8U or CV_32F array.
...
...
@@ -313,25 +320,20 @@ CV_EXPORTS_W double findTransformECC( InputArray templateImage, InputArray input
TermCriteria
criteria
=
TermCriteria
(
TermCriteria
::
COUNT
+
TermCriteria
::
EPS
,
50
,
0.001
),
InputArray
inputMask
=
noArray
());
/** @example kalman.cpp
An example using the standard Kalman filter
*/
/** @brief Kalman filter class.
The class implements a standard Kalman filter <http://en.wikipedia.org/wiki/Kalman_filter>,
@cite Welch95 . However, you can modify transitionMatrix, controlMatrix, and measurementMatrix to get
an extended Kalman filter functionality. See the OpenCV sample kalman.cpp.
@note
- An example using the standard Kalman filter can be found at
opencv_source_code/samples/cpp/kalman.cpp
an extended Kalman filter functionality.
@note In C API when CvKalman\* kalmanFilter structure is not needed anymore, it should be released
with cvReleaseKalman(&kalmanFilter)
*/
class
CV_EXPORTS_W
KalmanFilter
{
public
:
/** @brief The constructors.
@note In C API when CvKalman\* kalmanFilter structure is not needed anymore, it should be released
with cvReleaseKalman(&kalmanFilter)
*/
CV_WRAP
KalmanFilter
();
/** @overload
@param dynamParams Dimensionality of the state.
...
...
modules/videoio/include/opencv2/videoio.hpp
View file @
89480801
...
...
@@ -808,12 +808,12 @@ protected:
class
IVideoWriter
;
/** @example videowriter_basic.cpp
An example using VideoCapture and VideoWriter class
*/
/** @brief Video writer class.
The class provides C++ API for writing video files or image sequences.
Here is how the class can be used:
@include samples/cpp/videowriter_basic.cpp
*/
class
CV_EXPORTS_W
VideoWriter
{
...
...
samples/cpp/create_mask.cpp
View file @
89480801
...
...
@@ -33,8 +33,6 @@ int flag1 = 0;
int
minx
,
miny
,
maxx
,
maxy
,
lenx
,
leny
;
int
channel
;
void
mouseHandler
(
int
,
int
,
int
,
int
,
void
*
);
void
mouseHandler
(
int
event
,
int
x
,
int
y
,
int
,
void
*
)
...
...
@@ -121,14 +119,22 @@ void mouseHandler(int event, int x, int y, int, void*)
}
}
static
void
help
()
{
cout
<<
"
\n
This program demonstrates using mouse events"
"
\n
Call:
\n
"
"./create_mask <image_name>
\n
"
"
\n
"
"
\t
left mouse button - set a point to create mask shape"
"
\n
"
"
\t
right mouse button - create mask from points
\n
"
"
\t
middle mouse button - reset
\n
"
<<
endl
;
}
int
main
(
int
argc
,
char
**
argv
)
{
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{help h | | show help message}{@input | | input image}"
);
if
(
parser
.
has
(
"help"
))
{
parser
.
printMessage
();
return
0
;
}
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{@input | ../data/lena.jpg | input image}"
);
help
();
string
input_image
=
parser
.
get
<
string
>
(
"@input"
);
if
(
input_image
.
empty
())
{
...
...
@@ -143,8 +149,6 @@ int main(int argc, char **argv)
img0
=
src
;
channel
=
img0
.
channels
();
res1
=
Mat
::
zeros
(
img0
.
size
(),
CV_8UC1
);
final
=
Mat
::
zeros
(
img0
.
size
(),
CV_8UC3
);
//////////// source image ///////////////////
...
...
@@ -154,6 +158,5 @@ int main(int argc, char **argv)
imshow
(
"Source"
,
img0
);
waitKey
(
0
);
img0
.
release
();
img1
.
release
();
return
0
;
}
samples/cpp/drawing.cpp
View file @
89480801
...
...
@@ -2,6 +2,7 @@
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <stdio.h>
using
namespace
cv
;
static
void
help
()
...
...
@@ -16,14 +17,9 @@ static Scalar randomColor(RNG& rng)
return
Scalar
(
icolor
&
255
,
(
icolor
>>
8
)
&
255
,
(
icolor
>>
16
)
&
255
);
}
int
main
(
int
argc
,
char
**
argv
)
int
main
()
{
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{help h||}"
);
if
(
parser
.
has
(
"help"
))
{
help
();
return
0
;
}
help
();
char
wndname
[]
=
"Drawing Demo"
;
const
int
NUMBER
=
100
;
const
int
DELAY
=
5
;
...
...
@@ -36,7 +32,7 @@ int main(int argc, char** argv)
imshow
(
wndname
,
image
);
waitKey
(
DELAY
);
for
(
i
=
0
;
i
<
NUMBER
;
i
++
)
for
(
i
=
0
;
i
<
NUMBER
*
2
;
i
++
)
{
Point
pt1
,
pt2
;
pt1
.
x
=
rng
.
uniform
(
x1
,
x2
);
...
...
@@ -44,14 +40,19 @@ int main(int argc, char** argv)
pt2
.
x
=
rng
.
uniform
(
x1
,
x2
);
pt2
.
y
=
rng
.
uniform
(
y1
,
y2
);
line
(
image
,
pt1
,
pt2
,
randomColor
(
rng
),
rng
.
uniform
(
1
,
10
),
lineType
);
int
arrowed
=
rng
.
uniform
(
0
,
6
);
if
(
arrowed
<
3
)
line
(
image
,
pt1
,
pt2
,
randomColor
(
rng
),
rng
.
uniform
(
1
,
10
),
lineType
);
else
arrowedLine
(
image
,
pt1
,
pt2
,
randomColor
(
rng
),
rng
.
uniform
(
1
,
10
),
lineType
);
imshow
(
wndname
,
image
);
if
(
waitKey
(
DELAY
)
>=
0
)
return
0
;
}
for
(
i
=
0
;
i
<
NUMBER
;
i
++
)
for
(
i
=
0
;
i
<
NUMBER
*
2
;
i
++
)
{
Point
pt1
,
pt2
;
pt1
.
x
=
rng
.
uniform
(
x1
,
x2
);
...
...
@@ -59,8 +60,13 @@ int main(int argc, char** argv)
pt2
.
x
=
rng
.
uniform
(
x1
,
x2
);
pt2
.
y
=
rng
.
uniform
(
y1
,
y2
);
int
thickness
=
rng
.
uniform
(
-
3
,
10
);
int
marker
=
rng
.
uniform
(
0
,
10
);
int
marker_size
=
rng
.
uniform
(
30
,
80
);
rectangle
(
image
,
pt1
,
pt2
,
randomColor
(
rng
),
MAX
(
thickness
,
-
1
),
lineType
);
if
(
marker
>
5
)
rectangle
(
image
,
pt1
,
pt2
,
randomColor
(
rng
),
MAX
(
thickness
,
-
1
),
lineType
);
else
drawMarker
(
image
,
pt1
,
randomColor
(
rng
),
marker
,
marker_size
);
imshow
(
wndname
,
image
);
if
(
waitKey
(
DELAY
)
>=
0
)
...
...
@@ -181,7 +187,3 @@ int main(int argc, char** argv)
waitKey
();
return
0
;
}
#ifdef _EiC
main
(
1
,
"drawing.c"
);
#endif
samples/cpp/edge.cpp
View file @
89480801
...
...
@@ -53,15 +53,11 @@ const char* keys =
int
main
(
int
argc
,
const
char
**
argv
)
{
help
();
CommandLineParser
parser
(
argc
,
argv
,
keys
);
if
(
parser
.
has
(
"help"
))
{
help
();
return
0
;
}
string
filename
=
parser
.
get
<
string
>
(
0
);
image
=
imread
(
filename
,
1
);
image
=
imread
(
filename
,
IMREAD_COLOR
);
if
(
image
.
empty
())
{
printf
(
"Cannot read image file: %s
\n
"
,
filename
.
c_str
());
...
...
samples/cpp/falsecolor.cpp
View file @
89480801
...
...
@@ -125,11 +125,15 @@ static Mat DrawMyImage(int thickness,int nbShape)
return
img
;
}
int
main
(
void
)
int
main
(
int
argc
,
char
**
argv
)
{
ParamColorMar
p
;
Mat
img
=
DrawMyImage
(
2
,
256
);
Mat
img
;
if
(
argc
>
1
)
img
=
imread
(
argv
[
1
],
0
);
else
img
=
DrawMyImage
(
2
,
256
);
p
.
img
=
img
;
p
.
iColormap
=
0
;
...
...
samples/cpp/grabcut.cpp
View file @
89480801
...
...
@@ -276,12 +276,9 @@ static void on_mouse( int event, int x, int y, int flags, void* param )
int
main
(
int
argc
,
char
**
argv
)
{
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{help h||}{@input||}"
);
if
(
parser
.
has
(
"help"
))
{
help
();
return
0
;
}
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{@input| ../data/messi5.jpg |}"
);
help
();
string
filename
=
parser
.
get
<
string
>
(
"@input"
);
if
(
filename
.
empty
()
)
{
...
...
@@ -295,8 +292,6 @@ int main( int argc, char** argv )
return
1
;
}
help
();
const
string
winName
=
"image"
;
namedWindow
(
winName
,
WINDOW_AUTOSIZE
);
setMouseCallback
(
winName
,
on_mouse
,
0
);
...
...
samples/cpp/image_alignment.cpp
View file @
89480801
...
...
@@ -51,7 +51,7 @@ const std::string keys =
"{e epsilon | 0.0001 | ECC's convergence epsilon }"
"{o outputWarp | outWarp.ecc | output warp (matrix) filename }"
"{m motionType | affine | type of motion (translation, euclidean, affine, homography) }"
"{v verbose |
0
| display initial and final images }"
"{v verbose |
1
| display initial and final images }"
"{w warpedImfile | warpedECC.png | warped input image }"
"{h help | | print help message }"
;
...
...
@@ -165,10 +165,10 @@ static void draw_warped_roi(Mat& image, const int width, const int height, Mat&
GET_HOMO_VALUES
(
U
,
bottom_right
.
x
,
bottom_right
.
y
);
// draw the warped perimeter
line
(
image
,
top_left
,
top_right
,
Scalar
(
255
,
0
,
255
));
line
(
image
,
top_right
,
bottom_right
,
Scalar
(
255
,
0
,
255
));
line
(
image
,
bottom_right
,
bottom_left
,
Scalar
(
255
,
0
,
255
));
line
(
image
,
bottom_left
,
top_left
,
Scalar
(
255
,
0
,
255
));
line
(
image
,
top_left
,
top_right
,
Scalar
(
255
));
line
(
image
,
top_right
,
bottom_right
,
Scalar
(
255
));
line
(
image
,
bottom_right
,
bottom_left
,
Scalar
(
255
));
line
(
image
,
bottom_left
,
top_left
,
Scalar
(
255
));
}
int
main
(
const
int
argc
,
const
char
*
argv
[])
...
...
@@ -177,17 +177,9 @@ int main (const int argc, const char * argv[])
CommandLineParser
parser
(
argc
,
argv
,
keys
);
parser
.
about
(
"ECC demo"
);
if
(
argc
<
2
)
{
parser
.
printMessage
();
help
();
return
1
;
}
if
(
parser
.
has
(
"help"
))
{
parser
.
printMessage
();
help
();
return
1
;
}
parser
.
printMessage
();
help
();
string
imgFile
=
parser
.
get
<
string
>
(
0
);
string
tempImgFile
=
parser
.
get
<
string
>
(
1
);
string
inWarpFile
=
parser
.
get
<
string
>
(
2
);
...
...
@@ -239,10 +231,10 @@ int main (const int argc, const char * argv[])
}
}
else
{
//apply random war
o
to input image
else
{
//apply random war
p
to input image
resize
(
inputImage
,
target_image
,
Size
(
216
,
216
));
Mat
warpGround
;
cv
::
RNG
rng
;
RNG
rng
(
getTickCount
())
;
double
angle
;
switch
(
mode_temp
)
{
case
MOTION_TRANSLATION
:
...
...
@@ -299,7 +291,7 @@ int main (const int argc, const char * argv[])
}
else
{
printf
(
"
\n
->Perfo
mar
nce Warning: Identity warp ideally assumes images of "
printf
(
"
\n
->Perfo
rma
nce Warning: Identity warp ideally assumes images of "
"similar size. If the deformation is strong, the identity warp may not "
"be a good initialization.
\n
"
);
...
...
@@ -363,7 +355,8 @@ int main (const int argc, const char * argv[])
namedWindow
(
"warped image"
,
WINDOW_AUTOSIZE
);
namedWindow
(
"error (black: no error)"
,
WINDOW_AUTOSIZE
);
moveWindow
(
"template"
,
350
,
350
);
moveWindow
(
"image"
,
20
,
300
);
moveWindow
(
"template"
,
300
,
300
);
moveWindow
(
"warped image"
,
600
,
300
);
moveWindow
(
"error (black: no error)"
,
900
,
300
);
...
...
samples/cpp/image_sequence.cpp
View file @
89480801
...
...
@@ -18,17 +18,12 @@ static void help(char** argv)
int
main
(
int
argc
,
char
**
argv
)
{
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{help h||}{@image||}"
);
if
(
parser
.
has
(
"help"
))
{
help
(
argv
);
return
0
;
}
help
(
argv
);
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{@image| ../data/left%02d.jpg |}"
);
string
first_file
=
parser
.
get
<
string
>
(
"@image"
);
if
(
first_file
.
empty
())
{
help
(
argv
);
return
1
;
}
...
...
samples/cpp/inpaint.cpp
View file @
89480801
...
...
@@ -47,12 +47,9 @@ static void onMouse( int event, int x, int y, int flags, void* )
int
main
(
int
argc
,
char
**
argv
)
{
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{help h||}{@image|../data/fruits.jpg|}"
);
if
(
parser
.
has
(
"help"
))
{
help
();
return
0
;
}
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{@image|../data/fruits.jpg|}"
);
help
();
string
filename
=
parser
.
get
<
string
>
(
"@image"
);
Mat
img0
=
imread
(
filename
,
-
1
);
if
(
img0
.
empty
())
...
...
samples/cpp/laplace.cpp
View file @
89480801
...
...
@@ -26,12 +26,9 @@ int smoothType = GAUSSIAN;
int
main
(
int
argc
,
char
**
argv
)
{
VideoCapture
cap
;
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{help h | | }{ c | 0 | }{ p | | }"
);
if
(
parser
.
has
(
"help"
)
)
{
help
();
return
0
;
}
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{ c | 0 | }{ p | | }"
);
help
();
if
(
parser
.
get
<
string
>
(
"c"
).
size
()
==
1
&&
isdigit
(
parser
.
get
<
string
>
(
"c"
)[
0
])
)
cap
.
open
(
parser
.
get
<
int
>
(
"c"
));
else
...
...
samples/cpp/letter_recog.cpp
View file @
89480801
...
...
@@ -521,7 +521,7 @@ int main( int argc, char *argv[] )
int
method
=
0
;
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{data|../data/letter-recognition.data|}{save||}{load||}{boost||}"
"{mlp||}{knn knearest||}{nbayes||}{svm||}
{help h||}
"
);
"{mlp||}{knn knearest||}{nbayes||}{svm||}"
);
data_filename
=
parser
.
get
<
string
>
(
"data"
);
if
(
parser
.
has
(
"save"
))
filename_to_save
=
parser
.
get
<
string
>
(
"save"
);
...
...
@@ -537,11 +537,9 @@ int main( int argc, char *argv[] )
method
=
4
;
else
if
(
parser
.
has
(
"svm"
))
method
=
5
;
if
(
parser
.
has
(
"help"
))
{
help
();
return
0
;
}
help
();
if
(
(
method
==
0
?
build_rtrees_classifier
(
data_filename
,
filename_to_save
,
filename_to_load
)
:
method
==
1
?
...
...
@@ -555,8 +553,6 @@ int main( int argc, char *argv[] )
method
==
5
?
build_svm_classifier
(
data_filename
,
filename_to_save
,
filename_to_load
)
:
-
1
)
<
0
)
{
help
();
}
return
0
;
}
samples/cpp/lkdemo.cpp
View file @
89480801
...
...
@@ -45,16 +45,11 @@ int main( int argc, char** argv )
bool
needToInit
=
false
;
bool
nightMode
=
false
;
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{@input||}{help h||}"
);
help
();
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{@input|0|}"
);
string
input
=
parser
.
get
<
string
>
(
"@input"
);
if
(
parser
.
has
(
"help"
))
{
help
();
return
0
;
}
if
(
input
.
empty
()
)
cap
.
open
(
0
);
else
if
(
input
.
size
()
==
1
&&
isdigit
(
input
[
0
])
)
if
(
input
.
size
()
==
1
&&
isdigit
(
input
[
0
])
)
cap
.
open
(
input
[
0
]
-
'0'
);
else
cap
.
open
(
input
);
...
...
samples/cpp/mask_tmpl.cpp
View file @
89480801
...
...
@@ -19,16 +19,12 @@ static void help()
int
main
(
int
argc
,
const
char
**
argv
)
{
help
();
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{help h||}"
"{ i | ../data/lena_tmpl.jpg | }"
"{ t | ../data/tmpl.png | }"
"{ m | ../data/mask.png | }"
);
if
(
parser
.
has
(
"help"
))
{
help
();
return
0
;
}
string
filename
=
parser
.
get
<
string
>
(
"i"
);
string
tmplname
=
parser
.
get
<
string
>
(
"t"
);
string
maskname
=
parser
.
get
<
string
>
(
"m"
);
...
...
samples/cpp/npr_demo.cpp
View file @
89480801
...
...
@@ -28,7 +28,7 @@ using namespace cv;
int
main
(
int
argc
,
char
*
argv
[])
{
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{help h||show help message}{@image||input image}"
);
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{help h||show help message}{@image|
../data/lena.jpg
|input image}"
);
if
(
parser
.
has
(
"help"
))
{
parser
.
printMessage
();
...
...
samples/cpp/polar_transforms.cpp
View file @
89480801
...
...
@@ -53,14 +53,13 @@ int main( int argc, char** argv )
break
;
Point2f
center
(
(
float
)
frame
.
cols
/
2
,
(
float
)
frame
.
rows
/
2
);
double
radius
=
(
double
)
frame
.
cols
/
4
;
double
M
=
(
double
)
frame
.
cols
/
log
(
radius
);
double
M
=
70
;
logPolar
(
frame
,
log_polar_img
,
center
,
M
,
INTER_LINEAR
+
WARP_FILL_OUTLIERS
);
linearPolar
(
frame
,
lin_polar_img
,
center
,
radius
,
INTER_LINEAR
+
WARP_FILL_OUTLIERS
);
linearPolar
(
frame
,
lin_polar_img
,
center
,
M
,
INTER_LINEAR
+
WARP_FILL_OUTLIERS
);
logPolar
(
log_polar_img
,
recovered_log_polar
,
center
,
M
,
WARP_INVERSE_MAP
+
INTER_LINEAR
);
linearPolar
(
lin_polar_img
,
recovered_lin_polar_img
,
center
,
radius
,
WARP_INVERSE_MAP
+
INTER_LINEAR
+
WARP_FILL_OUTLIERS
);
linearPolar
(
lin_polar_img
,
recovered_lin_polar_img
,
center
,
M
,
WARP_INVERSE_MAP
+
INTER_LINEAR
+
WARP_FILL_OUTLIERS
);
imshow
(
"Log-Polar"
,
log_polar_img
);
imshow
(
"Linear-Polar"
,
lin_polar_img
);
...
...
samples/cpp/shape_example.cpp
View file @
89480801
...
...
@@ -115,6 +115,7 @@ int main(int argc, char** argv)
resize
(
iiIm
,
bestToShow
,
sz2Sh
);
imshow
(
"BEST MATCH"
,
bestToShow
);
moveWindow
(
"BEST MATCH"
,
sz2Sh
.
width
+
50
,
0
);
waitKey
();
return
0
;
}
samples/cpp/tutorial_code/HighGUI/BasicLinearTransformsTrackbar.cpp
View file @
89480801
...
...
@@ -40,10 +40,15 @@ static void on_trackbar( int, void* )
* @function main
* @brief Main function
*/
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
/// Read image given by user
image
=
imread
(
argv
[
1
]
);
String
imageName
(
"../data/lena.jpg"
);
// by default
if
(
argc
>
1
)
{
imageName
=
argv
[
1
];
}
image
=
imread
(
imageName
);
/// Initialize values
alpha
=
1
;
...
...
@@ -54,8 +59,8 @@ int main( int, char** argv )
namedWindow
(
"New Image"
,
1
);
/// Create Trackbars
createTrackbar
(
"Contrast
Trackbar
"
,
"New Image"
,
&
alpha
,
alpha_max
,
on_trackbar
);
createTrackbar
(
"Brightness
Trackbar
"
,
"New Image"
,
&
beta
,
beta_max
,
on_trackbar
);
createTrackbar
(
"Contrast"
,
"New Image"
,
&
alpha
,
alpha_max
,
on_trackbar
);
createTrackbar
(
"Brightness"
,
"New Image"
,
&
beta
,
beta_max
,
on_trackbar
);
/// Show some stuff
imshow
(
"Original Image"
,
image
);
...
...
samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp
View file @
89480801
...
...
@@ -15,7 +15,7 @@ using namespace cv;
* @function main
* @brief Main function
*/
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
//! [basic-linear-transform-parameters]
double
alpha
=
1.0
;
/*< Simple contrast control */
...
...
@@ -24,7 +24,12 @@ int main( int, char** argv )
/// Read image given by user
//! [basic-linear-transform-load]
Mat
image
=
imread
(
argv
[
1
]
);
String
imageName
(
"../data/lena.jpg"
);
// by default
if
(
argc
>
1
)
{
imageName
=
argv
[
1
];
}
Mat
image
=
imread
(
imageName
);
//! [basic-linear-transform-load]
//! [basic-linear-transform-output]
Mat
new_image
=
Mat
::
zeros
(
image
.
size
(),
image
.
type
()
);
...
...
samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp
View file @
89480801
...
...
@@ -29,10 +29,15 @@ void Morphology_Operations( int, void* );
/**
* @function main
*/
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
//![load]
src
=
imread
(
argv
[
1
],
IMREAD_COLOR
);
// Load an image
String
imageName
(
"../data/baboon.jpg"
);
// by default
if
(
argc
>
1
)
{
imageName
=
argv
[
1
];
}
src
=
imread
(
imageName
,
IMREAD_COLOR
);
// Load an image
if
(
src
.
empty
()
)
{
return
-
1
;
}
...
...
samples/cpp/tutorial_code/ImgProc/Threshold.cpp
View file @
89480801
...
...
@@ -30,10 +30,15 @@ void Threshold_Demo( int, void* );
/**
* @function main
*/
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
//! [load]
src
=
imread
(
argv
[
1
],
IMREAD_COLOR
);
// Load an image
String
imageName
(
"../data/stuff.jpg"
);
// by default
if
(
argc
>
1
)
{
imageName
=
argv
[
1
];
}
src
=
imread
(
imageName
,
IMREAD_COLOR
);
// Load an image
if
(
src
.
empty
()
)
{
return
-
1
;
}
...
...
samples/cpp/tutorial_code/ImgProc/changing_contrast_brightness_image/changing_contrast_brightness_image.cpp
View file @
89480801
...
...
@@ -58,9 +58,16 @@ void on_gamma_correction_trackbar(int, void *)
}
}
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
img_original
=
imread
(
argv
[
1
]
);
String
imageName
(
"../data/lena.jpg"
);
// by default
if
(
argc
>
1
)
{
imageName
=
argv
[
1
];
}
img_original
=
imread
(
imageName
);
img_corrected
=
Mat
(
img_original
.
rows
,
img_original
.
cols
*
2
,
img_original
.
type
());
img_gamma_corrected
=
Mat
(
img_original
.
rows
,
img_original
.
cols
*
2
,
img_original
.
type
());
...
...
samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp
View file @
89480801
...
...
@@ -21,7 +21,7 @@ namespace
const
std
::
string
usage
=
"Usage : tutorial_HoughCircle_Demo <path_to_input_image>
\n
"
;
// initial and max values of the parameters of interests.
const
int
cannyThresholdInitialValue
=
2
00
;
const
int
cannyThresholdInitialValue
=
1
00
;
const
int
accumulatorThresholdInitialValue
=
50
;
const
int
maxAccumulatorThreshold
=
200
;
const
int
maxCannyThreshold
=
255
;
...
...
@@ -55,15 +55,13 @@ int main(int argc, char** argv)
{
Mat
src
,
src_gray
;
if
(
argc
<
2
)
// Read the image
String
imageName
(
"../data/stuff.jpg"
);
// by default
if
(
argc
>
1
)
{
std
::
cerr
<<
"No input image specified
\n
"
;
std
::
cout
<<
usage
;
return
-
1
;
imageName
=
argv
[
1
];
}
// Read the image
src
=
imread
(
argv
[
1
],
IMREAD_COLOR
);
src
=
imread
(
imageName
,
IMREAD_COLOR
);
if
(
src
.
empty
()
)
{
...
...
samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
View file @
89480801
...
...
@@ -35,10 +35,15 @@ void Probabilistic_Hough( int, void* );
/**
* @function main
*/
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
/// Read the image
src
=
imread
(
argv
[
1
],
IMREAD_COLOR
);
// Read the image
String
imageName
(
"../data/building.jpg"
);
// by default
if
(
argc
>
1
)
{
imageName
=
argv
[
1
];
}
src
=
imread
(
imageName
,
IMREAD_COLOR
);
if
(
src
.
empty
()
)
{
help
();
...
...
samples/cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp
View file @
89480801
...
...
@@ -13,7 +13,7 @@ using namespace cv;
/**
* @function main
*/
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
//![variables]
Mat
src
,
src_gray
,
dst
;
...
...
@@ -25,7 +25,12 @@ int main( int, char** argv )
//![variables]
//![load]
src
=
imread
(
argv
[
1
],
IMREAD_COLOR
);
// Load an image
String
imageName
(
"../data/lena.jpg"
);
// by default
if
(
argc
>
1
)
{
imageName
=
argv
[
1
];
}
src
=
imread
(
imageName
,
IMREAD_COLOR
);
// Load an image
if
(
src
.
empty
()
)
{
return
-
1
;
}
...
...
samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp
View file @
89480801
...
...
@@ -23,10 +23,12 @@ void update_map( void );
/**
* @function main
*/
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
const
char
**
argv
)
{
/// Load the image
src
=
imread
(
argv
[
1
],
IMREAD_COLOR
);
CommandLineParser
parser
(
argc
,
argv
,
"{@image |../data/chicky_512.png|input image name}"
);
std
::
string
filename
=
parser
.
get
<
std
::
string
>
(
0
);
src
=
imread
(
filename
,
IMREAD_COLOR
);
/// Create dst, map_x and map_y with the same size as src:
dst
.
create
(
src
.
size
(),
src
.
type
()
);
...
...
samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp
View file @
89480801
...
...
@@ -13,7 +13,7 @@ using namespace cv;
/**
* @function main
*/
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
//![variables]
Mat
src
,
src_gray
;
...
...
@@ -25,7 +25,12 @@ int main( int, char** argv )
//![variables]
//![load]
src
=
imread
(
argv
[
1
],
IMREAD_COLOR
);
// Load an image
String
imageName
(
"../data/lena.jpg"
);
// by default
if
(
argc
>
1
)
{
imageName
=
argv
[
1
];
}
src
=
imread
(
imageName
,
IMREAD_COLOR
);
// Load an image
if
(
src
.
empty
()
)
{
return
-
1
;
}
...
...
samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp
View file @
89480801
...
...
@@ -21,10 +21,15 @@ RNG rng(12345);
/**
* @function main
*/
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
//![load]
src
=
imread
(
argv
[
1
],
IMREAD_COLOR
);
// Load an image
String
imageName
(
"../data/lena.jpg"
);
// by default
if
(
argc
>
1
)
{
imageName
=
argv
[
1
];
}
src
=
imread
(
imageName
,
IMREAD_COLOR
);
// Load an image
if
(
src
.
empty
()
)
{
...
...
samples/cpp/tutorial_code/ImgTrans/filter2D_demo.cpp
View file @
89480801
...
...
@@ -13,7 +13,7 @@ using namespace cv;
/**
* @function main
*/
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
/// Declare variables
Mat
src
,
dst
;
...
...
@@ -26,7 +26,12 @@ int main ( int, char** argv )
const
char
*
window_name
=
"filter2D Demo"
;
//![load]
src
=
imread
(
argv
[
1
],
IMREAD_COLOR
);
// Load an image
String
imageName
(
"../data/lena.jpg"
);
// by default
if
(
argc
>
1
)
{
imageName
=
argv
[
1
];
}
src
=
imread
(
imageName
,
IMREAD_COLOR
);
// Load an image
if
(
src
.
empty
()
)
{
return
-
1
;
}
...
...
samples/cpp/tutorial_code/ImgTrans/imageSegmentation.cpp
View file @
89480801
...
...
@@ -10,11 +10,11 @@
using
namespace
std
;
using
namespace
cv
;
int
main
(
int
,
char
**
argv
)
int
main
()
{
//! [load_image]
// Load the image
Mat
src
=
imread
(
argv
[
1
]
);
Mat
src
=
imread
(
"../data/cards.png"
);
// Check if everything was fine
if
(
!
src
.
data
)
...
...
samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp
View file @
89480801
...
...
@@ -23,10 +23,16 @@ void thresh_callback(int, void* );
/**
* @function main
*/
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
/// Load source image
src
=
imread
(
argv
[
1
],
IMREAD_COLOR
);
String
imageName
(
"../data/happyfish.jpg"
);
// by default
if
(
argc
>
1
)
{
imageName
=
argv
[
1
];
}
src
=
imread
(
imageName
,
IMREAD_COLOR
);
if
(
src
.
empty
())
{
cerr
<<
"No image supplied ..."
<<
endl
;
...
...
samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp
View file @
89480801
...
...
@@ -19,14 +19,13 @@ void readme();
* @function main
* @brief Main function
*/
int
main
(
int
argc
,
char
**
argv
)
int
main
()
{
if
(
argc
!=
3
)
{
readme
();
return
-
1
;
}
readme
();
//-- 1. Read the images
Mat
imgLeft
=
imread
(
argv
[
1
]
,
IMREAD_GRAYSCALE
);
Mat
imgRight
=
imread
(
argv
[
2
]
,
IMREAD_GRAYSCALE
);
Mat
imgLeft
=
imread
(
"../data/rubberwhale1.png"
,
IMREAD_GRAYSCALE
);
Mat
imgRight
=
imread
(
"../data/rubberwhale2.png"
,
IMREAD_GRAYSCALE
);
//-- And create the image in which we will save our disparities
Mat
imgDisparity16S
=
Mat
(
imgLeft
.
rows
,
imgLeft
.
cols
,
CV_16S
);
Mat
imgDisparity8U
=
Mat
(
imgLeft
.
rows
,
imgLeft
.
cols
,
CV_8UC1
);
...
...
samples/cpp/tutorial_code/features2D/AKAZE_match.cpp
View file @
89480801
...
...
@@ -63,7 +63,7 @@ int main(void)
Mat
res
;
drawMatches
(
img1
,
inliers1
,
img2
,
inliers2
,
good_matches
,
res
);
imwrite
(
"
res
.png"
,
res
);
imwrite
(
"
akaze_result
.png"
,
res
);
double
inlier_ratio
=
inliers1
.
size
()
*
1.0
/
matched1
.
size
();
cout
<<
"A-KAZE Matching Results"
<<
endl
;
...
...
@@ -75,5 +75,8 @@ int main(void)
cout
<<
"# Inliers Ratio:
\t
"
<<
inlier_ratio
<<
endl
;
cout
<<
endl
;
imshow
(
"result"
,
res
);
waitKey
();
return
0
;
}
samples/cpp/tutorial_code/features2D/AKAZE_tracking/planar_tracking.cpp
View file @
89480801
...
...
@@ -120,27 +120,27 @@ Mat Tracker::process(const Mat frame, Stats& stats)
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
<
2
)
{
cerr
<<
"Usage: "
<<
endl
<<
"akaze_track input_path"
<<
endl
<<
" (input_path can be a camera id, like 0,1,2 or a video filename)"
<<
endl
;
return
1
;
}
cerr
<<
"Usage: "
<<
endl
<<
"akaze_track input_path"
<<
endl
<<
" (input_path can be a camera id, like 0,1,2 or a video filename)"
<<
endl
;
std
::
string
video_name
=
argv
[
1
]
;
st
d
::
stringstream
ssFormat
;
s
sFormat
<<
atoi
(
argv
[
1
])
;
CommandLineParser
parser
(
argc
,
argv
,
"{@input_path |0|input path can be a camera id, like 0,1,2 or a video filename}"
)
;
st
ring
input_path
=
parser
.
get
<
string
>
(
0
)
;
s
tring
video_name
=
input_path
;
VideoCapture
video_in
;
if
(
video_name
.
compare
(
ssFormat
.
str
())
==
0
)
{
//test str==str(num)
video_in
.
open
(
atoi
(
argv
[
1
]));
if
(
(
isdigit
(
input_path
[
0
])
&&
input_path
.
size
()
==
1
)
)
{
int
camera_no
=
input_path
[
0
]
-
'0'
;
video_in
.
open
(
camera_no
);
}
else
{
video_in
.
open
(
video_name
);
}
if
(
!
video_in
.
isOpened
())
{
cerr
<<
"Couldn't open "
<<
argv
[
1
]
<<
endl
;
cerr
<<
"Couldn't open "
<<
video_name
<<
endl
;
return
1
;
}
...
...
samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp
View file @
89480801
...
...
@@ -94,12 +94,16 @@ double getOrientation(const vector<Point> &pts, Mat &img)
/**
* @function main
*/
int
main
(
int
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
//! [pre-process]
// Load image
// Mat src = imread("pca_test1.jpg");
Mat
src
=
imread
(
argv
[
1
]);
String
imageName
(
"../data/pca_test1.jpg"
);
// by default
if
(
argc
>
1
)
{
imageName
=
argv
[
1
];
}
Mat
src
=
imread
(
imageName
);
// Check if image is loaded successfully
if
(
!
src
.
data
||
src
.
empty
())
...
...
samples/cpp/tutorial_code/xfeatures2D/LATCH_match.cpp
View file @
89480801
...
...
@@ -81,7 +81,7 @@ int main(void)
Mat
res
;
drawMatches
(
img1
,
inliers1
,
img2
,
inliers2
,
good_matches
,
res
);
imwrite
(
"
../../samples/data/latch_res
.png"
,
res
);
imwrite
(
"
latch_result
.png"
,
res
);
double
inlier_ratio
=
inliers1
.
size
()
*
1.0
/
matched1
.
size
();
...
...
@@ -93,6 +93,10 @@ int main(void)
cout
<<
"# Inliers:
\t
"
<<
inliers1
.
size
()
<<
endl
;
cout
<<
"# Inliers Ratio:
\t
"
<<
inlier_ratio
<<
endl
;
cout
<<
endl
;
imshow
(
"result"
,
res
);
waitKey
();
return
0
;
}
...
...
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