Beispiel #1
0
        internal static PP3Curve[] Do(List<KeyValuePair<int, object>> Input)
        {
            Type CurType = Input[0].Value.GetType();
            int Pointcount, step = 1;

            if (CurType == typeof(PP3Curve_Array))
            {
                Pointcount = ((PP3Curve_Array)Input[0].Value).DataPoints.Count;
                if (Input.Any(t => ((PP3Curve_Array)t.Value).DataPoints.Count != Pointcount)) { throw new InterpolationNotPossibleException("Pointcount of curve is not consistet!"); }
            }
            else if (CurType == typeof(PP3Curve_ControlCage))
            {
                Pointcount = ((PP3Curve_ControlCage)Input[0].Value).DataPoints.Count;
                if (Input.Any(t => ((PP3Curve_ControlCage)t.Value).DataPoints.Count != Pointcount)) { throw new InterpolationNotPossibleException("Pointcount of curve is not consistet!"); }
            }
            else if (CurType == typeof(PP3Curve_Custom))
            {
                step = 2;
                Pointcount = ((PP3Curve_Custom)Input[0].Value).DataPoints.Count * 2;
                if (Input.Any(t => ((PP3Curve_Custom)t.Value).DataPoints.Count * 2 != Pointcount)) { throw new InterpolationNotPossibleException("Pointcount of curve is not consistet!"); }
            }
            else if (CurType == typeof(PP3Curve_Parametric)) { Pointcount = 7; }
            else { throw new InterpolationNotPossibleException(); }

            //check if it's possible to interpolate
            if (Input.Any(t => t.Value.GetType() != CurType)) { throw new InterpolationNotPossibleException("Curvetype is not consistet!"); }

            //start to interpolate
            PointD[][] InPoints = new PointD[Pointcount][];

            //Curves to points
            for (int i = 0; i < Pointcount; i += step)
            {
                if (InPoints[i] == null) { InPoints[i] = new PointD[Input.Count]; }

                for (int j = 0; j < Input.Count; j++)
                {
                    if (CurType == typeof(PP3Curve_Array)) { InPoints[i][j] = new PointD(Input[j].Key, ((PP3Curve_Array)Input[j].Value).DataPoints[i]); }
                    else if (CurType == typeof(PP3Curve_ControlCage)) { InPoints[i][j] = ((PP3Curve_ControlCage)Input[j].Value).DataPoints[i]; }
                    else if (CurType == typeof(PP3Curve_Custom))
                    {
                        if (InPoints[i + 1] == null) { InPoints[i + 1] = new PointD[Input.Count]; }
                        InPoints[i][j] = new PointD(j, ((PP3Curve_Custom)Input[j].Value).DataPoints[i / 2].X);
                        InPoints[i + 1][j] = new PointD(j, ((PP3Curve_Custom)Input[j].Value).DataPoints[i / 2].Y);
                    }
                    else if (CurType == typeof(PP3Curve_Parametric))
                    {
                        InPoints[i][0] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[0].Value).Zones[0]);
                        InPoints[i][1] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[1].Value).Zones[1]);
                        InPoints[i][2] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[2].Value).Zones[2]);
                        InPoints[i][3] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[3].Value).Highlights);
                        InPoints[i][4] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[4].Value).Lights);
                        InPoints[i][5] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[5].Value).Darks);
                        InPoints[i][6] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[6].Value).Shadows);
                    }
                }
            }

            PointD[][] OutPoints = new PointD[Pointcount][];

            //interpolate points
            for (int i = 0; i < Pointcount; i++) { OutPoints[i] = Do(InPoints[i], ProjectManager.CurrentProject.Frames.Count); }

            PP3Curve[] Output = new PP3Curve[ProjectManager.CurrentProject.Frames.Count];

            //points back to curves
            for (int i = 0; i < ProjectManager.CurrentProject.Frames.Count; i++)
            {
                for (int j = 0; j < Pointcount; j += step)
                {
                    if (CurType == typeof(PP3Curve_Array))
                    {
                        if (Output[i] == null) { Output[i] = new PP3Curve_Array(); }
                        ((PP3Curve_Array)Output[i]).DataPoints.Add((int)OutPoints[j][i].Y);
                    }
                    else if (CurType == typeof(PP3Curve_ControlCage))
                    {
                        if (Output[i] == null) { Output[i] = new PP3Curve_ControlCage(); }
                        ((PP3Curve_ControlCage)Output[i]).DataPoints.Add(OutPoints[j][i]);
                    }
                    else if (CurType == typeof(PP3Curve_Custom))
                    {
                        if (Output[i] == null) { Output[i] = new PP3Curve_Custom(); }
                        ((PP3Curve_Custom)Output[i]).DataPoints.Add(new PointD(OutPoints[j][i].Y, OutPoints[j + 1][i].Y));
                    }
                    else if (CurType == typeof(PP3Curve_Parametric))
                    {
                        if (Output[i] == null) { Output[i] = new PP3Curve_Parametric(); }
                        ((PP3Curve_Parametric)Output[i]).Zones[0] = OutPoints[0][i].Y;
                        ((PP3Curve_Parametric)Output[i]).Zones[1] = OutPoints[1][i].Y;
                        ((PP3Curve_Parametric)Output[i]).Zones[2] = OutPoints[2][i].Y;
                        ((PP3Curve_Parametric)Output[i]).Highlights = OutPoints[3][i].Y;
                        ((PP3Curve_Parametric)Output[i]).Lights = OutPoints[4][i].Y;
                        ((PP3Curve_Parametric)Output[i]).Darks = OutPoints[5][i].Y;
                        ((PP3Curve_Parametric)Output[i]).Shadows = OutPoints[6][i].Y;
                        j = Pointcount;
                    }
                    else if (CurType == typeof(PP3Curve_HSV))
                    {
                        //TODO: check for HSV curve type (also in PP3Curve.cs); handling is the same as custom curve
                    }
                }
            }

            return Output;
        }
