how to find extreme points of polygon in C#

how to find extreme points of polygon in C#

hi, i need help to find extreme points of polygon. example triangle points. there is 3 extreme points on triangle, on each corner of the triangle structure example points A (8, 15), point B (1, 2) points C (16,2)does anyone can help me on it? the sample set size is 16X 16.

basically, i have an image of 2D polygon sketches images.just now, i read the image and convert those image in binary form. all the image have the same size, 16x16 pixels. now, i need to read the vertex points which lies on each connected lines example triangle. triangle have a three connected points. therefore i need to return result and display those three points. thanks four the concern. i really appreciate it...

how can i to retrieve the most right side point, most top side and left and right.i already cut the images into many rectangles. where i selected the shape and resize those images size onto fix 16x16 pixels. however, i really need help on to code the program to identify those points. these are early program that i read the image an convert into binary, now i need to display the extreme points.

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;
using System.Collections;
using System.IO;

namespace JaccardRecognition
{
    public partial class shape : Form
    {


        Bitmap Image1, Image2;
        String textImage1 = "";
        String textImage2 = "";
       // float a, b, p, q, r, jd;
       // int sum1 = 0, sum2 = 0, sum3 = 0;
        // bool flag = true;



        public shape()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        /*Open and read the first image*/

        private void OpenFirstImageBttn_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            openFileDialog1.FileName = "";
            openFileDialog1.Title = "Images";
            openFileDialog1.Filter = "All Images|*.jpg; *.bmp; *.png";//
            openFileDialog1.ShowDialog();
            if (openFileDialog1.FileName.ToString() != "")
            {
                Box1.ImageLocation = openFileDialog1.FileName.ToString();
                Image1 = new Bitmap(openFileDialog1.FileName.ToString());
                string h = Convert.ToString(Image1.Height);
                string w = Convert.ToString(Image1.Width);
                displayh.Text = h;
                displayw.Text = w;
            }

        }



        /*Covert first image into binary*/

        private void convertImage1_Click(object sender, EventArgs e)
        {

            for (int i = 0; i < Image1.Height; i++)
            {
                for (int j = 0; j < Image1.Width; j++)
                {
                    if (Image1.GetPixel(j, i).A.ToString() == "255" && Image1.GetPixel(j, i).B.ToString() == "255" && Image1.GetPixel(j, i).G.ToString() == "255" && Image1.GetPixel(j, i).R.ToString() == "255")
                    {
                        textImage1 = textImage1 + "0";

                    }
                    else
                    {
                        textImage1 = textImage1 + "1";

                    }

                }
                textImage1 = textImage1 + "\r\n";
            }

            text1.Text = textImage1;
        }

        /*Open and read the second image*/

        private void OpenSecondImageBttn_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
        {
            openFileDialog2.FileName = "";
            openFileDialog2.Title = "Images";
            openFileDialog2.Filter = "All Images|*.jpg; *.bmp; *.png";//
            openFileDialog2.ShowDialog();
            if (openFileDialog1.FileName.ToString() != "")
            {
                Box2.ImageLocation = openFileDialog2.FileName.ToString();
                Image2 = new Bitmap(openFileDialog2.FileName.ToString());
                string h2 = Convert.ToString(Image2.Height);
                string w2 = Convert.ToString(Image2.Width);
                displayh2.Text = h2;
                displayw2.Text = w2;
            }
        }



        /*Covert second image into binary*/

        private void convertImage2_Click(object sender, EventArgs e)
        {


            for (int i = 0; i < Image2.Height; i++)
            {
                for (int j = 0; j < Image2.Width; j++)
                {
                    if (Image2.GetPixel(j, i).A.ToString() == "255" && Image2.GetPixel(j, i).B.ToString() == "255" && Image2.GetPixel(j, i).G.ToString() == "255" && Image2.GetPixel(j, i).R.ToString() == "255")
                    {
                        textImage2 = textImage2 + "0";

                    }
                    else
                    {
                        textImage2 = textImage2 + "1";

                    }

                }
                textImage2 = textImage2 + "\r\n";
            }

            text2.Text = textImage2;
        }

        /*This will compare both image from the binary data to check the similatiry measure */
        /*Retrieve data in binary form to compute
         --> The image size 16x16 pixels
         --> looping the image 16 times where the comparison between in rows operation*/


        private void Compare_Click(object sender, EventArgs e)
        {

            int p = 0;
            int q = 0;
            int r = 0;

            for (int i = 0; i < textImage1.Length; i++)
            {
                if (textImage1[i] == '1')
                {
                    if (textImage2[i] == '1')
                    {
                        p++;
                    }
                    else
                    {
                        q++;
                    }
                }
                else if (textImage2[i] == '1')
                {
                    r++;
                }
            }

            double jd = ((double)q + r) / (p + q + r);
            //double jd = 1-(p / (p + q + r));

           
                string valueP = Convert.ToString(p);
                string valueQ = Convert.ToString(q);
                string valueR = Convert.ToString(r);
               // string valueA = Convert.ToString(a);
               // string valueB = Convert.ToString(b);
                text3.Text = valueP;
                text4.Text = valueQ;
                text5.Text = valueR;
               // textqr.Text = valueA;
               // textpqr.Text = valueB;


                if (jd == 0)
                {
                    MessageBox.Show("Images are similar,ratio results:" + jd);

                }
                else if (jd == 0.01 || jd <= 1)
                {
                    MessageBox.Show("Images are dissimilar,ratio results:" + jd);

                }

                else
                    MessageBox.Show("can not compare this images");

               this.Dispose();

        }


    }
}


i really need a help, thanks you so much

Add Comment

Put code snippets inside language tags:
[language] [/language]

Examples:
[javascript] [/javascript]
[actionscript] [/actionscript]
[csharp] [/csharp]

See here for supported languages.

Javascript must be enabled to submit anonymous comments - or you can login.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.