Fix some issues with the image converter

This commit is contained in:
nsubiron 2017-09-19 18:59:36 +02:00
parent 99158bfb6e
commit 2d140ce657
5 changed files with 11 additions and 6 deletions

3
Util/ImageConverter/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
bin
images
converted_images

View File

@ -8,10 +8,12 @@ EXE=image_converter
build: release
release: $(SOURCES) $(HEADERS)
$(CXX) $(FLAGS) -O3 -DNDEBUG -o $(EXE) $(SOURCES) $(LIBS)
@mkdir -p bin
$(CXX) $(FLAGS) -O3 -DNDEBUG -o bin/$(EXE) $(SOURCES) $(LIBS)
debug: $(SOURCES) $(HEADERS)
$(CXX) $(FLAGS) -O0 -g -D_DEBUG -o $(EXE)_debug $(SOURCES) $(LIBS)
@mkdir -p bin
$(CXX) $(FLAGS) -O0 -g -D_DEBUG -o bin/$(EXE)_debug $(SOURCES) $(LIBS)
clean:
rm -f $(EXE) $(EXE)_debug

View File

@ -4,4 +4,4 @@ Image Converter
Converts output images of depth and semantic segmentation to a prettier format.
make
./image_converter -h
./bin/image_converter -h

Binary file not shown.

View File

@ -19,6 +19,7 @@ enum MainFunctionReturnValues {
};
namespace fs = boost::filesystem;
namespace po = boost::program_options;
using pixel_converter_function = std::function<void(boost::gil::rgb8_pixel_t &)>;
@ -30,7 +31,7 @@ static pixel_converter_function get_pixel_converter(const std::string &name) {
} else if (name == "logdepth") {
return image_converter::logarithmic_depth_pixel_converter();
} else {
throw std::invalid_argument("invalid converter, please choose \"semseg\", \"depth\", or \"logdepth\"");
throw po::error("invalid converter, please choose \"semseg\", \"depth\", or \"logdepth\"");
}
}
@ -99,7 +100,6 @@ int main(int argc, char *argv[]) {
fs::path output_folder;
// Fill program options.
namespace po = boost::program_options;
po::options_description desc("Allowed options");
desc.add_options()
("help,h", "produce help message")
@ -138,7 +138,7 @@ int main(int argc, char *argv[]) {
do_the_thing(input_folder, output_folder, converter);
} catch (const std::invalid_argument &e) {
} catch (const po::error &e) {
std::cerr << desc << "\n" << e.what() << std::endl;
return InvalidArgument;
}