TMC3.cpp 18.1 KB
Newer Older
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
1
/* The copyright in this software is being made available under the BSD
David Flynn's avatar
David Flynn committed
2
3
4
 * Licence, included below.  This software may be subject to other third
 * party and contributor rights, including patent rights, and no such
 * rights are granted under this licence.
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
5
 *
David Flynn's avatar
David Flynn committed
6
 * Copyright (c) 2017-2018, ISO/IEC
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
7
8
9
10
11
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
David Flynn's avatar
David Flynn committed
12
13
14
15
16
17
18
19
20
21
 * * Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 *
 * * Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 *
 * * Neither the name of the ISO/IEC nor the names of its contributors
 *   may be used to endorse or promote products derived from this
 *   software without specific prior written permission.
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
22
23
24
25
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
David Flynn's avatar
David Flynn committed
26
27
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
28
29
30
31
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
David Flynn's avatar
David Flynn committed
32
33
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
34
35
36
 */

#include "TMC3.h"
37
#include "program_options_lite.h"
38
#include "version.h"
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
39
40
41
42

using namespace std;
using namespace pcc;

43
44
45
int
main(int argc, char* argv[])
{
46
  cout << "MPEG PCC tmc3 version " << ::pcc::version << endl;
47

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
48
49
50
51
  Parameters params;
  if (!ParseParameters(argc, argv, params)) {
    return -1;
  }
52
53
54
55
56
57
58

  // Timers to count elapsed wall/user time
  pcc::chrono::Stopwatch<std::chrono::steady_clock> clock_wall;
  pcc::chrono::Stopwatch<pcc::chrono::utime_inc_children_clock> clock_user;

  clock_wall.start();

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
59
  int ret = 0;
60
61
62
63
  if (
    params.mode == CODEC_MODE_ENCODE
    || params.mode == CODEC_MODE_ENCODE_LOSSLESS_GEOMETRY
    || params.mode == CODEC_MODE_ENCODE_TRISOUP_GEOMETRY) {
64
    ret = Compress(params, clock_user);
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
65
  } else {
66
    ret = Decompress(params, clock_user);
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
67
68
  }

69
70
71
72
73
74
75
76
  clock_wall.stop();

  using namespace std::chrono;
  auto total_wall = duration_cast<milliseconds>(clock_wall.count()).count();
  auto total_user = duration_cast<milliseconds>(clock_user.count()).count();
  std::cout << "Processing time (wall): " << total_wall / 1000.0 << " s\n";
  std::cout << "Processing time (user): " << total_user / 1000.0 << " s\n";

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
77
78
79
  return ret;
}

80
81
82
//---------------------------------------------------------------------------
// :: Command line / config parsing helpers

83
84
85
86
template<typename T>
static std::istream&
readUInt(std::istream& in, T& val)
{
87
88
89
90
91
92
  unsigned int tmp;
  in >> tmp;
  val = T(tmp);
  return in;
}

93
94
95
static std::istream&
operator>>(std::istream& in, CodecMode& val)
{
96
  return readUInt(in, val);
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
97
98
}

99
100
101
static std::istream&
operator>>(std::istream& in, ColorTransform& val)
{
102
103
104
  return readUInt(in, val);
}

105
namespace pcc {
106
107
108
static std::istream&
operator>>(std::istream& in, TransformType& val)
{
109
  return readUInt(in, val);
110
111
}
}  // namespace pcc
112

113
namespace pcc {
114
115
116
static std::istream&
operator>>(std::istream& in, GeometryCodecType& val)
{
117
  return readUInt(in, val);
118
119
}
}  // namespace pcc
120

121
namespace pcc {
122
123
124
static std::ostream&
operator<<(std::ostream& out, const TransformType& val)
{
125
126
  switch (val) {
  case TransformType::kIntegerLift: out << "0 (IntegerLifting)"; break;
127
  case TransformType::kRAHT: out << "1 (RAHT)"; break;
128
  case TransformType::kLift: out << "2 (Lift)"; break;
129
130
  }
  return out;
131
132
}
}  // namespace pcc
133

134
namespace pcc {
135
136
137
static std::ostream&
operator<<(std::ostream& out, const GeometryCodecType& val)
{
138
  switch (val) {
139
140
  case GeometryCodecType::kBypass: out << "0 (Bypass)"; break;
  case GeometryCodecType::kOctree: out << "1 (TMC1 Octree)"; break;
141
142
143
  case GeometryCodecType::kTriSoup: out << "2 (TMC3 TriSoup)"; break;
  }
  return out;
144
145
}
}  // namespace pcc
146

