Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
vpMomentObject.h
1
/*
2
* ViSP, open source Visual Servoing Platform software.
3
* Copyright (C) 2005 - 2025 by Inria. All rights reserved.
4
*
5
* This software is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
* See the file LICENSE.txt at the root directory of this source
10
* distribution for additional information about the GNU GPL.
11
*
12
* For using ViSP with software that can not be combined with the GNU
13
* GPL, please contact Inria about acquiring a ViSP Professional
14
* Edition License.
15
*
16
* See https://visp.inria.fr for more information.
17
*
18
* This software was developed at:
19
* Inria Rennes - Bretagne Atlantique
20
* Campus Universitaire de Beaulieu
21
* 35042 Rennes Cedex
22
* France
23
*
24
* If you have questions regarding the use of this file, please contact
25
* Inria at visp@inria.fr
26
*
27
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29
*
30
* Description:
31
* Object input structure used by moments.
32
*/
33
38
#ifndef VP_MOMENT_OBJECT_H
39
#define VP_MOMENT_OBJECT_H
40
41
#include <cstdlib>
42
#include <utility>
43
#include <visp3/core/vpConfig.h>
44
#include <visp3/core/vpImage.h>
45
#include <visp3/core/vpMath.h>
46
#include <visp3/core/vpMoment.h>
47
#include <visp3/core/vpPoint.h>
48
49
BEGIN_VISP_NAMESPACE
50
class
vpCameraParameters
;
51
224
class
VISP_EXPORT
vpMomentObject
225
{
226
public
:
230
typedef
enum
231
{
232
DENSE_FULL_OBJECT
= 0,
234
DENSE_POLYGON
= 1,
237
DISCRETE
= 2,
238
} vpObjectType;
239
243
typedef
enum
244
{
245
BLACK
= 0,
246
WHITE
= 1,
247
} vpCameraImgBckGrndType;
248
249
bool
flg_normalize_intensity
;
// To scale the intensity of each individual
250
// pixel in the image by the maximum intensity
251
// value present in it
252
253
// Constructors
254
VP_EXPLICIT
vpMomentObject
(
unsigned
int
order
);
255
vpMomentObject
(
const
vpMomentObject
&srcobj);
264
virtual
~vpMomentObject
();
265
266
#if (VISP_CXX_STANDARD > VISP_CXX_STANDARD_98)
267
vpMomentObject
&
operator=
(
const
vpMomentObject
&) =
default
;
268
#endif
269
270
void
fromImage
(
const
vpImage<unsigned char>
&image,
unsigned
char
threshold,
271
const
vpCameraParameters
&cam);
// Binary version
272
void
fromImage
(
const
vpImage<unsigned char>
&image,
const
vpCameraParameters
&cam,
vpCameraImgBckGrndType
bg_type,
273
bool
normalize_with_pix_size =
true
);
// Photometric version
274
275
void
fromVector
(std::vector<vpPoint> &points);
276
const
std::vector<double> &
get
()
const
;
277
double
get
(
unsigned
int
i,
unsigned
int
j)
const
;
278
282
vpObjectType
getType
()
const
{
return
type
; }
283
288
unsigned
int
getOrder
()
const
{
return
order
- 1; }
289
290
// Constructor helpers
291
void
init(
unsigned
int
orderinp);
292
void
init(
const
vpMomentObject
&objin);
293
294
friend
VISP_EXPORT std::ostream &operator<<(std::ostream &os,
const
vpMomentObject
&v);
300
static
void
printWithIndices(
const
vpMomentObject
&momobj, std::ostream &os);
305
void
setType
(
vpObjectType
input_type) { this->
type
= input_type; }
306
311
static
vpMatrix
convertTovpMatrix(
const
vpMomentObject
&momobj);
312
313
protected
:
314
unsigned
int
order
;
315
vpObjectType
type
;
316
std::vector<double>
values
;
317
void
set
(
unsigned
int
i,
unsigned
int
j,
const
double
&value_ij);
318
void
cacheValues
(std::vector<double> &cache,
double
x,
double
y);
319
320
private
:
321
void
cacheValues
(std::vector<double> &cache,
double
x,
double
y,
double
IntensityNormalized);
322
double
calc_mom_polygon(
unsigned
int
p,
unsigned
int
q,
const
std::vector<vpPoint> &points);
323
};
324
END_VISP_NAMESPACE
325
326
#endif
vpCameraParameters
Generic class defining intrinsic camera parameters.
Definition
vpCameraParameters.h:311
vpImage
Definition of the vpImage class member functions.
Definition
vpImage.h:131
vpMatrix
Implementation of a matrix and operations on matrices.
Definition
vpMatrix.h:175
vpMomentObject
Class for generic objects.
Definition
vpMomentObject.h:225
vpMomentObject::getOrder
unsigned int getOrder() const
Definition
vpMomentObject.h:288
vpMomentObject::vpMomentObject
VP_EXPLICIT vpMomentObject(unsigned int order)
Definition
vpMomentObject.cpp:502
vpMomentObject::order
unsigned int order
Definition
vpMomentObject.h:314
vpMomentObject::cacheValues
void cacheValues(std::vector< double > &cache, double x, double y)
Definition
vpMomentObject.cpp:108
vpMomentObject::type
vpObjectType type
Definition
vpMomentObject.h:315
vpMomentObject::setType
void setType(vpObjectType input_type)
Definition
vpMomentObject.h:305
vpMomentObject::flg_normalize_intensity
bool flg_normalize_intensity
Definition
vpMomentObject.h:249
vpMomentObject::set
void set(unsigned int i, unsigned int j, const double &value_ij)
Definition
vpMomentObject.cpp:563
vpMomentObject::vpObjectType
vpObjectType
Definition
vpMomentObject.h:231
vpMomentObject::DISCRETE
@ DISCRETE
Definition
vpMomentObject.h:237
vpMomentObject::DENSE_FULL_OBJECT
@ DENSE_FULL_OBJECT
Definition
vpMomentObject.h:232
vpMomentObject::DENSE_POLYGON
@ DENSE_POLYGON
Definition
vpMomentObject.h:234
vpMomentObject::operator=
vpMomentObject & operator=(const vpMomentObject &)=default
vpMomentObject::vpCameraImgBckGrndType
vpCameraImgBckGrndType
Definition
vpMomentObject.h:244
vpMomentObject::BLACK
@ BLACK
Black background.
Definition
vpMomentObject.h:245
vpMomentObject::WHITE
@ WHITE
Not functional right now.
Definition
vpMomentObject.h:246
vpMomentObject::get
const std::vector< double > & get() const
Definition
vpMomentObject.cpp:538
vpMomentObject::values
std::vector< double > values
Definition
vpMomentObject.h:316
vpMomentObject::getType
vpObjectType getType() const
Definition
vpMomentObject.h:282
vpMomentObject::fromImage
void fromImage(const vpImage< unsigned char > &image, unsigned char threshold, const vpCameraParameters &cam)
Definition
vpMomentObject.cpp:296
vpMomentObject::fromVector
void fromVector(std::vector< vpPoint > &points)
Definition
vpMomentObject.cpp:232
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
modules
core
include
visp3
core
vpMomentObject.h
Generated by
1.17.0