C# Görüntü İşleme ve Analiz - C# Dersleri

C# ile görüntüyü gri tonlamaya dönüştürme, kırmızı-mavi-yeşil kanallardan ayrı görüntüler ve renk tonları için histogram grafikleri oluşturma.

BitmapAlgorithms.cs

using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;

namespace Bitmap_Analyzer
{
    public static class BitmapAlgorithms
    {
        private class Pixel
        {
            public byte r, g, b;

            public static Pixel FromByteArray(byte[] data, int i)
            {
                return new Pixel { b = data, g = data[i + 1], r = data[i + 2] };
            }

            public void ToByteArray(byte[] data, int i)
            {
                data = b; data[i + 1] = g; data[i + 2] = r;
            }

            public Pixel Grayscaled()
            {
                Pixel grayPixel = new Pixel();
                grayPixel.r = grayPixel.g = grayPixel.b = (byte)(r * 0.34f + g * 0.56f + b * 0.10f);
                return grayPixel;
            }

            public Pixel RedOnly()
            {
                Pixel redOnly = new Pixel();
                redOnly.r = r;
                return redOnly;
            }

            public Pixel GreenOnly()
            {
                Pixel greenOnly = new Pixel();
                greenOnly.g = g;
                return greenOnly;
            }

            public Pixel BlueOnly()
            {
                Pixel blueOnly = new Pixel();
                blueOnly.b = b;
                return blueOnly;
            }
        }

        public static Bitmap[] ProcessBitmap(Bitmap bitmap)
        {
            BitmapData originalBitmapData = bitmap.LockBits(new Rectangle(Point.Empty, bitmap.Size), ImageLockMode.ReadOnly, bitmap.PixelFormat);
            byte[] originalBitmapBytes = new byte[Math.Abs(originalBitmapData.Stride) * bitmap.Height];
            Marshal.Copy(originalBitmapData.Scan0, originalBitmapBytes, 0, originalBitmapBytes.Length);
            bitmap.UnlockBits(originalBitmapData);

            Bitmap bitmapGrayscaled = new Bitmap(bitmap.Width, bitmap.Height, PixelFormat.Format24bppRgb);
            Bitmap bitmapRedOnly = new Bitmap(bitmap.Width, bitmap.Height, PixelFormat.Format24bppRgb);
            Bitmap bitmapGreenOnly = new Bitmap(bitmap.Width, bitmap.Height, PixelFormat.Format24bppRgb);
            Bitmap bitmapBlueOnly = new Bitmap(bitmap.Width, bitmap.Height, PixelFormat.Format24bppRgb);

            Rectangle rect = new Rectangle(Point.Empty, bitmap.Size);
            PixelFormat pixelFormat = PixelFormat.Format24bppRgb;

            BitmapData bitmapGrayscaledData = bitmapGrayscaled.LockBits(rect, ImageLockMode.ReadWrite, pixelFormat);
            BitmapData bitmapRedOnlyData = bitmapRedOnly.LockBits(rect, ImageLockMode.ReadWrite, pixelFormat);
            BitmapData bitmapGreenOnlyData = bitmapGreenOnly.LockBits(rect, ImageLockMode.ReadWrite, pixelFormat);
            BitmapData bitmapBlueOnlyData = bitmapBlueOnly.LockBits(rect, ImageLockMode.ReadWrite, pixelFormat);

            int commonSize = Math.Abs(bitmapGrayscaledData.Stride) * bitmapGrayscaledData.Height;

            byte[] bitmapGrayscaledBytes = new byte[commonSize];
            byte[] bitmapRedOnlyBytes = new byte[commonSize];
            byte[] bitmapGreenOnlyBytes = new byte[commonSize];
            byte[] bitmapBlueOnlyBytes = new byte[commonSize];

            Marshal.Copy(bitmapGrayscaledData.Scan0, bitmapGrayscaledBytes, 0, commonSize);
            Marshal.Copy(bitmapRedOnlyData.Scan0, bitmapRedOnlyBytes, 0, commonSize);
            Marshal.Copy(bitmapGreenOnlyData.Scan0, bitmapGreenOnlyBytes, 0, commonSize);
            Marshal.Copy(bitmapBlueOnlyData.Scan0, bitmapBlueOnlyBytes, 0, commonSize);

            int step = Image.GetPixelFormatSize(bitmap.PixelFormat) / 8;

            for (int i = 0; i < originalBitmapBytes.Length - (originalBitmapBytes.Length % step); i += step)
            {
                Pixel p = Pixel.FromByteArray(originalBitmapBytes, i);
                p.Grayscaled().ToByteArray(bitmapGrayscaledBytes, i);
                p.RedOnly().ToByteArray(bitmapRedOnlyBytes, i);
                p.GreenOnly().ToByteArray(bitmapGreenOnlyBytes, i);
                p.BlueOnly().ToByteArray(bitmapBlueOnlyBytes, i);
            }

            Marshal.Copy(bitmapGrayscaledBytes, 0, bitmapGrayscaledData.Scan0, commonSize);
            Marshal.Copy(bitmapRedOnlyBytes, 0, bitmapRedOnlyData.Scan0, commonSize);
            Marshal.Copy(bitmapGreenOnlyBytes, 0, bitmapGreenOnlyData.Scan0, commonSize);
            Marshal.Copy(bitmapBlueOnlyBytes, 0, bitmapBlueOnlyData.Scan0, commonSize);

            bitmapGrayscaled.UnlockBits(bitmapGrayscaledData);
            bitmapRedOnly.UnlockBits(bitmapRedOnlyData);
            bitmapGreenOnly.UnlockBits(bitmapGreenOnlyData);
            bitmapBlueOnly.UnlockBits(bitmapBlueOnlyData);

            return new Bitmap[] { bitmapGrayscaled, bitmapRedOnly, bitmapGreenOnly, bitmapBlueOnly };
        }

        private static void DrawHistogramGraph(Graphics g, int[] data, int width, int height, Color color)
        {
            int max = 0;
            for (int i = 0; i < data.Length; i++) max = max >= data ? max : data;

            float w = width / 255.0f;
            float h = (float)max / height;
            if (h > 1.0f) h = 1.0f / h;

            float lastX = -1.0f, lastY = -1.0f;

            Brush brush = new SolidBrush(color);
            Pen pen = new Pen(color);

            for (int i = 0; i <= 255; i++)
            {
                float x = i * w, y = height - data * h;

                g.FillEllipse(brush, x - 0.5f, y - 0.5f, 1.0f, 1.0f);

                if (lastX != -1.0f) g.DrawLine(pen, lastX, lastY, x, y);

                lastX = x; lastY = y;
            }
        }

        private static Bitmap GenerateHistogramGraph(int[] data, int width, int height , Color color)
        {
            Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format24bppRgb);
            Graphics g = Graphics.FromImage(bitmap);
            g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

            g.Clear(Color.White);

            DrawHistogramGraph(g, data, width, height, color);

            return bitmap;
        }

        private static Bitmap GenerateHistogramGraph(int[][] data, int width, int height, Color[] colors)
        {
            Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format24bppRgb);
            Graphics g = Graphics.FromImage(bitmap);
            g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

            g.Clear(Color.White);

            for (int i = 0; i < data.Length; i++)
            {
                DrawHistogramGraph(g, data, width, height, colors);
            }

