---[ */
| 124 | |
| 125 | /* ---[ */ |
| 126 | int |
| 127 | main (int argc, char** argv) |
| 128 | { |
| 129 | print_info ("Convert a (or two with color and depth) PNG file to PCD format. For more information, use: %s -h\n", argv[0]); |
| 130 | |
| 131 | if (argc < 3) |
| 132 | { |
| 133 | printHelp (argc, argv); |
| 134 | return (-1); |
| 135 | } |
| 136 | |
| 137 | // Parse the command line arguments for .vtk and .ply files |
| 138 | std::vector<int> png_file_indices = parse_file_extension_argument (argc, argv, ".png"); |
| 139 | std::vector<int> pcd_file_indices = parse_file_extension_argument (argc, argv, ".pcd"); |
| 140 | |
| 141 | if ((png_file_indices.size () != 1 && png_file_indices.size () != 2) || pcd_file_indices.size () != 1) |
| 142 | { |
| 143 | print_error ("Need one/two input PNG file and one output PCD file.\n"); |
| 144 | return (-1); |
| 145 | } |
| 146 | |
| 147 | // Command line parsing |
| 148 | bool format = false; |
| 149 | parse_argument (argc, argv, "-format", format); |
| 150 | print_info ("PCD output format: "); print_value ("%s\n", (format ? "binary" : "ascii")); |
| 151 | |
| 152 | std::string mode = "DEFAULT"; |
| 153 | if (parse_argument (argc, argv, "-mode", mode) != -1) |
| 154 | { |
| 155 | if (! (mode == "DEFAULT" || mode == "FORCE_COLOR" || mode == "FORCE_GRAYSCALE") ) |
| 156 | { |
| 157 | std::cout << "Wrong mode name.\n"; |
| 158 | printHelp (argc, argv); |
| 159 | exit (-1); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | print_info ("%s mode selected.\n", mode.c_str ()); |
| 164 | |
| 165 | // Load the color input file |
| 166 | vtkSmartPointer<vtkImageData> color_image_data; |
| 167 | vtkSmartPointer<vtkPNGReader> color_reader = vtkSmartPointer<vtkPNGReader>::New (); |
| 168 | color_reader->SetFileName (argv[png_file_indices[0]]); |
| 169 | color_reader->Update (); |
| 170 | color_image_data = color_reader->GetOutput (); |
| 171 | |
| 172 | int components = color_image_data->GetNumberOfScalarComponents (); |
| 173 | int dimensions[3]; |
| 174 | color_image_data->GetDimensions (dimensions); |
| 175 | |
| 176 | // Load the depth input file |
| 177 | vtkSmartPointer<vtkImageData> depth_image_data; |
| 178 | vtkSmartPointer<vtkPNGReader> depth_reader; |
| 179 | bool enable_depth = false; |
| 180 | float v_viewing_angle = 43.0f; |
| 181 | float h_viewing_angle = 57.0f; |
| 182 | float depth_unit_magic = 1000.0f; |
| 183 | if (png_file_indices.size () == 2) |
nothing calls this directly
no test coverage detected