From de931b95f6dc358b20fdfdf493013fcd673ac70a Mon Sep 17 00:00:00 2001 From: rimio Date: Thu, 10 Jan 2019 01:29:40 +0200 Subject: PD120 somewhat working --- src/tools/sstv-encode.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) (limited to 'src/tools/sstv-encode.cpp') diff --git a/src/tools/sstv-encode.cpp b/src/tools/sstv-encode.cpp index 3919968..51b5a33 100644 --- a/src/tools/sstv-encode.cpp +++ b/src/tools/sstv-encode.cpp @@ -7,11 +7,11 @@ #include #include -#include #include #include -#include "cimg/CImg.h" +#include +#include extern "C" { #include @@ -50,12 +50,62 @@ int main(int argc, char **argv) /* TODO: parse SSTV mode */ sstv_mode_t mode = SSTV_MODE_PD120; - /* load image from file (TODO: perform normalization from source to desired properties) */ + /* get image properties for chosen mode */ + size_t width, height; + sstv_image_format_t format; + if (sstv_get_mode_image_props(mode, &width, &height, &format) != SSTV_OK) { + LOG(FATAL) << "sstv_get_mode_image_props() failed"; + } + + /* load image from file */ LOG(INFO) << "Loading image from " << FLAGS_input; - cimg_library::CImg input_image = (cimg_library::CImg<>(FLAGS_input.c_str())).RGBtoYCbCr(); + + Magick::Image image; + std::string map = ""; + uint8_t *image_buffer = NULL; + + try { + /* load from file */ + image.read(FLAGS_input); + + /* resize */ + LOG(INFO) << "Resizing to " << width << "x"<