Beispiel #2
0
        private void Read302(string[] lines)
        {
            CultureInfo   culture = new CultureInfo("en-US");
            List <string> Llines  = lines.ToList();

            Llines.RemoveAll(t => String.IsNullOrWhiteSpace(t) || t.StartsWith("["));
            int i = 0;

            Values.Add("Version.AppVersion", new PP3entry("Version.AppVersion", GetValue(Llines[i]), null, null)); i++;
            FileVersion = Convert.ToInt32(GetValue(Llines[i])); i++;
            Values.Add("General.Rank", new PP3entry("General.Rank", Convert.ToInt32(GetValue(Llines[i])), 0, 0)); i++;
            Values.Add("General.ColorLabel", new PP3entry("General.ColorLabel", Convert.ToInt32(GetValue(Llines[i])), 0, 0)); i++;
            Values.Add("General.InTrash", new PP3entry("General.InTrash", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Exposure.Auto", new PP3entry("Exposure.Auto", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Exposure.Clip", new PP3entry("Exposure.Clip", Convert.ToDouble(GetValue(Llines[i]), culture), 0d, 0.9999d)); i++;
            Compensation = Convert.ToDouble(GetValue(Llines[i]), culture); i++;
            Values.Add("Exposure.Brightness", new PP3entry("Exposure.Brightness", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("Exposure.Contrast", new PP3entry("Exposure.Contrast", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("Exposure.Saturation", new PP3entry("Exposure.Saturation", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("Exposure.Black", new PP3entry("Exposure.Black", Convert.ToInt32(GetValue(Llines[i])), -16384, 32768)); i++;
            Values.Add("Exposure.HighlightCompr", new PP3entry("Exposure.HighlightCompr", Convert.ToInt32(GetValue(Llines[i])), 0, 500)); i++;
            Values.Add("Exposure.HighlightComprThreshold", new PP3entry("Exposure.HighlightComprThreshold", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("Exposure.ShadowCompr", new PP3entry("Exposure.ShadowCompr", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("Exposure.Curve", new PP3entry("Exposure.Curve", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("ChannelMixer.Red", new PP3entry("ChannelMixer.Red", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("ChannelMixer.Green", new PP3entry("ChannelMixer.Green", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("ChannelMixer.Blue", new PP3entry("ChannelMixer.Blue", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("LuminanceCurve.Brightness", new PP3entry("LuminanceCurve.Brightness", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("LuminanceCurve.Contrast", new PP3entry("LuminanceCurve.Contrast", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("LuminanceCurve.Saturation", new PP3entry("LuminanceCurve.Saturation", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("LuminanceCurve.AvoidColorClipping", new PP3entry("LuminanceCurve.AvoidColorClipping", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("LuminanceCurve.SaturationLimiter", new PP3entry("LuminanceCurve.SaturationLimiter", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("LuminanceCurve.SaturationLimit", new PP3entry("LuminanceCurve.SaturationLimit", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("LuminanceCurve.BWtoning", new PP3entry("LuminanceCurve.BWtoning", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("LuminanceCurve.LCurve", new PP3entry("LuminanceCurve.LCurve", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("LuminanceCurve.aCurve", new PP3entry("LuminanceCurve.aCurve", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("LuminanceCurve.bCurve", new PP3entry("LuminanceCurve.bCurve", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Sharpening.Enabled", new PP3entry("Sharpening.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Sharpening.Method", new PP3entry("Sharpening.Method", GetValue(Llines[i]), null, null)); i++;
            Values.Add("Sharpening.Radius", new PP3entry("Sharpening.Radius", Convert.ToDouble(GetValue(Llines[i]), culture), 0.3d, 3d)); i++;
            Values.Add("Sharpening.Amount", new PP3entry("Sharpening.Amount", Convert.ToInt32(GetValue(Llines[i])), 1, 1000)); i++;
            Values.Add("Sharpening.Threshold", new PP3entry("Sharpening.Threshold", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Sharpening.OnlyEdges", new PP3entry("Sharpening.OnlyEdges", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Sharpening.EdgedetectionRadius", new PP3entry("Sharpening.EdgedetectionRadius", Convert.ToDouble(GetValue(Llines[i]), culture), 0.5d, 2.5d)); i++;
            Values.Add("Sharpening.EdgeTolerance", new PP3entry("Sharpening.EdgeTolerance", Convert.ToInt32(GetValue(Llines[i])), 10, 10000)); i++;
            Values.Add("Sharpening.HalocontrolEnabled", new PP3entry("Sharpening.HalocontrolEnabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Sharpening.HalocontrolAmount", new PP3entry("Sharpening.HalocontrolAmount", Convert.ToInt32(GetValue(Llines[i])), 1, 100)); i++;
            Values.Add("Sharpening.DeconvRadius", new PP3entry("Sharpening.DeconvRadius", Convert.ToDouble(GetValue(Llines[i]), culture), 0.5d, 2.5d)); i++;
            Values.Add("Sharpening.DeconvAmount", new PP3entry("Sharpening.DeconvAmount", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("Sharpening.DeconvDamping", new PP3entry("Sharpening.DeconvDamping", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("Sharpening.DeconvIterations", new PP3entry("Sharpening.DeconvIterations", Convert.ToInt32(GetValue(Llines[i])), 5, 100)); i++;
            Values.Add("Vibrance.Enabled", new PP3entry("Vibrance.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Vibrance.Pastels", new PP3entry("Vibrance.Pastels", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("Vibrance.Saturated", new PP3entry("Vibrance.Saturated", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("Vibrance.PSThreshold", new PP3entry("Vibrance.PSThreshold", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Vibrance.ProtectSkins", new PP3entry("Vibrance.ProtectSkins", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Vibrance.AvoidColorShift", new PP3entry("Vibrance.AvoidColorShift", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Vibrance.PastSatTog", new PP3entry("Vibrance.PastSatTog", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("SharpenEdge.Enabled", new PP3entry("SharpenEdge.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("SharpenEdge.Passes", new PP3entry("SharpenEdge.Passes", Convert.ToInt32(GetValue(Llines[i])), 1, 4)); i++;
            Values.Add("SharpenEdge.Strength", new PP3entry("SharpenEdge.Strength", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("SharpenEdge.ThreeChannels", new PP3entry("SharpenEdge.ThreeChannels", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("SharpenMicro.Enabled", new PP3entry("SharpenMicro.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("SharpenMicro.Matrix", new PP3entry("SharpenMicro.Matrix", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("SharpenMicro.Strength", new PP3entry("SharpenMicro.Strength", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("SharpenMicro.Uniformity", new PP3entry("SharpenMicro.Uniformity", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("WhiteBalance.Setting", new PP3entry("WhiteBalance.Setting", GetValue(Llines[i]), null, null)); i++;
            Values.Add("WhiteBalance.Temperature", new PP3entry("WhiteBalance.Temperature", Convert.ToInt32(GetValue(Llines[i])), 2000, 25000)); i++;
            Values.Add("WhiteBalance.Green", new PP3entry("WhiteBalance.Green", Convert.ToDouble(GetValue(Llines[i]), culture), 0.02d, 5d)); i++;
            Values.Add("ImpulseDenoising.Enabled", new PP3entry("ImpulseDenoising.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("ImpulseDenoising.Threshold", new PP3entry("ImpulseDenoising.Threshold", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("Defringing.Enabled", new PP3entry("Defringing.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Defringing.Radius", new PP3entry("Defringing.Radius", Convert.ToDouble(GetValue(Llines[i]), culture), 0.5d, 5d)); i++;
            Values.Add("Defringing.Threshold", new PP3entry("Defringing.Threshold", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("DirectionalPyramidDenoising.Enabled", new PP3entry("DirectionalPyramidDenoising.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("DirectionalPyramidDenoising.Luma", new PP3entry("DirectionalPyramidDenoising.Luma", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("DirectionalPyramidDenoising.Chroma", new PP3entry("DirectionalPyramidDenoising.Chroma", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("DirectionalPyramidDenoising.Gamma", new PP3entry("DirectionalPyramidDenoising.Gamma", Convert.ToDouble(GetValue(Llines[i]), culture), 1d, 3d)); i++;
            Values.Add("EPD.Enabled", new PP3entry("EPD.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("EPD.Strength", new PP3entry("EPD.Strength", Convert.ToDouble(GetValue(Llines[i]), culture), -2d, 0.25d)); i++;
            Values.Add("EPD.EdgeStopping", new PP3entry("EPD.EdgeStopping", Convert.ToDouble(GetValue(Llines[i]), culture), 0.1d, 1.4d)); i++;
            Values.Add("EPD.Scale", new PP3entry("EPD.Scale", Convert.ToDouble(GetValue(Llines[i]), culture), 0.1d, 1d)); i++;
            Values.Add("EPD.ReweightingIterates", new PP3entry("EPD.ReweightingIterates", Convert.ToInt32(GetValue(Llines[i])), 0, 9)); i++;
            Values.Add("ShadowsAndHighlights.Enabled", new PP3entry("ShadowsAndHighlights.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("ShadowsAndHighlights.HighQuality", new PP3entry("ShadowsAndHighlights.HighQuality", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("ShadowsAndHighlights.Highlights", new PP3entry("ShadowsAndHighlights.Highlights", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("ShadowsAndHighlights.HighlightTonalWidth", new PP3entry("ShadowsAndHighlights.HighlightTonalWidth", Convert.ToInt32(GetValue(Llines[i])), 10, 100)); i++;
            Values.Add("ShadowsAndHighlights.Shadows", new PP3entry("ShadowsAndHighlights.Shadows", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("ShadowsAndHighlights.ShadowTonalWidth", new PP3entry("ShadowsAndHighlights.ShadowTonalWidth", Convert.ToInt32(GetValue(Llines[i])), 10, 100)); i++;
            Values.Add("ShadowsAndHighlights.LocalContrast", new PP3entry("ShadowsAndHighlights.LocalContrast", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("ShadowsAndHighlights.Radius", new PP3entry("ShadowsAndHighlights.Radius", Convert.ToInt32(GetValue(Llines[i])), 5, 100)); i++;
            Values.Add("Crop.Enabled", new PP3entry("Crop.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Crop.X", new PP3entry("Crop.X", Convert.ToInt32(GetValue(Llines[i])), 0, 0)); i++;
            Values.Add("Crop.Y", new PP3entry("Crop.Y", Convert.ToInt32(GetValue(Llines[i])), 0, 0)); i++;
            Values.Add("Crop.W", new PP3entry("Crop.W", Convert.ToInt32(GetValue(Llines[i])), 0, 0)); i++;
            Values.Add("Crop.H", new PP3entry("Crop.H", Convert.ToInt32(GetValue(Llines[i])), 0, 0)); i++;
            Values.Add("Crop.FixedRatio", new PP3entry("Crop.FixedRatio", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Crop.Ratio", new PP3entry("Crop.Ratio", GetValue(Llines[i]), null, null)); i++;
            Values.Add("Crop.Orientation", new PP3entry("Crop.Orientation", GetValue(Llines[i]), null, null)); i++;
            Values.Add("Crop.Guide", new PP3entry("Crop.Guide", GetValue(Llines[i]), null, null)); i++;
            Values.Add("CoarseTransformation.Rotate", new PP3entry("CoarseTransformation.Rotate", Convert.ToInt32(GetValue(Llines[i])), 0, 0)); i++;
            Values.Add("CoarseTransformation.HorizontalFlip", new PP3entry("CoarseTransformation.HorizontalFlip", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("CoarseTransformation.VerticalFlip", new PP3entry("CoarseTransformation.VerticalFlip", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("CommonPropertiesforTransformations.AutoFill", new PP3entry("CommonPropertiesforTransformations.AutoFill", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Rotation.Degree", new PP3entry("Rotation.Degree", Convert.ToDouble(GetValue(Llines[i]), culture), -45d, 45d)); i++;
            Values.Add("Distortion.Amount", new PP3entry("Distortion.Amount", Convert.ToDouble(GetValue(Llines[i]), culture), -0.5d, 0.5d)); i++;
            Values.Add("LensProfile.LCPFile", new PP3entry("LensProfile.LCPFile", GetValue(Llines[i]), null, null)); i++;
            Values.Add("LensProfile.UseDistortion", new PP3entry("LensProfile.UseDistortion", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("LensProfile.UseVignette", new PP3entry("LensProfile.UseVignette", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("LensProfile.UseCA", new PP3entry("LensProfile.UseCA", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Perspective.Horizontal", new PP3entry("Perspective.Horizontal", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("Perspective.Vertical", new PP3entry("Perspective.Vertical", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("CACorrection.Red", new PP3entry("CACorrection.Red", Convert.ToDouble(GetValue(Llines[i]), culture), -0.005d, 0.005d)); i++;
            Values.Add("CACorrection.Blue", new PP3entry("CACorrection.Blue", Convert.ToDouble(GetValue(Llines[i]), culture), -0.005d, 0.005d)); i++;
            Values.Add("VignettingCorrection.Amount", new PP3entry("VignettingCorrection.Amount", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("VignettingCorrection.Radius", new PP3entry("VignettingCorrection.Radius", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("VignettingCorrection.Strength", new PP3entry("VignettingCorrection.Strength", Convert.ToInt32(GetValue(Llines[i])), 1, 100)); i++;
            Values.Add("VignettingCorrection.CenterX", new PP3entry("VignettingCorrection.CenterX", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("VignettingCorrection.CenterY", new PP3entry("VignettingCorrection.CenterY", Convert.ToInt32(GetValue(Llines[i])), -100, 100)); i++;
            Values.Add("HLRecovery.Enabled", new PP3entry("HLRecovery.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("HLRecovery.Method", new PP3entry("HLRecovery.Method", GetValue(Llines[i]), null, null)); i++;
            Values.Add("Resize.Enabled", new PP3entry("Resize.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("Resize.Scale", new PP3entry("Resize.Scale", Convert.ToDouble(GetValue(Llines[i]), culture), 0.01d, 4d)); i++;
            Values.Add("Resize.AppliesTo", new PP3entry("Resize.AppliesTo", GetValue(Llines[i]), null, null)); i++;
            Values.Add("Resize.Method", new PP3entry("Resize.Method", GetValue(Llines[i]), null, null)); i++;
            Values.Add("Resize.DataSpecified", new PP3entry("Resize.DataSpecified", Convert.ToInt32(GetValue(Llines[i])), 0, 0)); i++;
            Values.Add("Resize.Width", new PP3entry("Resize.Width", Convert.ToInt32(GetValue(Llines[i])), 0, 0)); i++;
            Values.Add("Resize.Height", new PP3entry("Resize.Height", Convert.ToInt32(GetValue(Llines[i])), 0, 0)); i++;
            Values.Add("ColorManagement.InputProfile", new PP3entry("ColorManagement.InputProfile", GetValue(Llines[i]), null, null)); i++;
            Values.Add("ColorManagement.BlendCMSMatrix", new PP3entry("ColorManagement.BlendCMSMatrix", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("ColorManagement.PreferredProfile", new PP3entry("ColorManagement.PreferredProfile", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("ColorManagement.WorkingProfile", new PP3entry("ColorManagement.WorkingProfile", GetValue(Llines[i]), null, null)); i++;
            Values.Add("ColorManagement.OutputProfile", new PP3entry("ColorManagement.OutputProfile", GetValue(Llines[i]), null, null)); i++;
            Values.Add("ColorManagement.Gammafree", new PP3entry("ColorManagement.Gammafree", GetValue(Llines[i]), null, null)); i++;
            Values.Add("ColorManagement.Freegamma", new PP3entry("ColorManagement.Freegamma", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("ColorManagement.GammaValue", new PP3entry("ColorManagement.GammaValue", Convert.ToDouble(GetValue(Llines[i]), culture), 1d, 1d)); i++;
            Values.Add("ColorManagement.GammaSlope", new PP3entry("ColorManagement.GammaSlope", Convert.ToDouble(GetValue(Llines[i]), culture), 0d, 15d)); i++;
            Values.Add("DirectionalPyramidEqualizer.Enabled", new PP3entry("DirectionalPyramidEqualizer.Enabled", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("DirectionalPyramidEqualizer.Mult0", new PP3entry("DirectionalPyramidEqualizer.Mult0", Convert.ToDouble(GetValue(Llines[i]), culture), 0d, 4d)); i++;
            Values.Add("DirectionalPyramidEqualizer.Mult1", new PP3entry("DirectionalPyramidEqualizer.Mult1", Convert.ToDouble(GetValue(Llines[i]), culture), 0d, 4d)); i++;
            Values.Add("DirectionalPyramidEqualizer.Mult2", new PP3entry("DirectionalPyramidEqualizer.Mult2", Convert.ToDouble(GetValue(Llines[i]), culture), 0d, 4d)); i++;
            Values.Add("DirectionalPyramidEqualizer.Mult3", new PP3entry("DirectionalPyramidEqualizer.Mult3", Convert.ToDouble(GetValue(Llines[i]), culture), 0d, 4d)); i++;
            Values.Add("DirectionalPyramidEqualizer.Mult4", new PP3entry("DirectionalPyramidEqualizer.Mult4", Convert.ToDouble(GetValue(Llines[i]), culture), 0d, 1d)); i++;
            Values.Add("HSVEqualizer.HCurve", new PP3entry("HSVEqualizer.HCurve", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("HSVEqualizer.SCurve", new PP3entry("HSVEqualizer.SCurve", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("HSVEqualizer.VCurve", new PP3entry("HSVEqualizer.VCurve", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("RGBCurves.rCurve", new PP3entry("RGBCurves.rCurve", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("RGBCurves.gCurve", new PP3entry("RGBCurves.gCurve", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("RGBCurves.bCurve", new PP3entry("RGBCurves.bCurve", PP3Curve.GetCurve(GetValue(Llines[i])), null, null)); i++;
            Values.Add("RAW.DarkFrame", new PP3entry("RAW.DarkFrame", GetValue(Llines[i]), null, null)); i++;
            Values.Add("RAW.DarkFrameAuto", new PP3entry("RAW.DarkFrameAuto", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("RAW.FlatFieldFile", new PP3entry("RAW.FlatFieldFile", GetValue(Llines[i]), null, null)); i++;
            Values.Add("RAW.FlatFieldAutoSelect", new PP3entry("RAW.FlatFieldAutoSelect", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("RAW.FlatFieldBlurRadius", new PP3entry("RAW.FlatFieldBlurRadius", Convert.ToInt32(GetValue(Llines[i])), 0, 200)); i++;
            Values.Add("RAW.FlatFieldBlurType", new PP3entry("RAW.FlatFieldBlurType", GetValue(Llines[i]), null, null)); i++;
            Values.Add("RAW.CA", new PP3entry("RAW.CA", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("RAW.CARed", new PP3entry("RAW.CARed", Convert.ToDouble(GetValue(Llines[i]), culture), -4d, 4d)); i++;
            Values.Add("RAW.CABlue", new PP3entry("RAW.CABlue", Convert.ToDouble(GetValue(Llines[i]), culture), -4d, 4d)); i++;
            Values.Add("RAW.HotDeadPixels", new PP3entry("RAW.HotDeadPixels", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("RAW.HotDeadPixelThresh", new PP3entry("RAW.HotDeadPixelThresh", Convert.ToInt32(GetValue(Llines[i])), 40, 40)); i++;
            Values.Add("RAW.LineDenoise", new PP3entry("RAW.LineDenoise", Convert.ToInt32(GetValue(Llines[i])), 0, 1000)); i++;
            Values.Add("RAW.GreenEqThreshold", new PP3entry("RAW.GreenEqThreshold", Convert.ToInt32(GetValue(Llines[i])), 0, 100)); i++;
            Values.Add("RAW.CcSteps", new PP3entry("RAW.CcSteps", Convert.ToInt32(GetValue(Llines[i])), 0, 5)); i++;
            Values.Add("RAW.Method", new PP3entry("RAW.Method", GetValue(Llines[i]), null, null)); i++;
            Values.Add("RAW.DCBIterations", new PP3entry("RAW.DCBIterations", Convert.ToInt32(GetValue(Llines[i])), 0, 5)); i++;
            Values.Add("RAW.DCBEnhance", new PP3entry("RAW.DCBEnhance", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("RAW.ALLEnhance", new PP3entry("RAW.ALLEnhance", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;
            Values.Add("RAW.PreExposure", new PP3entry("RAW.PreExposure", Convert.ToDouble(GetValue(Llines[i]), culture), 0.1d, 16d)); i++;
            Values.Add("RAW.PrePreserv", new PP3entry("RAW.PrePreserv", Convert.ToDouble(GetValue(Llines[i]), culture), 0d, 2.5d)); i++;
            Values.Add("RAW.PreBlackzero", new PP3entry("RAW.PreBlackzero", Convert.ToDouble(GetValue(Llines[i]), culture), -50d, 50d)); i++;
            Values.Add("RAW.PreBlackone", new PP3entry("RAW.PreBlackone", Convert.ToDouble(GetValue(Llines[i]), culture), -50d, 50d)); i++;
            Values.Add("RAW.PreBlacktwo", new PP3entry("RAW.PreBlacktwo", Convert.ToDouble(GetValue(Llines[i]), culture), -50d, 50d)); i++;
            Values.Add("RAW.PreBlackthree", new PP3entry("RAW.PreBlackthree", Convert.ToDouble(GetValue(Llines[i]), culture), -50d, 50d)); i++;
            Values.Add("RAW.PreTwoGreen", new PP3entry("RAW.PreTwoGreen", Convert.ToBoolean(GetValue(Llines[i])), null, null)); i++;

            NewCompensation = Compensation;
        }
Beispiel #3
0
        internal static PP3Curve[] Do(List <KeyValuePair <int, object> > Input)
        {
            Type CurType = Input[0].Value.GetType();
            int  Pointcount, step = 1;

            if (CurType == typeof(PP3Curve_Array))
            {
                Pointcount = ((PP3Curve_Array)Input[0].Value).DataPoints.Count;
                if (Input.Any(t => ((PP3Curve_Array)t.Value).DataPoints.Count != Pointcount))
                {
                    throw new InterpolationNotPossibleException("Pointcount of curve is not consistet!");
                }
            }
            else if (CurType == typeof(PP3Curve_ControlCage))
            {
                Pointcount = ((PP3Curve_ControlCage)Input[0].Value).DataPoints.Count;
                if (Input.Any(t => ((PP3Curve_ControlCage)t.Value).DataPoints.Count != Pointcount))
                {
                    throw new InterpolationNotPossibleException("Pointcount of curve is not consistet!");
                }
            }
            else if (CurType == typeof(PP3Curve_Custom))
            {
                step       = 2;
                Pointcount = ((PP3Curve_Custom)Input[0].Value).DataPoints.Count * 2;
                if (Input.Any(t => ((PP3Curve_Custom)t.Value).DataPoints.Count * 2 != Pointcount))
                {
                    throw new InterpolationNotPossibleException("Pointcount of curve is not consistet!");
                }
            }
            else if (CurType == typeof(PP3Curve_Parametric))
            {
                Pointcount = 7;
            }
            else
            {
                throw new InterpolationNotPossibleException();
            }

            //check if it's possible to interpolate
            if (Input.Any(t => t.Value.GetType() != CurType))
            {
                throw new InterpolationNotPossibleException("Curvetype is not consistet!");
            }

            //start to interpolate
            PointD[][] InPoints = new PointD[Pointcount][];

            //Curves to points
            for (int i = 0; i < Pointcount; i += step)
            {
                if (InPoints[i] == null)
                {
                    InPoints[i] = new PointD[Input.Count];
                }

                for (int j = 0; j < Input.Count; j++)
                {
                    if (CurType == typeof(PP3Curve_Array))
                    {
                        InPoints[i][j] = new PointD(Input[j].Key, ((PP3Curve_Array)Input[j].Value).DataPoints[i]);
                    }
                    else if (CurType == typeof(PP3Curve_ControlCage))
                    {
                        InPoints[i][j] = ((PP3Curve_ControlCage)Input[j].Value).DataPoints[i];
                    }
                    else if (CurType == typeof(PP3Curve_Custom))
                    {
                        if (InPoints[i + 1] == null)
                        {
                            InPoints[i + 1] = new PointD[Input.Count];
                        }
                        InPoints[i][j]     = new PointD(j, ((PP3Curve_Custom)Input[j].Value).DataPoints[i / 2].X);
                        InPoints[i + 1][j] = new PointD(j, ((PP3Curve_Custom)Input[j].Value).DataPoints[i / 2].Y);
                    }
                    else if (CurType == typeof(PP3Curve_Parametric))
                    {
                        InPoints[i][0] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[0].Value).Zones[0]);
                        InPoints[i][1] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[1].Value).Zones[1]);
                        InPoints[i][2] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[2].Value).Zones[2]);
                        InPoints[i][3] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[3].Value).Highlights);
                        InPoints[i][4] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[4].Value).Lights);
                        InPoints[i][5] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[5].Value).Darks);
                        InPoints[i][6] = new PointD(Input[j].Key, (float)((PP3Curve_Parametric)Input[6].Value).Shadows);
                    }
                }
            }

            PointD[][] OutPoints = new PointD[Pointcount][];

            //interpolate points
            for (int i = 0; i < Pointcount; i++)
            {
                OutPoints[i] = Do(InPoints[i], ProjectManager.CurrentProject.Frames.Count);
            }

            PP3Curve[] Output = new PP3Curve[ProjectManager.CurrentProject.Frames.Count];

            //points back to curves
            for (int i = 0; i < ProjectManager.CurrentProject.Frames.Count; i++)
            {
                for (int j = 0; j < Pointcount; j += step)
                {
                    if (CurType == typeof(PP3Curve_Array))
                    {
                        if (Output[i] == null)
                        {
                            Output[i] = new PP3Curve_Array();
                        }
                        ((PP3Curve_Array)Output[i]).DataPoints.Add((int)OutPoints[j][i].Y);
                    }
                    else if (CurType == typeof(PP3Curve_ControlCage))
                    {
                        if (Output[i] == null)
                        {
                            Output[i] = new PP3Curve_ControlCage();
                        }
                        ((PP3Curve_ControlCage)Output[i]).DataPoints.Add(OutPoints[j][i]);
                    }
                    else if (CurType == typeof(PP3Curve_Custom))
                    {
                        if (Output[i] == null)
                        {
                            Output[i] = new PP3Curve_Custom();
                        }
                        ((PP3Curve_Custom)Output[i]).DataPoints.Add(new PointD(OutPoints[j][i].Y, OutPoints[j + 1][i].Y));
                    }
                    else if (CurType == typeof(PP3Curve_Parametric))
                    {
                        if (Output[i] == null)
                        {
                            Output[i] = new PP3Curve_Parametric();
                        }
                        ((PP3Curve_Parametric)Output[i]).Zones[0]   = OutPoints[0][i].Y;
                        ((PP3Curve_Parametric)Output[i]).Zones[1]   = OutPoints[1][i].Y;
                        ((PP3Curve_Parametric)Output[i]).Zones[2]   = OutPoints[2][i].Y;
                        ((PP3Curve_Parametric)Output[i]).Highlights = OutPoints[3][i].Y;
                        ((PP3Curve_Parametric)Output[i]).Lights     = OutPoints[4][i].Y;
                        ((PP3Curve_Parametric)Output[i]).Darks      = OutPoints[5][i].Y;
                        ((PP3Curve_Parametric)Output[i]).Shadows    = OutPoints[6][i].Y;
                        j = Pointcount;
                    }
                    else if (CurType == typeof(PP3Curve_HSV))
                    {
                        //TODO: check for HSV curve type (also in PP3Curve.cs); handling is the same as custom curve
                    }
                }
            }

            return(Output);
        }