Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
vpRGBf.h
1
/*
2
* ViSP, open source Visual Servoing Platform software.
3
* Copyright (C) 2005 - 2024 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
* 32-bit floating point RGB pixel.
32
*/
33
39
40
#ifndef VP_RGBF_H
41
#define VP_RGBF_H
42
43
#include <visp3/core/vpConfig.h>
44
#include <visp3/core/vpColVector.h>
45
46
#ifdef VISP_HAVE_NLOHMANN_JSON
47
#include VISP_NLOHMANN_JSON(json.hpp)
48
#endif
49
50
#if ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)))
51
#include <type_traits>
52
#endif
53
54
BEGIN_VISP_NAMESPACE
55
67
class
VISP_EXPORT
vpRGBf
68
{
69
public
:
75
inline
vpRGBf
() :
R
(0),
G
(0),
B
(0) { }
76
86
inline
vpRGBf
(
float
r,
float
g,
float
b)
87
:
R
(r),
G
(g),
B
(b)
88
{ }
89
97
VP_EXPLICIT
inline
vpRGBf
(
float
v) :
R
(v),
G
(v),
B
(v) { }
98
106
VP_EXPLICIT
inline
vpRGBf
(
int
v)
107
{
108
*
this
= v;
109
}
110
114
#if ((__cplusplus >= 201103L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201103L)))
// Check if cxx11 or higher
115
inline
vpRGBf
(
const
vpRGBf
&v) =
default
;
116
#else
117
inline
vpRGBf
(
const
vpRGBf
&v) :
R
(v.
R
),
G
(v.
G
),
B
(v.
B
) { }
118
#endif
126
VP_EXPLICIT
inline
vpRGBf
(
const
vpColVector
&v) :
R
(0),
G
(0),
B
(0) { *
this
= v; }
127
128
vpRGBf
&operator=(
float
v);
129
vpRGBf
&operator=(
int
v);
130
#if ((__cplusplus >= 201103L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201103L)))
// Check if cxx11 or higher
131
vpRGBf
&
operator=
(
const
vpRGBf
&v) =
default
;
132
vpRGBf
&
operator=
(
vpRGBf
&&v) =
default
;
133
#else
134
vpRGBf
&
operator=
(
const
vpRGBf
&v)
135
{
136
this->
R
= v.R;
137
this->
G
= v.G;
138
this->
B
= v.B;
139
return
*
this
;
140
}
141
#endif
142
vpRGBf
&operator=(
const
vpColVector
&v);
143
bool
operator==(
const
vpRGBf
&v)
const
;
144
bool
operator!=(
const
vpRGBf
&v)
const
;
145
146
vpColVector
operator-(
const
vpRGBf
&v)
const
;
147
vpRGBf
operator+(
const
vpRGBf
&v)
const
;
148
vpColVector
operator-(
const
vpColVector
&v)
const
;
149
vpColVector
operator+(
const
vpColVector
&v)
const
;
150
vpColVector
operator*(
float
v)
const
;
151
vpColVector
operator*(
double
v)
const
;
152
153
bool
operator<(
const
vpRGBf
&v)
const
;
154
bool
operator>(
const
vpRGBf
&v)
const
;
155
156
friend
VISP_EXPORT std::ostream &operator<<(std::ostream &os,
const
vpRGBf
&rgb);
157
158
public
:
159
float
R
;
160
float
G
;
161
float
B
;
162
163
friend
VISP_EXPORT
vpRGBf
operator*
(
double
x,
const
vpRGBf
&rgb);
164
friend
VISP_EXPORT
vpRGBf
operator*
(
float
x,
const
vpRGBf
&rgb);
165
};
166
167
#if ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)))
168
static_assert
(std::is_trivially_assignable_v<vpRGBf, vpRGBf>);
169
static_assert
(std::is_trivially_copyable_v<vpRGBf>);
170
#endif
171
172
#ifdef VISP_HAVE_NLOHMANN_JSON
173
174
inline
void
from_json(
const
nlohmann::json &j,
vpRGBf
&c)
175
{
176
c.
R
= j.at(0);
177
c.
G
= j.at(1);
178
c.
B
= j.at(2);
179
180
}
181
182
inline
void
to_json(nlohmann::json &j,
const
vpRGBf
&c)
183
{
184
j
= { c.
R
, c.
G
, c.
B
};
185
}
186
#endif
187
188
END_VISP_NAMESPACE
189
190
#endif
vpColVector
Implementation of column vector and the associated operations.
Definition
vpColVector.h:191
vpRGBf
Definition
vpRGBf.h:68
vpRGBf::operator*
vpColVector operator*(float v) const
Definition
vpRGBf.cpp:198
vpRGBf::vpRGBf
vpRGBf()
Definition
vpRGBf.h:75
vpRGBf::B
float B
Blue component.
Definition
vpRGBf.h:161
vpRGBf::vpRGBf
VP_EXPLICIT vpRGBf(const vpColVector &v)
Definition
vpRGBf.h:126
vpRGBf::vpRGBf
vpRGBf(float r, float g, float b)
Definition
vpRGBf.h:86
vpRGBf::vpRGBf
VP_EXPLICIT vpRGBf(int v)
Definition
vpRGBf.h:106
vpRGBf::operator=
vpRGBf & operator=(vpRGBf &&v)=default
vpRGBf::vpRGBf
vpRGBf(const vpRGBf &v)=default
vpRGBf::vpRGBf
VP_EXPLICIT vpRGBf(float v)
Definition
vpRGBf.h:97
vpRGBf::operator=
vpRGBf & operator=(float v)
Definition
vpRGBf.cpp:51
vpRGBf::G
float G
Green component.
Definition
vpRGBf.h:160
vpRGBf::operator=
vpRGBf & operator=(const vpRGBf &v)=default
vpRGBf::R
float R
Red component.
Definition
vpRGBf.h:159
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
yolo-centering-task-afma6.j
j
Definition
yolo-centering-task-afma6.py:329
modules
core
include
visp3
core
vpRGBf.h
Generated by
1.17.0