147
148
149
//---------------------------------------------------------------------------
// :: Command line / config parsing

150
151
152
bool
ParseParameters(int argc, char* argv[], Parameters& params)
{
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
  namespace po = df::program_options_lite;

  PCCAttributeEncodeParamaters params_attr;
  bool print_help = false;

  // a helper to set the attribute
  std::function<po::OptionFunc::Func> attribute_setter =
    [&](po::Options&, const std::string& name, po::ErrorReporter) {
      // copy the current state of parsed attribute parameters
      //
      // NB: this does not cause the default values of attr to be restored
      // for the next attribute block.  A side-effect of this is that the
      // following is allowed leading to attribute foo having both X=1 and
      // Y=2:
      //   "--attr.X=1 --attribute foo --attr.Y=2 --attribute foo"
      //
      params.encodeParameters.attributeEncodeParameters[name] = params_attr;
    };

172
  /* clang-format off */
173
174
175
176
177
178
179
180
181
182
183
  // The definition of the program/config options, along with default values.
  //
  // NB: when updating the following tables:
  //      (a) please keep to 80-columns for easier reading at a glance,
  //      (b) do not vertically align values -- it breaks quickly
  //
  po::Options opts;
  opts.addOptions()
  ("help", print_help, false, "this help text")
  ("config,c", po::parseConfigFile, "configuration file name")

184
185
  (po::Section("General"))

186
  ("mode", params.mode, CODEC_MODE_ENCODE,
187
188
189
190
191
192
    "The encoding/decoding mode:\n"
    "  0: encode\n"
    "  1: decode\n"
    // NB: the following forms are deprecated
    "  2: encode with lossless geometry\n"
    "  3: decode with lossless geometry")
193
194
195

  // i/o parameters
  ("reconstructedDataPath",
196
197
    params.reconstructedDataPath, {},
    "The ouput reconstructed pointcloud file path (decoder only)")
198
199

  ("uncompressedDataPath",
200
201
    params.uncompressedDataPath, {},
    "The input pointcloud file path")
202
203

  ("compressedStreamPath",
204
205
    params.compressedStreamPath, {},
    "The compressed bitstream path (encoder=output, decoder=input)")
206

207
  ("postRecolorPath",
208
209
    params.encodeParameters.postRecolorPath, {},
    "Recolored pointcloud file path (encoder only)")
210
211

  ("preInvScalePath",
212
213
    params.decodeParameters.preInvScalePath, {},
    "Pre inverse scaled pointcloud file path (decoder only)")
214

215
216
  // general
  ("colorTransform",
217
218
219
220
    params.colorTransform, COLOR_TRANSFORM_RGB_TO_YCBCR,
    "The colour transform to be applied:\n"
    "  0: none\n"
    "  1: RGB to YCbCr (Rec.709)")
221

222
223
224
225
226
227
228
229
  (po::Section("Decoder"))

  ("roundOutputPositions",
    params.decodeParameters.roundOutputPositions, false,
    "todo(kmammou)")

  (po::Section("Encoder"))

230
  ("positionQuantizationScale",
231
232
    params.encodeParameters.positionQuantizationScale, 1.,
    "Scale factor to be applied to point positions during quantization process")
233
234

  ("mergeDuplicatedPoints",
235
236
    params.encodeParameters.mergeDuplicatedPoints, true,
    "Enables removal of duplicated points")
237

238
  (po::Section("Geometry"))
239

240
  // tools
241
  ("geometryCodec",
242
243
244
245
246
    params.encodeParameters.geometryCodec, GeometryCodecType::kOctree,
    "Controls the method used to encode geometry:"
    "  0: bypass (a priori)\n"
    "  1: octree (TMC3)\n"
    "  2: trisoup (TMC1)")
247

248
249
250
  ("neighbourContextRestriction",
    params.encodeParameters.neighbourContextRestriction, false,
    "Limit geometry octree occupancy contextualisation to sibling nodes")
251

252
253
254
255
256
  ("neighbourAvailBoundaryLog2",
    params.encodeParameters.neighbourAvailBoundaryLog2, 0,
    "Defines the avaliability volume for neighbour occupancy lookups."
    " 0: unconstrained")

257
  ("inferredDirectCodingMode",
258
259
    params.encodeParameters.inferredDirectCodingModeEnabled, true,
    "Permits early termination of the geometry octree for isolated points")
260

261
262
  // (trisoup) geometry parameters
  ("triSoupDepth",  // log2(maxBB+1), where maxBB+1 is analogous to image width
263
264
    params.encodeParameters.triSoup.depth, 10,
    "Depth of voxels (reconstructed points) in trisoup geometry")
265
266

  ("triSoupLevel",
267
268
    params.encodeParameters.triSoup.level, 7,
    "Level of triangles (reconstructed surface) in trisoup geometry")
269
270

  ("triSoupIntToOrigScale",  // reciprocal of positionQuantizationScale
271
272
    params.encodeParameters.triSoup.intToOrigScale, 1.,
    "orig_coords = integer_coords * intToOrigScale + intToOrigTranslation")
273
274

  ("triSoupIntToOrigTranslation",
275
276
    params.encodeParameters.triSoup.intToOrigTranslation, {0., 0., 0.},
    "orig_coords = integer_coords * intToOrigScale + intToOrigTranslation")
277

278
279
  (po::Section("Attributes"))

280
281
282
  // attribute processing
  //   NB: Attribute options are special in the way they are applied (see above)
  ("attribute",
283
284
285
    attribute_setter,
    "Encode the given attribute (NB, must appear after the"
    "following attribute parameters)")
286

287
  ("transformType",
288
289
290
    params_attr.transformType, TransformType::kIntegerLift,
    "Coding method to use for attribute:\n"
    "  0: Nearest neighbour prediction with integer lifting transform\n"
291
292
    "  1: Region Adaptive Hierarchical Transform (RAHT)\n"
    "  2: Nearest neighbour prediction with lifting transform")
293

294
  ("rahtLeafDecimationDepth",
295
296
297
    params_attr.binaryLevelThresholdRaht, 3,
    "Sets coefficients to zero in the bottom n levels of RAHT tree. "
    "Used for chroma-subsampling in attribute=color only.")
298

299
  ("rahtQuantizationStep",
300
301
    params_attr.quantizationStepRaht, 1,
    "Quantization step size used in RAHT")
302
303

  ("rahtDepth",
304
305
306
    params_attr.depthRaht, 21,
    "Number of bits for morton representation of an RAHT co-ordinate"
    "component")
307

308
  ("numberOfNearestNeighborsInPrediction",
309
310
    params_attr.numberOfNearestNeighborsInPrediction, size_t(4),
    "Attribute's maximum number of nearest neighbors to be used for prediction")
311
312

  ("levelOfDetailCount",
313
314
    params_attr.levelOfDetailCount, size_t(6),
    "Attribute's number of levels of detail")
315
316

  ("quantizationSteps",
317
318
319
320
321
322
323
324
325
326
    params_attr.quantizationStepsLuma, {},
    "deprecated -- use quantizationStepsLuma/Chroma")

  ("quantizationStepsLuma",
    params_attr.quantizationStepsLuma, {},
    "Attribute's luma quantization step sizes (one for each LoD)")

  ("quantizationStepsChroma",
    params_attr.quantizationStepsChroma, {},
    "Attribute's chroma quantization step sizes (one for each LoD)")
327
328

  ("dist2", params_attr.dist2, {},
329
    "Attribute's list of squared distances (one for each LoD)")
330
  ;
331
  /* clang-format on */
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346

  po::setDefaults(opts);
  po::ErrorReporter err;
  const list<const char*>& argv_unhandled =
    po::scanArgv(opts, argc, (const char**)argv, err);

  for (const auto arg : argv_unhandled) {
    err.warn() << "Unhandled argument ignored: " << arg << "\n";
  }

  if (argc == 1 || print_help) {
    po::doHelp(std::cout, opts, 78);
    return false;
  }

347
348
349
350
351
352
353
354
355
356
357
358
  // Set GeometryCodecType according to codec mode
  // NB: for bypass, the decoder must load the a priori geometry
  if (params.mode == 2 || params.mode == 3) {
    params.encodeParameters.geometryCodec = GeometryCodecType::kBypass;
  }
  if (params.mode == 4) {
    params.encodeParameters.geometryCodec = GeometryCodecType::kTriSoup;
  }

  // Restore params.mode to be encode vs decode
  params.mode = CodecMode(params.mode & 1);

359
  // For trisoup, ensure that positionQuantizationScale is the exact inverse of intToOrigScale.
360
  if (params.encodeParameters.geometryCodec == GeometryCodecType::kTriSoup) {
361
    params.encodeParameters.positionQuantizationScale =
362
      1.0 / params.encodeParameters.triSoup.intToOrigScale;
363
364
  }

365
  // For RAHT, ensure that the unused lod count = 0 (prevents mishaps)
366
  for (auto& attr : params.encodeParameters.attributeEncodeParameters) {
367
    if (attr.second.transformType == TransformType::kRAHT) {
368
369
370
371
      attr.second.levelOfDetailCount = 0;
    }
  }

372
  // sanity checks
373
  //  - validate that quantizationStepsLuma/Chroma, dist2
374
  //    of each attribute contain levelOfDetailCount elements.
375
  for (const auto& attr : params.encodeParameters.attributeEncodeParameters) {
376
377
    if (attr.second.transformType == TransformType::kIntegerLift) {
      int lod = attr.second.levelOfDetailCount;
378

379
380
      if (lod > 255) {
        err.error() << attr.first
381
                    << ".levelOfDetailCount must be less than 256\n";
382
      }
383
      // todo(df): the following two checks are removed in m42640/2
384
      if (attr.second.dist2.size() != lod) {
385
386
        err.error() << attr.first << ".dist2 does not have " << lod
                    << " entries\n";
387
      }
388
389
390
391
392
393
394
395
396
397
      if (attr.second.quantizationStepsLuma.size() != lod) {
        err.error() << attr.first << ".quantizationStepsLuma does not have "
                    << lod << " entries\n";
      }
      if (attr.first == "color") {
        if (attr.second.quantizationStepsChroma.size() != lod) {
          err.error() << attr.first
                      << ".quantizationStepsChroma does not have " << lod
                      << " entries\n";
        }
398
      }
399
400
401
402
403
      if (
        attr.second.numberOfNearestNeighborsInPrediction
        > PCCTMC3MaxPredictionNearestNeighborCount) {
        err.error()
          << attr.first
404
405
406
          << ".numberOfNearestNeighborsInPrediction must be less than "
          << PCCTMC3MaxPredictionNearestNeighborCount << "\n";
      }
407
    }
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
408
409
  }

410
411
  // check required arguments are specified

412
  const bool encode = params.mode == CODEC_MODE_ENCODE;
413
414
415
416
417
418
419
420
421
422
423
424

  if (encode && params.uncompressedDataPath.empty())
    err.error() << "uncompressedDataPath not set\n";

  if (!encode && params.reconstructedDataPath.empty())
    err.error() << "reconstructedDataPath not set\n";

  if (params.compressedStreamPath.empty())
    err.error() << "compressedStreamPath not set\n";

  // currently the attributes with lossless geometry require the source data
  // todo(?): remove this dependency by improving reporting
425
426
427
  if (
    params.encodeParameters.geometryCodec == GeometryCodecType::kBypass
    && params.uncompressedDataPath.empty())
428
429
430
431
432
433
434
    err.error() << "uncompressedDataPath not set\n";

  // report the current configuration (only in the absence of errors so
  // that errors/warnings are more obvious and in the same place).
  if (err.is_errored)
    return false;

435
436
  // Dump the complete derived configuration
  cout << "+ Effective configuration parameters\n";
437

438
439
440
  po::dumpCfg(cout, opts, "General", 4);
  if (params.mode == CODEC_MODE_DECODE) {
    po::dumpCfg(cout, opts, "Decoder", 4);
441
  } else {
442
443
444
445
446
447
448
449
450
    po::dumpCfg(cout, opts, "Encoder", 4);
    po::dumpCfg(cout, opts, "Geometry", 4);

    for (const auto& it : params.encodeParameters.attributeEncodeParameters) {
      // NB: when dumping the config, opts references params_attr
      params_attr = it.second;
      cout << "    " << it.first << "\n";
      po::dumpCfg(cout, opts, "Attributes", 8);
    }
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
451
452
  }

453
454
  cout << endl;

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
455
456
  return true;
}
457

