Skip to content

Commit bdb26b1

Browse files
Merge pull request #2025 from alicevision/dev/gsplat
Wrap Rgb in landmark for swig
2 parents 605e0ef + d6bf98d commit bdb26b1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/aliceVision/sfmData/Landmark.i

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,41 @@
88
%eigen_typemaps(Vec3)
99

1010
%include <aliceVision/sfmData/Observation.i>
11+
12+
// We don't want to have a direct access to rgb
13+
// It's easier to wrap it around a Vec3
14+
// As it's already binded to numpy
15+
%ignore aliceVision::sfmData::Landmark::rgb;
16+
17+
//Add new swig only C++ code
18+
%extend aliceVision::sfmData::Landmark {
19+
20+
// From RgbColor to Vec3
21+
Vec3 getRgb() const {
22+
Vec3 ret;
23+
24+
ret.x() = $self->rgb.r();
25+
ret.y() = $self->rgb.g();
26+
ret.z() = $self->rgb.b();
27+
28+
return ret;
29+
}
30+
31+
// From Vec3 to RgbColor
32+
void setRgb(Vec3 value) {
33+
$self->rgb.r() = value.x();
34+
$self->rgb.g() = value.y();
35+
$self->rgb.b() = value.z();
36+
}
37+
38+
// If the user asks for the rgb property
39+
// It is not a direct access to the rgb
40+
// variable but a getter/setter
41+
%pythoncode %{
42+
rgb = property(getRgb, setRgb)
43+
%}
44+
}
45+
1146
%include <aliceVision/sfmData/Landmark.hpp>
1247

1348
%{

0 commit comments

Comments
 (0)