satdump/src-core/handler/image/image_handler.h
2025-05-02 22:47:40 +02:00

87 lines
No EOL
2.8 KiB
C++

#pragma once
#include "../handler.h"
#include "../processing_handler.h"
#include "common/image/hue_saturation_json.h"
#include "common/image/meta.h"
#include "common/widgets/image_view.h"
#include "nlohmann/json.hpp"
#include "projection/projection.h"
namespace satdump
{
namespace viewer
{
class ImageHandler : public Handler, public ProcessingHandler
{
public:
ImageHandler();
ImageHandler(image::Image img);
ImageHandler(image::Image img, std::string name);
~ImageHandler();
std::string image_name = "Unknown Image";
bool imgview_needs_update = false;
bool has_second_image = false;
image::Image image, curr_image;
ImageViewWidget image_view;
image::Image &get_current_img() { return has_second_image ? curr_image : image; }
void updateImage(image::Image &img); // TODOREWORK
// All params
bool huesaturation_img = false;
image::HueSaturation huesaturation_cfg_img;
bool equalize_img = false;
bool equalize_perchannel_img = false;
bool white_balance_img = false;
bool normalize_img = false;
bool invert_img = false;
bool median_blur_img = false;
bool despeckle_img = false;
bool rotate180_image = false;
bool geocorrect_image = false;
bool brightness_contrast_image = false;
float brightness_contrast_brightness_image = 0.0;
float brightness_contrast_constrast_image = 0.0;
bool remove_background_img = false;
// Proj/Calib TODOREWORK
bool image_calib_valid = false;
image::ImgCalibHandler image_calib;
bool image_proj_valid = false;
proj::Projection image_proj;
std::vector<float> correct_fwd_lut; // TODOREWORK handle this better?
std::vector<float> correct_rev_lut;
// TODOREWORK File save
bool file_save_thread_running = false;
std::thread file_save_thread;
// Proc function
void do_process();
// Mouse callback to be added by other handlers if needed
std::function<void(int x, int y)> additionalMouseCallback = [](int, int) {};
std::string getSaneName();
void saveResult(std::string directory);
// The Rest
void drawMenu();
void drawContents(ImVec2 win_size);
void drawMenuBar();
void setConfig(nlohmann::json p);
nlohmann::json getConfig();
std::string getName() { return image_name; }
std::string getID() { return "image_handler"; }
};
} // namespace viewer
} // namespace satdump