Home > Code > C# > How to implement corner detection (C#)

How to implement corner detection (C#)

by Mahendra Gadhavi   on Feb 06, 2015   Category: C#   |  Views: 612    |  Points: 25   |  Starter 


You can find the full source code for corner detection here. I found this solution on www.camera-sdk.com and it worked for me fine. I created a Visual C# WPF application in Visual Studio, and added two .dll files (VOIPSDK.dll and NVA.dll) to the references. The .dll files can be found on the webpage.

First, you can see the full source code for the interface of the program at Form1.Desginer.cs. On this GUI you can adjust many configurations in connection with the image of the camera, and you can have a detailed list about the detected corners.

Under Form1.cs you can find the source code for the program itself and you will see which mediahandlers, methods and configurations you should use to achieve this function.

I hope you can all use this snippet! I wish you success to build your corner detecting solutions!

------------------------------------------------------------------------------------------------------


// Form1.Designer.cs

namespace CornerDetection
{
partial class Form1
{
/// <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.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.btn_Set = new System.Windows.Forms.Button();
this.tb_BlockSize = new System.Windows.Forms.TextBox();
this.tb_Epsilon = new System.Windows.Forms.TextBox();
this.tb_MaxDetectedObjects = new System.Windows.Forms.TextBox();
this.tb_MaxIteration = new System.Windows.Forms.TextBox();
this.tb_MinDistance = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tb_ZeroZoneSizeY = new System.Windows.Forms.TextBox();
this.tb_SearchWindowSizeY = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
this.tb_ZeroZoneSizeX = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.tb_SearchWindowSizeX = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.tb_QualityLevel = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btn_HighlightSet = new System.Windows.Forms.Button();
this.label11 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.tb_DrawThickness = new System.Windows.Forms.TextBox();
this.tb_Blue = new System.Windows.Forms.TextBox();
this.chk_ShowImage = new System.Windows.Forms.CheckBox();
this.tb_Green = new System.Windows.Forms.TextBox();
this.tb_Red = new System.Windows.Forms.TextBox();
this.lb_Detection = new System.Windows.Forms.ListBox();
this.label12 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.tb_DrawSize = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.label1.Location = new System.Drawing.Point(30, 265);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(87, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Original image";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.label2.Location = new System.Drawing.Point(370, 265);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(103, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Processed image";
//
// btn_Set
//
this.btn_Set.Location = new System.Drawing.Point(189, 319);
this.btn_Set.Name = "btn_Set";
this.btn_Set.Size = new System.Drawing.Size(58, 23);
this.btn_Set.TabIndex = 2;
this.btn_Set.Text = "Set";
this.btn_Set.UseVisualStyleBackColor = true;
this.btn_Set.Click += new System.EventHandler(this.btn_Set_Click);
//
// tb_BlockSize
//
this.tb_BlockSize.Location = new System.Drawing.Point(153, 26);
this.tb_BlockSize.Name = "tb_BlockSize";
this.tb_BlockSize.Size = new System.Drawing.Size(87, 20);
this.tb_BlockSize.TabIndex = 3;
//
// tb_Epsilon
//
this.tb_Epsilon.Location = new System.Drawing.Point(153, 62);
this.tb_Epsilon.Name = "tb_Epsilon";
this.tb_Epsilon.Size = new System.Drawing.Size(87, 20);
this.tb_Epsilon.TabIndex = 5;
//
// tb_MaxDetectedObjects
//
this.tb_MaxDetectedObjects.Location = new System.Drawing.Point(153, 98);
this.tb_MaxDetectedObjects.Name = "tb_MaxDetectedObjects";
this.tb_MaxDetectedObjects.Size = new System.Drawing.Size(87, 20);
this.tb_MaxDetectedObjects.TabIndex = 6;
//
// tb_MaxIteration
//
this.tb_MaxIteration.Location = new System.Drawing.Point(153, 134);
this.tb_MaxIteration.Name = "tb_MaxIteration";
this.tb_MaxIteration.Size = new System.Drawing.Size(87, 20);
this.tb_MaxIteration.TabIndex = 7;
//
// tb_MinDistance
//
this.tb_MinDistance.Location = new System.Drawing.Point(153, 170);
this.tb_MinDistance.Name = "tb_MinDistance";
this.tb_MinDistance.Size = new System.Drawing.Size(87, 20);
this.tb_MinDistance.TabIndex = 8;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.tb_ZeroZoneSizeY);
this.groupBox1.Controls.Add(this.tb_SearchWindowSizeY);
this.groupBox1.Controls.Add(this.label14);
this.groupBox1.Controls.Add(this.tb_ZeroZoneSizeX);
this.groupBox1.Controls.Add(this.label13);
this.groupBox1.Controls.Add(this.tb_SearchWindowSizeX);
this.groupBox1.Controls.Add(this.label9);
this.groupBox1.Controls.Add(this.tb_QualityLevel);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.tb_MaxDetectedObjects);
this.groupBox1.Controls.Add(this.btn_Set);
this.groupBox1.Controls.Add(this.tb_BlockSize);
this.groupBox1.Controls.Add(this.tb_MaxIteration);
this.groupBox1.Controls.Add(this.tb_MinDistance);
this.groupBox1.Controls.Add(this.tb_Epsilon);
this.groupBox1.Location = new System.Drawing.Point(676, 225);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(258, 348);
this.groupBox1.TabIndex = 12;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Settings";
//
// tb_ZeroZoneSizeY
//
this.tb_ZeroZoneSizeY.Location = new System.Drawing.Point(198, 278);
this.tb_ZeroZoneSizeY.Name = "tb_ZeroZoneSizeY";
this.tb_ZeroZoneSizeY.Size = new System.Drawing.Size(42, 20);
this.tb_ZeroZoneSizeY.TabIndex = 23;
//
// tb_SearchWindowSizeY
//
this.tb_SearchWindowSizeY.Location = new System.Drawing.Point(198, 242);
this.tb_SearchWindowSizeY.Name = "tb_SearchWindowSizeY";
this.tb_SearchWindowSizeY.Size = new System.Drawing.Size(42, 20);
this.tb_SearchWindowSizeY.TabIndex = 22;
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(70, 281);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(77, 13);
this.label14.TabIndex = 21;
this.label14.Text = "ZeroZoneSize:";
//
// tb_ZeroZoneSizeX
//
this.tb_ZeroZoneSizeX.Location = new System.Drawing.Point(153, 278);
this.tb_ZeroZoneSizeX.Name = "tb_ZeroZoneSizeX";
this.tb_ZeroZoneSizeX.Size = new System.Drawing.Size(42, 20);
this.tb_ZeroZoneSizeX.TabIndex = 20;
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(44, 245);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(103, 13);
this.label13.TabIndex = 19;
this.label13.Text = "SearchWindowSize:";
//
// tb_SearchWindowSizeX
//
this.tb_SearchWindowSizeX.Location = new System.Drawing.Point(153, 242);
this.tb_SearchWindowSizeX.Name = "tb_SearchWindowSizeX";
this.tb_SearchWindowSizeX.Size = new System.Drawing.Size(42, 20);
this.tb_SearchWindowSizeX.TabIndex = 18;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(79, 209);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(68, 13);
this.label9.TabIndex = 17;
this.label9.Text = "QualityLevel:";
//
// tb_QualityLevel
//
this.tb_QualityLevel.Location = new System.Drawing.Point(153, 206);
this.tb_QualityLevel.Name = "tb_QualityLevel";
this.tb_QualityLevel.Size = new System.Drawing.Size(87, 20);
this.tb_QualityLevel.TabIndex = 16;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(37, 101);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(110, 13);
this.label6.TabIndex = 13;
this.label6.Text = "MaxDetectedObjects:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(103, 65);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(44, 13);
this.label5.TabIndex = 12;
this.label5.Text = "Epsilon:";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(78, 173);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(69, 13);
this.label8.TabIndex = 15;
this.label8.Text = "MinDistance:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(90, 29);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(57, 13);
this.label3.TabIndex = 10;
this.label3.Text = "BlockSize:";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(79, 137);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(68, 13);
this.label7.TabIndex = 14;
this.label7.Text = "MaxIteration:";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.tb_DrawSize);
this.groupBox2.Controls.Add(this.btn_HighlightSet);
this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.tb_DrawThickness);
this.groupBox2.Controls.Add(this.tb_Blue);
this.groupBox2.Controls.Add(this.chk_ShowImage);
this.groupBox2.Controls.Add(this.tb_Green);
this.groupBox2.Controls.Add(this.tb_Red);
this.groupBox2.Location = new System.Drawing.Point(679, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(258, 207);
this.groupBox2.TabIndex = 13;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Highlight";
//
// btn_HighlightSet
//
this.btn_HighlightSet.Location = new System.Drawing.Point(186, 178);
this.btn_HighlightSet.Name = "btn_HighlightSet";
this.btn_HighlightSet.Size = new System.Drawing.Size(58, 23);
this.btn_HighlightSet.TabIndex = 19;
this.btn_HighlightSet.Text = "Set";
this.btn_HighlightSet.UseVisualStyleBackColor = true;
this.btn_HighlightSet.Click += new System.EventHandler(this.btn_HighlightSet_Click);
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(64, 97);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(84, 13);
this.label11.TabIndex = 18;
this.label11.Text = "DrawThickness:";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(74, 63);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(33, 13);
this.label10.TabIndex = 17;
this.label10.Text = "RGB:";
//
// tb_DrawThickness
//
this.tb_DrawThickness.Location = new System.Drawing.Point(153, 95);
this.tb_DrawThickness.Name = "tb_DrawThickness";
this.tb_DrawThickness.Size = new System.Drawing.Size(87, 20);
this.tb_DrawThickness.TabIndex = 17;
//
// tb_Blue
//
this.tb_Blue.Location = new System.Drawing.Point(198, 59);
this.tb_Blue.Name = "tb_Blue";
this.tb_Blue.Size = new System.Drawing.Size(42, 20);
this.tb_Blue.TabIndex = 16;
//
// chk_ShowImage
//
this.chk_ShowImage.AutoSize = true;
this.chk_ShowImage.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.chk_ShowImage.Location = new System.Drawing.Point(37, 25);
this.chk_ShowImage.Name = "chk_ShowImage";
this.chk_ShowImage.Size = new System.Drawing.Size(85, 17);
this.chk_ShowImage.TabIndex = 14;
this.chk_ShowImage.Text = "ShowImage:";
this.chk_ShowImage.UseVisualStyleBackColor = true;
//
// tb_Green
//
this.tb_Green.Location = new System.Drawing.Point(153, 59);
this.tb_Green.Name = "tb_Green";
this.tb_Green.Size = new System.Drawing.Size(42, 20);
this.tb_Green.TabIndex = 15;
//
// tb_Red
//
this.tb_Red.Location = new System.Drawing.Point(108, 59);
this.tb_Red.Name = "tb_Red";
this.tb_Red.Size = new System.Drawing.Size(42, 20);
this.tb_Red.TabIndex = 14;
//
// lb_Detection
//
this.lb_Detection.FormattingEnabled = true;
this.lb_Detection.Location = new System.Drawing.Point(10, 322);
this.lb_Detection.Name = "lb_Detection";
this.lb_Detection.Size = new System.Drawing.Size(660, 251);
this.lb_Detection.TabIndex = 14;
//
// label12
//
this.label12.AutoSize = true;
this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.label12.Location = new System.Drawing.Point(12, 305);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(91, 13);
this.label12.TabIndex = 15;
this.label12.Text = "Detection info:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(92, 135);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(55, 13);
this.label4.TabIndex = 21;
this.label4.Text = "DrawSize:";
//
// tb_DrawSize
//
this.tb_DrawSize.Location = new System.Drawing.Point(153, 131);
this.tb_DrawSize.Name = "tb_DrawSize";
this.tb_DrawSize.Size = new System.Drawing.Size(87, 20);
this.tb_DrawSize.TabIndex = 20;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(947, 581);
this.Controls.Add(this.label12);
this.Controls.Add(this.lb_Detection);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "MainForm";
this.Text = "Corner Detection";
this.Load += new System.EventHandler(this.MainForm_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btn_Set;
private System.Windows.Forms.TextBox tb_BlockSize;
private System.Windows.Forms.TextBox tb_Epsilon;
private System.Windows.Forms.TextBox tb_MaxDetectedObjects;
private System.Windows.Forms.TextBox tb_MaxIteration;
private System.Windows.Forms.TextBox tb_MinDistance;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckBox chk_ShowImage;
private System.Windows.Forms.TextBox tb_Blue;
private System.Windows.Forms.TextBox tb_Green;
private System.Windows.Forms.TextBox tb_Red;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox tb_DrawThickness;
private System.Windows.Forms.ListBox lb_Detection;
private System.Windows.Forms.Button btn_HighlightSet;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.TextBox tb_ZeroZoneSizeX;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox tb_SearchWindowSizeX;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox tb_QualityLevel;
private System.Windows.Forms.TextBox tb_ZeroZoneSizeY;
private System.Windows.Forms.TextBox tb_SearchWindowSizeY;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox tb_DrawSize;
}
}


