private IAdapterProxy GetAdapter() { if (_adapter == null) { _adapter = new CameraRawXmpAdapter(_photoPath); } return(_adapter); }
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); }
/* 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); } }
/* 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); } }
// 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(); } }
public static string GetName(this IAdapterProxy proxy) { Console.WriteLine("Called Proxy Extension Method"); return("proxy name"); }
/* 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"); }