ViSP
Main Page
Related Pages
Modules
Classes
Examples
All
Classes
Functions
Variables
Enumerations
Enumerator
Friends
Groups
Pages
tutorial-undistort.cpp
1
2
#include <visp/vpImageIo.h>
3
#include <visp/vpImageTools.h>
4
#include <visp/vpXmlParserCamera.h>
5
6
int
main()
7
{
8
vpImage<unsigned char>
I;
9
vpImageIo::read
(I,
"chessboard.pgm"
);
10
11
vpCameraParameters
cam;
12
#ifdef VISP_HAVE_XML2
13
vpXmlParserCamera
p;
14
vpCameraParameters::vpCameraParametersProjType
projModel;
15
projModel =
vpCameraParameters::perspectiveProjWithDistortion
;
16
if
(p.
parse
(cam,
"camera.xml"
,
"Camera"
, projModel, I.
getWidth
(), I.
getHeight
()) !=
vpXmlParserCamera::SEQUENCE_OK
) {
17
std::cout <<
"Cannot found parameters for camera named \"Camera\""
<< std::endl;
18
}
19
#else
20
cam.
initPersProjWithDistortion
(582.7, 580.6, 326.6, 215.0, -0.3372, 0.4021);
21
#endif
22
23
std::cout << cam << std::endl;
24
25
vpImage<unsigned char>
Iud;
26
vpImageTools::undistort
(I, cam, Iud);
27
vpImageIo::write
(Iud,
"chessboard-undistort.pgm"
);
28
29
return
0;
30
}
tutorial
image
tutorial-undistort.cpp
Generated on Thu Oct 24 2013 14:47:38 for ViSP by
1.8.4