PCLVisualizer is showing black and white HSV Point Cloud

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

PCLVisualizer is showing black and white HSV Point Cloud

ravijoshi
I have captured a point cloud of type PointXYZRGBA as shown below-

<http://www.pcl-users.org/file/t499210/rgb1.png>

I have converted it to PointXYZHSV. I am trying to visualize it using
PCLVisualizer. Surprisingly, PCLVisualizer is showing it as black and white
as shown below-

<http://www.pcl-users.org/file/t499210/hsv1.png>

Below is the code snippet-
------------------------------------------------------------------
typedef pcl::PointXYZHSV PointHSV;
typedef pcl::PointXYZRGBA PointRGBA;
typedef pcl::PointCloud<PointHSV> PointCloudHSV;
typedef pcl::PointCloud<PointRGBA> PointCloudRGBA;

int main (int argc, char** argv)
{
    pcl::visualization::PCLVisualizer viewer("Cloud Viewer");
    PointCloudRGBA::Ptr rgba_cloud (new PointCloudRGBA);
    PointCloudHSV::Ptr hsv_cloud (new PointCloudHSV);
    pcl::io::loadPCDFile("capture.pcd", *rgba_cloud);
    pcl::PointCloudXYZRGBtoXYZHSV(*rgba_cloud, *hsv_cloud);
    viewer.addPointCloud<PointHSV>(hsv_cloud, "hsv_cloud_name");
    viewer.spin();
    return 0;
}
------------------------------------------------------------------

I am using PCL_VERSION: 1.8.1.99 in Ubuntu 14.04 LTS 64 Bit OS.



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: PCLVisualizer is showing black and white HSV Point Cloud

Sérgio Agostinho
I don't think PCL Visualizer is prepared to handle different color
spaces other than RGB for display purposes.

Cheers

On 04-02-2018 07:24, ravijoshi wrote:

> I have captured a point cloud of type PointXYZRGBA as shown below-
>
> <http://www.pcl-users.org/file/t499210/rgb1.png>
>
> I have converted it to PointXYZHSV. I am trying to visualize it using
> PCLVisualizer. Surprisingly, PCLVisualizer is showing it as black and white
> as shown below-
>
> <http://www.pcl-users.org/file/t499210/hsv1.png>
>
> Below is the code snippet-
> ------------------------------------------------------------------
> typedef pcl::PointXYZHSV PointHSV;
> typedef pcl::PointXYZRGBA PointRGBA;
> typedef pcl::PointCloud<PointHSV> PointCloudHSV;
> typedef pcl::PointCloud<PointRGBA> PointCloudRGBA;
>
> int main (int argc, char** argv)
> {
>     pcl::visualization::PCLVisualizer viewer("Cloud Viewer");
>     PointCloudRGBA::Ptr rgba_cloud (new PointCloudRGBA);
>     PointCloudHSV::Ptr hsv_cloud (new PointCloudHSV);
>     pcl::io::loadPCDFile("capture.pcd", *rgba_cloud);
>     pcl::PointCloudXYZRGBtoXYZHSV(*rgba_cloud, *hsv_cloud);
>     viewer.addPointCloud<PointHSV>(hsv_cloud, "hsv_cloud_name");
>     viewer.spin();
>     return 0;
> }
> ------------------------------------------------------------------
>
> I am using PCL_VERSION: 1.8.1.99 in Ubuntu 14.04 LTS 64 Bit OS.
>
>
>
> --
> Sent from: http://www.pcl-users.org/
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PCLVisualizer is showing black and white HSV Point Cloud

ravijoshi
I left with only one option which is to convert HSV Point Cloud back into a
new RGB Point Cloud. But got following error-

error: ‘PointCloudXYZHSVtoXYZRGB’ is not a member of ‘pcl’
pcl::PointCloudXYZHSVtoXYZRGB(*hsv_cloud, *rgb_cloud);

It seems that this function doesn't exist.

Well, the point of converting into HSV is related to HSV color based
segmentation. In order to see the segmentation results, I need to visualize
HSV point cloud. A possible workaround was to convert back to RGB but the
function doesn't exit. What to do?



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: PCLVisualizer is showing black and white HSV Point Cloud

ravijoshi
Done.

I found
[here](https://github.com/PointCloudLibrary/pcl/blob/master/common/include/pcl/point_types_conversion.h#L180)
PointXYZHSVtoXYZRGB function, which converts a XYZHSV point type to a
XYZRGB. So I added following function PointCloudXYZHSVtoXYZRGB in my code
and it works!

----------------------------------------------------------------------------------
typedef PointCloud<PointXYZRGB> PointCloudXYZRGB;
typedef PointCloud<PointXYZHSV> PointCloudXYZHSV;

void PointCloudXYZHSVtoXYZRGB(const PointCloudXYZHSV& in, PointCloudXYZRGB&
out)
{
    out.width = in.width;
    out.height = in.height;
    for (size_t i = 0; i < in.points.size(); i++)
    {
        PointXYZRGB p;
        PointXYZHSVtoXYZRGB(in.points[i], p);
        out.points.push_back(p);
    }
}
----------------------------------------------------------------------------------



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users