Exemplo n.º 1
0
 private IAdapterProxy GetAdapter()
 {
     if (_adapter == null)
     {
         _adapter = new CameraRawXmpAdapter(_photoPath);
     }
     return(_adapter);
 }
Exemplo n.º 2
0
 private bool IsExposureChanged(IAdapterProxy img1, IAdapterProxy img2)
 {
     if ((img1.GetExif()["ExposureTime"] != img2.GetExif()["ExposureTime"]) || (img1.GetExif()["Iso"] != img2.GetExif()["Iso"]) || (img1.GetExif()["F-number"] != img2.GetExif()["F-number"]))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
        /* it applies the preset to every image in the change object */
        public override void SaveChange()
        {
            for (int i = _startImageNum; i <= _lastImageNum; i++)
            {
                IAdapterProxy current = _modifiedImages[i];

                current.ApplyPreset(this);
            }
        }
Exemplo n.º 4
0
        /* it saves the vignette values to every image belonging the change */
        public override void SaveChange()
        {
            for (int i = _startImageNum; i <= _lastImageNum; i++)
            {
                IAdapterProxy current = _modifiedImages[i];

                current.ApplyVignette(_intensity);
            }
        }
Exemplo n.º 5
0
        // it calculates and applies the changes to every image
        public override void SaveChange()
        {
            // retriving the initial value
            double initialExposureTime = _modifiedImages[_startImageNum].GetExposure();

            for (int i = _startImageNum; i <= _lastImageNum; i++)
            {
                IAdapterProxy current = _modifiedImages[i];

                /* (relative position * unit increment) + initial value = new value
                 * using this methods we can obtain a smooth exposure transition */
                double newExposureTime = initialExposureTime + (_increment * (i - _startImageNum));

                // set & save
                current.SetExposure(newExposureTime);
                current.SaveExposure();
            }
        }
Exemplo n.º 6
0
 public static string GetName(this IAdapterProxy proxy)
 {
     Console.WriteLine("Called Proxy Extension Method");
     return("proxy name");
 }
Exemplo n.º 7
0
        /* Analyzes exposure, searching for changes and creating "exposureChanges"
         * lists, to store images data in change sequence. Then Calculate the
         * exposure offset required to match differences in images.
         */
        public void AnalyzeExposure()
        {
            int startExpChange;

            // foreach image in _images
            for (int i = 0; i < _images.Count - 1; i++)
            {
                IAdapterProxy curr = _images[i];
                IAdapterProxy next = _images[i + 1];

                // Sets start image of exposure change
                if (_exposureChanges.Count == 0)
                {
                    startExpChange = 0;
                }
                else
                {
                    startExpChange = _exposureChanges.Last().GetLastImageNum() + 1;
                }

                if (IsExposureChanged(curr, next))
                {
                    ExposureChange newChange          = new ExposureChange(_images, startExpChange, i);
                    double         exposure           = 0;
                    Dictionary <string, double> exif1 = curr.GetExif();
                    Dictionary <string, double> exif2 = next.GetExif();

                    // If the shutter speed was changed
                    if (exif1["ExposureTime"] != exif2["ExposureTime"])
                    {
                        // Use log and doubling function to calculate stops
                        if (exif1["ExposureTime"] < exif2["ExposureTime"])
                        {
                            exposure += Math.Log2(exif1["ExposureTime"] / exif2["ExposureTime"]);
                        }
                        else
                        {
                            exposure += (-1) * Math.Log2(exif1["ExposureTime"] / exif2["ExposureTime"]);
                        }
                    }

                    // If the aperture was changed
                    if (exif1["F-number"] != exif2["F-number"])
                    {
                        // Use log function to calculate stops
                        exposure += (2) * Math.Log2(exif1["F-number"] / exif2["F-number"]);
                    }

                    // If iso was changed
                    if (exif1["Iso"] != exif2["Iso"])
                    {
                        // Use log function to calculate stops
                        exposure += (-1) * Math.Log2(exif1["Iso"] / exif2["Iso"]);
                    }

                    // If the "xmp" exposure setting is changed..
                    if (curr.GetExposure() != next.GetExposure())
                    {
                        exposure += (next.GetExposure() - curr.GetExposure());
                    }

                    // Set calculated change to object
                    newChange.SetExposureChange(exposure);

                    // Save exposure change to exposureChanges list!
                    // Allowing multiple exposure changes to occur and be analyzed independently
                    _exposureChanges.Add(newChange);
                }
            }
            Console.WriteLine("[!] Finished analyzing the exposure time");
            _exposureChanges.ForEach(expChange => expChange.SaveChange());
            Console.WriteLine("[!] Finished saving the exposure changes to files");
        }