-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sensors] Encapsulate VTK image readers and writers
The file format is now a first-class citizen, passed as an argument, and reading or writing from files or a memory buffer are now equally well supported. Switch LCM image receiver system to use the VTK PNG decoder instead of custom code. Solve the VTK TIFF upside down dilemma noted in a prior glTF render engine TODO comment. Add acceptance test for write-and-readback.
- Loading branch information
1 parent
b8644b8
commit 287327c
Showing
11 changed files
with
537 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "drake/systems/sensors/image_file_format.h" | ||
|
||
#include "drake/common/drake_assert.h" | ||
|
||
namespace drake { | ||
namespace systems { | ||
namespace sensors { | ||
|
||
std::string to_string(ImageFileFormat format) { | ||
switch (format) { | ||
case ImageFileFormat::kJpeg: | ||
return "jpeg"; | ||
case ImageFileFormat::kPng: | ||
return "png"; | ||
case ImageFileFormat::kTiff: | ||
return "tiff"; | ||
} | ||
DRAKE_UNREACHABLE(); | ||
} | ||
|
||
} // namespace sensors | ||
} // namespace systems | ||
} // namespace drake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
#include "drake/common/fmt.h" | ||
|
||
namespace drake { | ||
namespace systems { | ||
namespace sensors { | ||
|
||
/** The image file formats known to Drake. */ | ||
enum class ImageFileFormat { | ||
/** mime-type: image/jpeg. */ | ||
kJpeg, | ||
/** mime-type: image/png. */ | ||
kPng, | ||
/** mime-type: image/tiff. */ | ||
kTiff, | ||
}; | ||
|
||
std::string to_string(ImageFileFormat); | ||
|
||
} // namespace sensors | ||
} // namespace systems | ||
} // namespace drake | ||
|
||
DRAKE_FORMATTER_AS(, drake::systems::sensors, ImageFileFormat, x, | ||
drake::systems::sensors::to_string(x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.