            return bitmap;
        }

        public static Bitmap[] GenerateHistograms(Bitmap bitmap, int width, int height)
        {
            int[] grays = new int[256], reds = new int[256], greens = new int[256], blues = new int[256];

            BitmapData bitmapData = bitmap.LockBits(new Rectangle(Point.Empty, bitmap.Size), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
            byte[] data = new byte[Math.Abs(bitmapData.Stride) * bitmapData.Height];
            Marshal.Copy(bitmapData.Scan0, data, 0, data.Length);
            bitmap.UnlockBits(bitmapData);

            int step = Image.GetPixelFormatSize(bitmap.PixelFormat) / 8;

            for (int i = 0; i < data.Length - (data.Length % step); i+=step)
            {
                Pixel p = Pixel.FromByteArray(data, i);

                grays[(byte)(p.r * 0.56f + p.g * 0.34f + p.b * 0.10f)]++; reds[p.r]++; greens[p.g]++; blues[p.b]++;
            }

            Bitmap bitmapGrayscaled = GenerateHistogramGraph(grays, width, height, Color.Black);
            Bitmap bitmapReds = GenerateHistogramGraph(reds, width, height, Color.Red);
            Bitmap bitmapGreens = GenerateHistogramGraph(greens, width, height, Color.Green);
            Bitmap bitmapBlues = GenerateHistogramGraph(blues, width, height, Color.Blue);

            Bitmap bitmapRGB = GenerateHistogramGraph(new int[][] { reds, greens, blues }, width, height, 
                new Color[] { Color.Red, Color.Green, Color.Blue });

            return new Bitmap[] { bitmapGrayscaled, bitmapReds, bitmapGreens, bitmapBlues, bitmapRGB };
        }

        public static Bitmap BetaCorrected(Bitmap bitmapOriginal, int beta)
        {
            BitmapData bitmapOriginalData = bitmapOriginal.LockBits(new Rectangle(Point.Empty, bitmapOriginal.Size), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
            byte[] bitmapOriginalBytes = new byte[Math.Abs(bitmapOriginalData.Stride) * bitmapOriginalData.Height];
            Marshal.Copy(bitmapOriginalData.Scan0, bitmapOriginalBytes, 0, bitmapOriginalBytes.Length);
            bitmapOriginal.UnlockBits(bitmapOriginalData);

            Bitmap betaCorrectedBitmap = new Bitmap(bitmapOriginal.Width, bitmapOriginal.Height, PixelFormat.Format24bppRgb);
            BitmapData betaCorrectedData = betaCorrectedBitmap.LockBits(new Rectangle(Point.Empty, betaCorrectedBitmap.Size), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
            byte[] betaCorrectedBytes = new byte[Math.Abs(betaCorrectedData.Stride) * betaCorrectedData.Height];

            Marshal.Copy(betaCorrectedData.Scan0, betaCorrectedBytes, 0, betaCorrectedBytes.Length);

            for (int i = 0; i < bitmapOriginalBytes.Length; i++)
            {
                int val = bitmapOriginalBytes;
                val += beta;
                if (val < 0) val = 0;
                if (val > 255) val = 255;
                betaCorrectedBytes = (byte)val;
            }

            Marshal.Copy(betaCorrectedBytes, 0, betaCorrectedData.Scan0, betaCorrectedBytes.Length);

            betaCorrectedBitmap.UnlockBits(betaCorrectedData);

            return betaCorrectedBitmap;
        }

        public static Bitmap GammaCorrected(Bitmap bitmapOriginal, float gamma)
        {
            BitmapData bitmapOriginalData = bitmapOriginal.LockBits(new Rectangle(Point.Empty, bitmapOriginal.Size), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
            byte[] bitmapOriginalBytes = new byte[Math.Abs(bitmapOriginalData.Stride) * bitmapOriginalData.Height];
            Marshal.Copy(bitmapOriginalData.Scan0, bitmapOriginalBytes, 0, bitmapOriginalBytes.Length);
            bitmapOriginal.UnlockBits(bitmapOriginalData);

            Bitmap gammaCorrectedBitmap = new Bitmap(bitmapOriginal.Width, bitmapOriginal.Height, PixelFormat.Format24bppRgb);
            BitmapData gammaCorrectedData = gammaCorrectedBitmap.LockBits(new Rectangle(Point.Empty, gammaCorrectedBitmap.Size), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
            byte[] gammaCorrectedBytes = new byte[Math.Abs(gammaCorrectedData.Stride) * gammaCorrectedData.Height];

            Marshal.Copy(gammaCorrectedData.Scan0, gammaCorrectedBytes, 0, gammaCorrectedBytes.Length);

            for (int i = 0; i < bitmapOriginalBytes.Length; i++)
            {
                float val = bitmapOriginalBytes / 255.0f;
                val = (float)Math.Pow(val, gamma);
                gammaCorrectedBytes = (byte)(val * 255.0f);
            }

            Marshal.Copy(gammaCorrectedBytes, 0, gammaCorrectedData.Scan0, gammaCorrectedBytes.Length);

            gammaCorrectedBitmap.UnlockBits(gammaCorrectedData);

            return gammaCorrectedBitmap;
        }
    }
}

FormMain.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Bitmap_Analyzer
{
    public partial class FormMain : Form
    {
        private Bitmap bitmapOriginal;

        public FormMain()
        {
            InitializeComponent();
        }

        private void buttonLoadBitmap_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Title = "Open Bitmap";
            ofd.Filter = "Image Files (*.jpg;*.png;*.bmp;*.jpeg;*.gif)|*.jpg;*.png;*.bmp;*.jpeg;*.gif";
            
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                bitmapOriginal = (Bitmap)Image.FromFile(ofd.FileName);

                if (Image.IsCanonicalPixelFormat(bitmapOriginal.PixelFormat))
                {
                    System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                    bitmapOriginal.Save(memoryStream, ImageFormat.Jpeg);

                    bitmapOriginal.Dispose();
                    bitmapOriginal = null;

                    bitmapOriginal = (Bitmap)Image.FromStream(memoryStream);
                }

                buttonLoadBitmap.Enabled = false;

                pictureBoxOriginal.Image = bitmapOriginal;

                Bitmap[] bitmaps = BitmapAlgorithms.ProcessBitmap(bitmapOriginal);
                pictureBoxGrayscaled.Image = bitmaps[0];
                pictureBoxRedImage.Image = bitmaps[1];
                pictureBoxGreenImage.Image = bitmaps[2];
                pictureBoxBlueImage.Image = bitmaps[3];

                Bitmap[] histograms = BitmapAlgorithms.GenerateHistograms(bitmapOriginal, pictureBoxGrayscaledHistogram.Width, pictureBoxGrayscaledHistogram.Height);
                pictureBoxGrayscaledHistogram.Image = histograms[0];
                pictureBoxRedHistogram.Image = histograms[1];
                pictureBoxGreenHistogram.Image = histograms[2];
                pictureBoxBlueHistogram.Image = histograms[3];
                pictureBoxRGBHistogram.Image = histograms[4];

                buttonLoadBitmap.Enabled = true;
                trackBarBeta.Enabled = true;
                trackBarGamma.Enabled = true;

                trackBarBeta.Value = trackBarBeta.Maximum / 2;
                trackBarGamma.Value = trackBarGamma.Maximum / 2;

                labelBeta.Text = "0";
                labelGamma.Text = "1,00";
            }
        }

        private void trackBarBeta_Scroll(object sender, EventArgs e)
        {
            int beta = trackBarBeta.Value -  trackBarBeta.Maximum / 2;
            labelBeta.Text = beta.ToString();

            trackBarGamma.Value = trackBarGamma.Maximum / 2;
            labelGamma.Text = "1,00";

            pictureBoxOriginal.Image = BitmapAlgorithms.BetaCorrected(bitmapOriginal, beta);
        }

        private void trackBarGamma_Scroll(object sender, EventArgs e)
        {
            float gamma = (float)trackBarGamma.Value / trackBarGamma.Maximum * 2.0f;
            labelGamma.Text = gamma.ToString("F2");

            trackBarBeta.Value = trackBarBeta.Maximum / 2;
            labelBeta.Text = "0";

            pictureBoxOriginal.Image = BitmapAlgorithms.GammaCorrected(bitmapOriginal, gamma);
        }

        private void pictureBoxOriginal_Click(object sender, EventArgs e)
        {
            pictureBoxOriginal.Image = bitmapOriginal;

            trackBarBeta.Value = trackBarBeta.Maximum / 2;
            trackBarGamma.Value = trackBarGamma.Maximum / 2;

            labelBeta.Text = "0";
            labelGamma.Text = "1,00";
        }
    }
}

FormMain.Designer.cs

namespace Bitmap_Analyzer
{
    partial class FormMain
    {
        /// <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.pictureBoxOriginal = new System.Windows.Forms.PictureBox();
            this.label1 = new System.Windows.Forms.Label();
            this.pictureBoxGrayscaled = new System.Windows.Forms.PictureBox();
            this.buttonLoadBitmap = new System.Windows.Forms.Button();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.pictureBoxGrayscaledHistogram = new System.Windows.Forms.PictureBox();
            this.label4 = new System.Windows.Forms.Label();
            this.pictureBoxRedHistogram = new System.Windows.Forms.PictureBox();
            this.label5 = new System.Windows.Forms.Label();
            this.pictureBoxGreenHistogram = new System.Windows.Forms.PictureBox();
            this.label6 = new System.Windows.Forms.Label();
            this.pictureBoxBlueHistogram = new System.Windows.Forms.PictureBox();
            this.label7 = new System.Windows.Forms.Label();
            this.pictureBoxRedImage = new System.Windows.Forms.PictureBox();
            this.label8 = new System.Windows.Forms.Label();
            this.pictureBoxGreenImage = new System.Windows.Forms.PictureBox();
            this.label9 = new System.Windows.Forms.Label();
            this.pictureBoxBlueImage = new System.Windows.Forms.PictureBox();
            this.label10 = new System.Windows.Forms.Label();
            this.pictureBoxRGBHistogram = new System.Windows.Forms.PictureBox();
            this.trackBarBeta = new System.Windows.Forms.TrackBar();
            this.label11 = new System.Windows.Forms.Label();
            this.label12 = new System.Windows.Forms.Label();
            this.trackBarGamma = new System.Windows.Forms.TrackBar();
            this.labelBeta = new System.Windows.Forms.Label();
            this.labelGamma = new System.Windows.Forms.Label();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxOriginal)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxGrayscaled)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxGrayscaledHistogram)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxRedHistogram)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxGreenHistogram)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxBlueHistogram)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxRedImage)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxGreenImage)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxBlueImage)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxRGBHistogram)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.trackBarBeta)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.trackBarGamma)).BeginInit();
            this.SuspendLayout();
            // 
            // pictureBoxOriginal
            // 
            this.pictureBoxOriginal.BackColor = System.Drawing.Color.White;
            this.pictureBoxOriginal.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxOriginal.Location = new System.Drawing.Point(15, 77);
            this.pictureBoxOriginal.Name = "pictureBoxOriginal";
            this.pictureBoxOriginal.Size = new System.Drawing.Size(400, 300);
            this.pictureBoxOriginal.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            this.pictureBoxOriginal.TabIndex = 0;
            this.pictureBoxOriginal.TabStop = false;
            this.pictureBoxOriginal.Click += new System.EventHandler(this.pictureBoxOriginal_Click);
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(12, 56);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(106, 18);
            this.label1.TabIndex = 1;
            this.label1.Text = "Original Image:";
            // 
            // pictureBoxGrayscaled
            // 
            this.pictureBoxGrayscaled.BackColor = System.Drawing.Color.White;
            this.pictureBoxGrayscaled.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxGrayscaled.Location = new System.Drawing.Point(421, 77);
            this.pictureBoxGrayscaled.Name = "pictureBoxGrayscaled";
            this.pictureBoxGrayscaled.Size = new System.Drawing.Size(400, 300);
            this.pictureBoxGrayscaled.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            this.pictureBoxGrayscaled.TabIndex = 2;
            this.pictureBoxGrayscaled.TabStop = false;
            // 
            // buttonLoadBitmap
            // 
            this.buttonLoadBitmap.Location = new System.Drawing.Point(15, 10);
            this.buttonLoadBitmap.Name = "buttonLoadBitmap";
            this.buttonLoadBitmap.Size = new System.Drawing.Size(215, 31);
            this.buttonLoadBitmap.TabIndex = 3;
            this.buttonLoadBitmap.Text = "Load Bitmap";
            this.buttonLoadBitmap.UseVisualStyleBackColor = true;
            this.buttonLoadBitmap.Click += new System.EventHandler(this.buttonLoadBitmap_Click);
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(418, 56);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(131, 18);
            this.label3.TabIndex = 6;
            this.label3.Text = "Grayscaled Image:";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(833, 56);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(160, 18);
            this.label2.TabIndex = 8;
            this.label2.Text = "Grayscaled Histogram:";
            // 
            // pictureBoxGrayscaledHistogram
            // 
            this.pictureBoxGrayscaledHistogram.BackColor = System.Drawing.Color.White;
            this.pictureBoxGrayscaledHistogram.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxGrayscaledHistogram.Location = new System.Drawing.Point(836, 77);
            this.pictureBoxGrayscaledHistogram.Name = "pictureBoxGrayscaledHistogram";
            this.pictureBoxGrayscaledHistogram.Size = new System.Drawing.Size(290, 81);
            this.pictureBoxGrayscaledHistogram.TabIndex = 7;
            this.pictureBoxGrayscaledHistogram.TabStop = false;
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(833, 165);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(112, 18);
            this.label4.TabIndex = 10;
            this.label4.Text = "Red Histogram:";
            // 
            // pictureBoxRedHistogram
            // 
            this.pictureBoxRedHistogram.BackColor = System.Drawing.Color.White;
            this.pictureBoxRedHistogram.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxRedHistogram.Location = new System.Drawing.Point(836, 186);
            this.pictureBoxRedHistogram.Name = "pictureBoxRedHistogram";
            this.pictureBoxRedHistogram.Size = new System.Drawing.Size(290, 81);
            this.pictureBoxRedHistogram.TabIndex = 9;
            this.pictureBoxRedHistogram.TabStop = false;
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(833, 281);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(126, 18);
            this.label5.TabIndex = 12;
            this.label5.Text = "Green Histogram:";
            // 
            // pictureBoxGreenHistogram
            // 
            this.pictureBoxGreenHistogram.BackColor = System.Drawing.Color.White;
            this.pictureBoxGreenHistogram.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxGreenHistogram.Location = new System.Drawing.Point(836, 302);
            this.pictureBoxGreenHistogram.Name = "pictureBoxGreenHistogram";
            this.pictureBoxGreenHistogram.Size = new System.Drawing.Size(290, 81);
            this.pictureBoxGreenHistogram.TabIndex = 11;
            this.pictureBoxGreenHistogram.TabStop = false;
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(833, 389);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(114, 18);
            this.label6.TabIndex = 14;
            this.label6.Text = "Blue Histogram:";
            // 
            // pictureBoxBlueHistogram
            // 
            this.pictureBoxBlueHistogram.BackColor = System.Drawing.Color.White;
            this.pictureBoxBlueHistogram.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxBlueHistogram.Location = new System.Drawing.Point(836, 410);
            this.pictureBoxBlueHistogram.Name = "pictureBoxBlueHistogram";
            this.pictureBoxBlueHistogram.Size = new System.Drawing.Size(290, 81);
            this.pictureBoxBlueHistogram.TabIndex = 13;
            this.pictureBoxBlueHistogram.TabStop = false;
            // 
            // label7
            // 
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(10, 448);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(39, 18);
            this.label7.TabIndex = 16;
            this.label7.Text = "Red:";
            // 
            // pictureBoxRedImage
            // 
            this.pictureBoxRedImage.BackColor = System.Drawing.Color.White;
            this.pictureBoxRedImage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxRedImage.Location = new System.Drawing.Point(13, 469);
            this.pictureBoxRedImage.Name = "pictureBoxRedImage";
            this.pictureBoxRedImage.Size = new System.Drawing.Size(252, 189);
            this.pictureBoxRedImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            this.pictureBoxRedImage.TabIndex = 15;
            this.pictureBoxRedImage.TabStop = false;
            // 
            // label8
            // 
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(286, 448);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(53, 18);
            this.label8.TabIndex = 18;
            this.label8.Text = "Green:";
            // 
            // pictureBoxGreenImage
            // 
            this.pictureBoxGreenImage.BackColor = System.Drawing.Color.White;
            this.pictureBoxGreenImage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxGreenImage.Location = new System.Drawing.Point(289, 469);
            this.pictureBoxGreenImage.Name = "pictureBoxGreenImage";
            this.pictureBoxGreenImage.Size = new System.Drawing.Size(252, 189);
            this.pictureBoxGreenImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            this.pictureBoxGreenImage.TabIndex = 17;
            this.pictureBoxGreenImage.TabStop = false;
            // 
            // label9
            // 
            this.label9.AutoSize = true;
            this.label9.Location = new System.Drawing.Point(564, 448);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(41, 18);
            this.label9.TabIndex = 20;
            this.label9.Text = "Blue:";
            // 
            // pictureBoxBlueImage
            // 
            this.pictureBoxBlueImage.BackColor = System.Drawing.Color.White;
            this.pictureBoxBlueImage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxBlueImage.Location = new System.Drawing.Point(567, 469);
            this.pictureBoxBlueImage.Name = "pictureBoxBlueImage";
            this.pictureBoxBlueImage.Size = new System.Drawing.Size(252, 189);
            this.pictureBoxBlueImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            this.pictureBoxBlueImage.TabIndex = 19;
            this.pictureBoxBlueImage.TabStop = false;
            // 
            // label10
            // 
            this.label10.AutoSize = true;
            this.label10.Location = new System.Drawing.Point(833, 499);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(118, 18);
            this.label10.TabIndex = 22;
            this.label10.Text = "RGB Histogram:";
            // 
            // pictureBoxRGBHistogram
            // 
            this.pictureBoxRGBHistogram.BackColor = System.Drawing.Color.White;
            this.pictureBoxRGBHistogram.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxRGBHistogram.Location = new System.Drawing.Point(836, 520);
            this.pictureBoxRGBHistogram.Name = "pictureBoxRGBHistogram";
            this.pictureBoxRGBHistogram.Size = new System.Drawing.Size(290, 81);
            this.pictureBoxRGBHistogram.TabIndex = 21;
            this.pictureBoxRGBHistogram.TabStop = false;
            // 
            // trackBarBeta
            // 
            this.trackBarBeta.Enabled = false;
            this.trackBarBeta.Location = new System.Drawing.Point(60, 383);
            this.trackBarBeta.Maximum = 200;
            this.trackBarBeta.Name = "trackBarBeta";
            this.trackBarBeta.Size = new System.Drawing.Size(130, 45);
            this.trackBarBeta.TabIndex = 23;
            this.trackBarBeta.TickStyle = System.Windows.Forms.TickStyle.None;
            this.trackBarBeta.Value = 100;
            this.trackBarBeta.Scroll += new System.EventHandler(this.trackBarBeta_Scroll);
            // 
            // label11
            // 
            this.label11.AutoSize = true;
            this.label11.Location = new System.Drawing.Point(12, 389);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(42, 18);
            this.label11.TabIndex = 24;
            this.label11.Text = "Beta:";
            // 
            // label12
            // 
            this.label12.AutoSize = true;
            this.label12.Location = new System.Drawing.Point(209, 389);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(66, 18);
            this.label12.TabIndex = 25;
            this.label12.Text = "Gamma:";
            // 
            // trackBarGamma
            // 
            this.trackBarGamma.Enabled = false;
            this.trackBarGamma.Location = new System.Drawing.Point(281, 383);
            this.trackBarGamma.Maximum = 200;
            this.trackBarGamma.Name = "trackBarGamma";
            this.trackBarGamma.Size = new System.Drawing.Size(130, 45);
            this.trackBarGamma.TabIndex = 26;
            this.trackBarGamma.TickStyle = System.Windows.Forms.TickStyle.None;
            this.trackBarGamma.Value = 100;
            this.trackBarGamma.Scroll += new System.EventHandler(this.trackBarGamma_Scroll);
            // 
            // labelBeta
            // 
            this.labelBeta.Location = new System.Drawing.Point(60, 410);
            this.labelBeta.Name = "labelBeta";
            this.labelBeta.Size = new System.Drawing.Size(130, 18);
            this.labelBeta.TabIndex = 27;
            this.labelBeta.Text = "0";
            this.labelBeta.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // labelGamma
            // 
            this.labelGamma.Location = new System.Drawing.Point(278, 410);
            this.labelGamma.Name = "labelGamma";
            this.labelGamma.Size = new System.Drawing.Size(130, 18);
            this.labelGamma.TabIndex = 28;
            this.labelGamma.Text = "1,00";
            this.labelGamma.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // FormMain
            // 
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
            this.ClientSize = new System.Drawing.Size(1143, 672);
            this.Controls.Add(this.labelGamma);
            this.Controls.Add(this.labelBeta);
            this.Controls.Add(this.trackBarGamma);
            this.Controls.Add(this.label12);
            this.Controls.Add(this.label11);
            this.Controls.Add(this.trackBarBeta);
            this.Controls.Add(this.label10);
            this.Controls.Add(this.pictureBoxRGBHistogram);
            this.Controls.Add(this.label9);
            this.Controls.Add(this.pictureBoxBlueImage);
            this.Controls.Add(this.label8);
            this.Controls.Add(this.pictureBoxGreenImage);
            this.Controls.Add(this.label7);
            this.Controls.Add(this.pictureBoxRedImage);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.pictureBoxBlueHistogram);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.pictureBoxGreenHistogram);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.pictureBoxRedHistogram);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.pictureBoxGrayscaledHistogram);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.buttonLoadBitmap);
            this.Controls.Add(this.pictureBoxGrayscaled);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.pictureBoxOriginal);
            this.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FormMain";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Bitmap Analyzer";
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxOriginal)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxGrayscaled)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxGrayscaledHistogram)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxRedHistogram)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxGreenHistogram)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxBlueHistogram)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxRedImage)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxGreenImage)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxBlueImage)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxRGBHistogram)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.trackBarBeta)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.trackBarGamma)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.PictureBox pictureBoxOriginal;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.PictureBox pictureBoxGrayscaled;
        private System.Windows.Forms.Button buttonLoadBitmap;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.PictureBox pictureBoxGrayscaledHistogram;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.PictureBox pictureBoxRedHistogram;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.PictureBox pictureBoxGreenHistogram;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.PictureBox pictureBoxBlueHistogram;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.PictureBox pictureBoxRedImage;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.PictureBox pictureBoxGreenImage;
        private System.Windows.Forms.Label label9;
        private System.Windows.Forms.PictureBox pictureBoxBlueImage;
        private System.Windows.Forms.Label label10;
        private System.Windows.Forms.PictureBox pictureBoxRGBHistogram;
        private System.Windows.Forms.TrackBar trackBarBeta;
        private System.Windows.Forms.Label label11;
        private System.Windows.Forms.Label label12;
        private System.Windows.Forms.TrackBar trackBarGamma;
        private System.Windows.Forms.Label labelBeta;
        private System.Windows.Forms.Label labelGamma;
    }
}

 

Yorum Yaz

Yorum yazabilmek için üye girişi yapmanız gerekiyor!

Yukarı Git