Purple fringing tool added. May also be useful for CA desaturation.

This commit is contained in:
Emil Martinec 2010-11-26 11:56:14 -06:00
parent 053bc26d40
commit dbb4cf6abe
16 changed files with 82 additions and 4 deletions

View File

@ -14,6 +14,7 @@ set (RTENGINESOURCEFILES colortemp.cc curves.cc dcraw.cc iccstore.cc dfmanager.c
processingjob.cc rtthumbnail.cc utils.cc labimage.cc slicer.cc
iplab2rgb.cc ipsharpen.cc iptransform.cc ipresize.cc
jpeg_memsrc.c
PF_correct_RT.cc
wavelet_dec.cc ipequalizer.cc dirpyrLab_denoise.cc dirpyrLab_equalizer.cc dirpyr_equalizer.cc)
add_library (rtengine ${RTENGINESOURCEFILES})

View File

@ -180,6 +180,7 @@ void Crop::update (int todo, bool internal) {
if (skip==1) {
parent->ipf.impulsedenoise (labnCrop);
parent->ipf.defringe (labnCrop);
parent->ipf.lumadenoise (labnCrop, cbuffer);
parent->ipf.colordenoise (labnCrop, cbuffer);
parent->ipf.dirpyrdenoise (labnCrop);

View File

@ -199,6 +199,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
progress ("Denoising luminance impulse...",100*readyphase/numofphases);
ipf.impulsedenoise (nprevl);
}
if (scale==1) {
progress ("Defringing...",100*readyphase/numofphases);
ipf.defringe (nprevl);
}
if (scale==1) {
progress ("Denoising luminance...",100*readyphase/numofphases);
ipf.lumadenoise (nprevl, buffer);

View File

@ -543,6 +543,13 @@ void ImProcFunctions::colorCurve (LabImage* lold, LabImage* lnew) {
impulse_nr (lab->L, lab->L, lab->W, lab->H, (float)params->impulseDenoise.thresh/20.0 );
}
void ImProcFunctions::defringe (LabImage* lab) {
if (params->defringe.enabled && lab->W>=8 && lab->H>=8)
PF_correct_RT(lab, lab, params->defringe.radius, params->defringe.threshold, false /*edges only*/ );
}
void ImProcFunctions::dirpyrdenoise (LabImage* lab) {
if (params->dirpyrDenoise.enabled && lab->W>=8 && lab->H>=8)
@ -634,7 +641,7 @@ void ImProcFunctions::getAutoExp (unsigned int* histogram, int histcompr, doubl
awg = CurveFactory::igamma2 ((float)(awg/65535.0)) * 65535.0; //need to inverse gamma transform to get correct exposure compensation parameter
bl = (int)((65535*bl)/awg);
br = log(65535.0 / (awg)) / log(2.0);
br = log(65535.0 / (awg)) / log(2.0);
if (br<0)
br = 0;
}

View File

@ -109,6 +109,9 @@ class ImProcFunctions {
void dirpyr_channel(unsigned short ** data_fine, unsigned short ** data_coarse, int width, int height, int * rangefn, int level, int scale, const double * mult );
void idirpyr_eq_channel(unsigned short ** data_coarse, unsigned short ** data_fine, int ** buffer, int width, int height, int level, const double * mult );
void defringe (LabImage* lab);
void PF_correct_RT(LabImage * src, LabImage * dst, double radius, int thresh, bool edges);
Image8* lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile);
Image16* lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile);

View File

@ -126,7 +126,10 @@ enum ProcEvent {
EvHSVEqualizerS=101,
EvHSVEqualizerV=102,
EvHSVEqEnabled=103,
NUMOFEVENTS=104
EvDefringeEnabled=104,
EvDefringeRadius=105,
EvDefringeThreshold=106,
NUMOFEVENTS=107
};
}
#endif

View File

@ -103,6 +103,10 @@ void ProcParams::setDefaults () {
impulseDenoise.enabled = false;
impulseDenoise.thresh = 50;
defringe.enabled = false;
defringe.radius = 2.0;
defringe.threshold = 25;
dirpyrDenoise.enabled = false;
dirpyrDenoise.luma = 10;
@ -286,6 +290,10 @@ int ProcParams::save (Glib::ustring fname) const {
keyFile.set_boolean ("Impulse Denoising", "Enabled", impulseDenoise.enabled);
keyFile.set_integer ("Impulse Denoising", "Threshold", impulseDenoise.thresh);
// save defringe
keyFile.set_boolean ("Defringing", "Enabled", defringe.enabled);
keyFile.set_double ("Defringing", "Radius", defringe.radius);
keyFile.set_integer ("Defringing", "Threshold", defringe.threshold);
// save dirpyrDenoise
keyFile.set_boolean ("Directional Pyramid Denoising", "Enabled", dirpyrDenoise.enabled);
@ -552,6 +560,13 @@ if (keyFile.has_group ("Color Shift")) {
if (keyFile.has_key ("Color Shift", "ChannelB")) colorShift.b = keyFile.get_double ("Color Shift", "ChannelB");
}
// load defringe
if (keyFile.has_group ("Defringing")) {
if (keyFile.has_key ("Defringing", "Enabled")) defringe.enabled = keyFile.get_boolean ("Defringing", "Enabled");
if (keyFile.has_key ("Defringing", "Radius")) defringe.radius = keyFile.get_double ("Defringing", "Radius");
if (keyFile.has_key ("Defringing", "Threshold")) defringe.threshold = keyFile.get_integer ("Defringing", "Threshold");
}
// load impulseDenoise
if (keyFile.has_group ("Impulse Denoising")) {
if (keyFile.has_key ("Impulse Denoising", "Enabled")) impulseDenoise.enabled = keyFile.get_boolean ("Impulse Denoising", "Enabled");
@ -853,6 +868,9 @@ bool ProcParams::operator== (const ProcParams& other) {
&& dirpyrDenoise.luma == other.dirpyrDenoise.luma
&& dirpyrDenoise.chroma == other.dirpyrDenoise.chroma
&& dirpyrDenoise.gamma == other.dirpyrDenoise.gamma
&& defringe.enabled == other.defringe.enabled
&& defringe.radius == other.defringe.radius
&& defringe.threshold == other.defringe.threshold
&& lumaDenoise.enabled == other.lumaDenoise.enabled
&& lumaDenoise.radius == other.lumaDenoise.radius
&& lumaDenoise.edgetolerance == other.lumaDenoise.edgetolerance

View File

@ -137,6 +137,18 @@ class ColorDenoiseParams {
int amount;
};
/**
* Parameters of defringing
*/
class DefringeParams {
public:
bool enabled;
double radius;
int threshold;
};
/**
* Parameters of impulse denoising
*/
@ -403,6 +415,7 @@ class ProcParams {
ColorShiftParams colorShift; ///< Color shift parameters
LumaDenoiseParams lumaDenoise; ///< Luminance denoising parameters
ColorDenoiseParams colorDenoise; ///< Color denoising parameters
DefringeParams defringe; ///< Impulse denoising parameters
ImpulseDenoiseParams impulseDenoise; ///< Impulse denoising parameters
DirPyrDenoiseParams dirpyrDenoise; ///< Directional Pyramid denoising parameters
SHParams sh; ///< Shadow/highlight enhancement parameters

View File

@ -124,5 +124,8 @@ RGBCURVE, // EvHSVEqualizerH,
RGBCURVE, // EvHSVEqualizerS,
RGBCURVE, // EvHSVEqualizerV,
RGBCURVE, // EvHSVEqEnabled,
DEFRINGE, // EvDefringeEnabled,
DEFRINGE, // EvDefringeRadius,
DEFRINGE, // EvDefringeThreshold,
};

View File

@ -31,6 +31,7 @@
#define LUMINANCECURVE 6
#define SHARPENING 2
#define IMPULSEDENOISE 2
#define DEFRINGE 2
#define LUMADENOISE 2
#define WHITEBALANCE 255
#define DEMOSAIC 511

View File

@ -159,6 +159,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
ipf.chrominanceCurve (labView, labView, 1, curve, 0, fh);
ipf.impulsedenoise (labView);
ipf.defringe (labView);
ipf.lumadenoise (labView, buffer);
ipf.sharpening (labView, (unsigned short**)buffer);

View File

@ -26,7 +26,7 @@ set (BASESOURCEFILES
batchqueue.cc lwbutton.cc lwbuttonset.cc
batchqueuebuttonset.cc browserfilter.cc exiffiltersettings.cc
profilestore.cc partialpastedlg.cc rawprocess.cc preprocess.cc
equalizer.cc dirpyrequalizer.cc hsvequalizer.cc
equalizer.cc dirpyrequalizer.cc hsvequalizer.cc defringe.cc
popupcommon.cc popupbutton.cc popuptogglebutton.cc)
if (WIN32)

View File

@ -72,6 +72,9 @@ void ParamsEdited::set (bool v) {
lumaDenoise.edgetolerance = v;
colorDenoise.enabled = v;
colorDenoise.amount = v;
defringe.enabled = v;
defringe.radius = v;
defringe.threshold = v;
impulseDenoise.enabled = v;
impulseDenoise.thresh = v;
dirpyrDenoise.enabled = v;
@ -210,6 +213,9 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
lumaDenoise.edgetolerance = lumaDenoise.edgetolerance && p.lumaDenoise.edgetolerance == other.lumaDenoise.edgetolerance;
colorDenoise.enabled = colorDenoise.enabled && p.colorDenoise.enabled == other.colorDenoise.enabled;
colorDenoise.amount = colorDenoise.amount && p.colorDenoise.amount == other.colorDenoise.amount;
defringe.enabled = defringe.enabled && p.defringe.enabled == other.defringe.enabled;
defringe.radius = defringe.radius && p.defringe.radius == other.defringe.radius;
defringe.threshold = defringe.threshold && p.defringe.threshold == other.defringe.threshold;
impulseDenoise.enabled = impulseDenoise.enabled && p.impulseDenoise.enabled == other.impulseDenoise.enabled;
impulseDenoise.thresh = impulseDenoise.thresh && p.impulseDenoise.thresh == other.impulseDenoise.thresh;
@ -350,6 +356,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (colorDenoise.enabled) toEdit.colorDenoise.enabled = mods.colorDenoise.enabled;
if (colorDenoise.amount) toEdit.colorDenoise.amount = mods.colorDenoise.amount;
if (defringe.enabled) toEdit.defringe.enabled = mods.defringe.enabled;
if (defringe.radius) toEdit.defringe.radius = mods.defringe.radius;
if (defringe.threshold) toEdit.defringe.threshold = mods.defringe.threshold;
if (impulseDenoise.enabled) toEdit.impulseDenoise.enabled = mods.impulseDenoise.enabled;
if (impulseDenoise.thresh) toEdit.impulseDenoise.thresh = mods.impulseDenoise.thresh;

View File

@ -109,6 +109,14 @@ class ColorDenoiseParamsEdited {
bool amount;
};
class DefringeParamsEdited {
public:
bool enabled;
bool radius;
bool threshold;
};
class ImpulseDenoiseParamsEdited {
public:
@ -304,8 +312,9 @@ class ParamsEdited {
LumaDenoiseParamsEdited lumaDenoise;
ColorDenoiseParamsEdited colorDenoise;
DefringeParamsEdited defringe;
DirPyrDenoiseParamsEdited dirpyrDenoise;
ImpulseDenoiseParamsEdited impulseDenoise;
ImpulseDenoiseParamsEdited impulseDenoise;
SHParamsEdited sh;
CropParamsEdited crop;

View File

@ -37,6 +37,7 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
lumadenoise = Gtk::manage (new LumaDenoise ());
colordenoise = Gtk::manage (new ColorDenoise ());
impulsedenoise = Gtk::manage (new ImpulseDenoise ());
defringe = Gtk::manage (new Defringe ());
dirpyrdenoise = Gtk::manage (new DirPyrDenoise ());
sharpening = Gtk::manage (new Sharpening ());
lcurve = Gtk::manage (new LCurve ());
@ -76,6 +77,7 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
addPanel (detailsPanel, lumadenoise, M("TP_LUMADENOISE_LABEL")); toolPanels.push_back (lumadenoise);
addPanel (detailsPanel, colordenoise, M("TP_COLORDENOISE_LABEL")); toolPanels.push_back (colordenoise);
addPanel (detailsPanel, dirpyrdenoise, M("TP_DIRPYRDENOISE_LABEL")); toolPanels.push_back (dirpyrdenoise);
addPanel (detailsPanel, defringe, M("TP_DEFRINGE_LABEL")); toolPanels.push_back (defringe);
addPanel (detailsPanel, dirpyrequalizer, M("TP_DIRPYREQUALIZER_LABEL")); toolPanels.push_back (dirpyrequalizer);
addPanel (detailsPanel, equalizer, M("TP_EQUALIZER_LABEL")); toolPanels.push_back (equalizer);
addPanel (transformPanel, crop, M("TP_CROP_LABEL")); toolPanels.push_back (crop);

View File

@ -34,6 +34,7 @@
#include <lumadenoise.h>
#include <colordenoise.h>
#include <impulsedenoise.h>
#include <defringe.h>
#include <dirpyrdenoise.h>
#include <sharpening.h>
#include <labcurve.h>
@ -90,6 +91,7 @@ class ToolPanelCoordinator : public ToolPanelListener,
ShadowsHighlights* shadowshighlights;
LumaDenoise* lumadenoise;
ColorDenoise* colordenoise;
Defringe* defringe;
ImpulseDenoise* impulsedenoise;
DirPyrDenoise* dirpyrdenoise;
Sharpening* sharpening;