-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpscaler.h
27 lines (22 loc) · 999 Bytes
/
Upscaler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef UPSCALER_H
#define UPSCALER_H
#include "ESRGAN.h"
#include <QImage>
class Upscaler
{
private:
Axodox::MachineLearning::OnnxEnvironment* Env;
std::unique_ptr<Axodox::MachineLearning::ESRGAN> Model;
bool Loaded;
void Destroy();
QList<QImage> SplitImageIntoChunks(const QImage& image, int chunkSize = 128, int overlap = 48);
QImage RemoveOverlapFromChunk(const QImage& chunk, const QSize& finalChunkSize, const QSize& originalSize, int overlap, int xPosition, int yPosition);
QImage JoinImageChunks(const QList<QImage>& chunks, const QSize& finalChunkSize, const QSize& originalSize, int overlap);
public:
Upscaler();
void Load(const std::string& ModelPath);
QImage UpscaleImg(const QImage& InImg, uint32_t TileSize, uint32_t Overlap = 48, Axodox::Threading::async_operation_source* async_src = nullptr);
bool IsLoaded() { return Loaded; }
void SetEnv(Axodox::MachineLearning::OnnxEnvironment* InEnv) { Env = InEnv; }
};
#endif // UPSCALER_H