// Form1.cs

using System;
using System.Drawing;
using System.Windows.Forms;
using Ozeki.Media.MediaHandlers;
using Ozeki.Media.MediaHandlers.Video;
using Ozeki.Media.MediaHandlers.Video.CV;
using Ozeki.Media.MediaHandlers.Video.CV.Data;
using Ozeki.Media.MediaHandlers.Video.CV.Processer;
using Ozeki.Media.Video.Controls;

namespace CornerDetection
{
public partial class Form1 : Form
{
WebCamera _webCamera;
MediaConnector _connector;

ImageProcesserHandler _imageProcesserHandler;
ICornerDetector _cornerDetector;
FrameCapture _frameCapture;

VideoViewerWF _originalView;
VideoViewerWF _processedView;
DrawingImageProvider _originalImageProvider;
DrawingImageProvider _processedImageProvider;

public Form1()
{
InitializeComponent();
}

void MainForm_Load(object sender, EventArgs e)
{
Init();

SetVideoViewers();

InitDetectorFields();

ConnectWebcam();

Start();
}

void Init()
{
_frameCapture = new FrameCapture();
_frameCapture.SetInterval(5);

_webCamera = WebCamera.GetDefaultDevice();
_connector = new MediaConnector();
_originalImageProvider = new DrawingImageProvider();
_processedImageProvider = new DrawingImageProvider();

_cornerDetector = ImageProcesserFactory.CreateCornerDetector();
_cornerDetector.DetectionOccurred += _cornerDetector_DetectionOccurred;

_imageProcesserHandler = new ImageProcesserHandler();
_imageProcesserHandler.AddProcesser(_cornerDetector);
}

void SetVideoViewers()
{
_originalView = new VideoViewerWF
{
BackColor = Color.Black,
Location = new Point(10, 20),
Size = new Size(320, 240)
};

_originalView.SetImageProvider(_originalImageProvider);
Controls.Add(_originalView);

_processedView = new VideoViewerWF
{
BackColor = Color.Black,
Location = new Point(350, 20),
Size = new Size(320, 240)
};

_processedView.SetImageProvider(_processedImageProvider);
Controls.Add(_processedView);
}

void InitDetectorFields()
{
InvokeGUIThread(() =>
{
chk_ShowImage.Checked = _cornerDetector.ShowImage;
tb_Red.Text = _cornerDetector.DrawColor.R.ToString();
tb_Green.Text = _cornerDetector.DrawColor.G.ToString();
tb_Blue.Text = _cornerDetector.DrawColor.B.ToString();
tb_DrawThickness.Text = _cornerDetector.DrawThickness.ToString();

tb_BlockSize.Text = _cornerDetector.BlockSize.ToString();
tb_DrawSize.Text = _cornerDetector.DrawSize.ToString();
tb_Epsilon.Text = _cornerDetector.Epsilon.ToString();
tb_MaxDetectedObjects.Text = _cornerDetector.MaxDetectedObjects.ToString();
tb_MaxIteration.Text = _cornerDetector.MaxIteration.ToString();
tb_MinDistance.Text = _cornerDetector.MinDistance.ToString();
tb_QualityLevel.Text = _cornerDetector.QualityLevel.ToString();
tb_SearchWindowSizeX.Text = _cornerDetector.SearchWindowSize.Width.ToString();
tb_SearchWindowSizeY.Text = _cornerDetector.SearchWindowSize.Height.ToString();
tb_ZeroZoneSizeX.Text = _cornerDetector.ZeroZoneSize.Width.ToString();
tb_ZeroZoneSizeY.Text = _cornerDetector.ZeroZoneSize.Height.ToString();
});
}

void ConnectWebcam()
{
_connector.Connect(_webCamera, _originalImageProvider);

_connector.Connect(_webCamera, _frameCapture);
_connector.Connect(_frameCapture, _imageProcesserHandler);
_connector.Connect(_imageProcesserHandler, _processedImageProvider);
}

void Start()
{
_originalView.Start();
_processedView.Start();

_frameCapture.Start();
_webCamera.Start();
}

void btn_HighlightSet_Click(object sender, EventArgs e)
{
InvokeGUIThread(() =>
{
_cornerDetector.ShowImage = chk_ShowImage.Checked;
_cornerDetector.DrawColor = Color.FromArgb(Int32.Parse(tb_Red.Text), Int32.Parse(tb_Green.Text), Int32.Parse(tb_Blue.Text));
_cornerDetector.DrawSize = Int32.Parse(tb_DrawSize.Text);
_cornerDetector.DrawThickness = Int32.Parse(tb_DrawThickness.Text);
});
}

void btn_Set_Click(object sender, EventArgs e)
{
InvokeGUIThread(() =>
{
_cornerDetector.BlockSize = Int32.Parse(tb_BlockSize.Text);
_cornerDetector.Epsilon = Double.Parse(tb_Epsilon.Text);
_cornerDetector.MaxDetectedObjects = Int32.Parse(tb_MaxDetectedObjects.Text);
_cornerDetector.MaxIteration = Int32.Parse(tb_MaxIteration.Text);
_cornerDetector.MinDistance = Int32.Parse(tb_MinDistance.Text);
_cornerDetector.QualityLevel = Double.Parse(tb_QualityLevel.Text);
_cornerDetector.SearchWindowSize = new Size(Int32.Parse(tb_SearchWindowSizeX.Text), Int32.Parse(tb_SearchWindowSizeY.Text));
_cornerDetector.ZeroZoneSize = new Size(Int32.Parse(tb_ZeroZoneSizeX.Text), Int32.Parse(tb_ZeroZoneSizeY.Text));
});
}

void _cornerDetector_DetectionOccurred(object sender, CornerDetectedEventArgs e)
{
InvokeGUIThread(() =>
{
lb_Detection.Items.Clear();

foreach (var info in e.Info)
{
lb_Detection.Items.Add(info);
}
});
}

void InvokeGUIThread(Action action)
{
BeginInvoke(action);
}

}
}



Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts