PointCloudLibrary/pcl — pull request #204 by taketwo (2013-07-28 19:28:03+00:00)
Title: Add a generic `savePNGFile()` function

This pull request introduces a new `savePNGFile()` function as discussed in this thread: http://www.pcl-developers.org/A-generic-savePNGFile-function-td5707976.html.

The function accepts the name of the field which should be used to extract image data. Currently "rgb", "normal", "label", "z", "curvature", and "intensity" fields are supported. The underlying implementation is driven by a set of `PointCloudImageExtractorFrom...Field` classes which know how to extract data from a particular field (applying additional scaling as necessary).

There are tests for all Image Extractors.

Additionally there is a new application "pcd2png" in the "tools" module which uses the new functionality.

There are three things that should be discussed before merging this pull request:

1) The new tool "pcd2png" obsoletes "organized_pcd_to_png". Should it be removed?
2) There exist a version of `savePNGFile()` with the following signature:
```cpp
void savePNGFile (const std::string& file_name, const pcl::PointCloud& cloud);
```
Should it be removed in favor of using `savePNGFile("blah.png", cloud, "label")`?
3) There exist a templated version of `savePNGFile()` with the following signature:
```cpp
template void
savePNGFile (const std::string& file_name, const pcl::PointCloud& cloud)
```
It uses "r", "g", and "b" field of a point cloud (if exist, otherwise it fails to compile, of course). Should it be removed in favor of using `savePNGFile("blah.png", cloud, "rgb")`?