40 lines
1.4 KiB
C++
40 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "RasterRendererBase.h"
|
|
#include "RasterRenderParams.h"
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
class RasterDataProvider;
|
|
|
|
class MultibandRasterRenderer : public RasterRendererBase
|
|
{
|
|
public:
|
|
explicit MultibandRasterRenderer(RasterDataProvider* provider);
|
|
|
|
QImage render() override;
|
|
|
|
// Parameter access
|
|
MultibandRenderParams params() const { return m_params; }
|
|
void setParams(const MultibandRenderParams& params) { m_params = params; }
|
|
|
|
void setStretchRatio(float ratio) { m_stretchRatio = ratio; }
|
|
float stretchRatio() const { return m_stretchRatio; }
|
|
|
|
private:
|
|
MultibandRenderParams m_params;
|
|
float m_stretchRatio = 0.02f;
|
|
|
|
// Helper to map float buffer to 8-bit with min/max stretch
|
|
static void stretchTo8bit(const std::vector<float>& in, std::vector<unsigned char>& out, float minVal, float maxVal);
|
|
|
|
// Helper to compute histogram from float buffer
|
|
static void computeHistogram(const std::vector<float>& in, std::vector<long>& hist, float& minVal, float& maxVal);
|
|
|
|
// Helper to find stretch values by cumulative histogram ratio
|
|
static void findStretchValuesByRatio(const std::vector<long>& hist, float ratio, float& minVal, float& maxVal);
|
|
|
|
// Helper to stretch to 8-bit using histogram-based stretch
|
|
static void stretchTo8bitByHistogram(const std::vector<float>& in, std::vector<unsigned char>& out, float minVal, float maxVal);
|
|
};
|