ViSP
Main Page
Related Pages
Modules
Classes
Examples
All
Classes
Functions
Variables
Enumerations
Enumerator
Friends
Groups
Pages
vpHomography.h
1
/****************************************************************************
2
*
3
* $Id: vpHomography.h 4276 2013-06-25 12:36:48Z fspindle $
4
*
5
* This file is part of the ViSP software.
6
* Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7
*
8
* This software is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License
10
* ("GPL") version 2 as published by the Free Software Foundation.
11
* See the file LICENSE.txt at the root directory of this source
12
* distribution for additional information about the GNU GPL.
13
*
14
* For using ViSP with software that can not be combined with the GNU
15
* GPL, please contact INRIA about acquiring a ViSP Professional
16
* Edition License.
17
*
18
* See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19
*
20
* This software was developed at:
21
* INRIA Rennes - Bretagne Atlantique
22
* Campus Universitaire de Beaulieu
23
* 35042 Rennes Cedex
24
* France
25
* http://www.irisa.fr/lagadic
26
*
27
* If you have questions regarding the use of this file, please contact
28
* INRIA at visp@inria.fr
29
*
30
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32
*
33
*
34
* Description:
35
* Homography transformation.
36
*
37
* Authors:
38
* Muriel Pressigout
39
* Fabien Spindler
40
*
41
*****************************************************************************/
42
43
51
#ifndef vpHomography_hh
52
#define vpHomography_hh
53
54
#include <visp/vpHomogeneousMatrix.h>
55
#include <visp/vpPlane.h>
56
#ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
57
# include <visp/vpList.h>
58
#endif
59
60
#include <list>
61
173
class
VISP_EXPORT
vpHomography
:
public
vpMatrix
174
{
175
176
private
:
177
static
const
double
sing_threshold;
// = 0.0001;
178
static
const
double
threshold_rotation;
179
static
const
double
threshold_displacement;
180
vpHomogeneousMatrix
aMb ;
181
// bool isplanar;
183
vpPlane
bP ;
184
void
init
() ;
185
186
private
:
188
void
insert
(
const
vpHomogeneousMatrix
&aRb) ;
190
void
insert
(
const
vpRotationMatrix
&aRb) ;
192
void
insert
(
const
vpThetaUVector
&tu) ;
194
void
insert
(
const
vpTranslationVector
&atb) ;
196
void
insert
(
const
vpPlane
&bP) ;
197
198
static
void
initRansac(
unsigned
int
n,
199
double
*xb,
double
*yb,
200
double
*xa,
double
*ya,
201
vpColVector
&x) ;
202
203
public
:
204
static
void
HartleyNormalization(
unsigned
int
n,
205
double
*x,
double
*y,
206
double
*xn,
double
*yn,
207
double
&xg,
double
&yg,
208
double
&coef);
209
static
void
HartleyDenormalization(
vpHomography
&aHbn,
210
vpHomography
&aHb,
211
double
xg1,
double
yg1,
double
coef1,
212
double
xg2,
double
yg2,
double
coef2 ) ;
213
214
215
vpHomography
() ;
216
218
vpHomography
(
const
vpHomography
&aMb) ;
220
vpHomography
(
const
vpHomogeneousMatrix
&aMb,
221
const
vpPlane
&bP) ;
223
vpHomography
(
const
vpRotationMatrix
&aRb,
224
const
vpTranslationVector
&atb,
225
const
vpPlane
&bP) ;
227
vpHomography
(
const
vpThetaUVector
&tu,
228
const
vpTranslationVector
&atb,
229
const
vpPlane
&bP) ;
231
vpHomography
(
const
vpPoseVector
&arb,
232
const
vpPlane
&bP) ;
233
virtual
~vpHomography
() { }
234
236
void
buildFrom(
const
vpRotationMatrix
&aRb,
237
const
vpTranslationVector
&atb,
238
const
vpPlane
&bP) ;
240
void
buildFrom(
const
vpThetaUVector
&tu,
241
const
vpTranslationVector
&atb,
242
const
vpPlane
&bP) ;
244
void
buildFrom(
const
vpPoseVector
&arb,
245
const
vpPlane
&bP) ;
247
void
buildFrom(
const
vpHomogeneousMatrix
&aMb,
248
const
vpPlane
&bP) ;
249
251
void
build() ;
252
253
254
void
computeDisplacement(
vpRotationMatrix
&aRb,
255
vpTranslationVector
&atb,
256
vpColVector
&n) ;
257
258
void
computeDisplacement(
const
vpColVector
& nd,
259
vpRotationMatrix
&aRb,
260
vpTranslationVector
&atb,
261
vpColVector
&n) ;
262
264
void
load(std::ifstream &f) ;
266
void
print
() ;
268
void
save(std::ofstream &f)
const
;
269
271
vpHomography
inverse()
const
;
273
void
inverse(
vpHomography
&Hi)
const
;
274
275
// Multiplication by an homography
276
vpHomography
operator*
(
const
vpHomography
&H)
const
;
277
278
// Multiplication by a scalar
279
vpHomography
operator*
(
const
double
&v)
const
;
280
281
// Division by a scalar
282
vpHomography
operator/
(
const
double
&v)
const
;
283
285
static
void
build(
vpHomography
&aHb,
286
const
vpHomogeneousMatrix
&aMb,
287
const
vpPlane
&bP) ;
288
289
static
void
DLT(
unsigned
int
n,
290
double
*xb,
double
*yb ,
291
double
*xa,
double
*ya,
292
vpHomography
&aHb) ;
293
294
static
void
HartleyDLT(
unsigned
int
n,
295
double
*xb,
double
*yb ,
296
double
*xa,
double
*ya,
297
vpHomography
&aHb) ;
298
static
void
HLM(
unsigned
int
n,
299
double
*xb,
double
*yb,
300
double
*xa,
double
*ya ,
301
bool
isplan,
302
vpHomography
&aHb) ;
303
304
static
void
computeDisplacement(
const
vpHomography
&aHb,
305
const
vpColVector
& nd,
306
vpRotationMatrix
&aRb,
307
vpTranslationVector
&atb,
308
vpColVector
&n) ;
309
310
static
void
computeDisplacement (
const
vpHomography
&aHb,
311
vpRotationMatrix
&aRb,
312
vpTranslationVector
&atb,
313
vpColVector
&n) ;
314
315
static
void
computeDisplacement(
const
vpMatrix
&H,
316
const
double
x,
317
const
double
y,
318
std::list<vpRotationMatrix> & vR,
319
std::list<vpTranslationVector> & vT,
320
std::list<vpColVector> & vN) ;
321
static
double
computeDisplacement(
unsigned
int
nbpoint,
322
vpPoint
*c1P,
323
vpPoint
*c2P,
324
vpPlane
&oN,
325
vpHomogeneousMatrix
&c2Mc1,
326
vpHomogeneousMatrix
&c1Mo,
327
int
userobust
328
) ;
329
static
double
computeDisplacement(
unsigned
int
nbpoint,
330
vpPoint
*c1P,
331
vpPoint
*c2P,
332
vpPlane
*oN,
333
vpHomogeneousMatrix
&c2Mc1,
334
vpHomogeneousMatrix
&c1Mo,
335
int
userobust
336
) ;
337
static
double
computeResidual(
vpColVector
&x,
vpColVector
&M,
vpColVector
&d);
338
// VVS
339
static
double
computeRotation(
unsigned
int
nbpoint,
340
vpPoint
*c1P,
341
vpPoint
*c2P,
342
vpHomogeneousMatrix
&c2Mc1,
343
int
userobust
344
) ;
345
static
void
computeTransformation(
vpColVector
&x,
unsigned
int
*ind,
vpColVector
&M) ;
346
347
static
bool
degenerateConfiguration(
vpColVector
&x,
unsigned
int
*ind) ;
348
static
bool
degenerateConfiguration(
vpColVector
&x,
unsigned
int
*ind,
double
threshold_area);
349
350
static
bool
ransac(
unsigned
int
n,
351
double
*xb,
double
*yb,
352
double
*xa,
double
*ya ,
353
vpHomography
&aHb,
354
int
consensus = 1000,
355
double
threshold = 1e-6
356
) ;
357
358
static
bool
ransac(
unsigned
int
n,
359
double
*xb,
double
*yb,
360
double
*xa,
double
*ya ,
361
vpHomography
&aHb,
362
vpColVector
& inliers,
363
double
& residual,
364
int
consensus = 1000,
365
double
epsilon = 1e-6,
366
double
areaThreshold = 0.0);
367
368
#ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
369
372
vp_deprecated
static
void
computeDisplacement(
const
vpMatrix
H,
373
const
double
x,
374
const
double
y,
375
vpList<vpRotationMatrix>
& vR,
376
vpList<vpTranslationVector>
& vT,
377
vpList<vpColVector>
& vN) ;
378
379
#endif // VISP_BUILD_DEPRECATED_FUNCTIONS
380
} ;
381
382
383
384
#endif
src
computer-vision
homography-estimation
vpHomography.h
Generated on Fri Sep 27 2013 21:09:13 for ViSP by
1.8.4