Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

Commit

Permalink
v2.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
asiryan committed Feb 22, 2021
1 parent 6e27e99 commit 420b957
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 56 deletions.
7 changes: 4 additions & 3 deletions sources/LocalLaplacianFilters.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
Expand All @@ -77,8 +78,8 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="UMapx, Version=4.0.2.3, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\UMapx.4.0.2.3\lib\netstandard2.0\UMapx.dll</HintPath>
<Reference Include="UMapx, Version=5.0.1.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\UMapx.5.0.1.1\lib\netstandard2.0\UMapx.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions sources/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
// Можно задать все значения или принять номер построения и номер редакции по умолчанию,
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]
18 changes: 9 additions & 9 deletions sources/filters/BilateralGammaFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace LaplacianHDR.Filters
public class BilateralGammaCorrection : Correction
{
#region Private data
private double g;
private float g;
#endregion

#region Filter components
Expand All @@ -18,14 +18,14 @@ public class BilateralGammaCorrection : Correction
/// </summary>
/// <param name="g">Gamma</param>
/// <param name="space">Space</param>
public BilateralGammaCorrection(double g, Space space)
public BilateralGammaCorrection(float g, Space space)
{
Value = g; Space = space;
}
/// <summary>
/// Gets or sets gamma value.
/// </summary>
public double Value
public float Value
{
get
{
Expand Down Expand Up @@ -53,13 +53,13 @@ protected override void Rebuild()
/// <param name="g">Gamma</param>
/// <param name="length">Length</param>
/// <returns>Array</returns>
public static double[] Gamma(double g, int length)
public static float[] Gamma(float g, int length)
{
double[] table = new double[length];
float[] table = new float[length];

for (int x = 0; x < length; x++)
{
table[x] = Gamma(x / (double)length, g);
table[x] = Gamma(x / (float)length, g);
}
return table;
}
Expand All @@ -69,7 +69,7 @@ public static double[] Gamma(double g, int length)
/// <param name="x">Argument</param>
/// <param name="g">Gamma</param>
/// <returns>Double</returns>
public static double Gamma(double x, double g)
public static float Gamma(float x, float g)
{
double y, z, w;

Expand All @@ -90,9 +90,9 @@ public static double Gamma(double x, double g)

// check
if (double.IsNaN(y))
return 1.0;
return 1.0f;

return y;
return (float)y;
}
#endregion
}
Expand Down
2 changes: 1 addition & 1 deletion sources/filters/GeneralizedLocalLaplacianFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public GeneralizedLocalLaplacianFilter()
/// <param name="levels">Number of levels</param>
/// <param name="factor">Factor</param>
/// <param name="space">Colorspace</param>
public void SetParams(int radius, double lightshadows, double sigma, int discrets, int levels, double factor, Space space)
public void SetParams(int radius, float lightshadows, float sigma, int discrets, int levels, float factor, Space space)
{
this.bgc.Value = lightshadows;
this.bgc.Space = space;
Expand Down
2 changes: 1 addition & 1 deletion sources/filters/HueSaturationLightnessFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public HueSaturationLightnessFilter()
/// <param name="h">Hue</param>
/// <param name="s">Saturation</param>
/// <param name="l">Lightness</param>
public void SetParams(double h, double s, double l)
public void SetParams(float h, float s, float l)
{
this.hsl.Hue = h;
this.hsl.Saturation = s;
Expand Down
2 changes: 1 addition & 1 deletion sources/filters/SaturationContrastBrightnessFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public SaturationContrastBrightnessFilter()
/// <param name="exposure">Exposure</param>
/// <param name="gamma">Gamma</param>
/// <param name="space">Colorspace</param>
public void SetParams(double saturation, double contrast, double brightness, double exposure, double gamma, Space space)
public void SetParams(float saturation, float contrast, float brightness, float exposure, float gamma, Space space)
{
this.sc.Saturation = saturation;

Expand Down
2 changes: 1 addition & 1 deletion sources/filters/TemperatureFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public TemperatureFilter()
/// </summary>
/// <param name="temperature">Temperature</param>
/// <param name="strenght">Strength</param>
public void SetParams(double temperature, double strenght)
public void SetParams(float temperature, float strenght)
{
this.temp.Temperature = temperature;
this.temp.Strength = strenght;
Expand Down
37 changes: 19 additions & 18 deletions sources/forms/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions sources/forms/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ private void ResetAdjustments()
return;
}

private void Processor(Bitmap bitmap, SingleFilter filter, bool cache = true)
private void Processor(Bitmap bitmap, Filter filter, bool cache = true)
{
// check if null
if (bitmap != null)
Expand All @@ -545,7 +545,7 @@ private void Processor(Bitmap bitmap, SingleFilter filter, bool cache = true)
return;
}

private void Processor(Bitmap[] bitmap, ComplexFilter filter)
private void Processor(Bitmap[] bitmap, MultiFilter filter)
{
// check if null
if (bitmap != null)
Expand All @@ -568,11 +568,11 @@ private void Processor(Bitmap[] bitmap, ComplexFilter filter)
public Bitmap Apply(Bitmap image)
{
// parsing
double saturation = int.Parse(textBox1.Text);
double contrast = double.Parse(textBox2.Text) / 100.0;
double brightness = double.Parse(textBox5.Text) / 100.0;
double exposure = double.Parse(textBox4.Text) / 100.0;
double gamma = Math.Pow(2, -3 * double.Parse(textBox3.Text) / 100.0);
float saturation = int.Parse(textBox1.Text);
float contrast = float.Parse(textBox2.Text) / 100.0f;
float brightness = float.Parse(textBox5.Text) / 100.0f;
float exposure = float.Parse(textBox4.Text) / 100.0f;
float gamma = (float)Math.Pow(2, -3 * float.Parse(textBox3.Text) / 100.0f);

// parameters
scf.SetParams(saturation, contrast, brightness, exposure, gamma, Space);
Expand Down
6 changes: 3 additions & 3 deletions sources/forms/Form2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public Space Space
public Bitmap Apply(Bitmap image)
{
// parsing
double lightshadows = Math.Pow(2, double.Parse(textBox1.Text) / 100.0);
double sigma = double.Parse(textBox2.Text);
float lightshadows = (float)Math.Pow(2, float.Parse(textBox1.Text) / 100.0);
float sigma = float.Parse(textBox2.Text);
int discrets = int.Parse(textBox3.Text);
int levels = int.Parse(textBox4.Text);
double factor = double.Parse(textBox5.Text);
float factor = float.Parse(textBox5.Text);
int radius = 2 * (int.Parse(textBox6.Text) + 1);

// applying filter
Expand Down
4 changes: 2 additions & 2 deletions sources/forms/Form3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ private void Form3_Load(object sender, EventArgs e)
public Bitmap Apply(Bitmap image)
{
// parsing
double saturation = double.Parse(textBox1.Text);
double contrast = double.Parse(textBox2.Text);
float saturation = float.Parse(textBox1.Text);
float contrast = float.Parse(textBox2.Text);

// applying
temp.SetParams(saturation, contrast);
Expand Down
6 changes: 3 additions & 3 deletions sources/forms/Form4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ private void Form4_Load(object sender, EventArgs e)
public Bitmap Apply(Bitmap image)
{
// parsing
double h = double.Parse(textBox1.Text);
double s = double.Parse(textBox2.Text) / 100.0;
double l = double.Parse(textBox3.Text) / 100.0;
float h = float.Parse(textBox1.Text);
float s = float.Parse(textBox2.Text) / 100.0f;
float l = float.Parse(textBox3.Text) / 100.0f;

// applying filter
hsl.SetParams(h, s, l);
Expand Down
2 changes: 1 addition & 1 deletion sources/forms/Form5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private void Form5_Load(object sender, EventArgs e)

public Bitmap Apply(params Bitmap[] images)
{
this.fusion = new ExposureFusion(int.MaxValue, double.Parse(textBox2.Text));
this.fusion = new ExposureFusion(int.MaxValue, float.Parse(textBox2.Text));
return this.fusion.Apply(images);
}

Expand Down
4 changes: 2 additions & 2 deletions sources/helpers/DelegateHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ namespace LaplacianHDR.Helpers
/// </summary>
/// <param name="bitmap">Bitmap</param>
/// <returns>Bitmap</returns>
public delegate Bitmap SingleFilter(Bitmap bitmap);
public delegate Bitmap Filter(Bitmap bitmap);
/// <summary>
/// Filter delegate.
/// </summary>
/// <param name="bitmap">Bitmap</param>
/// <returns>Bitmap</returns>
public delegate Bitmap ComplexFilter(Bitmap[] bitmap);
public delegate Bitmap MultiFilter(Bitmap[] bitmap);
#endregion
}
2 changes: 1 addition & 1 deletion sources/helpers/ImageHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public static Bitmap Crop(Bitmap bitmap, int box)
double k = min / (double)box;

return (new Bitmap(bitmap, (int)(width / k + 1), (int)(height / k + 1))).
Clone(new Rectangle(0, 0, box, box), System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Clone(new Rectangle(0, 0, box, box), PixelFormat.Format32bppArgb);
}
/// <summary>
/// Checks if bitmaps in array have the same sizes.
Expand Down
2 changes: 1 addition & 1 deletion sources/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Drawing.Common" version="5.0.0" targetFramework="net472" />
<package id="UMapx" version="4.0.2.3" targetFramework="net472" />
<package id="UMapx" version="5.0.1.1" targetFramework="net472" />
</packages>

0 comments on commit 420b957

Please sign in to comment.