2022-04-12 20:18:44 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "viewer.h"
|
|
|
|
|
|
|
|
|
|
#include "logger.h"
|
2022-04-13 13:40:44 +02:00
|
|
|
#include "products/image_products.h"
|
2022-04-12 20:18:44 +02:00
|
|
|
#include "common/widgets/image_view.h"
|
|
|
|
|
#include "imgui/imgui_stdlib.h"
|
|
|
|
|
#include "common/image/composite.h"
|
|
|
|
|
#include "main_ui.h"
|
2022-05-02 18:59:03 +02:00
|
|
|
#include "core/style.h"
|
2022-05-04 19:50:23 +02:00
|
|
|
#include "imgui/pfd/portable-file-dialogs.h"
|
2022-04-12 20:18:44 +02:00
|
|
|
|
|
|
|
|
namespace satdump
|
|
|
|
|
{
|
|
|
|
|
class ImageViewerHandler : public ViewerHandler
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
// Products
|
|
|
|
|
ImageProducts *products;
|
|
|
|
|
|
|
|
|
|
// Image handling
|
2022-04-13 17:51:30 +02:00
|
|
|
int active_channel_id = 0, select_image_id = 1;
|
2022-04-12 20:18:44 +02:00
|
|
|
std::string select_image_str;
|
|
|
|
|
image::Image<uint16_t> rgb_image, current_image;
|
|
|
|
|
std::vector<image::Image<uint16_t>> images_obj;
|
|
|
|
|
ImageViewWidget image_view;
|
|
|
|
|
|
|
|
|
|
// Other controls
|
2022-04-27 14:31:36 +02:00
|
|
|
bool median_blur = false;
|
2022-04-12 20:18:44 +02:00
|
|
|
bool rotate_image = false;
|
|
|
|
|
bool equalize_image = false;
|
|
|
|
|
bool invert_image = false;
|
2022-04-12 21:37:36 +02:00
|
|
|
bool normalize_image = false;
|
2022-04-13 13:40:44 +02:00
|
|
|
bool white_balance_image = false;
|
2022-04-12 20:18:44 +02:00
|
|
|
|
|
|
|
|
// RGB Handling
|
2022-04-20 15:57:17 +02:00
|
|
|
ImageCompositeCfg rgb_compo_cfg;
|
2022-04-12 20:18:44 +02:00
|
|
|
std::vector<std::string> channel_numbers;
|
|
|
|
|
float rgb_progress = 0;
|
|
|
|
|
bool rgb_processing = false;
|
2022-04-20 15:57:17 +02:00
|
|
|
std::vector<std::pair<std::string, ImageCompositeCfg>> rgb_presets;
|
2022-04-12 20:18:44 +02:00
|
|
|
std::string rgb_presets_str;
|
|
|
|
|
int select_rgb_presets = -1;
|
|
|
|
|
|
2022-05-12 14:18:26 +02:00
|
|
|
// Warp/Project
|
|
|
|
|
int warp_project_width = 2048;
|
|
|
|
|
int warp_project_height = 1024;
|
|
|
|
|
|
2022-04-12 20:18:44 +02:00
|
|
|
void init();
|
|
|
|
|
void updateImage();
|
|
|
|
|
|
|
|
|
|
std::mutex async_image_mutex;
|
|
|
|
|
void asyncUpdate();
|
|
|
|
|
void updateRGB();
|
|
|
|
|
|
|
|
|
|
void drawMenu();
|
|
|
|
|
void drawContents(ImVec2 win_size);
|
2022-04-16 08:10:25 +02:00
|
|
|
float drawTreeMenu();
|
2022-04-12 20:18:44 +02:00
|
|
|
|
|
|
|
|
static std::string getID() { return "image_handler"; }
|
|
|
|
|
static std::shared_ptr<ViewerHandler> getInstance() { return std::make_shared<ImageViewerHandler>(); }
|
|
|
|
|
};
|
|
|
|
|
}
|