diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2022-05-02 17:04:11 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2022-05-02 17:04:11 +0300 |
| commit | f42516c06b3bb1f4f2f05384a4c341ee423aed82 (patch) | |
| tree | 898f272ba20d64646277e24fadebb2769073b14d /Software | |
| parent | 643e13480ee25f02e8bf88a8d8e152780545bf3b (diff) | |
| parent | 734716458232a0d43413bdda78ae0586dc1ed81b (diff) | |
| download | Tango-f42516c06b3bb1f4f2f05384a4c341ee423aed82.tar.gz Tango-f42516c06b3bb1f4f2f05384a4c341ee423aed82.zip | |
Merged ColorLib v5 changes for VP3.
Diffstat (limited to 'Software')
| -rw-r--r-- | Software/Visual_Studio/ColorLib/Tango.ColorLib_v5/ColorConverter.cpp | 35 | ||||
| -rw-r--r-- | Software/Visual_Studio/ColorLib/Tango.ColorLib_v5/ColorConverter.h | 4 |
2 files changed, 22 insertions, 17 deletions
diff --git a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v5/ColorConverter.cpp b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v5/ColorConverter.cpp index 268271cb8..95b92b665 100644 --- a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v5/ColorConverter.cpp +++ b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v5/ColorConverter.cpp @@ -59,8 +59,8 @@ #define eps 1e-06 #define NegValue -1000 #define WPTol 1.0 -#define dETol 2.0 -# define ROUNDINGDigits 1.0 +#define dETol 0.5 +# define ROUNDINGDigits 3.0 #define maxPerRegion 100.0 #define GamutMinReg0 200 #define GamutMinReg1 300 @@ -1350,7 +1350,7 @@ void Tango::ColorLib::ColorConverter::NLInkPToVolume(VectorXd NLInk, VectorXd &V } } // Round to k decimal digits, verify that sum in within allowed values. - double sumNorm = 0.0; +/* double sumNorm = 0.0; double RsumNorm = 0.0; VectorXd VolumeRound(m_nInks); double ROUNDINGTol = pow(10, ROUNDINGDigits); @@ -1376,7 +1376,7 @@ void Tango::ColorLib::ColorConverter::NLInkPToVolume(VectorXd NLInk, VectorXd &V VolumeRound(maxInd) = std::floor(VolumeRound(maxInd)*ROUNDINGTol) / ROUNDINGTol; } for (int i = 0; i < m_nInks; ++i) - Volume(i) = VolumeRound(i); + Volume(i) = VolumeRound(i);*/ } @@ -1441,9 +1441,10 @@ void Tango::ColorLib::ColorConverter::ConvertVolumeToRGBDisplay(InputCoordinates GamutRegion = GetGamutRegion(VolumeNoLI, m_GamutRegionMaxLim); //Volume is in Color Table Units int CTUnits = 1; GetClosestInk(VolumeNoLI, GamutRegion, VolumeNoLI, CTUnits); //Input VolumeNoLI is in [nl/cm] Output VolumeNoLI is in [%] - VolumeToNLInkP(VolumeNoLI, NLInkP); //NLInkP is in % for (int i = 0; i < m_nInks; ++i) FinalVolumeNoLI(i) = VolumeNoLI(i); + + VolumeToNLInkP(VolumeNoLI, NLInkP); //NLInkP is in % VectorToDouble(NLInkP, InkOutP); // NLcmtoPercentage(VolumeNoLI, VolumeNoLI); @@ -2451,8 +2452,11 @@ bool Tango::ColorLib::ColorConverter::IsInGamut(double *InLab, SURROUND sur, CA { VectorXd V1(3); VectorXd V2(3); + V1 << JLab[0], JLab[1], JLab[2]; V2 << xCoord[0], xCoord[1], xCoord[2]; + V1 = m_Conv02->Jab_2_Lab(V1, CS); + V2 = m_Conv02->Jab_2_Lab(V2, CS); double dECMC; m_Conv02->SymmetricaldECMC(V1, V2, dECMC); if (dECMC < dETol) @@ -4384,7 +4388,7 @@ void Tango::ColorLib::ColorConverter::ConfineVolumes(VectorXd &Volume) int maxInd = -1; for (int i = 0; i < m_nInks; ++i) { - VolumeRound(i) = std::floor(Volume(i)*(m_currentMaxNLPerCM(i) / 100.0)*ROUNDINGTol) / ROUNDINGTol; + VolumeRound(i) =std::round (Volume(i)*ROUNDINGTol*(m_currentMaxNLPerCM(i) / 100.0))/ ROUNDINGTol; if (VolumeRound(i) > maxInk) { maxInk = VolumeRound(i); @@ -4398,10 +4402,9 @@ void Tango::ColorLib::ColorConverter::ConfineVolumes(VectorXd &Volume) { ddCorr = TotalVolumeRound - m_CurrentProcessRangesMax[m_nProcessRanges - 1] ; VolumeRound(maxInd) = VolumeRound(maxInd) - ddCorr; - VolumeRound(maxInd) = (std::floor((VolumeRound(maxInd)*ROUNDINGTol)) / ROUNDINGTol) ; } for (int i = 0; i < m_nInks; ++i) - Volume(i) = std::floor(VolumeRound(i)*(100/ m_currentMaxNLPerCM(i))*ROUNDINGTol)/ ROUNDINGTol; + Volume(i) =VolumeRound(i)*(100/ m_currentMaxNLPerCM(i)); } @@ -4414,7 +4417,7 @@ void Tango::ColorLib::ColorConverter::LimitNLInks2VolumeThr(VectorXd NLInks, int GamutRegion = GetGamutRegion(Volume, m_CurrentProcessRangesMax); LimitLowVolume(Volume, GamutRegion, Volume); // [nl/cm] NLcmtoPercentage(Volume, Volume); // output volume in % - + ConfineVolumes(Volume); if (InkOutL != NULL) { delete[]InkOutL; @@ -4437,7 +4440,7 @@ void Tango::ColorLib::ColorConverter::GetClosestInk(VectorXd Volume, int &GamutR DefineSplitLimits(low, high, TotalVolume); for (int i = 0; i < m_nInks; ++i) { - if (Volume(i) > 1.e-05) + if (Volume(i) > 1.e-04) diffVolume[i] = std::abs(Volume(i) - std::max(Volume(i), low)); else diffVolume[i] = 0; @@ -4648,8 +4651,10 @@ void Tango::ColorLib::ColorConverter::SplitVolume(VectorXd Volume, VectorXd &Vol //This might happen because of a previous rounding step that changes the low limit by a small amount for (int i = 0; i < m_nInks; ++i) { - if ((Vol_nlcm(i) < low) & (Vol_nlcm(i) > 0)) - Vol_nlcm(i) = low; + if (Vol_nlcm(i) < (low / 2)) + Vol_nlcm(i) = 0.0; + else if ((Vol_nlcm(i) < low) & (Vol_nlcm(i) > (low / 2))) + Vol_nlcm(i) = low; } //Apply 1st Split for (int i = 0; i < m_nInks - 1; ++i) @@ -4783,7 +4788,7 @@ void Tango::ColorLib::ColorConverter::DefineSplitLimits(double &low, double &hi low = m_LowVolumeThreshold * m_CurrentProcessRangesMin[ProcessRangeInd] / 100.0; high = m_LightInksThr * m_CurrentProcessRangesMin[ProcessRangeInd] / 100.0; } - else if ((InitTotalVolume <= lim3) & (InitTotalVolume > lim2)) + else if (InitTotalVolume > lim2) { //Calculate Ink Split Based on Total Volume low = m_LowVolumeThreshold * InitTotalVolume / 100.0; @@ -5576,8 +5581,8 @@ void Tango::ColorLib::ColorConverter::DirectInversionCalc(double *LabIn, VectorX { bool FSInd = true; for (i = 0; i < npars - 1; ++i) - FSInd = FSInd & ((Vol[k][i] < 0.05) | (Vol[k][i] > m_LowVolumeThreshold)); - FSInd = FSInd & ((Vol[k][npars - 1] < 0.05) | (Vol[k][npars - 1] > m_LightInksThr)); + FSInd = FSInd & ((Vol[k][i] < 0.01) | (Vol[k][i] > m_LowVolumeThreshold)); + FSInd = FSInd & ((Vol[k][npars - 1] < 0.01) | (Vol[k][npars - 1] > m_LightInksThr)); FSInd = FSInd & (dECMC[k] < 0.5); if (FSInd) { diff --git a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v5/ColorConverter.h b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v5/ColorConverter.h index 5b5cda87a..5ad42483b 100644 --- a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v5/ColorConverter.h +++ b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v5/ColorConverter.h @@ -85,7 +85,7 @@ namespace Tango void ConvertVolumeToRGBDisplay(InputCoordinates *IC, int n_processRanges,int colorspace, VectorXd &InkOut, VectorXd &RGBOut, VectorXd &LabOut, int &GamutRegion); - void ConvertVolumeToLabRel(VectorXd &Volume, VectorXd &LabOut, int GamutRegion, int CTUnits); + void ConvertVolumeToLabRel(VectorXd &Volume, VectorXd &LabOut, int GamutRegion, int CTUnits); size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t input_buffer_size, uint8_t *& output_buffer); size_t Tango::ColorLib::ColorConverter::GenerateGradient(uint8_t * input_buffer, size_t input_buffer_size, uint8_t *& output_buffer); @@ -209,7 +209,7 @@ namespace Tango void LimitNLInks2Volume(VectorXd NLInks, int &GamutRegion, VectorXd &OutVolume, int CTUnits); void LimitNLInks2VolumeNoFix(VectorXd NLInks, int &GamutRegion, VectorXd &Volume); void LimitNLInks2VolumeThr(VectorXd NLInks, int &GamutRegion, VectorXd &Volume); - void GetClosestInk(VectorXd Volume, int &GamutRegion, VectorXd &BestVolume, int CTUnits); + void GetClosestInk(VectorXd Volume, int &GamutRegion, VectorXd &BestVolume, int CTUnits); bool CheckMonotonicity(CalibrationData *calibdata); void ConfineVolumes(VectorXd &Volume); void SplitVolume(VectorXd Volume, VectorXd &VolumeLI, int &GamutRegion); |
