summaryrefslogtreecommitdiff
path: root/ImageProcessing
diff options
context:
space:
mode:
Diffstat (limited to 'ImageProcessing')
-rw-r--r--ImageProcessing/ColorTools.cs217
-rw-r--r--ImageProcessing/Filters.cs604
-rw-r--r--ImageProcessing/FormImageProcessing.Designer.cs235
-rw-r--r--ImageProcessing/FormImageProcessing.cs441
-rw-r--r--ImageProcessing/FormImageProcessing.resx129
-rw-r--r--ImageProcessing/ImageProcessing.csproj90
-rw-r--r--ImageProcessing/Program.cs21
-rw-r--r--ImageProcessing/Properties/AssemblyInfo.cs36
-rw-r--r--ImageProcessing/Properties/Resources.Designer.cs71
-rw-r--r--ImageProcessing/Properties/Resources.resx117
-rw-r--r--ImageProcessing/Properties/Settings.Designer.cs30
-rw-r--r--ImageProcessing/Properties/Settings.settings7
-rw-r--r--ImageProcessing/bin/Debug/1.pngbin0 -> 377494 bytes
-rw-r--r--ImageProcessing/bin/Debug/2.pngbin0 -> 413209 bytes
-rw-r--r--ImageProcessing/bin/Debug/3.pngbin0 -> 296197 bytes
-rw-r--r--ImageProcessing/bin/Debug/4.pngbin0 -> 122646 bytes
-rw-r--r--ImageProcessing/bin/Debug/ImageProcessing.exebin0 -> 25088 bytes
-rw-r--r--ImageProcessing/bin/Debug/ImageProcessing.pdbbin0 -> 65024 bytes
-rw-r--r--ImageProcessing/bin/Debug/ImageProcessing.vshost.exebin0 -> 11600 bytes
-rw-r--r--ImageProcessing/bin/Debug/ImageProcessing.vshost.exe.manifest11
-rw-r--r--ImageProcessing/bin/Debug/grid color.jpgbin0 -> 193452 bytes
-rw-r--r--ImageProcessing/bin/Debug/screenshoot1.Jpgbin0 -> 29667 bytes
-rw-r--r--ImageProcessing/bin/Debug/screenshoot2.Jpgbin0 -> 2611 bytes
-rw-r--r--ImageProcessing/bin/Debug/screenshoot3.Jpgbin0 -> 43860 bytes
-rw-r--r--ImageProcessing/bin/Debug/strip.pngbin0 -> 16807 bytes
-rw-r--r--ImageProcessing/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cachebin0 -> 4501 bytes
-rw-r--r--ImageProcessing/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cachebin0 -> 6305 bytes
-rw-r--r--ImageProcessing/obj/x86/Debug/GenerateResource.read.1.tlogbin0 -> 518 bytes
-rw-r--r--ImageProcessing/obj/x86/Debug/GenerateResource.write.1.tlogbin0 -> 1298 bytes
-rw-r--r--ImageProcessing/obj/x86/Debug/ImageProcessing.FormImageProcessing.resourcesbin0 -> 180 bytes
-rw-r--r--ImageProcessing/obj/x86/Debug/ImageProcessing.Properties.Resources.resourcesbin0 -> 180 bytes
-rw-r--r--ImageProcessing/obj/x86/Debug/ImageProcessing.csproj.FileListAbsolute.txt18
-rw-r--r--ImageProcessing/obj/x86/Debug/ImageProcessing.exebin0 -> 25088 bytes
-rw-r--r--ImageProcessing/obj/x86/Debug/ImageProcessing.pdbbin0 -> 65024 bytes
-rw-r--r--ImageProcessing/obj/x86/Debug/ResolveAssemblyReference.cachebin0 -> 8031 bytes
-rw-r--r--ImageProcessing/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cachebin0 -> 6194 bytes
-rw-r--r--ImageProcessing/obj/x86/Release/GenerateResource.read.1.tlogbin0 -> 236 bytes
-rw-r--r--ImageProcessing/obj/x86/Release/GenerateResource.write.1.tlogbin0 -> 610 bytes
-rw-r--r--ImageProcessing/obj/x86/Release/ImageProcessing.FormImageProcessing.resourcesbin0 -> 180 bytes
-rw-r--r--ImageProcessing/obj/x86/Release/ImageProcessing.Properties.Resources.resourcesbin0 -> 180 bytes
-rw-r--r--ImageProcessing/obj/x86/Release/ImageProcessing.csproj.FileListAbsolute.txt5
41 files changed, 2032 insertions, 0 deletions
diff --git a/ImageProcessing/ColorTools.cs b/ImageProcessing/ColorTools.cs
new file mode 100644
index 0000000..5c625fd
--- /dev/null
+++ b/ImageProcessing/ColorTools.cs
@@ -0,0 +1,217 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+
+namespace ImageProcessing
+{
+ public struct ColorRGB
+ {
+ public byte R;
+ public byte G;
+ public byte B;
+
+ public ColorRGB(Color value)
+ {
+ this.R = value.R;
+ this.G = value.G;
+ this.B = value.B;
+ }
+
+ public static implicit operator Color(ColorRGB rgb)
+ {
+ Color c = Color.FromArgb(rgb.R, rgb.G, rgb.B);
+ return c;
+ }
+
+ public static explicit operator ColorRGB(Color c)
+ {
+ return new ColorRGB(c);
+ }
+
+ }
+
+ public struct ColorHSL
+ {
+ public double H;
+ public double S;
+ public double L;
+
+ public ColorHSL(double h, double s, double l)
+ {
+ this.L = l;
+ this.S = s;
+ this.H = h;
+ }
+ }
+
+
+ public class ColorTools
+ {
+
+ /// <summary>
+ /// Given H,S,L, alph in range of 0-1
+ /// </summary>
+ /// <param name="h"></param>
+ /// <param name="s"></param>
+ /// <param name="l"></param>
+ /// <param name="alpha"></param>
+ /// <returns></returns> Returns a Color (RGB struct) in range of 0-255
+ public static Color HSL2RGB(double h, double s, double l, double alpha)
+ {
+ double v;
+ double r, g, b;
+
+ r = l; // default to gray
+ g = l;
+ b = l;
+
+ v = (l <= 0.5) ? (l * (1.0 + s)) : (l + s - l * s);
+
+ if (v > 0)
+ {
+ double m;
+ double sv;
+ int sextant;
+ double fract, vsf, mid1, mid2;
+
+ m = l + l - v;
+ sv = (v - m) / v;
+ h *= 6.0;
+
+ sextant = (int)h;
+ fract = h - sextant;
+ vsf = v * sv * fract;
+
+ mid1 = m + vsf;
+ mid2 = v - vsf;
+ switch (sextant)
+ {
+
+ case 0:
+ r = v;
+ g = mid1;
+ b = m;
+ break;
+
+ case 1:
+ r = mid2;
+ g = v;
+ b = m;
+ break;
+
+ case 2:
+ r = m;
+ g = v;
+ b = mid1;
+ break;
+
+ case 3:
+ r = m;
+ g = mid2;
+ b = v;
+ break;
+
+ case 4:
+ r = mid1;
+ g = m;
+ b = v;
+ break;
+
+ case 5:
+ r = v;
+ g = m;
+ b = mid2;
+ break;
+ case 6:
+ r = v;
+ g = mid1;
+ b = m;
+ break;
+
+ }
+
+ }
+
+
+ Byte R = Convert.ToByte(r * 255.0f);
+ Byte G = Convert.ToByte(g * 255.0f);
+ Byte B = Convert.ToByte(b * 255.0f);
+ Byte A = Convert.ToByte(alpha * 255.0f);
+
+ return Color.FromArgb(A, R, G, B);
+
+ }
+
+ // Given a Color (RGB Struct) in range of 0-255
+
+ // Return H,S,L in range of 0-1
+ public static ColorHSL RGB2HSL(byte r, byte g, byte b)
+ {
+ ColorRGB rgb = new ColorRGB();
+ rgb.R = r;
+ rgb.G = g;
+ rgb.B = b;
+ return ColorTools.RGB2HSL(rgb);
+ }
+ public static ColorHSL RGB2HSL(ColorRGB rgb)
+ {
+
+ double r = rgb.R / 255.0;
+ double g = rgb.G / 255.0;
+ double b = rgb.B / 255.0;
+ double v;
+ double m;
+ double vm;
+ double r2, g2, b2;
+
+ double h = 0; // default to black
+ double s = 0;
+ double l = 0;
+
+ v = Math.Max(r, g);
+ v = Math.Max(v, b);
+ m = Math.Min(r, g);
+ m = Math.Min(m, b);
+ l = (m + v) / 2.0;
+ if (l <= 0.0)
+ {
+ return new ColorHSL(h, s, l);
+ }
+
+ vm = v - m;
+ s = vm;
+ if (s > 0.0)
+ {
+ s /= (l <= 0.5) ? (v + m) : (2.0 - v - m);
+ }
+ else
+ {
+ return new ColorHSL(h, s, l);
+ }
+
+ r2 = (v - r) / vm;
+ g2 = (v - g) / vm;
+ b2 = (v - b) / vm;
+ if (r == v)
+ {
+ h = (g == m ? 5.0 + b2 : 1.0 - g2);
+ }
+
+ else if (g == v)
+ {
+ h = (b == m ? 1.0 + r2 : 3.0 - b2);
+ }
+ else
+ {
+ h = (r == m ? 3.0 + g2 : 5.0 - r2);
+ }
+ h /= 6.0;
+
+ return new ColorHSL(h, s, l);
+
+ }
+
+ }
+}
diff --git a/ImageProcessing/Filters.cs b/ImageProcessing/Filters.cs
new file mode 100644
index 0000000..59c6cbd
--- /dev/null
+++ b/ImageProcessing/Filters.cs
@@ -0,0 +1,604 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Drawing.Imaging;
+
+namespace ImageProcessing
+{
+ public class BitmapFilter
+ {
+ static public float GetMedian( float[] array)
+ {
+ float[] tempArray = array;
+ int count = tempArray.Length;
+
+ Array.Sort(tempArray);
+
+ float medianValue = 0;
+
+ if (count % 2 == 0)
+ {
+ // count is even, need to get the middle two elements, add them together, then divide by 2
+ float middleElement1 = tempArray[(count / 2) - 1];
+ float middleElement2 = tempArray[(count / 2)];
+ medianValue = (middleElement1 + middleElement2) / 2;
+ }
+ else
+ {
+ // count is odd, simply get the middle element.
+ medianValue = tempArray[(count / 2)];
+ }
+
+ return medianValue;
+ }
+ static public float[] ComputeLocalMean(float[] gray, int width, int height)
+ {
+ int kernelWidth = 5;
+
+ float[] tab = new float[width * height];
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ tab[x + y * width] = ComputeMean(x, y, gray, width, height, kernelWidth);
+ }
+ }
+ return tab;
+ }
+
+ private static float ComputeMean(int x, int y, float[] gray, int width, int height, int kernelWidth)
+ {
+ float mean = 0;
+ float count = 0;
+ for (int yy = Math.Max(0, y - kernelWidth); yy < Math.Min(y + kernelWidth, height); yy++)
+ {
+ for (int xx = Math.Max(0, x - kernelWidth); xx < Math.Min(x + kernelWidth, width); xx++)
+ {
+ mean += gray[xx + yy * width];
+ count++;
+ }
+ }
+ mean /= count;
+ return mean;
+ }
+
+
+ static public float[] HorizontalThreshold(float[] gray, int width, int height)
+ {
+ float[] tab = new float[width * height];
+ float[] line = new float[width];
+
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ line[x] = gray[x + y * width];
+ }
+ float med = GetMedian(line);
+ for (int x = 0; x < width; x++)
+ {
+ float diff = gray[x + y * width] - med;
+ if (diff < 0) diff = 0;
+ else
+ diff = 1;
+ tab[x + y * width] = diff;
+ }
+ }
+
+ return tab;
+ }
+
+ static public bool Invert(Bitmap b)
+ {
+ // GDI+ still lies to us - the return format is BGR, NOT RGB.
+ BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+
+ int stride = bmData.Stride;
+ System.IntPtr Scan0 = bmData.Scan0;
+
+ unsafe
+ {
+ byte* p = (byte*)(void*)Scan0;
+
+ int nOffset = stride - b.Width * 3;
+ int nWidth = b.Width * 3;
+
+ for (int y = 0; y < b.Height; ++y)
+ {
+ for (int x = 0; x < nWidth; ++x)
+ {
+ p[0] = (byte)(255 - p[0]);
+ ++p;
+ }
+ p += nOffset;
+ }
+ }
+
+ b.UnlockBits(bmData);
+
+ return true;
+ }
+
+ static public Bitmap GenerateBitmap(float[] gray, int width, int height)
+ {
+ Bitmap b = new Bitmap(width, height, PixelFormat.Format24bppRgb);
+ // GDI+ still lies to us - the return format is BGR, NOT RGB.
+ BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+
+ int stride = bmData.Stride;
+ System.IntPtr Scan0 = bmData.Scan0;
+
+ unsafe
+ {
+ byte* p = (byte*)(void*)Scan0;
+
+ int nOffset = stride - b.Width * 3;
+
+ for (int y = 0; y < b.Height; ++y)
+ {
+ for (int x = 0; x < b.Width; ++x)
+ {
+ p[0] = p[1] = p[2] = (byte)(gray[y * b.Width + x]*255);
+
+ p += 3;
+
+ }
+ p += nOffset;
+
+ }
+ }
+
+ b.UnlockBits(bmData);
+
+ return b;
+ }
+
+ static public float GenericScaleF(float input, float i1, float o1, float i2, float o2)
+ {
+ if (i2 == i1) return ((o2 + o1) / 2.0f);
+ float a = (o2 - o1) / (i2 - i1);
+ float b = o1 - a * i1;
+ return (a * input + b);
+ }
+
+ static public ColorRGB[] ColorRGBBitmap(Bitmap b)
+ {
+ ColorRGB[] tab = new ColorRGB[b.Width * b.Height];
+
+ Bitmap des = new Bitmap(b);
+ // GDI+ still lies to us - the return format is BGR, NOT RGB.
+ BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+
+ int stride = bmData.Stride;
+ System.IntPtr Scan0 = bmData.Scan0;
+
+ unsafe
+ {
+
+ byte* p = (byte*)(void*)Scan0;
+
+ int nOffset = stride - b.Width * 3;
+
+ for (int y = 0; y < b.Height; ++y)
+ {
+ for (int x = 0; x < b.Width; ++x)
+ {
+ tab[y * b.Width + x].R = p[2];
+ tab[y * b.Width + x].G = p[1];
+ tab[y * b.Width + x].B = p[0];
+
+ p += 3;
+
+ }
+ p += nOffset;
+
+ }
+ }
+
+ b.UnlockBits(bmData);
+
+ return tab;
+ }
+
+ static public ColorHSL[] ColorLSHBitmap(Bitmap b)
+ {
+ ColorHSL[] tab = new ColorHSL[b.Width * b.Height];
+
+ Bitmap des = new Bitmap(b);
+ // GDI+ still lies to us - the return format is BGR, NOT RGB.
+ BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+
+ int stride = bmData.Stride;
+ System.IntPtr Scan0 = bmData.Scan0;
+
+ unsafe
+ {
+
+ byte* p = (byte*)(void*)Scan0;
+
+ int nOffset = stride - b.Width * 3;
+
+ byte red, green, blue;
+
+ for (int y = 0; y < b.Height; ++y)
+ {
+ for (int x = 0; x < b.Width; ++x)
+ {
+ blue = p[0];
+ green = p[1];
+ red = p[2];
+
+
+ tab[y * b.Width + x] = ColorTools.RGB2HSL( red, green, blue);
+
+ p += 3;
+
+ }
+ p += nOffset;
+
+ }
+ }
+
+ b.UnlockBits(bmData);
+
+ return tab;
+ }
+
+ static public Bitmap GenerateBitmapFromHSL(ColorHSL[] col, int width, int height)
+ {
+ Bitmap b = new Bitmap(width, height, PixelFormat.Format24bppRgb);
+ // GDI+ still lies to us - the return format is BGR, NOT RGB.
+ BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+
+ int stride = bmData.Stride;
+ System.IntPtr Scan0 = bmData.Scan0;
+
+ unsafe
+ {
+ byte* p = (byte*)(void*)Scan0;
+
+ int nOffset = stride - b.Width * 3;
+
+ for (int y = 0; y < b.Height; ++y)
+ {
+ for (int x = 0; x < b.Width; ++x)
+ {
+ ColorHSL hsl = col[y * b.Width + x];
+ Color c = ColorTools.HSL2RGB(hsl.H,hsl.S,hsl.L,1);
+ p[0] = c.B;
+ p[1] = c.G;
+ p[2] = c.R;
+
+ p += 3;
+
+ }
+ p += nOffset;
+
+ }
+ }
+
+ b.UnlockBits(bmData);
+
+ return b;
+ }
+
+ static public float[] GrayScaleFloat(Bitmap b)
+ {
+ float[] tab = new float[b.Width * b.Height];
+
+ Bitmap des = new Bitmap(b);
+ // GDI+ still lies to us - the return format is BGR, NOT RGB.
+ BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+
+ int stride = bmData.Stride;
+ System.IntPtr Scan0 = bmData.Scan0;
+
+ unsafe
+ {
+
+ byte* p = (byte*)(void*)Scan0;
+
+ int nOffset = stride - b.Width * 3;
+
+ byte red, green, blue;
+
+ for (int y = 0; y < b.Height; ++y)
+ {
+ for (int x = 0; x < b.Width; ++x)
+ {
+ blue = p[0];
+ green = p[1];
+ red = p[2];
+
+ tab[y *b.Width + x] = (float)(.299 * red + .587 * green + .114 * blue)/255.0f;
+
+ p += 3;
+
+ }
+ p += nOffset;
+
+ }
+ }
+
+ b.UnlockBits(bmData);
+
+ return tab;
+ }
+
+ static public Bitmap GrayScaleBitmap(Bitmap b)
+ {
+ Bitmap des = new Bitmap(b);
+ // GDI+ still lies to us - the return format is BGR, NOT RGB.
+ BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+ BitmapData bmDataDest = des.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+
+ int stride = bmData.Stride;
+ System.IntPtr Scan0 = bmData.Scan0;
+ System.IntPtr Scan0Dest = bmDataDest.Scan0;
+
+ unsafe
+ {
+ byte* p = (byte*)(void*)Scan0;
+ byte* pDest = (byte*)(void*)Scan0Dest;
+
+ int nOffset = stride - b.Width * 3;
+
+ byte red, green, blue;
+
+ for (int y = 0; y < b.Height; ++y)
+ {
+ for (int x = 0; x < b.Width; ++x)
+ {
+ blue = p[0];
+ green = p[1];
+ red = p[2];
+
+ pDest[0] = pDest[1] = pDest[2] = (byte)(.299 * red + .587 * green + .114 * blue);
+
+ p += 3;
+ pDest += 3;
+ }
+ p += nOffset;
+ pDest += nOffset;
+ }
+ }
+
+ b.UnlockBits(bmData);
+ des.UnlockBits(bmDataDest);
+
+ return des;
+ }
+
+
+ static public float[] Normalize(float[] grayf, out float min, out float max, out float mean)
+ {
+ mean = 0;
+ min = float.MaxValue;
+ max = 0;
+ float[] res = new float[grayf.Length];
+
+ for (int i = 0; i < grayf.Length; i++)
+ {
+ if (grayf[i] > max) max = grayf[i];
+ if (grayf[i] < min) min = grayf[i];
+ mean += grayf[i];
+ }
+ mean /= grayf.Length;
+
+ for (int i = 0; i < grayf.Length; i++)
+ {
+ res[i] = GenericScaleF( grayf[i], min,0,max,1);
+ }
+
+ return res;
+ }
+
+ static public bool Brightness(Bitmap b, int nBrightness)
+ {
+ if (nBrightness < -255 || nBrightness > 255)
+ return false;
+
+ // GDI+ still lies to us - the return format is BGR, NOT RGB.
+ BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+
+ int stride = bmData.Stride;
+ System.IntPtr Scan0 = bmData.Scan0;
+
+ int nVal = 0;
+
+ unsafe
+ {
+ byte* p = (byte*)(void*)Scan0;
+
+ int nOffset = stride - b.Width * 3;
+ int nWidth = b.Width * 3;
+
+ for (int y = 0; y < b.Height; ++y)
+ {
+ for (int x = 0; x < nWidth; ++x)
+ {
+ nVal = (int)(p[0] + nBrightness);
+
+ if (nVal < 0) nVal = 0;
+ if (nVal > 255) nVal = 255;
+
+ p[0] = (byte)nVal;
+
+ ++p;
+ }
+ p += nOffset;
+ }
+ }
+
+ b.UnlockBits(bmData);
+
+ return true;
+ }
+
+ static public bool Contrast(Bitmap b, sbyte nContrast)
+ {
+ if (nContrast < -100) return false;
+ if (nContrast > 100) return false;
+
+ double pixel = 0, contrast = (100.0 + nContrast) / 100.0;
+
+ contrast *= contrast;
+
+ int red, green, blue;
+
+ // GDI+ still lies to us - the return format is BGR, NOT RGB.
+ BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+
+ int stride = bmData.Stride;
+ System.IntPtr Scan0 = bmData.Scan0;
+
+ unsafe
+ {
+ byte* p = (byte*)(void*)Scan0;
+
+ int nOffset = stride - b.Width * 3;
+
+ for (int y = 0; y < b.Height; ++y)
+ {
+ for (int x = 0; x < b.Width; ++x)
+ {
+ blue = p[0];
+ green = p[1];
+ red = p[2];
+
+ pixel = red / 255.0;
+ pixel -= 0.5;
+ pixel *= contrast;
+ pixel += 0.5;
+ pixel *= 255;
+ if (pixel < 0) pixel = 0;
+ if (pixel > 255) pixel = 255;
+ p[2] = (byte)pixel;
+
+ pixel = green / 255.0;
+ pixel -= 0.5;
+ pixel *= contrast;
+ pixel += 0.5;
+ pixel *= 255;
+ if (pixel < 0) pixel = 0;
+ if (pixel > 255) pixel = 255;
+ p[1] = (byte)pixel;
+
+ pixel = blue / 255.0;
+ pixel -= 0.5;
+ pixel *= contrast;
+ pixel += 0.5;
+ pixel *= 255;
+ if (pixel < 0) pixel = 0;
+ if (pixel > 255) pixel = 255;
+ p[0] = (byte)pixel;
+
+ p += 3;
+ }
+ p += nOffset;
+ }
+ }
+
+ b.UnlockBits(bmData);
+
+ return true;
+ }
+
+ static public bool Gamma(Bitmap b, double red, double green, double blue)
+ {
+ if (red < .2 || red > 5) return false;
+ if (green < .2 || green > 5) return false;
+ if (blue < .2 || blue > 5) return false;
+
+ byte[] redGamma = new byte[256];
+ byte[] greenGamma = new byte[256];
+ byte[] blueGamma = new byte[256];
+
+ for (int i = 0; i < 256; ++i)
+ {
+ redGamma[i] = (byte)Math.Min(255, (int)((255.0 * Math.Pow(i / 255.0, 1.0 / red)) + 0.5));
+ greenGamma[i] = (byte)Math.Min(255, (int)((255.0 * Math.Pow(i / 255.0, 1.0 / green)) + 0.5));
+ blueGamma[i] = (byte)Math.Min(255, (int)((255.0 * Math.Pow(i / 255.0, 1.0 / blue)) + 0.5));
+ }
+
+ // GDI+ still lies to us - the return format is BGR, NOT RGB.
+ BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+
+ int stride = bmData.Stride;
+ System.IntPtr Scan0 = bmData.Scan0;
+
+ unsafe
+ {
+ byte* p = (byte*)(void*)Scan0;
+
+ int nOffset = stride - b.Width * 3;
+
+ for (int y = 0; y < b.Height; ++y)
+ {
+ for (int x = 0; x < b.Width; ++x)
+ {
+ p[2] = redGamma[p[2]];
+ p[1] = greenGamma[p[1]];
+ p[0] = blueGamma[p[0]];
+
+ p += 3;
+ }
+ p += nOffset;
+ }
+ }
+
+ b.UnlockBits(bmData);
+
+ return true;
+ }
+
+ static public bool Color(Bitmap b, int red, int green, int blue)
+ {
+ if (red < -255 || red > 255) return false;
+ if (green < -255 || green > 255) return false;
+ if (blue < -255 || blue > 255) return false;
+
+ // GDI+ still lies to us - the return format is BGR, NOT RGB.
+ BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+
+ int stride = bmData.Stride;
+ System.IntPtr Scan0 = bmData.Scan0;
+
+ unsafe
+ {
+ byte* p = (byte*)(void*)Scan0;
+
+ int nOffset = stride - b.Width * 3;
+ int nPixel;
+
+ for (int y = 0; y < b.Height; ++y)
+ {
+ for (int x = 0; x < b.Width; ++x)
+ {
+ nPixel = p[2] + red;
+ nPixel = Math.Max(nPixel, 0);
+ p[2] = (byte)Math.Min(255, nPixel);
+
+ nPixel = p[1] + green;
+ nPixel = Math.Max(nPixel, 0);
+ p[1] = (byte)Math.Min(255, nPixel);
+
+ nPixel = p[0] + blue;
+ nPixel = Math.Max(nPixel, 0);
+ p[0] = (byte)Math.Min(255, nPixel);
+
+ p += 3;
+ }
+ p += nOffset;
+ }
+ }
+
+ b.UnlockBits(bmData);
+
+ return true;
+ }
+ }
+
+}
diff --git a/ImageProcessing/FormImageProcessing.Designer.cs b/ImageProcessing/FormImageProcessing.Designer.cs
new file mode 100644
index 0000000..4d42a26
--- /dev/null
+++ b/ImageProcessing/FormImageProcessing.Designer.cs
@@ -0,0 +1,235 @@
+namespace ImageProcessing
+{
+ partial class FormImageProcessing
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.showToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.orinigalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.normalizedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.horizontalThresholdToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.localMeanToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.diffToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.medianOnMaskToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.maskedInfoWithMedianToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.openFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.loadGrayScaleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.lodColorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
+ this.statusStrip1 = new System.Windows.Forms.StatusStrip();
+ this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
+ this.trackBar1 = new System.Windows.Forms.TrackBar();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ this.menuStrip1.SuspendLayout();
+ this.statusStrip1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.BackColor = System.Drawing.SystemColors.ActiveCaption;
+ this.pictureBox1.Location = new System.Drawing.Point(0, 53);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(691, 474);
+ this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
+ this.pictureBox1.TabIndex = 0;
+ this.pictureBox1.TabStop = false;
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.showToolStripMenuItem,
+ this.openFileToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(691, 24);
+ this.menuStrip1.TabIndex = 1;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // showToolStripMenuItem
+ //
+ this.showToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.orinigalToolStripMenuItem,
+ this.normalizedToolStripMenuItem,
+ this.horizontalThresholdToolStripMenuItem,
+ this.localMeanToolStripMenuItem,
+ this.diffToolStripMenuItem,
+ this.medianOnMaskToolStripMenuItem,
+ this.maskedInfoWithMedianToolStripMenuItem});
+ this.showToolStripMenuItem.Name = "showToolStripMenuItem";
+ this.showToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
+ this.showToolStripMenuItem.Text = "Show";
+ //
+ // orinigalToolStripMenuItem
+ //
+ this.orinigalToolStripMenuItem.Name = "orinigalToolStripMenuItem";
+ this.orinigalToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
+ this.orinigalToolStripMenuItem.Text = "Orinigal";
+ this.orinigalToolStripMenuItem.Click += new System.EventHandler(this.orinigalToolStripMenuItem_Click);
+ //
+ // normalizedToolStripMenuItem
+ //
+ this.normalizedToolStripMenuItem.Name = "normalizedToolStripMenuItem";
+ this.normalizedToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
+ this.normalizedToolStripMenuItem.Text = "Normalized";
+ this.normalizedToolStripMenuItem.Click += new System.EventHandler(this.normalizedToolStripMenuItem_Click);
+ //
+ // horizontalThresholdToolStripMenuItem
+ //
+ this.horizontalThresholdToolStripMenuItem.Name = "horizontalThresholdToolStripMenuItem";
+ this.horizontalThresholdToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
+ this.horizontalThresholdToolStripMenuItem.Text = "HorizontalThreshold";
+ this.horizontalThresholdToolStripMenuItem.Click += new System.EventHandler(this.horizontalThresholdToolStripMenuItem_Click);
+ //
+ // localMeanToolStripMenuItem
+ //
+ this.localMeanToolStripMenuItem.Name = "localMeanToolStripMenuItem";
+ this.localMeanToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
+ this.localMeanToolStripMenuItem.Text = "LocalMean";
+ this.localMeanToolStripMenuItem.Click += new System.EventHandler(this.localMeanToolStripMenuItem_Click);
+ //
+ // diffToolStripMenuItem
+ //
+ this.diffToolStripMenuItem.Name = "diffToolStripMenuItem";
+ this.diffToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
+ this.diffToolStripMenuItem.Text = "Diff";
+ this.diffToolStripMenuItem.Click += new System.EventHandler(this.diffToolStripMenuItem_Click);
+ //
+ // medianOnMaskToolStripMenuItem
+ //
+ this.medianOnMaskToolStripMenuItem.Name = "medianOnMaskToolStripMenuItem";
+ this.medianOnMaskToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
+ this.medianOnMaskToolStripMenuItem.Text = "MAskedInfo";
+ this.medianOnMaskToolStripMenuItem.Click += new System.EventHandler(this.medianOnMaskToolStripMenuItem_Click);
+ //
+ // maskedInfoWithMedianToolStripMenuItem
+ //
+ this.maskedInfoWithMedianToolStripMenuItem.Name = "maskedInfoWithMedianToolStripMenuItem";
+ this.maskedInfoWithMedianToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
+ this.maskedInfoWithMedianToolStripMenuItem.Text = "MaskedInfoWithMedian";
+ this.maskedInfoWithMedianToolStripMenuItem.Click += new System.EventHandler(this.maskedInfoWithMedianToolStripMenuItem_Click);
+ //
+ // openFileToolStripMenuItem
+ //
+ this.openFileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.loadGrayScaleToolStripMenuItem,
+ this.lodColorToolStripMenuItem});
+ this.openFileToolStripMenuItem.Name = "openFileToolStripMenuItem";
+ this.openFileToolStripMenuItem.Size = new System.Drawing.Size(66, 20);
+ this.openFileToolStripMenuItem.Text = "OpenFile";
+ //
+ // loadGrayScaleToolStripMenuItem
+ //
+ this.loadGrayScaleToolStripMenuItem.Name = "loadGrayScaleToolStripMenuItem";
+ this.loadGrayScaleToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
+ this.loadGrayScaleToolStripMenuItem.Text = "Load Gray Scale";
+ this.loadGrayScaleToolStripMenuItem.Click += new System.EventHandler(this.openFileToolStripMenuItem_Click);
+ //
+ // lodColorToolStripMenuItem
+ //
+ this.lodColorToolStripMenuItem.Name = "lodColorToolStripMenuItem";
+ this.lodColorToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
+ this.lodColorToolStripMenuItem.Text = "Lod Color";
+ this.lodColorToolStripMenuItem.Click += new System.EventHandler(this.lodColorToolStripMenuItem_Click);
+ //
+ // openFileDialog1
+ //
+ this.openFileDialog1.FileName = "openFileDialog1";
+ //
+ // statusStrip1
+ //
+ this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.toolStripStatusLabel1});
+ this.statusStrip1.Location = new System.Drawing.Point(0, 476);
+ this.statusStrip1.Name = "statusStrip1";
+ this.statusStrip1.Size = new System.Drawing.Size(691, 22);
+ this.statusStrip1.TabIndex = 2;
+ this.statusStrip1.Text = "statusStrip1";
+ //
+ // toolStripStatusLabel1
+ //
+ this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
+ this.toolStripStatusLabel1.Size = new System.Drawing.Size(118, 17);
+ this.toolStripStatusLabel1.Text = "toolStripStatusLabel1";
+ //
+ // trackBar1
+ //
+ this.trackBar1.Location = new System.Drawing.Point(526, 12);
+ this.trackBar1.Maximum = 100;
+ this.trackBar1.Name = "trackBar1";
+ this.trackBar1.Size = new System.Drawing.Size(104, 45);
+ this.trackBar1.TabIndex = 3;
+ this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll);
+ //
+ // FormImageProcessing
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(691, 498);
+ this.Controls.Add(this.trackBar1);
+ this.Controls.Add(this.statusStrip1);
+ this.Controls.Add(this.pictureBox1);
+ this.Controls.Add(this.menuStrip1);
+ this.MainMenuStrip = this.menuStrip1;
+ this.Name = "FormImageProcessing";
+ this.Text = "Form1";
+ this.Load += new System.EventHandler(this.Form1_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ this.statusStrip1.ResumeLayout(false);
+ this.statusStrip1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.PictureBox pictureBox1;
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem showToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem orinigalToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem normalizedToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem horizontalThresholdToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem localMeanToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem diffToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem medianOnMaskToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem openFileToolStripMenuItem;
+ private System.Windows.Forms.OpenFileDialog openFileDialog1;
+ private System.Windows.Forms.StatusStrip statusStrip1;
+ private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
+ private System.Windows.Forms.TrackBar trackBar1;
+ private System.Windows.Forms.ToolStripMenuItem maskedInfoWithMedianToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem loadGrayScaleToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem lodColorToolStripMenuItem;
+ }
+}
+
diff --git a/ImageProcessing/FormImageProcessing.cs b/ImageProcessing/FormImageProcessing.cs
new file mode 100644
index 0000000..dc62bfe
--- /dev/null
+++ b/ImageProcessing/FormImageProcessing.cs
@@ -0,0 +1,441 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace ImageProcessing
+{
+ public partial class FormImageProcessing : Form
+ {
+ // string ImageFile = @"1.png";
+ string ImageFile = @"strip.png";
+
+ Bitmap Bmp;
+ float[] Original;
+ float[] Normalized;
+ float[] HorizontalThresholdF;
+ float[] LocalMeanF;
+ float[] Diff;
+ float[] MaskedInfo;
+ float[] MaskedInfoWithMedian;
+
+ ColorHSL[] OriginalHSL;
+
+ ColorRGB[] OriginalRGB;
+
+ public FormImageProcessing()
+ {
+ InitializeComponent();
+ }
+
+
+ private void ComputeRGBFilter(string p)
+ {
+ Bmp = (Bitmap)Bitmap.FromFile(p);
+
+ OriginalRGB = BitmapFilter.ColorRGBBitmap(Bmp);
+
+ float[] threasholdImg = new float[OriginalRGB.Length];
+ // chroma histogram 10 steps
+ // find the 2 max
+ //if the 2 max> 1 the threashold = min (2 max) + (max2 - max1)/2
+
+ //Horizontal line
+ for (int y = 0; y < Bmp.Height; y++)
+ {
+ int lenght = Bmp.Width;
+ for (int x = 0; x < lenght; x++)
+ {
+ ColorRGB pix = OriginalRGB[x + y * Bmp.Width];
+
+ threasholdImg[x + y * Bmp.Width] = 0.50f; //no relevant histogram
+
+ if ((pix.R > 125) && (pix.G < 125) && (pix.B < 125))
+ threasholdImg[x + y * Bmp.Width] = 0.00f; //no relevant histogram
+ if ((pix.R < 125) && (pix.G > 125) && (pix.B < 125))
+ threasholdImg[x + y * Bmp.Width] = 1.00f; //no relevant histogram
+
+ }
+
+
+
+ }
+
+
+ // pictureBox1.Image = BitmapFilter.GenerateBitmapFromHSL(OriginalHSL, Bmp.Width, Bmp.Height);
+ pictureBox1.Image = BitmapFilter.GenerateBitmap(threasholdImg, Bmp.Width, Bmp.Height);
+
+ }
+
+ private void ComputeColorFilter(string p)
+ {
+ Bmp = (Bitmap)Bitmap.FromFile(p);
+
+ OriginalHSL = BitmapFilter.ColorLSHBitmap(Bmp);
+
+ float[] threasholdImg = new float[OriginalHSL.Length];
+ // chroma histogram 10 steps
+ // find the 2 max
+ //if the 2 max> 1 the threashold = min (2 max) + (max2 - max1)/2
+
+ //Horizontal line
+ for (int y = 0; y < Bmp.Height; y++)
+ {
+ //Find min max mean median
+ int steps = 10;
+ int[] chromaHisto = new int[steps + 1];
+ int lenght = Bmp.Width;
+ for (int x = 0; x < lenght; x++)
+ {
+ ColorHSL pix = OriginalHSL[x + y * Bmp.Width];
+ int histIndexChroma = (int)(pix.H * steps);
+ chromaHisto[histIndexChroma]++;
+ }
+
+ //Find the two max
+ int max1 = -1;
+ int chroma1 = -1;
+ int max2 = -1;
+ int chroma2 = -1;
+
+ //Find max1
+ for (int i = 0; i < chromaHisto.Length; i++)
+ {
+ if ((chromaHisto[i] > max1) && (chromaHisto[i] != 0))
+ {
+ max1 = chromaHisto[i];
+ chroma1 = i;
+ }
+ }
+ //find max2
+ for (int i = 0; i < chromaHisto.Length; i++)
+ {
+ //circular distance
+ // int dist = Math.Abs(i - chroma1);
+ // if (Math.Min(dist, Math.Abs(dist - steps)) > (steps / 3)) //At least delta chroma > steps / 3
+ if (CircularDistance(i, chroma1, steps) > (steps / 3))
+ if ((chromaHisto[i] > max2) && (chromaHisto[i] != 0))
+ {
+ max2 = chromaHisto[i];
+ chroma2 = i;
+ }
+ }
+
+
+ int peak = chroma1;
+ if ((max1 != -1) && (max2 != -1) && (chromaHisto[chroma2] > chromaHisto[chroma1])) peak = chroma2;
+ double delta = 3;
+
+ Console.WriteLine(chroma1 + " " + chroma2);
+
+ //binaries
+ for (int x = 0; x < Bmp.Width; x++)
+ {
+ if ((max1 != -1) && (max2 != -1)) //found a max1 and max 2 ?
+ {
+ ColorHSL pix = OriginalHSL[x + y * Bmp.Width];
+ int histIndexChroma = (int)(pix.H * steps);
+
+ if (CircularDistance(histIndexChroma, peak, steps) < delta)
+ threasholdImg[x + y * Bmp.Width] = 1; //Black
+ else
+ threasholdImg[x + y * Bmp.Width] = 0; //White
+ }
+ else
+ threasholdImg[x + y * Bmp.Width] = 0.50f; //no relevant histogram
+
+ }
+ }
+
+ // pictureBox1.Image = BitmapFilter.GenerateBitmapFromHSL(OriginalHSL, Bmp.Width, Bmp.Height);
+ pictureBox1.Image = BitmapFilter.GenerateBitmap(threasholdImg, Bmp.Width, Bmp.Height);
+
+ }
+
+ int CircularDistance(int index1, int index2, int steps)
+ { //circular distance
+ int dist = Math.Abs(index1 - index2);
+ return Math.Min(dist, Math.Abs(dist - steps));
+ }
+
+
+ private void ComputeFilter(string p)
+ {
+ Bmp = (Bitmap)Bitmap.FromFile(p);
+
+ Original = BitmapFilter.GrayScaleFloat(Bmp);
+ float min = 0, max = 0, mean = 0;
+
+ Normalized = BitmapFilter.Normalize(Original, out min, out max, out mean);
+
+ Diff = new float[Original.Length];
+ float[] imput = Original;
+ //Horizontal line normalization
+ for (int y = 0; y < Bmp.Height; y++)
+ {
+ //Find min max mean median
+ float minL = float.MaxValue, maxL = 0, meanL = 0, median = 0;
+ List<float> line = new List<float>();
+ int lenght = Bmp.Width;
+ for (int x = 0; x < lenght; x++)
+ {
+ float pix = imput[x + y * Bmp.Width];
+ if (pix < minL) minL = pix;
+ if (pix > maxL) maxL = pix;
+ line.Add(pix);
+ meanL += pix;
+ }
+ line.Sort();
+ median = line[line.Count / 2];
+ meanL /= (float)lenght;
+
+ //Scale and binaries
+ for (int x = 0; x < Bmp.Width; x++)
+ {
+ float pix = imput[x + y * Bmp.Width];
+
+ Diff[x + y * Bmp.Width] = Original[x + y * Bmp.Width] - minL + meanL;
+ if (Diff[x + y * Bmp.Width] > 1) Diff[x + y * Bmp.Width] = 1;
+ if (Diff[x + y * Bmp.Width] < 0) Diff[x + y * Bmp.Width] = 0;
+ }
+ }
+
+ //Vertical line normalization
+ imput = Diff;
+ for (int x = 0; x < Bmp.Width; x++)
+ {
+ //Find min max mean median
+ float minL = float.MaxValue, maxL = 0, meanL = 0, median = 0;
+ List<float> line = new List<float>();
+ int lenght = Bmp.Height;
+ for (int y = 0; y < lenght; y++)
+ {
+ float pix = imput[x + y * Bmp.Width];
+ if (pix < minL) minL = pix;
+ if (pix > maxL) maxL = pix;
+ line.Add(pix);
+ meanL += pix;
+ }
+ line.Sort();
+ median = line[line.Count / 2];
+ meanL /= (float)lenght;
+
+ //Scale and binaries
+ for (int y = 0; y < lenght; y++)
+ {
+ float pix = imput[x + y * Bmp.Width];
+
+ Diff[x + y * Bmp.Width] = Diff[x + y * Bmp.Width] - minL + meanL;
+ if (Diff[x + y * Bmp.Width] > 1) Diff[x + y * Bmp.Width] = 1;
+ if (Diff[x + y * Bmp.Width] < 0) Diff[x + y * Bmp.Width] = 0;
+ }
+ }
+
+
+ /* for (int x = 0; x < Bmp.Width; x++)
+ {
+ float minL = float.MaxValue, maxL = 0, meanL = 0, median = 0;
+ List<float> line = new List<float>();
+ int lenght = Bmp.Height;
+ for (int y = 0; y < Bmp.Height; y++)
+ {
+ float pix = Diff[x + y * Bmp.Width];
+ if (pix < minL) minL = pix;
+ if (pix > maxL) maxL = pix;
+ line.Add(pix);
+ meanL += pix;
+ }
+ line.Sort();
+ median = line[line.Count / 2];
+ meanL /= (float)lenght;
+
+ //Scale and binaries
+ for (int y = 0; y < lenght; y++)
+ {
+
+ Diff[x + y * Bmp.Width] = BitmapFilter.GenericScaleF(Diff[x + y * Bmp.Width], minL, 0, maxL, 1);
+ }
+ }
+ */
+
+ /* //Compute the mean and min of each horizontal line
+ for (int y = 0; y < Bmp.Height; y++)
+ {
+ float minL = float.MaxValue, meanL = 0;
+ for (int x = 0; x < Bmp.Width; x++)
+ {
+ float pix = Original[x+y*Bmp.Width];
+ if (pix < minL) minL = pix;
+ meanL += pix;
+ }
+ meanL /= (float)Bmp.Width;
+ for (int x = 0; x < Bmp.Width; x++)
+ {
+ Diff[x + y * Bmp.Width] = Original[x + y * Bmp.Width] - minL + meanL;
+ if (Diff[x + y * Bmp.Width] < 0) Diff[x + y * Bmp.Width] = 0;
+ if (Diff[x + y * Bmp.Width] > 1) Diff[x + y * Bmp.Width] = 1;
+ }
+ }
+
+ //Compute the mean and min of each horizontal line
+ for (int x = 0; x < Bmp.Width; x++)
+ {
+ float minL = float.MaxValue, meanL = 0, median = 0;
+ List<float> lst = new List<float>();
+ for (int y = 0; y < Bmp.Height; y++)
+ {
+ float pix = Diff[x + y * Bmp.Width];
+ if (pix < minL) minL = pix;
+ lst.Add(pix);
+ meanL += pix;
+ }
+ meanL /= (float)Bmp.Height;
+ lst.Sort();
+ median = lst[lst.Count / 2];
+
+ for (int y = 0; y < Bmp.Height; y++)
+ {
+ Diff[x + y * Bmp.Width] = Diff[x + y * Bmp.Width] - minL + meanL;
+ if (Diff[x + y * Bmp.Width] < 0) Diff[x + y * Bmp.Width] = 0;
+ if (Diff[x + y * Bmp.Width] > 1) Diff[x + y * Bmp.Width] = 1;
+ }
+ }
+ Diff = BitmapFilter.Normalize(Diff, out min, out max, out mean);
+ */
+
+ // HorizontalThresholdF = BitmapFilter.HorizontalThreshold(Normalized, Bmp.Width, Bmp.Height);
+ // LocalMeanF = BitmapFilter.ComputeLocalMean(Normalized, Bmp.Width, Bmp.Height);
+
+ /* Diff = new float[Original.Length];
+ for (int i = 0; i < Original.Length; i++)
+ {
+ Diff[i] = Normalized[i] - LocalMeanF[i];
+ if (Diff[i] < 0) Diff[i] = 0;
+ else Diff[i] = 1;
+
+ }*/
+
+ //Compute the median Threshold only on the mask (HorizontalThresholdF)
+ /* MaskedInfo = new float[Original.Length];
+ List<float> lst = new List<float>();
+ for (int i = 0; i < Original.Length; i++)
+ {
+ if (HorizontalThresholdF[i] == 0)
+ {
+ MaskedInfo[i] = Normalized[i];
+ lst.Add(Normalized[i]);
+ }
+ else
+ MaskedInfo[i] = 1;
+ }
+
+ lst.Sort();
+ float median = lst[lst.Count / 2];
+
+ SUperCompute(median);
+ */
+
+
+ }
+
+ private void SUperCompute(float median)
+ {
+ toolStripStatusLabel1.Text = median.ToString("0.000");
+ MaskedInfoWithMedian = new float[Original.Length];
+
+ for (int i = 0; i < Original.Length; i++)
+ {
+ if (MaskedInfo[i] > median) MaskedInfoWithMedian[i] = 1.0f;
+ else
+ MaskedInfoWithMedian[i] = 0.0f;
+
+ }
+
+
+ }
+
+ private void Form1_Load(object sender, EventArgs e)
+ {
+ ComputeFilter(ImageFile);
+
+ pictureBox1.Image = BitmapFilter.GenerateBitmap(Diff, Bmp.Width, Bmp.Height);
+ pictureBox1.Invalidate();
+
+ }
+
+ private void orinigalToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ pictureBox1.Image = BitmapFilter.GenerateBitmap(Original, Bmp.Width, Bmp.Height);
+ pictureBox1.Invalidate();
+ }
+
+ private void normalizedToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ pictureBox1.Image = BitmapFilter.GenerateBitmap(Normalized, Bmp.Width, Bmp.Height);
+ pictureBox1.Invalidate();
+
+ }
+
+ private void horizontalThresholdToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ pictureBox1.Image = BitmapFilter.GenerateBitmap(HorizontalThresholdF, Bmp.Width, Bmp.Height);
+ pictureBox1.Invalidate();
+
+ }
+
+ private void localMeanToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ pictureBox1.Image = BitmapFilter.GenerateBitmap(LocalMeanF, Bmp.Width, Bmp.Height);
+ pictureBox1.Invalidate();
+ }
+
+ private void diffToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ pictureBox1.Image = BitmapFilter.GenerateBitmap(Diff, Bmp.Width, Bmp.Height);
+ pictureBox1.Invalidate();
+
+ }
+
+ private void medianOnMaskToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ pictureBox1.Image = BitmapFilter.GenerateBitmap(MaskedInfo, Bmp.Width, Bmp.Height);
+ pictureBox1.Invalidate();
+
+ }
+
+ private void openFileToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void trackBar1_Scroll(object sender, EventArgs e)
+ {
+ float median = (float)trackBar1.Value / (float)trackBar1.Maximum;
+ SUperCompute(median);
+ }
+
+ private void maskedInfoWithMedianToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ pictureBox1.Image = BitmapFilter.GenerateBitmap(MaskedInfoWithMedian, Bmp.Width, Bmp.Height);
+ pictureBox1.Invalidate();
+
+ }
+
+ private void lodColorToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (openFileDialog1.ShowDialog() == DialogResult.OK)
+ {
+ //ComputeColorFilter(openFileDialog1.FileName);
+ ComputeRGBFilter(openFileDialog1.FileName);
+ }
+ }
+
+
+
+
+ }
+}
diff --git a/ImageProcessing/FormImageProcessing.resx b/ImageProcessing/FormImageProcessing.resx
new file mode 100644
index 0000000..c68d348
--- /dev/null
+++ b/ImageProcessing/FormImageProcessing.resx
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>132, 17</value>
+ </metadata>
+ <metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>272, 17</value>
+ </metadata>
+</root> \ No newline at end of file
diff --git a/ImageProcessing/ImageProcessing.csproj b/ImageProcessing/ImageProcessing.csproj
new file mode 100644
index 0000000..af9797c
--- /dev/null
+++ b/ImageProcessing/ImageProcessing.csproj
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{525828F6-94FC-4D3B-8A96-C0AFF306F081}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ImageProcessing</RootNamespace>
+ <AssemblyName>ImageProcessing</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ColorTools.cs" />
+ <Compile Include="Filters.cs" />
+ <Compile Include="FormImageProcessing.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="FormImageProcessing.Designer.cs">
+ <DependentUpon>FormImageProcessing.cs</DependentUpon>
+ </Compile>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <EmbeddedResource Include="FormImageProcessing.resx">
+ <DependentUpon>FormImageProcessing.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/ImageProcessing/Program.cs b/ImageProcessing/Program.cs
new file mode 100644
index 0000000..afd6001
--- /dev/null
+++ b/ImageProcessing/Program.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace ImageProcessing
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new FormImageProcessing());
+ }
+ }
+}
diff --git a/ImageProcessing/Properties/AssemblyInfo.cs b/ImageProcessing/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..c7db90f
--- /dev/null
+++ b/ImageProcessing/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ImageProcessing")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("ImageProcessing")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("dc072d3d-4f78-49db-8d07-b832a77dd820")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ImageProcessing/Properties/Resources.Designer.cs b/ImageProcessing/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..55384e4
--- /dev/null
+++ b/ImageProcessing/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.235
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ImageProcessing.Properties
+{
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ImageProcessing.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/ImageProcessing/Properties/Resources.resx b/ImageProcessing/Properties/Resources.resx
new file mode 100644
index 0000000..ffecec8
--- /dev/null
+++ b/ImageProcessing/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/ImageProcessing/Properties/Settings.Designer.cs b/ImageProcessing/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..278b796
--- /dev/null
+++ b/ImageProcessing/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.235
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ImageProcessing.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/ImageProcessing/Properties/Settings.settings b/ImageProcessing/Properties/Settings.settings
new file mode 100644
index 0000000..abf36c5
--- /dev/null
+++ b/ImageProcessing/Properties/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
diff --git a/ImageProcessing/bin/Debug/1.png b/ImageProcessing/bin/Debug/1.png
new file mode 100644
index 0000000..075350f
--- /dev/null
+++ b/ImageProcessing/bin/Debug/1.png
Binary files differ
diff --git a/ImageProcessing/bin/Debug/2.png b/ImageProcessing/bin/Debug/2.png
new file mode 100644
index 0000000..ceecd1a
--- /dev/null
+++ b/ImageProcessing/bin/Debug/2.png
Binary files differ
diff --git a/ImageProcessing/bin/Debug/3.png b/ImageProcessing/bin/Debug/3.png
new file mode 100644
index 0000000..7d83356
--- /dev/null
+++ b/ImageProcessing/bin/Debug/3.png
Binary files differ
diff --git a/ImageProcessing/bin/Debug/4.png b/ImageProcessing/bin/Debug/4.png
new file mode 100644
index 0000000..63c5525
--- /dev/null
+++ b/ImageProcessing/bin/Debug/4.png
Binary files differ
diff --git a/ImageProcessing/bin/Debug/ImageProcessing.exe b/ImageProcessing/bin/Debug/ImageProcessing.exe
new file mode 100644
index 0000000..ed8bfb1
--- /dev/null
+++ b/ImageProcessing/bin/Debug/ImageProcessing.exe
Binary files differ
diff --git a/ImageProcessing/bin/Debug/ImageProcessing.pdb b/ImageProcessing/bin/Debug/ImageProcessing.pdb
new file mode 100644
index 0000000..068643e
--- /dev/null
+++ b/ImageProcessing/bin/Debug/ImageProcessing.pdb
Binary files differ
diff --git a/ImageProcessing/bin/Debug/ImageProcessing.vshost.exe b/ImageProcessing/bin/Debug/ImageProcessing.vshost.exe
new file mode 100644
index 0000000..bb84a51
--- /dev/null
+++ b/ImageProcessing/bin/Debug/ImageProcessing.vshost.exe
Binary files differ
diff --git a/ImageProcessing/bin/Debug/ImageProcessing.vshost.exe.manifest b/ImageProcessing/bin/Debug/ImageProcessing.vshost.exe.manifest
new file mode 100644
index 0000000..f96b1d6
--- /dev/null
+++ b/ImageProcessing/bin/Debug/ImageProcessing.vshost.exe.manifest
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+ <security>
+ <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+</assembly>
diff --git a/ImageProcessing/bin/Debug/grid color.jpg b/ImageProcessing/bin/Debug/grid color.jpg
new file mode 100644
index 0000000..9491570
--- /dev/null
+++ b/ImageProcessing/bin/Debug/grid color.jpg
Binary files differ
diff --git a/ImageProcessing/bin/Debug/screenshoot1.Jpg b/ImageProcessing/bin/Debug/screenshoot1.Jpg
new file mode 100644
index 0000000..bc4690a
--- /dev/null
+++ b/ImageProcessing/bin/Debug/screenshoot1.Jpg
Binary files differ
diff --git a/ImageProcessing/bin/Debug/screenshoot2.Jpg b/ImageProcessing/bin/Debug/screenshoot2.Jpg
new file mode 100644
index 0000000..aa59407
--- /dev/null
+++ b/ImageProcessing/bin/Debug/screenshoot2.Jpg
Binary files differ
diff --git a/ImageProcessing/bin/Debug/screenshoot3.Jpg b/ImageProcessing/bin/Debug/screenshoot3.Jpg
new file mode 100644
index 0000000..c8b6061
--- /dev/null
+++ b/ImageProcessing/bin/Debug/screenshoot3.Jpg
Binary files differ
diff --git a/ImageProcessing/bin/Debug/strip.png b/ImageProcessing/bin/Debug/strip.png
new file mode 100644
index 0000000..71ef4cc
--- /dev/null
+++ b/ImageProcessing/bin/Debug/strip.png
Binary files differ
diff --git a/ImageProcessing/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache b/ImageProcessing/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache
new file mode 100644
index 0000000..b1d289a
--- /dev/null
+++ b/ImageProcessing/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache
Binary files differ
diff --git a/ImageProcessing/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/ImageProcessing/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
new file mode 100644
index 0000000..a5c76bd
--- /dev/null
+++ b/ImageProcessing/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary files differ
diff --git a/ImageProcessing/obj/x86/Debug/GenerateResource.read.1.tlog b/ImageProcessing/obj/x86/Debug/GenerateResource.read.1.tlog
new file mode 100644
index 0000000..8d8f0c3
--- /dev/null
+++ b/ImageProcessing/obj/x86/Debug/GenerateResource.read.1.tlog
Binary files differ
diff --git a/ImageProcessing/obj/x86/Debug/GenerateResource.write.1.tlog b/ImageProcessing/obj/x86/Debug/GenerateResource.write.1.tlog
new file mode 100644
index 0000000..8637e0c
--- /dev/null
+++ b/ImageProcessing/obj/x86/Debug/GenerateResource.write.1.tlog
Binary files differ
diff --git a/ImageProcessing/obj/x86/Debug/ImageProcessing.FormImageProcessing.resources b/ImageProcessing/obj/x86/Debug/ImageProcessing.FormImageProcessing.resources
new file mode 100644
index 0000000..6c05a97
--- /dev/null
+++ b/ImageProcessing/obj/x86/Debug/ImageProcessing.FormImageProcessing.resources
Binary files differ
diff --git a/ImageProcessing/obj/x86/Debug/ImageProcessing.Properties.Resources.resources b/ImageProcessing/obj/x86/Debug/ImageProcessing.Properties.Resources.resources
new file mode 100644
index 0000000..6c05a97
--- /dev/null
+++ b/ImageProcessing/obj/x86/Debug/ImageProcessing.Properties.Resources.resources
Binary files differ
diff --git a/ImageProcessing/obj/x86/Debug/ImageProcessing.csproj.FileListAbsolute.txt b/ImageProcessing/obj/x86/Debug/ImageProcessing.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000..7783500
--- /dev/null
+++ b/ImageProcessing/obj/x86/Debug/ImageProcessing.csproj.FileListAbsolute.txt
@@ -0,0 +1,18 @@
+E:\SaveData\Projects\Anoto\ImageProcessing\obj\x86\Debug\ResolveAssemblyReference.cache
+E:\SaveData\Projects\Anoto\ImageProcessing\obj\x86\Debug\ImageProcessing.Properties.Resources.resources
+E:\SaveData\Projects\Anoto\ImageProcessing\obj\x86\Debug\GenerateResource.read.1.tlog
+E:\SaveData\Projects\Anoto\ImageProcessing\obj\x86\Debug\GenerateResource.write.1.tlog
+E:\SaveData\Projects\Anoto\ImageProcessing\bin\Debug\ImageProcessing.exe
+E:\SaveData\Projects\Anoto\ImageProcessing\bin\Debug\ImageProcessing.pdb
+E:\SaveData\Projects\Anoto\ImageProcessing\obj\x86\Debug\ImageProcessing.exe
+E:\SaveData\Projects\Anoto\ImageProcessing\obj\x86\Debug\ImageProcessing.pdb
+E:\SaveData\Projects\Anoto\ImageProcessing\obj\x86\Debug\ImageProcessing.FormImageProcessing.resources
+C:\Anoto\Anoto\ImageProcessing\obj\x86\Debug\ImageProcessing.exe
+C:\Anoto\Anoto\ImageProcessing\obj\x86\Debug\ImageProcessing.pdb
+C:\Anoto\Anoto\ImageProcessing\bin\Debug\ImageProcessing.exe
+C:\Anoto\Anoto\ImageProcessing\bin\Debug\ImageProcessing.pdb
+C:\Anoto\Anoto\ImageProcessing\obj\x86\Debug\ResolveAssemblyReference.cache
+C:\Anoto\Anoto\ImageProcessing\obj\x86\Debug\ImageProcessing.FormImageProcessing.resources
+C:\Anoto\Anoto\ImageProcessing\obj\x86\Debug\ImageProcessing.Properties.Resources.resources
+C:\Anoto\Anoto\ImageProcessing\obj\x86\Debug\GenerateResource.read.1.tlog
+C:\Anoto\Anoto\ImageProcessing\obj\x86\Debug\GenerateResource.write.1.tlog
diff --git a/ImageProcessing/obj/x86/Debug/ImageProcessing.exe b/ImageProcessing/obj/x86/Debug/ImageProcessing.exe
new file mode 100644
index 0000000..ed8bfb1
--- /dev/null
+++ b/ImageProcessing/obj/x86/Debug/ImageProcessing.exe
Binary files differ
diff --git a/ImageProcessing/obj/x86/Debug/ImageProcessing.pdb b/ImageProcessing/obj/x86/Debug/ImageProcessing.pdb
new file mode 100644
index 0000000..068643e
--- /dev/null
+++ b/ImageProcessing/obj/x86/Debug/ImageProcessing.pdb
Binary files differ
diff --git a/ImageProcessing/obj/x86/Debug/ResolveAssemblyReference.cache b/ImageProcessing/obj/x86/Debug/ResolveAssemblyReference.cache
new file mode 100644
index 0000000..9df83bb
--- /dev/null
+++ b/ImageProcessing/obj/x86/Debug/ResolveAssemblyReference.cache
Binary files differ
diff --git a/ImageProcessing/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache b/ImageProcessing/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache
new file mode 100644
index 0000000..c2d8521
--- /dev/null
+++ b/ImageProcessing/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache
Binary files differ
diff --git a/ImageProcessing/obj/x86/Release/GenerateResource.read.1.tlog b/ImageProcessing/obj/x86/Release/GenerateResource.read.1.tlog
new file mode 100644
index 0000000..b456c2d
--- /dev/null
+++ b/ImageProcessing/obj/x86/Release/GenerateResource.read.1.tlog
Binary files differ
diff --git a/ImageProcessing/obj/x86/Release/GenerateResource.write.1.tlog b/ImageProcessing/obj/x86/Release/GenerateResource.write.1.tlog
new file mode 100644
index 0000000..9a3c77d
--- /dev/null
+++ b/ImageProcessing/obj/x86/Release/GenerateResource.write.1.tlog
Binary files differ
diff --git a/ImageProcessing/obj/x86/Release/ImageProcessing.FormImageProcessing.resources b/ImageProcessing/obj/x86/Release/ImageProcessing.FormImageProcessing.resources
new file mode 100644
index 0000000..6c05a97
--- /dev/null
+++ b/ImageProcessing/obj/x86/Release/ImageProcessing.FormImageProcessing.resources
Binary files differ
diff --git a/ImageProcessing/obj/x86/Release/ImageProcessing.Properties.Resources.resources b/ImageProcessing/obj/x86/Release/ImageProcessing.Properties.Resources.resources
new file mode 100644
index 0000000..6c05a97
--- /dev/null
+++ b/ImageProcessing/obj/x86/Release/ImageProcessing.Properties.Resources.resources
Binary files differ
diff --git a/ImageProcessing/obj/x86/Release/ImageProcessing.csproj.FileListAbsolute.txt b/ImageProcessing/obj/x86/Release/ImageProcessing.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000..9ef693a
--- /dev/null
+++ b/ImageProcessing/obj/x86/Release/ImageProcessing.csproj.FileListAbsolute.txt
@@ -0,0 +1,5 @@
+C:\Anoto\Anoto\ImageProcessing\obj\x86\Release\ResolveAssemblyReference.cache
+C:\Anoto\Anoto\ImageProcessing\obj\x86\Release\ImageProcessing.FormImageProcessing.resources
+C:\Anoto\Anoto\ImageProcessing\obj\x86\Release\ImageProcessing.Properties.Resources.resources
+C:\Anoto\Anoto\ImageProcessing\obj\x86\Release\GenerateResource.read.1.tlog
+C:\Anoto\Anoto\ImageProcessing\obj\x86\Release\GenerateResource.write.1.tlog