458
459
460
int
Compress(const Parameters& params, Stopwatch& clock)
{
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
461
  PCCPointSet3 pointCloud;
462
463
464
  if (
    !pointCloud.read(params.uncompressedDataPath)
    || pointCloud.getPointCount() == 0) {
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
465
466
467
468
    cout << "Error: can't open input file!" << endl;
    return -1;
  }

469
470
  clock.start();

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
471
472
473
474
475
476
  if (params.colorTransform == COLOR_TRANSFORM_RGB_TO_YCBCR) {
    pointCloud.convertRGBToYUV();
  }
  PCCTMC3Encoder3 encoder;
  PCCBitstream bitstream = {};
  const size_t predictedBitstreamSize =
477
    encoder.estimateBitstreamSize(pointCloud, params.encodeParameters);
478
  std::unique_ptr<uint8_t[]> buffer(new uint8_t[predictedBitstreamSize]);
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
479
480
481
482
483
484
485
486
487
  bitstream.buffer = buffer.get();
  bitstream.capacity = predictedBitstreamSize;
  bitstream.size = 0;

  std::unique_ptr<PCCPointSet3> reconstructedPointCloud;
  if (!params.reconstructedDataPath.empty()) {
    reconstructedPointCloud.reset(new PCCPointSet3);
  }

488
  int ret = encoder.compress(
489
490
    pointCloud, params.encodeParameters, bitstream,
    reconstructedPointCloud.get());
491
  if (ret) {
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
492
493
494
    cout << "Error: can't compress point cloud!" << endl;
    return -1;
  }
495

496
497
  clock.stop();

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
498
499
500
501
502
503
  assert(bitstream.size <= bitstream.capacity);
  std::cout << "Total bitstream size " << bitstream.size << " B" << std::endl;
  ofstream fout(params.compressedStreamPath, ios::binary);
  if (!fout.is_open()) {
    return -1;
  }
504
  fout.write(reinterpret_cast<const char*>(bitstream.buffer), bitstream.size);
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
505
506
507
508
509
510
511
512
513
514
515
  fout.close();

  if (!params.reconstructedDataPath.empty()) {
    if (params.colorTransform == COLOR_TRANSFORM_RGB_TO_YCBCR) {
      reconstructedPointCloud->convertYUVToRGB();
    }
    reconstructedPointCloud->write(params.reconstructedDataPath, true);
  }

  return 0;
}
516
517
518
int
Decompress(const Parameters& params, Stopwatch& clock)
{
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
519
520
521
522
523
524
525
526
527
528
529
530
  PCCBitstream bitstream = {};
  ifstream fin(params.compressedStreamPath, ios::binary);
  if (!fin.is_open()) {
    return -1;
  }
  fin.seekg(0, std::ios::end);
  uint64_t bitStreamSize = fin.tellg();
  fin.seekg(0, std::ios::beg);
  unique_ptr<uint8_t[]> buffer(new uint8_t[bitStreamSize]);
  bitstream.buffer = buffer.get();
  bitstream.capacity = bitStreamSize;
  bitstream.size = 0;
531
  fin.read(reinterpret_cast<char*>(bitstream.buffer), bitStreamSize);
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
532
533
534
535
536
  if (!fin) {
    return -1;
  }
  fin.close();

537
538
  clock.start();

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
539
540
  PCCTMC3Decoder3 decoder;
  PCCPointSet3 pointCloud;
541
542
543

  // read a priori geometry from input file for bypass case
  if (params.encodeParameters.geometryCodec == GeometryCodecType::kBypass) {
544
545
546
    if (
      !pointCloud.read(params.uncompressedDataPath)
      || pointCloud.getPointCount() == 0) {
547
548
549
550
551
552
553
      cout << "Error: can't open input file!" << endl;
      return -1;
    }
    pointCloud.removeReflectances();
    pointCloud.removeColors();
  }

554
  int ret = decoder.decompress(params.decodeParameters, bitstream, pointCloud);
555
  if (ret) {
Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
556
557
558
559
560
561
562
563
564
565
    cout << "Error: can't decompress point cloud!" << endl;
    return -1;
  }
  assert(bitstream.size <= bitstream.capacity);
  std::cout << "Total bitstream size " << bitstream.size << " B" << std::endl;

  if (params.colorTransform == COLOR_TRANSFORM_RGB_TO_YCBCR) {
    pointCloud.convertYUVToRGB();
  }

566
567
  clock.stop();

Khaled Mammou's avatar
TMC3v0  
Khaled Mammou committed
568
569
570
571
572
573
  if (!pointCloud.write(params.reconstructedDataPath, true)) {
    cout << "Error: can't open output file!" << endl;
    return -1;
  }
  return 0;
}