Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Pope
ftl
Commits
725174e6
Commit
725174e6
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Add colour to pcl vis
parent
6b78376c
No related branches found
No related tags found
No related merge requests found
Pipeline
#10478
failed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
renderer/cpp/src/display.cpp
+5
-5
5 additions, 5 deletions
renderer/cpp/src/display.cpp
with
5 additions
and
5 deletions
renderer/cpp/src/display.cpp
+
5
−
5
View file @
725174e6
...
...
@@ -36,6 +36,7 @@ Display::~Display() {
#endif // HAVE_VIZ
}
#if defined HAVE_PCL
static
pcl
::
PointCloud
<
pcl
::
PointXYZRGB
>::
Ptr
matToPointXYZ
(
const
cv
::
Mat
&
OpencVPointCloud
,
const
cv
::
Mat
&
rgbimage
)
{
/*
* Function: Get from a Mat to pcl pointcloud datatype
...
...
@@ -46,8 +47,6 @@ static pcl::PointCloud<pcl::PointXYZRGB>::Ptr matToPointXYZ(const cv::Mat &Openc
//char pr=100, pg=100, pb=100;
pcl
::
PointCloud
<
pcl
::
PointXYZRGB
>::
Ptr
point_cloud_ptr
(
new
pcl
::
PointCloud
<
pcl
::
PointXYZRGB
>
);
//(new pcl::pointcloud<pcl::pointXYZ>);
LOG
(
INFO
)
<<
"OCVPC SIZE = "
<<
OpencVPointCloud
.
cols
<<
","
<<
OpencVPointCloud
.
rows
;
for
(
int
i
=
0
;
i
<
OpencVPointCloud
.
rows
;
i
++
)
{
for
(
int
j
=
0
;
j
<
OpencVPointCloud
.
cols
;
j
++
)
{
//std::cout<<i<<endl;
...
...
@@ -58,10 +57,10 @@ static pcl::PointCloud<pcl::PointXYZRGB>::Ptr matToPointXYZ(const cv::Mat &Openc
point
.
y
=
cvpoint
[
1
];
//OpencVPointCloud.at<float>(1,i);
point
.
z
=
cvpoint
[
2
];
//OpencVPointCloud.at<float>(2,i);
cv
::
Point3_
<
uchar
>
prgb
;
//
= rgbimage.at<cv::Point3_<uchar>>(
(int)point.x, (int)point.y
);
cv
::
Point3_
<
uchar
>
prgb
=
rgbimage
.
at
<
cv
::
Point3_
<
uchar
>>
(
i
,
j
);
// when color needs to be added:
uint32_t
rgb
=
(
static_cast
<
uint32_t
>
(
prgb
.
x
)
<<
16
|
static_cast
<
uint32_t
>
(
prgb
.
y
)
<<
8
|
static_cast
<
uint32_t
>
(
prgb
.
z
));
uint32_t
rgb
=
(
static_cast
<
uint32_t
>
(
prgb
.
z
)
<<
16
|
static_cast
<
uint32_t
>
(
prgb
.
y
)
<<
8
|
static_cast
<
uint32_t
>
(
prgb
.
x
));
point
.
rgb
=
*
reinterpret_cast
<
float
*>
(
&
rgb
);
point_cloud_ptr
->
points
.
push_back
(
point
);
...
...
@@ -72,6 +71,7 @@ static pcl::PointCloud<pcl::PointXYZRGB>::Ptr matToPointXYZ(const cv::Mat &Openc
return
point_cloud_ptr
;
}
#endif // HAVE_PCL
bool
Display
::
render
(
const
cv
::
Mat
&
rgb
,
const
cv
::
Mat
&
depth
)
{
Mat
idepth
;
...
...
@@ -99,7 +99,7 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth) {
);*/
cv
::
Mat_
<
cv
::
Vec3f
>
XYZ
(
depth
.
rows
,
depth
.
cols
);
// Output point cloud
reprojectImageTo3D
(
depth
+
20.0
f
,
XYZ
,
q_
,
true
);
reprojectImageTo3D
(
depth
,
XYZ
,
q_
,
true
);
auto
pc
=
matToPointXYZ
(
XYZ
,
rgb
);
pcl
::
visualization
::
PointCloudColorHandlerRGBField
<
pcl
::
PointXYZRGB
>
rgb
(
pc
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment