52{
54 QString fileName = this->
widget()->fileNameURLRequester->fileName();
55
56 if (fileName.isEmpty()) return config;
57
59
60 dbgPlugins <<
"Use as reference file : " << fileName;
61
63
68
69 if (importedImage) {
71 }
72 if (!ref) {
73 dbgPlugins <<
"No reference image was specified.";
75 return config;
76 }
77
78
80 if (!labCS) {
81 dbgPlugins <<
"The LAB colorspace is not available.";
83 return config;
84 }
85
88
89
90 double meanL_ref = 0., meanA_ref = 0., meanB_ref = 0.;
91 double sigmaL_ref = 0., sigmaA_ref = 0., sigmaB_ref = 0.;
92
94 while (refIt.nextPixel()) {
95 const quint16* data = reinterpret_cast<const quint16*>(refIt.oldRawData());
96
97 quint32 L = data[0];
100
101 meanL_ref += L;
104
105 sigmaL_ref += L * L;
108
109 }
110
111 double totalSize = 1. / (importedImage->
width() * importedImage->
height());
112
113 meanL_ref *= totalSize;
114 meanA_ref *= totalSize;
115 meanB_ref *= totalSize;
116 sigmaL_ref *= totalSize;
117 sigmaA_ref *= totalSize;
118 sigmaB_ref *= totalSize;
119
120 dbgPlugins << totalSize <<
"" << meanL_ref <<
"" << meanA_ref <<
"" << meanB_ref <<
"" << sigmaL_ref <<
"" << sigmaA_ref <<
"" << sigmaB_ref;
121
122 config->setProperty("filename", fileName);
123 config->setProperty("meanL", meanL_ref);
124 config->setProperty("meanA", meanA_ref);
125 config->setProperty("meanB", meanB_ref);
126 config->setProperty("sigmaL", sigmaL_ref);
127 config->setProperty("sigmaA", sigmaA_ref);
128 config->setProperty("sigmaB", sigmaB_ref);
129
131
132 return config;
133}
static KisResourcesInterfaceSP instance()
KisPaintDeviceSP projection() const
QRect bounds() const override
QString errorMessage() const
The class managing all the filters.
void convertTo(const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent=KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::ConversionFlags conversionFlags=KoColorConversionTransformation::internalConversionFlags(), KUndo2Command *parentCommand=nullptr, KoUpdater *progressUpdater=nullptr)
static KisPart * instance()
KisDocument * createDocument() const
const Ui_WdgFastColorTransfer * widget() const
const KoColorSpace * lab16(const QString &profileName=QString())
static KoColorSpaceRegistry * instance()