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 processingjob.cc rtthumbnail.cc utils.cc labimage.cc slicer.cc
iplab2rgb.cc ipsharpen.cc iptransform.cc ipresize.cc iplab2rgb.cc ipsharpen.cc iptransform.cc ipresize.cc
jpeg_memsrc.c jpeg_memsrc.c
PF_correct_RT.cc
wavelet_dec.cc ipequalizer.cc dirpyrLab_denoise.cc dirpyrLab_equalizer.cc dirpyr_equalizer.cc) wavelet_dec.cc ipequalizer.cc dirpyrLab_denoise.cc dirpyrLab_equalizer.cc dirpyr_equalizer.cc)
add_library (rtengine ${RTENGINESOURCEFILES}) add_library (rtengine ${RTENGINESOURCEFILES})

View File

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

View File

@ -199,6 +199,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
progress ("Denoising luminance impulse...",100*readyphase/numofphases); progress ("Denoising luminance impulse...",100*readyphase/numofphases);
ipf.impulsedenoise (nprevl); ipf.impulsedenoise (nprevl);
} }
if (scale==1) {
progress ("Defringing...",100*readyphase/numofphases);
ipf.defringe (nprevl);
}
if (scale==1) { if (scale==1) {
progress ("Denoising luminance...",100*readyphase/numofphases); progress ("Denoising luminance...",100*readyphase/numofphases);
ipf.lumadenoise (nprevl, buffer); 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 ); 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) { void ImProcFunctions::dirpyrdenoise (LabImage* lab) {
if (params->dirpyrDenoise.enabled && lab->W>=8 && lab->H>=8) if (params->dirpyrDenoise.enabled && lab->W>=8 && lab->H>=8)

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 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 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); 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); 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, EvHSVEqualizerS=101,
EvHSVEqualizerV=102, EvHSVEqualizerV=102,
EvHSVEqEnabled=103, EvHSVEqEnabled=103,
NUMOFEVENTS=104 EvDefringeEnabled=104,
EvDefringeRadius=105,
EvDefringeThreshold=106,
NUMOFEVENTS=107
}; };
} }
#endif #endif

View File

@ -104,6 +104,10 @@ void ProcParams::setDefaults () {
impulseDenoise.enabled = false; impulseDenoise.enabled = false;
impulseDenoise.thresh = 50; impulseDenoise.thresh = 50;
defringe.enabled = false;
defringe.radius = 2.0;
defringe.threshold = 25;
dirpyrDenoise.enabled = false; dirpyrDenoise.enabled = false;
dirpyrDenoise.luma = 10; dirpyrDenoise.luma = 10;
dirpyrDenoise.chroma = 10; dirpyrDenoise.chroma = 10;
@ -286,6 +290,10 @@ int ProcParams::save (Glib::ustring fname) const {
keyFile.set_boolean ("Impulse Denoising", "Enabled", impulseDenoise.enabled); keyFile.set_boolean ("Impulse Denoising", "Enabled", impulseDenoise.enabled);
keyFile.set_integer ("Impulse Denoising", "Threshold", impulseDenoise.thresh); 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 // save dirpyrDenoise
keyFile.set_boolean ("Directional Pyramid Denoising", "Enabled", dirpyrDenoise.enabled); 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"); 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 // load impulseDenoise
if (keyFile.has_group ("Impulse Denoising")) { if (keyFile.has_group ("Impulse Denoising")) {
if (keyFile.has_key ("Impulse Denoising", "Enabled")) impulseDenoise.enabled = keyFile.get_boolean ("Impulse Denoising", "Enabled"); 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.luma == other.dirpyrDenoise.luma
&& dirpyrDenoise.chroma == other.dirpyrDenoise.chroma && dirpyrDenoise.chroma == other.dirpyrDenoise.chroma
&& dirpyrDenoise.gamma == other.dirpyrDenoise.gamma && 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.enabled == other.lumaDenoise.enabled
&& lumaDenoise.radius == other.lumaDenoise.radius && lumaDenoise.radius == other.lumaDenoise.radius
&& lumaDenoise.edgetolerance == other.lumaDenoise.edgetolerance && lumaDenoise.edgetolerance == other.lumaDenoise.edgetolerance

View File

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

View File

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

View File

@ -31,6 +31,7 @@
#define LUMINANCECURVE 6 #define LUMINANCECURVE 6
#define SHARPENING 2 #define SHARPENING 2
#define IMPULSEDENOISE 2 #define IMPULSEDENOISE 2
#define DEFRINGE 2
#define LUMADENOISE 2 #define LUMADENOISE 2
#define WHITEBALANCE 255 #define WHITEBALANCE 255
#define DEMOSAIC 511 #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.chrominanceCurve (labView, labView, 1, curve, 0, fh);
ipf.impulsedenoise (labView); ipf.impulsedenoise (labView);
ipf.defringe (labView);
ipf.lumadenoise (labView, buffer); ipf.lumadenoise (labView, buffer);
ipf.sharpening (labView, (unsigned short**)buffer); ipf.sharpening (labView, (unsigned short**)buffer);

View File

@ -26,7 +26,7 @@ set (BASESOURCEFILES
batchqueue.cc lwbutton.cc lwbuttonset.cc batchqueue.cc lwbutton.cc lwbuttonset.cc
batchqueuebuttonset.cc browserfilter.cc exiffiltersettings.cc batchqueuebuttonset.cc browserfilter.cc exiffiltersettings.cc
profilestore.cc partialpastedlg.cc rawprocess.cc preprocess.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) popupcommon.cc popupbutton.cc popuptogglebutton.cc)
if (WIN32) if (WIN32)

View File

@ -72,6 +72,9 @@ void ParamsEdited::set (bool v) {
lumaDenoise.edgetolerance = v; lumaDenoise.edgetolerance = v;
colorDenoise.enabled = v; colorDenoise.enabled = v;
colorDenoise.amount = v; colorDenoise.amount = v;
defringe.enabled = v;
defringe.radius = v;
defringe.threshold = v;
impulseDenoise.enabled = v; impulseDenoise.enabled = v;
impulseDenoise.thresh = v; impulseDenoise.thresh = v;
dirpyrDenoise.enabled = 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; lumaDenoise.edgetolerance = lumaDenoise.edgetolerance && p.lumaDenoise.edgetolerance == other.lumaDenoise.edgetolerance;
colorDenoise.enabled = colorDenoise.enabled && p.colorDenoise.enabled == other.colorDenoise.enabled; colorDenoise.enabled = colorDenoise.enabled && p.colorDenoise.enabled == other.colorDenoise.enabled;
colorDenoise.amount = colorDenoise.amount && p.colorDenoise.amount == other.colorDenoise.amount; 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.enabled = impulseDenoise.enabled && p.impulseDenoise.enabled == other.impulseDenoise.enabled;
impulseDenoise.thresh = impulseDenoise.thresh && p.impulseDenoise.thresh == other.impulseDenoise.thresh; 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.enabled) toEdit.colorDenoise.enabled = mods.colorDenoise.enabled;
if (colorDenoise.amount) toEdit.colorDenoise.amount = mods.colorDenoise.amount; 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.enabled) toEdit.impulseDenoise.enabled = mods.impulseDenoise.enabled;
if (impulseDenoise.thresh) toEdit.impulseDenoise.thresh = mods.impulseDenoise.thresh; if (impulseDenoise.thresh) toEdit.impulseDenoise.thresh = mods.impulseDenoise.thresh;

View File

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

View File

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

View File

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