if( !cloud->empty() ){
// Create cv::Mat
image = cv::Mat( cloud->height, cloud->width, CV_8UC4 );
// pcl::PointCloud to cv::Mat
#pragma omp parallel for
for( int y = 0; y < image.rows; y++ ) {
for( int x = 0; x < image.cols; x++ ) {
pcl::PointXYZRGBA point = cloud->at( x, y );
image.at<cv::Vec4b>( y, x )[0] = point.b;
image.at<cv::Vec4b>( y, x )[1] = point.g;
image.at<cv::Vec4b>( y, x )[2] = point.r;
image.at<cv::Vec4b>( y, x )[3] = point.a;
}
}
}