Fix some issues with the image converter
This commit is contained in:
parent
99158bfb6e
commit
2d140ce657
|
@ -0,0 +1,3 @@
|
||||||
|
bin
|
||||||
|
images
|
||||||
|
converted_images
|
|
@ -8,10 +8,12 @@ EXE=image_converter
|
||||||
build: release
|
build: release
|
||||||
|
|
||||||
release: $(SOURCES) $(HEADERS)
|
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)
|
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:
|
clean:
|
||||||
rm -f $(EXE) $(EXE)_debug
|
rm -f $(EXE) $(EXE)_debug
|
||||||
|
|
|
@ -4,4 +4,4 @@ Image Converter
|
||||||
Converts output images of depth and semantic segmentation to a prettier format.
|
Converts output images of depth and semantic segmentation to a prettier format.
|
||||||
|
|
||||||
make
|
make
|
||||||
./image_converter -h
|
./bin/image_converter -h
|
||||||
|
|
Binary file not shown.
|
@ -19,6 +19,7 @@ enum MainFunctionReturnValues {
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
using pixel_converter_function = std::function<void(boost::gil::rgb8_pixel_t &)>;
|
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") {
|
} else if (name == "logdepth") {
|
||||||
return image_converter::logarithmic_depth_pixel_converter();
|
return image_converter::logarithmic_depth_pixel_converter();
|
||||||
} else {
|
} 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;
|
fs::path output_folder;
|
||||||
|
|
||||||
// Fill program options.
|
// Fill program options.
|
||||||
namespace po = boost::program_options;
|
|
||||||
po::options_description desc("Allowed options");
|
po::options_description desc("Allowed options");
|
||||||
desc.add_options()
|
desc.add_options()
|
||||||
("help,h", "produce help message")
|
("help,h", "produce help message")
|
||||||
|
@ -138,7 +138,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
do_the_thing(input_folder, output_folder, converter);
|
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;
|
std::cerr << desc << "\n" << e.what() << std::endl;
|
||||||
return InvalidArgument;
|
return InvalidArgument;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue