Merge pull request #4891 from Beep6581/show_flatfield_autoclip_in_gui
Flat field: Show auto calculated clip control value in ui
This commit is contained in:
commit
eee6837385
@ -83,6 +83,7 @@ public:
|
||||
virtual void setBorder (unsigned int border) {}
|
||||
virtual void setCurrentFrame (unsigned int frameNum) = 0;
|
||||
virtual int getFrameCount () = 0;
|
||||
virtual int getFlatFieldAutoClipValue () = 0;
|
||||
|
||||
|
||||
// use right after demosaicing image, add coarse transformation and put the result in the provided Imagefloat*
|
||||
|
@ -93,7 +93,7 @@ ImProcCoordinator::ImProcCoordinator()
|
||||
fw(0), fh(0), tr(0),
|
||||
fullw(1), fullh(1),
|
||||
pW(-1), pH(-1),
|
||||
plistener(nullptr), imageListener(nullptr), aeListener(nullptr), acListener(nullptr), abwListener(nullptr), awbListener(nullptr), bayerAutoContrastListener(nullptr), xtransAutoContrastListener(nullptr), frameCountListener(nullptr), imageTypeListener(nullptr), actListener(nullptr), adnListener(nullptr), awavListener(nullptr), dehaListener(nullptr), hListener(nullptr),
|
||||
plistener(nullptr), imageListener(nullptr), aeListener(nullptr), acListener(nullptr), abwListener(nullptr), awbListener(nullptr), flatFieldAutoClipListener(nullptr), bayerAutoContrastListener(nullptr), xtransAutoContrastListener(nullptr), frameCountListener(nullptr), imageTypeListener(nullptr), actListener(nullptr), adnListener(nullptr), awavListener(nullptr), dehaListener(nullptr), hListener(nullptr),
|
||||
resultValid(false), lastOutputProfile("BADFOOD"), lastOutputIntent(RI__COUNT), lastOutputBPC(false), thread(nullptr), changeSinceLast(0), updaterRunning(false), destroying(false), utili(false), autili(false),
|
||||
butili(false), ccutili(false), cclutili(false), clcutili(false), opautili(false), wavcontlutili(false), colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f), highQualityComputed(false)
|
||||
{}
|
||||
@ -199,6 +199,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
|
||||
imgsrc->setCurrentFrame(params.raw.bayersensor.imageNum);
|
||||
|
||||
imgsrc->preprocess(rp, params.lensProf, params.coarse);
|
||||
if (flatFieldAutoClipListener && rp.ff_AutoClipControl) {
|
||||
flatFieldAutoClipListener->flatFieldAutoClipValueChanged(imgsrc->getFlatFieldAutoClipValue());
|
||||
}
|
||||
imgsrc->getRAWHistogram(histRedRaw, histGreenRaw, histBlueRaw);
|
||||
|
||||
highDetailPreprocessComputed = highDetailNeeded;
|
||||
|
@ -158,6 +158,7 @@ protected:
|
||||
AutoCamListener* acListener;
|
||||
AutoBWListener* abwListener;
|
||||
AutoWBListener* awbListener;
|
||||
FlatFieldAutoClipListener *flatFieldAutoClipListener;
|
||||
AutoContrastListener *bayerAutoContrastListener;
|
||||
AutoContrastListener *xtransAutoContrastListener;
|
||||
FrameCountListener *frameCountListener;
|
||||
@ -346,6 +347,10 @@ public:
|
||||
frameCountListener = fcl;
|
||||
}
|
||||
|
||||
void setFlatFieldAutoClipListener (FlatFieldAutoClipListener* ffacl)
|
||||
{
|
||||
flatFieldAutoClipListener = ffacl;
|
||||
}
|
||||
void setBayerAutoContrastListener (AutoContrastListener* acl)
|
||||
{
|
||||
bayerAutoContrastListener = acl;
|
||||
|
@ -2872,8 +2872,6 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile
|
||||
float limitFactor = 1.f;
|
||||
|
||||
if(raw.ff_AutoClipControl) {
|
||||
// int clipControlGui = 0;
|
||||
|
||||
for (int m = 0; m < 2; m++)
|
||||
for (int n = 0; n < 2; n++) {
|
||||
float maxval = 0.f;
|
||||
@ -2917,7 +2915,7 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile
|
||||
}
|
||||
}
|
||||
|
||||
// clipControlGui = (1.f - limitFactor) * 100.f; // this value can be used to set the clip control slider in gui
|
||||
flatFieldAutoClipValue = (1.f - limitFactor) * 100.f; // this value can be used to set the clip control slider in gui
|
||||
} else {
|
||||
limitFactor = max((float)(100 - raw.ff_clipControl) / 100.f, 0.01f);
|
||||
}
|
||||
@ -3003,7 +3001,6 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile
|
||||
|
||||
if(raw.ff_AutoClipControl) {
|
||||
// determine maximum calculated value to avoid clipping
|
||||
// int clipControlGui = 0;
|
||||
float maxval = 0.f;
|
||||
// xtrans files have only one black level actually, so we can simplify the code a bit
|
||||
#ifdef _OPENMP
|
||||
@ -3038,7 +3035,7 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile
|
||||
// there's only one white level for xtrans
|
||||
if(maxval + black[0] > ri->get_white(0)) {
|
||||
limitFactor = ri->get_white(0) / (maxval + black[0]);
|
||||
// clipControlGui = (1.f - limitFactor) * 100.f; // this value can be used to set the clip control slider in gui
|
||||
flatFieldAutoClipValue = (1.f - limitFactor) * 100.f; // this value can be used to set the clip control slider in gui
|
||||
}
|
||||
} else {
|
||||
limitFactor = max((float)(100 - raw.ff_clipControl) / 100.f, 0.01f);
|
||||
|
@ -74,7 +74,7 @@ protected:
|
||||
RawImage* riFrames[4] = {nullptr};
|
||||
unsigned int currFrame = 0;
|
||||
unsigned int numFrames = 0;
|
||||
|
||||
int flatFieldAutoClipValue = 0;
|
||||
array2D<float> rawData; // holds preprocessed pixel values, rowData[i][j] corresponds to the ith row and jth column
|
||||
array2D<float> *rawDataFrames[4] = {nullptr};
|
||||
array2D<float> *rawDataBuffer[3] = {nullptr};
|
||||
@ -212,6 +212,7 @@ public:
|
||||
ri = riFrames[currFrame];
|
||||
}
|
||||
int getFrameCount() {return numFrames;}
|
||||
int getFlatFieldAutoClipValue() {return flatFieldAutoClipValue;}
|
||||
|
||||
class GreenEqulibrateThreshold {
|
||||
public:
|
||||
|
@ -371,6 +371,13 @@ public:
|
||||
virtual void FrameCountChanged(int n, int frameNum) = 0;
|
||||
};
|
||||
|
||||
class FlatFieldAutoClipListener
|
||||
{
|
||||
public:
|
||||
virtual ~FlatFieldAutoClipListener() = default;
|
||||
virtual void flatFieldAutoClipValueChanged(int n) = 0;
|
||||
};
|
||||
|
||||
class ImageTypeListener
|
||||
{
|
||||
public:
|
||||
@ -488,6 +495,7 @@ public:
|
||||
virtual void setHistogramListener (HistogramListener *l) = 0;
|
||||
virtual void setPreviewImageListener (PreviewImageListener* l) = 0;
|
||||
virtual void setAutoCamListener (AutoCamListener* l) = 0;
|
||||
virtual void setFlatFieldAutoClipListener (FlatFieldAutoClipListener* l) = 0;
|
||||
virtual void setFrameCountListener (FrameCountListener* l) = 0;
|
||||
virtual void setBayerAutoContrastListener (AutoContrastListener* l) = 0;
|
||||
virtual void setXtransAutoContrastListener (AutoContrastListener* l) = 0;
|
||||
|
@ -100,6 +100,7 @@ public:
|
||||
}
|
||||
void setCurrentFrame(unsigned int frameNum) {}
|
||||
int getFrameCount() {return 1;}
|
||||
int getFlatFieldAutoClipValue() {return 0;}
|
||||
|
||||
|
||||
void getRawValues(int x, int y, int rotate, int &R, int &G, int &B) { R = G = B = 0;}
|
||||
|
@ -104,6 +104,11 @@ FlatField::FlatField () : FoldableToolPanel(this, "flatfield", M("TP_FLATFIELD_L
|
||||
}
|
||||
}
|
||||
|
||||
FlatField::~FlatField ()
|
||||
{
|
||||
idle_register.destroy();
|
||||
}
|
||||
|
||||
void FlatField::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited)
|
||||
{
|
||||
disableListener ();
|
||||
@ -403,3 +408,22 @@ void FlatField::setShortcutPath(const Glib::ustring& path)
|
||||
|
||||
} catch (Glib::Error&) {}
|
||||
}
|
||||
|
||||
void FlatField::flatFieldAutoClipValueChanged(int n)
|
||||
{
|
||||
struct Data {
|
||||
FlatField *me;
|
||||
int n;
|
||||
};
|
||||
const auto func = [](gpointer data) -> gboolean {
|
||||
Data *d = static_cast<Data *>(data);
|
||||
FlatField *me = d->me;
|
||||
me->disableListener();
|
||||
me->flatFieldClipControl->setValue (d->n);
|
||||
me->enableListener();
|
||||
delete d;
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
idle_register.add(func, new Data { this, n });
|
||||
}
|
@ -35,7 +35,7 @@ public:
|
||||
// add other info here
|
||||
};
|
||||
|
||||
class FlatField : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel
|
||||
class FlatField : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public rtengine::FlatFieldAutoClipListener
|
||||
{
|
||||
|
||||
protected:
|
||||
@ -58,9 +58,11 @@ protected:
|
||||
bool b_filter_asCurrent;
|
||||
bool israw;
|
||||
|
||||
IdleRegister idle_register;
|
||||
public:
|
||||
|
||||
FlatField ();
|
||||
~FlatField ();
|
||||
|
||||
void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr);
|
||||
void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr);
|
||||
@ -80,6 +82,7 @@ public:
|
||||
{
|
||||
ffp = p;
|
||||
};
|
||||
void flatFieldAutoClipValueChanged(int n = 0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -521,6 +521,7 @@ void ToolPanelCoordinator::initImage (rtengine::StagedImageProcessor* ipc_, bool
|
||||
ipc->setAutoCamListener (colorappearance);
|
||||
ipc->setAutoBWListener (blackwhite);
|
||||
ipc->setFrameCountListener (bayerprocess);
|
||||
ipc->setFlatFieldAutoClipListener (flatfield);
|
||||
ipc->setBayerAutoContrastListener (bayerprocess);
|
||||
ipc->setXtransAutoContrastListener (xtransprocess);
|
||||
ipc->setAutoWBListener (whitebalance);
|
||||
|
Loading…
x
Reference in New Issue
Block a user